Home Contents Forum Links Tip Jar
Animation Math in Lingo       

Parametric Animation

When Director does "tweening" it's using parametric animation, but doing it in lingo gives much more variety and control. Take a look at this simple example and notice how it differs from incremental animation.

  property sp
property param  --parameter

on beginsprite(me)
  sp = sprite(me.spritenum)
  param = 0
end

on exitframe()
  param = param + 2
  if param > 125 then param = 0 --wrap

  sp.loch = param + 20
  sp.locv = param * -2 + 280
end

Parametric animation - source movie - To pause, right-click and select "pause"

What's going on here? Two points:

1. The sprite properties that are being animated, loch and locv, are set to expressions that rely on param. One way to say this is that "loch is a function of param" and "locv is a function of param."

2. The variable param goes through values from 0 to 125. It is driving the animation. It is a standard feature of parametric animation and in subsequent demos will simply be p, and called "the parameter."

These are the two parts that make up parametric animation. Before continuing, make sure you are familiar with the material in Functions and Shifting & Scaling Numbers.

 
 


Copyright © 2003 JM Harward 
 jmckell~at~jmckell~dot~com
All lingo provided on this site may be used freely for educational purposes. Not for redistribution as uncompiled code. Instructional materials may not be reproduced without permission.