adjusting speed of set arcangle of graphic

Malte Pfaff-Brill revolution at derbrill.de
Wed Mar 17 05:12:55 EDT 2010


Hi Nicolas,

> Instead of the arcangle increasing, how could I use AE to make it
> decrease? So that the circle disappears.

The good part about the easing functions is that they are agnostic towards order of values. They always calculate the correct
value at the given elapsed time. A few minor changes to the original script will make the circle disappear.

The most important change:

   put aeEaseIn(0,360,pDuration,tElapsed,1) into tAngle

to

   put aeEaseIn(360,0,pDuration,tElapsed,1) into tAngle

Values will decrease from 360 to 0 instead of increasing from 0 to 360. This will in return first draw the full circle and then 
make it disappear

I have revised the script a bit. Gave setArcangle a third parameter (pEffect). 

This will allow you to make the circle appear or vanish as you wish with one command call. Hope that helps,

Malte


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

on setArcAngle pSecs,pDuration,pEffect
   local tElapsed,tAngle 
   lock screen
   put the millisecs - pSecs into tElapsed
   switch pEffect
      case "vanish"
         put aeEaseIn(360,0,pDuration,tElapsed,1) into tAngle
         break
      case "appear"
         put aeEaseIn(0,360,pDuration,tElapsed,1) into tAngle
         break
      case "bounceVanish"
         put aeBounceEaseOut(360,0,pDuration,tElapsed) into tAngle
         break
      case "bounceAppear"
         put aeBounceEaseOut(0,360,pDuration,tElapsed) into tAngle
         break
   end switch
   set the arcAngle of grc "circle" to round(tAngle)
   unlock screen
   if pDuration>tElapsed then 
      if "setArcAngle" is not in the pendingmessages then
         send "setArcAngle"&&pSecs,pDuration,pEffect to me in 40 millisecs
      end if
   else
      if "vanish" is in pEffect then
         set the arcAngle of grc "circle" to 0
      else
         set the arcAngle of grc "circle" to 360
      end if
   end if
end setArcAngle




More information about the use-livecode mailing list