Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- phi =0
- def setup():
- fullScreen(P2D)
- frameRate(50)
- textAlign(CENTER, CENTER)
- def draw():
- stroke(0)
- global phi
- phi += 0.001
- centers = [(width/2, height/2), \
- (width/2 + 250*cos(phi)*(sqrt(2)-1)/(sqrt(2)+1), \
- height/2 + 250*sin(phi)*(sqrt(2)-1)/(sqrt(2)+1))]
- background(100)
- fill(200)
- ellipse(width/2, height/2, 500, 500)
- fill(150)
- arc(width/2 + cos(phi)*250, height/2 + sin(phi)*250, \
- 500*sqrt(2), 500*sqrt(2),PI+ phi-QUARTER_PI,PI+ phi+QUARTER_PI, PIE)
- fill(200)
- ellipse(centers[1][0], centers[1][1], \
- 500*sqrt(2)/(sqrt(2)+1),500*sqrt(2)/(sqrt(2)+1))
- fill(150)
- arc(centers[1][0] + cos(2*phi)*250*sqrt(2)/(sqrt(2)+1), \
- centers[1][1] + sin(2*phi)*250*sqrt(2)/(sqrt(2)+1), \
- 500*sqrt(2)/(sqrt(2)+1)*sqrt(2), 500*sqrt(2)/(sqrt(2)+1)*sqrt(2), \
- PI+2*phi - QUARTER_PI, PI+2*phi+QUARTER_PI, PIE)
- stroke(200, 0, 0)
- line(centers[1][0], centers[1][1], \
- width/2+ cos(phi)*250, height/2 + sin(phi)*250)
- line(centers[1][0] + cos(2*phi)*250*sqrt(2)/(sqrt(2)+1), \
- centers[1][1] + sin(2*phi)*250*sqrt(2)/(sqrt(2)+1), \
- centers[1][0], \
- centers[1][1])
- noFill();
- arc(centers[1][0], centers[1][1], 60, 60, phi, phi+(phi)%(TWO_PI));
- fill(200, 0, 0)
- text("phi", centers[1][0] + 20*cos((phi%TWO_PI)/2+phi),
- centers[1][1] + 20*sin((phi%TWO_PI)/2+phi))
- stroke(0,0,200)
- noFill()
- arc(centers[0][0], centers[0][1], 60, 60, 0, phi%TWO_PI)
- fill(0, 0, 200)
- text("phi", centers[0][0] + 20*cos((phi%TWO_PI)/2),\
- centers[0][1] + 20*sin((phi%TWO_PI)/2))
- line(centers[0][0], centers[0][1], centers[0][0]+250, centers[0][1])
- line(centers[0][0],centers[0][1], \
- width/2 + cos(phi)*250, height/2 + sin(phi)*250)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement