A Flash Developer Resource Site

Thread: spiral that grows by 1.618

1. I need some actionscript that will make a "golden section" spiral. I'd love it if I could have the spiral drawn rather than just appear. I'm relatively new to Flash, please - any help is greatly appreciated.

http://dgleahy.com/dgl/p14.html

2. I dont know what is that 1.618 means. The reference web that you included here just scared me. I did not read it.

Well, you want a spiral animation, so we do animation. If the whole 360 degree (or 2*Math.PI) is divided into 20, then we get a sub-zoom-factor f, that Math.pow(f,20) will be the zoom factor that we need for the radius of outer circle/the radius of inner circle. In the fla below I divide a circle as 60 parts.

I can not solve the equation, so I just made an approximation function. Here is the fla I draw mulitple lines to simulate the picture in that web page.

http://dr_ericlin.tripod.com/forum/spiral5.html
http://dr_ericlin.tripod.com/forum/spiral5.zip

Eric,
The swf you posted looks like exactly what I need, but I can't download the .zip file. Tripod won't allow. You can e-mail it to me

perry@inkandpaper.org

4. Hi - could you please send me this file that you made?

Hi
I found an old post of yours in the flashkit forum with a link to a golden mean spiral - but the link no longer works.
Would you be good enough to send it to me?
Dan Vantari
wb@bookoffire.net

Heres the post

Originally Posted by ericlin
I dont know what is that 1.618 means. The reference web that you included here just scared me. I did not read it.

Well, you want a spiral animation, so we do animation. If the whole 360 degree (or 2*Math.PI) is divided into 20, then we get a sub-zoom-factor f, that Math.pow(f,20) will be the zoom factor that we need for the radius of outer circle/the radius of inner circle. In the fla below I divide a circle as 60 parts.

I can not solve the equation, so I just made an approximation function. Here is the fla I draw mulitple lines to simulate the picture in that web page.

http://dr_ericlin.tripod.com/forum/spiral5.html
http://dr_ericlin.tripod.com/forum/spiral5.zip

5. his code has very old line drawing method; it can be done much simpler now:
Code:
```// as per http://en.wikipedia.org/wiki/Golden_spiral
function spiral (a, t) {
var f = 0.5 * (1 + Math.sqrt (5));
var c = Math.pow (f, 2 / Math.PI);

return a * Math.pow (c, t);
}

this.lineStyle (1);
for (var t = 0; t < 23; t += 0.1) {
var r = spiral (1, t);
var x = Stage.width/2 + r * Math.sin (t);
var y = Stage.height/2 + r * Math.cos (t);
if (t == 0) {
this.moveTo (x, y);
}
this.lineTo (x, y);
}```

6. Thanks thats a great beginning and the Wikipedia article is interesting.
WB

7. Here is another similar code for a spiral.
Please see the attached FLA. (F8).

8. Thanks Eager Beaver itsd good to have one that draws the line.

9. here goes my spiral code spin-off.

10. Oh very nice !
The code is way beyond me but I like the shrinking spiral.
Whats the black semi circular shape there for?
Cool anyway

WB

11. Originally Posted by White Bird
Whats the black semi circular shape there for?
?

12. Fibonacci Sequence <3 From the Da Vinci Code :P We use it alot in maths atm.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap