Director gives tweening options to 'ease-in' and 'ease-out'.
The effect is to regulate the speed of the object along its path. In parametric
animation, this is done by 'biasing' the parameter.
A biasing function b(p) has two characteristics:
1. b(0)=0 and b(1)=1.
2. It is a curve, not a straight
line. The curve gives the 'ease' effect.
Some examples:
Bias-in
Bias-out
p = power(p, 1.5)
p = power(p, 3)
p = power(p, x) for x>1
p = 1 - abs(power(p-1, x)) for x<1
p = sin((p-1) * pi * .5)
p = yourBiasFunction(p)
p = 1 - abs(power(p-1, 1.5))
p = 1 - abs(power(p-1, 3))
p = 1 - abs(power(p-1, x)) for x>1 p = power(p, x) for x<1 p = sin(p * pi * .5) p = yourBiasFunction(p)
Bias-in and
-out
p = (-cos(p*pi)
+ 1) / 2.0
p = yourBiasFunction(p)
Another advantage of standardizing p
to 0->1 is that it simplifies biasing functions.
To see what these functions look like, type them (without the 'p =') into
the Parameter Tool.
Click to move the
dotBiasing the Parameter - source
movie
onexitframe() -- drive p
p = eTimeOnce(1000) --
one second
-- bias p case bias of "in":
p = biasIn(p, 3) "out":
p = biasOut(p, 3) "both":
p = biasBoth(p) end case
-- p drives animation
sp.loch = p * (endX - startX)
+ startX
sp.locv = p * (endY - startY)
+ startY
sp.rotation = p * (endRot
- startRot) + startRot end
on biasIn(p, amount) returnpower(p,amount) end
on biasOut(p, amount) return1
- abs(power(p-1,
amount)) end
on biasBoth(p) return (1 - cos(p
* pi)) / 2.0 end
Only the exitframe handler and biasing functions
are shown here. See source movie for full script
First, p is driven by time.
The time-based driver eTimeOnce() is similar to eTime() in the previous
demo, except that it doesn't cycle automatically.
Clicking the mouse starts the time cycle. (see full script in source movie)
p is then biased. If
"none" is selected, none of the biasing functions in the case
statement get called and p remains unbiased.
The nature of biasing can be clearly seen with "trails"
turned on—the positions are spaced differently
along the path. If it isn't clear why the biasing functions do this, take
a piece of graph paper and draw a number line across it from 0 to 1. Then
take values for p between 0 and 1 at increments of .1,
put each into a biasing function like power(p, 2), and plot the result on the number line.
pthen drives the
animation of the properties. In these functions variables
are used, rather than literal values as in previous demos.
This is because the start and end locations can vary in this demo,
whereas in previous demos the start and end locations were always the
same. The variable names make clear how the start
and end values of the ranges are being usedin
the shift & scale functions. To see how these variables
are being set see the full script in the source movie.
•What would it look like if you used
a slider driver and biased p? For an example, see the Independent
Model Rate demo.
Combining Different
Biases
What would happen if different biases were given to each
property being animated? Try this for the exitframe handler:
Pretty cool, huh? Try giving different biases
to loch and locv. It's an easy way to make a curved path, though it isn't
consistent and disappears altogether when dx
or dy is zero. Curving the path is better done with the
functions used to drive the location properties. These functions
are the focus of the next section.
Calculating endRot
The trickiest part in this demo is calculating endRot (see
source movie). Most of the math involved is explained in Sine
& Cosine Definitions. As for the last two "if"
statements in that section of code, try removing them and see what
the difference is.