Sunday, May 04, 2003

Soft Tweening

Tweening is possible through equations. Robert Penner has created a set of equations highly acclaimed by the flash community. I downloaded the equations , but yet to discover how they work. More examples using these 'easing equations' are at

http://proto.layer51.com/d.aspx?f=804

Full code is at the URL above

" The main feature on this prototype is that it only takes one swift mc.tween
command to add tweenings to objects. You don't have to set onEnterFrame or
similar events.

It also has several "shortcut" functions, so it does it all: sliding,
fading, changing colors, etc. You can use this tween method for all types of
tweening.

.tween(property, pEnd, seconds, animType, delay, callback, extra1, extra2)

Only the two first parameters are needed."



Some examples, explained:

// Moves BALL to _x = 10, in two seconds, using an easeOutExpo (default)
ball.tween ("_x", 10);

// Moves BOX to (100, 100) in 4 seconds, using linear easing (normal tweening)
box.tween (["_x", "_y"], [100, 100], 4, "linear");

0 Comments:

Post a Comment

<< Home