I was unsure how to approach this assignment. I am new to coding, and I am also not an artist in any way, shape, or form. Coming up with ideas was difficult, as I am not used to looking for inspiration and executing the vision. Most of my initial ideas were to try and replicate or recreate existing pieces of art, but I felt that was too uncreative. When I began to formulate my own ideas, I quickly became frustrated, as I would often bite off more than I could chew, and very quickly realize that I could not execute my own vision. In the end, I settled on trying to recreate a picture I took recently of a sunset over the beach.
I thought that this would provide some new challenges, while also not being too busy, and hopefully looking good in the end. I was looking forward to figuring out the gradient, and getting some movement in the grass and the sun. I basically wanted to create a GIF. The toughest thing for me to work out was the grass, which I wanted to move. I tried creating random ellipses, at first, but I didn’t like the way it looked. In the end, I used arcs, which I think worked out well. I also got the sun to set behind the sand and reappear at the top of the screen, which I thought was a cool effect.
float x = 0;
float y = 0;
float circleY;
float ySpeed=2;
void setup(){
size(680,780);
// Define colors
b1 = color(255,218,185);
b2 = color(188,143,143);
c1 = color(255);
c2 = color(0);
circleY=height/3;
//noLoop();
}
int Y_AXIS = 1;
int X_AXIS = 2;
color b1, b2, c1, c2;
void draw() {
//sky
setGradient(0, 0, width, height/2, b2, b1, X_AXIS);
//sun
stroke(255,215,0);
fill(255);
ellipse(0+width/5,circleY,100,100);
circleY = circleY + ySpeed;
if(circleY>height/1.5){
circleY=-100;
}
//sand
fill(255,222,173);
noStroke();
quad(0,height/2,width,height/2,width,height,0,height/1.3);
//road
fill(105);
noStroke();
quad(0,height/1.3,width,height/1.1,width,height,0,height);
grass();
}
void setGradient(int x, int y, float w, float h, color c1, color c2, int axis ) {
noFill();
if (axis == X_AXIS) {
for (int i = x; i <= x+h; i++) {
float inter = map(i, x, x+h, 0, 1);
color b = lerpColor(b1, b2, inter);
stroke(b);
line(x, i, x+w, i);
}
}
}
void grass() {
for (int i =0; i<width; i+=1) {
stroke(85,107,47);
noFill();
arc(i+random(8), height/1.5-random(height/6), i, 100, radians(0), radians(45));
}
}
My beach photo