xxxxxxxxxx
345
function setup() {
createCanvas(800, 450);
}
function draw() {
background(147,128,150);
for (let y = 0; y < height; y++) {
let inter = map(y, 0, height, 0, 1);
let c = lerpColor(color(147,128,150), color(173, 216, 230), inter);
stroke(c);
line(0, y, width, y);
}
noStroke()
push()
fill(100)
triangle(510,95,60,46,75,30)
fill(100)
triangle(510,95,860,46,875,30)
quad(500,95,520,95,515,75,510,75)
pop()
push()
translate(20,-220)
noStroke();
push()
fill(248,233,185,170);
quad(110,500,110,542,-20,590,-20,440);
fill(255,84,62,40)
quad(668,436,800,300,800,600,668,495)
fill(234,117,0,25)
quad(668,436,800,325,800,575,668,495)
fill(237,181,0,25)
quad(668,436,800,350,800,550,668,495)
fill(258,197,0,25)
quad(668,436,800,375,800,525,668,495)
fill(288,215,0,25)
quad(668,436,800,400,800,500,668,495)
push()
fill(288,232,231)
translate(-200,-60)
//arc(690,400,230,82,0,TWO_PI)
pop()
//car base
fill(248,192,191);
rect(340,315,308,273);
quad(97,464,97,588,345,588,263,445);
triangle(263,445,340,315,400,467);
quad(264,445,164,588,464,588,445,400);
pop()
fill(148,92,91)
rect(400,312,180,5,5)
//black underbase
fill(0)
quad(97,588,136,619,637,619,637,588)
quad(109,598,150,530,245,530,289,598)
push()
translate(320,0)
quad(100,598,150,530,245,530,289,598)
pop()
fill(47,28,20)
// triangle(77,572,157,638,70,618)
//grey rim
push()
fill(100);
quad(152,538,147,518,253,518,255,538)
quad(87,588,117,588,153,538,147,518);
translate(400,0);
scale(-1,1)
quad(87,588,117,588,156,538,147,518);
pop()
push()
fill(100);
translate(316,0)
quad(152,538,147,518,253,518,255,538)
quad(87,588,117,588,153,538,147,518);
translate(400,0);
scale(-1,1)
quad(67,620,97,620,153,538,147,518);
pop()
push()
fill(100)
translate(155,73)
quad(145,538,128,515,278,515,260,538)
pop()
fill(100)
rect(622,588,27,31,)
//inside yellow
fill("#FFFFED")
rect(355,345,270,155)
fill("#FFFFED")
quad(470,475,395,565,320,565,265,495);
triangle(355,345,265,495,400,495)
//steering
fill(109,65,48)
quad(265,495,320,565,350,565,294,448)
quad(293,448,320,448,350,500,350,565)
fill(0)
quad(336,478,332,471,350,460,355,468)
push()
noFill()
strokeWeight(8)
stroke(0)
arc(370, 450, 40, 50, HALF_PI, PI);
pop()
//pillow
push()
fill(226,190,94)
translate(83,-57)
rotate(.2)
rect(420,420,35,67,12,2,2,12)
pop()
//seat
fill(126,38,26)
rect(365,500,30,65,11,0,0,0)
triangle(395,565,450,500,385,500)
fill(126,38,26)
rect(420,410,30,90,17,4,0,0)
//rail
fill(0)
quad(349,355,346,360,625,360,625,355)
//disco
fill(0)
rect(355,345,2,50)
fill(230)
let posX = 355;
let posY = 400;
let radius = 19;
let c1 = color(100);
let c2 = color(200);
for (let r = radius; r > 0; r--) {
let inter = map(r, radius, 0, 0, 1);
let c = lerpColor(c1, c2, inter);
fill(c);
noStroke();
ellipse(posX, posY, r * 2);}
//curtain
push()
// fill("#9cd7b1")
fill(210,240,202)
rect(500,350,115,135,0,0,10)
// fill("#9cd7b1")
fill(190,222,182)
rect(595,350,9,140,0,0,3)
translate(-20,0)
rect(595,350,9,140,0,0,3)
translate(-20,0)
rect(595,350,9,140,0,0,3)
translate(-20,0)
rect(595,350,9,140,0,0,3)
translate(-20,0)
rect(595,350,9,140,0,0,3)
translate(-20,0)
rect(595,350,9,140,0,0,3)
//extras
pop()
fill(0)
arc(97, 493, 20, 108, 0, HALF_PI);
fill(1000)
rect(648,420,10,90)
fill(104, 201, 210)
rect(658,435,10,60)
fill(150)
//arc(678,400,80,80,0,PI)
translate(0,135)
rect(648,420,25,40)
fill(0)
rect(648,420,25,15)
pop()
//wheels
noStroke()
fill("#d1edf2")
push();
translate(width * 0.62, height * 0.871);
scale(.25)
// rotate(frameCount / -1.5);
star(0, 0, 80, 100, 40);
pop();
fill(104, 201, 210);
push();
translate(width * 0.62, height * 0.871);
scale(.25)
//rotate(frameCount / -7.0);
star(0, 0, 30, 70, 5);
pop();
fill("#362204");
push();
translate(width * 0.62, height * 0.871);
scale(.05)
// rotate(frameCount / -7.0);
star(0, 0, 30, 70, 5);
pop();
noStroke()
fill("#d1edf2")
push();
translate(width * 0.72, height * 0.871);
scale(.25)
// rotate(frameCount / -1.5);
star(0, 0, 80, 100, 40);
pop();
fill(104, 201, 210);
push();
translate(width * 0.72, height * 0.871);
scale(.25)
//rotate(frameCount / -7.0);
star(0, 0, 30, 70, 5);
pop();
fill("#362204");
push();
translate(width * 0.72, height * 0.871);
scale(.05)
// rotate(frameCount / -7.0);
star(0, 0, 30, 70, 5);
pop();
noStroke()
fill("#d1edf2")
push();
translate(width * 0.22, height * 0.871);
scale(.25)
// rotate(frameCount / -1.5);
star(0, 0, 80, 100, 40);
pop();
fill(104, 201, 210);
push();
translate(width * 0.22, height * 0.871);
scale(.25)
//rotate(frameCount / -7);
star(0, 0, 30, 70, 5);
pop();
fill("#362204");
push();
translate(width * 0.22, height * 0.871);
scale(.05)
// rotate(frameCount / -7.0);
star(0, 0, 30, 70, 5);
pop();
noStroke()
fill("#d1edf2")
push();
translate(width * 0.32, height * 0.871);
scale(.25)
// rotate(frameCount / -1.5);
star(0, 0, 80, 100, 40);
pop();
fill(104, 201, 210);
push();
translate(width * 0.32, height * 0.871);
scale(.25)
//rotate(frameCount / -7);
star(0, 0, 30, 70, 5);
pop();
fill("#362204");
push();
translate(width * 0.32, height * 0.871);
scale(.05)
// rotate(frameCount / -7.0);
star(0, 0, 30, 70, 5);
pop();
}
function star(x, y, radius1, radius2, npoints) {
let angle = TWO_PI / npoints;
let halfAngle = angle / 2.0;
beginShape();
for (let a = 0; a < TWO_PI; a += angle) {
let sx = x + cos(a) * radius2;
let sy = y + sin(a) * radius2;
vertex(sx, sy);
sx = x + cos(a + halfAngle) * radius1;
sy = y + sin(a + halfAngle) * radius1;
vertex(sx, sy);
}
endShape(CLOSE);
}
function keyPressed(){
if (key === 's' || key === 'S'){
save('carimage.png')
}
}