Rolling Animation

Malte Brill revolution at derbrill.de
Fri Apr 13 04:15:41 EDT 2007


Hi Katir,

Here is a starter. Try this in a button:

on mouseUp
   set the flag of me to not the flag of me
   if the flag of me then
     createBall
   end if
end mouseUp


on createBall
   if there is a grp "ball" then delete grp "ball"
   local tSpikes,tAngle
   put 6 into tSpikes
   put 360/tSpikes into tAngle
   create group "ball"
   set the style of the templateGraphic to "oval"
   set the height of the templateGraphic to 50
   set the width of the templateGraphic to 50
   set the opaque of the templategraphic to true
   set the loc of the templateGraphic to 100,100
   repeat with i=1 to tSpikes
     set the backColor of the templateGraphic to any item of  
"red,green,blue,yellow,purple,magenta"
     create grc ("spike"&i) in grp "ball"
     set the arcAngle of the last grc to tAngle
     set the startangle of the last grc to i*tAngle-tAngle
   end repeat
   if the flag of me then rollBall
end createBall


on rollBall
   local tStep
   put 8 into tStep
   lock screen
   repeat with i=1 to the number of grcs of grp "ball"
     set the startAngle of grc i of grp "ball" to the startAngle of  
grc i of grp "ball" + tStep
   end repeat
   unlock screen
   if the flag of me then send "rollBall" to me in 40 milliseconds
end rollBall


You will need to move the group asynchronously then. AE might help  
there.




More information about the use-livecode mailing list