adjusting speed of set arcangle of graphic

Malte Pfaff-Brill revolution at derbrill.de
Tue Mar 16 04:58:15 EDT 2010


Hi Nicolas,

what you would need to do to make it accurate on all machines is calculate the value for the arcangle as it *should* be at the current time stamp. 
that way it might look a bit jerky on slower machines, though I doubt that would be noticeable. I am afraid I´ll need to blow my own horn here, so
*toot* *toot* You can do this with a timer using AEs easing functions.

The following script will always last 1800 millisecs (+- 40 millisecs, but those are neglectible)

on mouseUp
   local tDuration
   put 1800 into tDuration
   setArcAngle the milliseconds,tDuration
end mouseUp

on setArcAngle pSecs,pDuration
   local tElapsed,tAngle
   lock screen
   put the millisecs - pSecs into tElapsed
   put aeEaseIn(0,360,pDuration,tElapsed,1) into tAngle
   set the arcAngle of grc "circle" to round(tAngle)
   unlock screen
   if tAngle<360 then 
      if "setArcAngle" is not in the pendingmessages then
         send "setArcAngle"&&pSecs,pDuration to me in 40 millisecs
      end if
   else
      set the arcAngle of grc "circle" to 360
   end if
end setArcAngle

All the best,

Malte


More information about the use-livecode mailing list