We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent daaad1b commit 1e8b53cCopy full SHA for 1e8b53c
ex5_1SpinCycle.pyde
@@ -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
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