scripted animation advice

Yves COPPE yvescoppe at skynet.be
Wed Jun 30 09:46:40 EDT 2004


Le 30 juin 04, à 11:52, Malte Brill a écrit :

> I´ve improved the stack a bit:
>
> Create a stack with a button called "startWheel"
>
> You initialise it from the messagebox:
>
> send init to btn "startWheel"
>
> if you don´t like the colors you can
>
> send changecolor to btn "startWheel"
>
> a few times or set the colors individually.
> If you klick the button the spinning will decrease speed and put which 
> part
> is on top, the backColor of that part.
>
>
> Here is the script:
>
>
> on mouseUp
>   set the flag of me to the flag of me*-1
>   spinTheWheel
>   set the speed of me to 60+random(35)
>   decreasespeed
> end mouseUp
>
> on spinTheWheel
>   lock screen
>   repeat with i=1 to the elements of me
>     put the startangle of grc ("part"&i) into newangle
>     put newangle-the speed of me into newangle
>     if newangle<1 then put newangle+360 into newangle
>     set the startangle of grc ("part"&i) to newangle
>   end repeat
>   unlock screen
>   if the flag of me=1 then send spinTheWheel to me in 20 milliseconds
> end spinTheWheel
>
> on decreaseSpeed
>   set the speed of me to the speed of me-1
>   if the speed of me<=0 then
>     set the flag of me to -1
>     whichPart
>   end if
>   if the flag of me=1 then send decreaseSpeed to me in 100 milliseconds
> end decreaseSpeed
>
> on whichpart
>   repeat with i=1 to the elements of me
>     if the startangle of grc ("part"&i)>360/the elements of me and the 
> \\
>        startangle of grc ("part"&i)<(360/the elements of me)*2 then
>       --mind linebreak
>       put i, the backcolor of grc ("part"&i)
>       exit repeat
>     end if
>   end repeat
> end whichpart
>
> on init
>   set the elements of me to 8
>   set the speed of me to 60
>   set the flag of me to -1
>   repeat with i=1 to the elements of btn "startWheel"
>     create grc ("part"&i)
>     set the style of grc ("part"&i) to oval
>     set the height of grc ("part"&i) to 100
>     set the width of grc ("part"&i) to 100
>     set the loc of grc ("part"&i) to the loc of this card
>     set the arcangle of grc ("part"&i) to 360/the elements \\
>         of btn "startWheel"
>     --mind linebreak
>     put 360/the elements of btn "startWheel"*(i-1) into thestartAngle
>     set the startangle of grc ("part"&i) to theStartangle
>     set the backcolor of grc ("part"&i) to any line of the colornames
>   end repeat
> end init
>
> on changeColor
>   repeat with i=1 to the elements of me
>     set the backcolor of grc ("part"&i) to any line of the colornames
>   end repeat
> end changeColor
>
>



Hi,

I've changed the script of my stack as you write here above BUT

1) now I have a nice COLORED wheel when I code "init" (ii have a btn 
"startwheel")
2) when I click on my btn "spinning wheel", the wheel STAYS whithout 
spinning…

what am I missing ?

Greetings.

Yves COPPE
yvescoppe at skynet.be


More information about the use-livecode mailing list