-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCar_following_mouse.pde
66 lines (60 loc) · 1.69 KB
/
Car_following_mouse.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
background(196, 253, 255);
fill(13, 255, 0);
var x = 10;
var y = 1;
draw = function() {
background(0, 255, 204);
fill(0, 255, 17);
rect(-1,250,400,437);
fill(255, 0, 0);
rect(mouseX,222,50,20);
rect(mouseX + 10,202,28,20);
fill(0, 0, 0);
ellipse(mouseX + 11, 241,20,20);
ellipse(mouseX + 41, 241,20,20);
fill(255, 255, 255);
noStroke();
ellipse(x + 10, 100,115,55);
ellipse(x + 17, 96,62,27);
ellipse(x + 9,80,50,35);
ellipse(x + 300,80,43,30);
ellipse(x + 317,67,70,50);
ellipse(x + 347,77,80,30);
x++;
if (x > 500){x = -400; }
fill(135, 126, 125);
ellipse(300, 222, 100, 70);
if (mouseX > 200){
draw = function() {
background(159, 252, 232);
fill(0, 255, 17);
rect(-1,250,400,437);
fill(255, 0, 0);
rect(204,224,46,20);
rect(214,207,28,20);
fill(0, 0, 0);
ellipse(243,244,20,19);
ellipse(214,243,20,19);
fill(255, 255, 255);
ellipse(x + 10, 100,115,55);
ellipse(x + 17, 96,62,27);
ellipse(x + 9,80,50,35);
ellipse(x + 300,80,43,30);
ellipse(x + 317,67,70,50);
ellipse(x + 347,77,80,30);
x++;
if (x > 500){x = -400; }
fill(110, 96, 94);
stroke(0, 0, 0);
ellipse(300, 222, 100, 70);
fill(0, 0, 0);
rect(221,200 - y,35,33);
rect(221,291 - y,35,20);
rect(221,319 - y,28,33);
y++;
fill(0, 255, 17);
rect(-1,250,400,437);
noStroke();
};
}
};