Text field formatting

Trevor DeVore lists at mangomultimedia.com
Tue Oct 28 15:29:10 EST 2003

On Tuesday, October 28, 2003, at 01:02  PM, Thomas J McGrath III wrote:
> Also, I already figured the special effects would be rebuilt in REV 
> from scratch. But, I was wondering if any one built some functions to 
> handle the built in abilities in REV for animation type effects???? If 
> I do this I will write my own for this and future projects and upload 
> but it would be nice to have a Build slide via first bullet/every 
> line/ every word etc. function.
> it would be nice to have a few affects to animate a text field with 
> that are straight forward and simple.

If you want to just animate the whole text field you could use these 
functions from an animation library I am working on.  It uses cosine 
interpolation to animate and is easy enough to use.  I converted the 
code from some examples in the book Interactive QuickTime by Matthew 
Peterson (excellent book not only for QuickTime but all media based 

Put both of the functions below somewhere where they are available to 
all of your scripts and then call it with something like this:

libAnim_Ease short id of field "MyField", long owner of field 
"MyField", 0, 200, 0, 200, true, 10, 20

This would move your field from 0,0 to 50,200 and send the message 
"libAnim_Finished" to the object you were animating when the animation 
was done.  It would move the object every 10 milliseconds and do the 
entire animation in 20 steps.

Hope this helps,

Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com

  * Performs the ease animation on an object
  * @param pObjID    objID      ID of the object to animate
  * @param pOwner    obj        Owner of the object to animate
  * @param pStartX   integer    Starting x position
  * @param pEndX     integer    Ending x position
  * @param pStartY   integer    Starting y position
  * @param pEndY     integer    Ending y position
  * @param pWithMsgs boolean    Whether to send updates to object on 
updates and finishing.
  * @param pSpeed    integer    Speed of animation in milliseconds.  How 
often message is sent.
  * @param pNumSteps integer    Number of steps to do the animation in
on libAnim_Ease pObjID, pOwner, pStartX, pEndX, pStartY, pEndY, 
pWithMsgs, pSpeed, pNumsteps
   local tTarget

   put "control id " & pObjID & " of " & pOwner into tTarget

   set the libAnim["uCurrentStep"] of tTarget to 1
   set the libAnim["uNumSteps"] of tTarget to pNumsteps
   set the libAnim["uStepSizeX"] of tTarget to (pEndX - pStartX) / 
   set the libAnim["uStepSizeY"] of tTarget to (pEndY - pStartY) / 
   set the libAnim["uStepAngle"] of tTarget to 2 * pi / pNumSteps
   set the libAnim["uSendMessages"] of tTarget to pWithMsgs
   set loc of tTarget to pStartX, pStartY

   # Start animation
   libAnim_CosineInterpolation pObjID, pOwner, pSpeed
end libAnim_Ease

  * Animates an object using cosine interpolation
  * @param pObj   objID    ID of control to animate
  * @param pOwner obj      Owner of the object (long owner)
  * @param pSpeed integer  How often to resend the message in 
on libAnim_CosineInterpolation pObjID, pObjOwner pSpeed
   local tVelocityScale
   local tTarget

   put "control id " & pObjID & " of " & pObjOwner into tTarget

   put 1 - \
       cos (the libAnim["uCurrentStep"] of tTarget * the 
libAnim["uStepAngle"] of tTarget) \
       into tVelocityScale
   put item 1 of loc of tTarget into tX
   put item 2 of loc of tTarget into tY
   set loc of tTarget to (tX + (tVelocityScale * the 
libAnim["uStepSizeX"] of tTarget), \
       tY + (tVelocityScale * the libAnim["uStepSizeY"] of tTarget))
   set the libAnim["uCurrentStep"] of tTarget to the 
libAnim["uCurrentStep"] of tTarget + 1
   if (the libAnim["uCurrentStep"] of tTarget <= the 
libAnim["uNumSteps"] of tTarget) then
     send "libAnim_CosineInterpolation" && pObjID &","& pObjOwner & "," 
& pSpeed to me in pSpeed milliseconds
     if (the libAnim["uSendMessages"] of tTarget = true) then
       send "libAnim_Finished" to tTarget
     end if
   end if
end libAnim_CosineInterpolation

More information about the Use-livecode mailing list