In the first parametric demo,
the parameter went from 0 to 125. The choice was arbitrary—it could
have been any range, and the functions changed to get the same path for
the object.
Standardizing the parameter means using the same
range for the parameter in all parametric animation. In particular,
standardizing the range to p:0->1.
Standardizing the parameter range to 0->1 has many
advantages in parametric animation. For one, it is easy to shift
& scale p:0->1 to any range.
As an example, say I want to move an object in a straight
line from
point(71, 28) to point(131, 275). I also want the rotation
to go from 0 to 60. The ranges for the
properties, then, are:
loch: 71 -> 131
locv: 28 -> 275
rotation: 0 -> 60
For p to drive this animation, I need
to find functions that shift & scale the range p:0->1 to each of these ranges. Using the steps
outlined in shifting & scaling numbers gives me these linear functions:
loch = p * (131 - 71) + 71
locv = p * (275 - 28) + 28
rotation = p * (60 - 0) + 0
Notice the simplicity of the equations, and how they are
related to the ranges. This is a result of standardizing to p:0->1.
property
sp property p
--parameter
onbeginsprite(me)
sp = sprite(me.spritenum)
p = 0 end
onexitframe()
p = p + .015 if p > 1 then
p = 0 --wrap
sp.loch = p * (131
- 71) + 71
sp.locv = p
* (275 - 28)
+ 28
sp.rotation = p * (60
- 0) + 0 end
Standardizing the parameter - source
movie - To pause, right-click and select "pause"
The form of the general function that shifts & scales
p:A->B >> prop:C->D was
given as:
prop = (p - A) * (D -
C)/(B - A) + C
If p (source range) is standardized to
0->1, making A = 0 and B
= 1, the equation becomes:
prop = p * (D - C) +
C
This is the form of the equations in the demo.
•What does the value (D-C) represent?
What is the value of (D-C) in the functions in the demo?
If p is driving the animation,
what is driving p? In this demo it's the looping
of the frame that drives p. Each frame, p
is incremented. The next segment of the tutorial discusses different
ways of driving p.