-
Notifications
You must be signed in to change notification settings - Fork 0
/
fawazVote.pde
74 lines (57 loc) · 1.25 KB
/
fawazVote.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
67
68
69
70
71
72
73
74
PImage img;
final int xVal=20;
final int yVal=30;
float xPos=0, yPos=10, xSpeed=2.8, ySpeed=2.8;
float imgX=100,imgY=150;
boolean moveRight=true;
boolean moveDown=false;
boolean imgRight=false;
boolean imgDown=false;
String text[]={"VOTE", "FAWAZ", "FOR", "EVENTS", "EXEC"};
void setup() {
size(700, 400);
textSize(30);
}
void draw() {
frameRate(60);
background(0);
img = loadImage("download.png");
if (moveRight) {
xPos+=xSpeed;
} else {
xPos-=xSpeed;
}
if (imgRight) {
imgX+=xSpeed;
} else {
imgX-=xSpeed;
}
if (moveDown) {
yPos+=ySpeed;
} else {
yPos-=ySpeed;
}
if (imgDown) {
imgY+=ySpeed;
} else {
imgY-=ySpeed;
}
if (xPos<0||xPos>width-180) {
moveRight=!moveRight;
fill(random(100,255), random(100,255), random(100,255));
}
if (imgX<0||imgX>width-100) {
imgRight=!imgRight;
}
if (yPos<0|| yPos>height-180) {
moveDown=!moveDown;
fill(random(100,255), random(100,255), random(100,255));
}
if (imgY<0|| imgY>height-100) {
imgDown=!imgDown;
}
image(img,imgX,imgY,100,100);
for (int i=0; i<=4; i++) {
text(text[i], xPos+xVal*i+10, yPos+yVal*i+40);
}
}