Spirograph

A Spirograph is formed by rolling a circle inside or outside of another circle. The pen is placed at any point A on the rolling circle.

If the radius of fixed circle is R, the radius of moving circle is r, and the offset of the pen point in the moving circle is ρ, then the equation of the resulting curve is defined by :
x = (R-r) cos t + ρ * cos( (R-r)t/r )
y = (R-r) sin t + ρ * sin( (R-r)t/r )

Different stages are gonna described right now.

Creating Objects

1 - Set up movie properties 600x600. Background color 999999.
Frame rate = 35.

2 - Create a horizontal line in the middle named X_axis. ( x:300 y:300 w:600 )

3 - Create a vertical line in the middle named Y_axis. ( x:300 y:300 h:600 )

4 - Create a static text at the bottom of the scene to write parametric equations. (x:140 y:560 w:330 h:35)
Verdana 14

5 - Create a static text at the top of the scene to write title Spirograph. (x:300 y:20 w:130 h:20)
Verdana 16

6 - Create a dynamic text named Rrp just above the equations. Target toggled. variable : txtdyn
Verdana 14 x:300 y:545 w:400 h: 21
txtdyn will display parameters R, r and ρ of the current curve.

7 - Create a static text R100r2p80. (x:540 y:60 w:100 h:16)
Verdana 12
Convert to button. With a right click on button you can modify the states (Click, Over, Down).

8 - Create a static text R100r2p8. (x:540 y:80 w:100 h:16)
Verdana 12
Convert to button. With a right click on button you can modify the states (Click, Over, Down).

9 - You could add another buttons, but don't forget to increment y with +20 as many times as it needs.

10 - Create a pointer which y position 'll change when a button 'll pressed.
Create a static text named index (x:480 y:60 w:15 h:15)
Verdana 12

Script animation

Enter the following script in Scene_1 :

Enter the following script for button R100r2p80 :

Enter the following script for button R100r2p8 :

If you need another buttons, add and adapt previous script (parameters and index._Y).
Et voilà, that's it !

Si vous aimez le site

Select a language if you need :

Page chargée en 0.001 sec.

Dernière Modification : Dim 28 Avril 2019 12:45