-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77bc786
commit 5373de5
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Make Roger Antonsen's sketch "90 Rotating Equilateral Triangles" and color each triangle using stroke(). | ||
|
||
def setup(): | ||
size(1400, 800) | ||
rectMode(CENTER) | ||
colorMode(HSB) | ||
|
||
t=0 | ||
|
||
def draw(): | ||
global t | ||
background(0) | ||
translate(width/2, height/2) | ||
rotate(radians(t)) | ||
for i in range(90): | ||
rotate(radians(360/90)) #space the triangles evenly to cover up whole 360 degrees i.e., 4 degree each | ||
pushMatrix() #save this orientation | ||
translate(200,0) #go to circumference | ||
rotate(radians(t+i*360/45)) #spin each triangle with phase-shifting so that Roger Antonsen's sketch can be made | ||
stroke(255-i*255/90, 255, 255) #hue is varied such that a unique color can be obtained while keeping saturation and brightness constant | ||
tri(t) # make a triangle of t length | ||
popMatrix() #return to the saved orientation | ||
t+=0.5 | ||
|
||
def tri(length): | ||
#Draws an equilateral triangle around centre of triangle | ||
noFill() | ||
triangle(0, -length, | ||
-length*sqrt(3)/2, length/2, | ||
length*sqrt(3)/2, length/2) |