[Fun] Spiral animation

Markus Gaelli gaelli at emergent.de
Sun Jun 20 14:11:29 UTC 2004


Hi Stef,

> Really cool.
Thanks. :-)
> I tried it in my last 3.7 image and it could not stopped strange.
It takes a while, and I did not make it stoppable.

I also thought it was stoppable when I roughly scanned the source that  
I programmed some while ago.
I guess it should be, but the idea was to keep it simple to understand  
with the for-loop, and I do not know how to combine that with an early  
"button-exit".

Cheers,

Markus
>
> Stef
> On 20 juin 04, at 14:34, Markus Gaelli wrote:
>
>> Hi folks,
>>
>> I thought some of you might like it...
>> I stole the formula at the bottom from Wolframs New Kind of Science:  
>> http://www.wolframscience.com/nksonline/page-411?firstview=1
>>
>> For an online version of the spirals see:  
>> http://www.squeakland.org/project.jsp?http://www.emergent.de/pub/ 
>> smalltalk/squeak/projects/galaxies.001.pr
>>
>> I find it amazing, that sunflowers (anAngle =  137.5 = 360*(1-phi)),  
>> yin-yang, and lots of other interesting :-/ symbols can be made out  
>> of this simple formula (which I made a bit more complex for aesthetic  
>> reasons).
>>
>> | backgroundColor  leafSize anExtent aCanvas numbersOfLeafs  
>> someColors aPoint |
>> 	backgroundColor _ Color blue muchDarker.
>> 	leafSize _ 60 @ 60.
>> 	anExtent _ Display extent y @ Display extent y.
>> 	aCanvas _ BalloonCanvas extent: anExtent.
>> 	numbersOfLeafs _ 200.
>> 	someColors _ Color wheel: numbersOfLeafs.
>> 	[Display fillColor: backgroundColor.
>> 	0
>> 		to: 360
>> 		by: 0.1
>> 		do: [:anAngle |
>> 			(1 to: numbersOfLeafs)
>> 				do: [:anInt |
>> 					aPoint _ (anInt sqrt * ((anInt * anAngle degreesToRadians) cos @  
>> (anInt * anAngle degreesToRadians) sin) * (anExtent - leafSize /  
>> numbersOfLeafs sqrt) + (anExtent - leafSize) / 2) rounded.
>> 					aCanvas
>> 						fillOval: (aPoint extent: (leafSize * (numbersOfLeafs - anInt)  
>> / numbersOfLeafs) rounded)
>> 						color: (someColors at: anInt)].
>> 			aCanvas showAt: (Display center - (anExtent / 2)) rounded.
>> 			aCanvas fillColor: backgroundColor].
>> 	[Sensor anyButtonPressed] whileFalse.
>> 	nil]
>> 		ensure: [Display restore]
>>
>> Enjoy,
>>
>> Markus
>>
>>
>
>




More information about the Squeak-dev mailing list