Java Reference
In-Depth Information
public override function curve(t: Number) : Number
{
if( t == 0.0 or t == 1.0) {
return t;
}
if(type == IN) {
var xt = t - 1;
return -(amplitude*Math.pow(2,10*xt) *
Math.sin( (xt-s)*(2*Math.PI)/period ));
} else if(type == OUT) {
var xt = t;
return amplitude*Math.pow(2,-10*xt) *
Math.sin( (xt-s)*(2*Math.PI)/period )
+ 1.0;
} else { // type == BOTH
var dt = t * 2.0;
if(dt < 1.0) {
var xt = dt -1;
return -.5 * amplitude*Math.pow(2,10*(xt)) *
Math.sin( (xt-s)*(2*Math.PI)/
period );
} else {
var xt = dt-1;
return (0.5 * amplitude*
Math.pow(2,-10*(xt)) *
Math.sin(
(xt-s)*(2*Math.PI)/period )) + 1.0;
}
}
}
}
Elastic is similar to bounce or spring effects, but gives a snap out/in effect. There
are three flavors for
Elastic: IN
focuses the elastic movement at the start of the
animation,
OUT
focuses on the end of the animation, and
BOTH
focuses on both
ends of the animation.
The elastic graphs are shown in the following three figures. Figure 7.4 shows the
Elastic IN
graph where the animated movement snaps into its final location.
Figure 7.5 shows the
Elastic OUT
graph where the movement jumps out of its
original position then smoothly moves to its final location.
Figure 7.6 shows the
Elastic BOTH
graph where the movement jumps out of its
original position and then snaps into its final position.
Search WWH ::
Custom Search