-
Notifications
You must be signed in to change notification settings - Fork 0
/
PinkSquare.py
52 lines (43 loc) · 981 Bytes
/
PinkSquare.py
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
RECTSIZE = 6
CANVAS = 500
NFRAMES = 120
MID = 59.5
TRUEMID = 60.5
def IncreaseRotate(t):
size = (t + MID) * RECTSIZE
return size
def IncreaseTiny(t):
if t < 1:
size = 0
else:
size = ((t) * RECTSIZE)
return size
def IncreaseLast(t):
if t < MID:
size = 0
else:
size = ((t - TRUEMID) * RECTSIZE)
return size
for i in range(NFRAMES):
newPage(CANVAS, CANVAS)
frameDuration(1/20)
translate(CANVAS/2, CANVAS/2)
fill(1)
rect(-CANVAS/2, -CANVAS/2, CANVAS, CANVAS)
#Pink Square
fill(1, 0, 0, .5)
stroke(0)
bigSize = IncreaseRotate(i)
rotate(3 * i)
rect(-bigSize/2, -bigSize/2, bigSize, bigSize)
#White Square
fill(1)
stroke(0)
sqSize = IncreaseTiny(i)
rect(-sqSize/2, -sqSize/2, sqSize, sqSize)
#Pink Square
fill(1, 0, 0, .5)
stroke(0)
lastSize = IncreaseLast(i)
rect(-lastSize/2, -lastSize/2, lastSize, lastSize)
saveImage("PinkSquare.gif")