xxxxxxxxxx
let image1;
let image2;
let x=0;
let y=220;
let d=40;
let when ='night';
function preload(){
image1=loadImage('k3.png');
image2=loadImage('car.png');
}
function setup() {
createCanvas(600,400);
//imageMode(CENTER);
}
function draw() {
noStroke();
let form=color('skyblue');
let to=color('#FF7F5F');
for(let i =0;i<300;i+=5){
let newColor= lerpColor(form,to,i/300);
fill(newColor);
rect(0,i,600,5);
}
dX1=map(mouseX-1,-200,400,0,220);
dX2=map(mouseX-30,-200,200,400,100);
dX3=map(mouseX-1,-200,400,-400,220);
imageMode(CORNER);
image(image1,-400+dX1, 0);
// sunsunsunsun
// let sunD=[50,60,80,120,180];
// fill(250,199,30,40);
// for (let i in sunD){
// //ellipse(100,100+dX1,sunD[i]);
// ellipse(170,100+dX1,sunD[i]);
// }
fill(44,98,40);
triangle(-200+dX2,300,520+dX2,300,120+dX2,230);
fill(23,49,21);
triangle(-170+dX2,300,600+dX2,300,390+dX2,260);
noStroke();
fill('#191652');
rect(0,300,600,200);
//car
imageMode(CORNER);
image(image2,-300+dX3, 0);
for(let g =0;g<12;g++){
fill(255,255,180,10);
circle(410,150,g*30);
}
for(let g =0;g<8;g++){
fill(255,255,180,20);
circle(270,230,g*8);
}
for(let g =0;g<8;g++){
fill(255,30,20,20);
circle(380,170,g*10);
}
for(let g =0;g<8;g++){
fill(255,255,255,40);
circle(385,285,g*5);
}
noFill();
stroke('white');
strokeWeight(12);
strokeCap(ROUND);
//line(60,300,340,300);
line(60,350,170,350);
line(230,350,340,350);
line(400,350,510,350);
//line(490,350,560,350);
//noFill();
//stroke('#FADB60');
//strokeWeight(10);
//strokeCap(ROUND);
//line(200,320,300,320);
//line(235,340,340,340);
//noStroke();
//fill('black');
//triangle(400,250,400,300,480,300);
//noStroke();
//fill('red');
//triangle(455,220,432,250,480,270);
//noFill();
//stroke('black');
//strokeWeight(5);
//strokeCap(ROUND);
//line(420,270,455,220);
noStroke();
fill('#FFA66F');
// ellipse(x-d*0.7,y-40,d);
// ellipse(x-d*0.2,y-d*0.3-40,d*1.2);
// ellipse(x,y-40,d*1.2);
// ellipse(x+d*0.5,y-40,d);
// ellipse(x-d*0.7+70,y-40+70,d);
// ellipse(x-d*0.2+70,y-d*0.3-40+70,d*1.2);
// ellipse(x+70,y-40+70,d*1.2);
// ellipse(x+d*0.5+70,y-40+70,d);
// ellipse(x-d*0.7+370,y-40,d);
// ellipse(x-d*0.2+370,y-d*0.3-40,d*1.2);
// ellipse(x+370,y-40,d*1.2);
// ellipse(x+d*0.5+370,y-40,d);
}