-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCondo.html
79 lines (71 loc) · 1.66 KB
/
Condo.html
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
67
68
69
70
71
72
73
74
75
76
77
78
79
<html>
<head>
<title> GWC Graphics and Animation Week!
</title>
<script src="http://cloud.github.com/downloads/processing-js/processing-js/processing-1.4.1.min.js"></script>
<script type="text/processing" data-processing-target="mycanvas">
var condo;
void setup(){
size(400,400);
background(0,0,0);
var xPos = 450;
var condo = [];
for (var i =0; i <3; i++){
condo.push( new Condo(10,100,-3));
xPos -= 120;
}
}
void draw(){
background(0,0,0);
noStroke();
for (var i =0; i< condo.length; i++){
condo[i].drawCondo();
condo[i].moveCondo();
}
}
class Condo{
var xPos;
var yPos;
var SpeedX;
Condo(xp,yp,sp){
xPos= xp;
yPos=yp;
SpeedX= sp;
}
void drawCondo(){
noStroke();
fill(204, 194, 194);
rect(xPos,yPos,175,300);//building
fill(141, 138, 150);
quad(xPos,yPos,xPos-10,yPos-20,xPos+185,yPos-20,xPos+175,yPos);//roof
stroke(56, 64, 94);
strokeWeight(2);
fill(119, 137, 156);
rect(xPos+20,yPos+20,50,40);//windows
rect(xPos+100,yPos+20,50,40);//windows
rect(xPos+20,yPos+80,50,40);//windows
rect(xPos+100,yPos+80,50,40);//windows
rect(xPos+20,yPos+140,50,40);//windows
rect(xPos+100,yPos+140,50,40);//windows
stroke(91, 99, 117);
strokeWeight(2);
rect(xPos+57.5,yPos+227,30,70);//doors
rect(xPos+90.5,yPos+227,30,70);//doors
stroke(92, 173, 94);
strokeWeight(1.75);
fill(32, 153, 36);
ellipse(xPos+30,yPos+285,45,45);//bush
}
void moveCondo(){
xPos = xPos + speedX;
if (xPos< -130){
xPos= 480;
}
}
}
</script>
</head>
<body>
<canvas id="mycanvas"></canvas>
<body onLoad="pageScroll()">
</html>