Skip to content

Commit 1e8b53c

Browse files
authored
Add files via upload
1 parent daaad1b commit 1e8b53c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ex5_1SpinCycle.pyde

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Create a circle of equilateral triangles in a Processing sketch, and rotate them using the rotate() function.
2+
3+
def setup():
4+
size(600, 600)
5+
rectMode(CENTER)
6+
colorMode(HSB)
7+
8+
t=0
9+
10+
def draw():
11+
global t
12+
background(255)
13+
translate(width/2, height/2)
14+
rotate(radians(t))
15+
for i in range(90):
16+
pushMatrix() #save this orientation
17+
translate(200,0)
18+
rotate(radians(t))
19+
tri(30)
20+
popMatrix() #return to the saved orientation
21+
rotate(radians(360/12))
22+
t+=0.5
23+
24+
def tri(length):
25+
#Draws an equilateral triangle around centre of triangle
26+
triangle(0, -length,
27+
-length*sqrt(3)/2, length/2,
28+
length*sqrt(3)/2, length/2)

0 commit comments

Comments
 (0)