MC Tween: it saves the world.™

Home | Using MC Tween | Documentation | Animation Types | Downloads | Examples | Extensions | Author & Disclaimer | Links

Special notice! While MC Tween is a nice extension and it will continue to work for AS1 and AS2 until the end of time, it is my duty to inform all citizens that I have switched the focus from further development on MC Tween to a new AS2 and AS3 extension, a real Class this time, called "caurina.transitions.Tweener" (or just Tweener). Tweener doesn't have as many features as MC Tween yet (for example, it doesn't have native filter tweens), and the documentation isn't 100% done, but it features a complete, more solid redesign with a few additional syntax features that were impossible to achieve with MC Tween. And it works the same for AS2 (including Flash Lite 2+) and AS3.

So, if you use MC Tween, or you're thinking about using it, I'd like to suggest you try Tweener instead. It follows all the principles of simplicity I tried to feature on MC Tween, but with a more powerful syntax. Tweener download, examples and documentation are available on Tweener's page. You can read more about this change on this blog post.

Thank you for your attention and sorry for this ugly box. And don't worry, this website will not be deleted or anything.

Notice for October 2008: also note that, if you are still interested in MC Tween and don't want to use class-based AS2 or AS3 solutions, Larry Benedict has taken the matter into his hands and updated MC Tween with some filter features that are not available in the latest version. You can read more about it (and download his version) here or here.

Documentation

» Introduction

Core Methods

» tween()

» stopTween()

Shortcut Methods

» alphaTo()

» bezierSlideTo()

» colorTo()

» colorTransformTo()

» frameTo()

» panTo()

» resizeTo()

» rotateTo()

» scaleTo()

» scrollTo()

» slideTo()

» volumeTo()

» xScaleTo()

» xSlideTo()

» yScaleTo()

» ySlideTo()

Rounded Shortcut Methods

» roundedBezierSlideTo()

» roundedSlideTo()

» roundedTween()

» roundedXSlideTo()

» roundedYSlideTo()

Flash 8 Filters Shortcut Methods

» bevelTo()

» blurTo()

» glowTo()

» xBlurTo()

» xGlowTo()

» yBlurTo()

» yGlowTo()

» xyBevelTo()

» xyBlurTo()

» xyGlowTo()

Auxiliary Functions

» getTweens()

» isTweening()

Auxiliary Methods

» lockTween()

» unlockTween()

» pauseTween()

» resumeTween()

Additional Events

» onTweenComplete

» onTweenUpdate

.roundedTween()

Applies To

MovieClip, Sound, TextField

Availability

Flash 6 and above, using AS1 or AS2.

Usage

<MovieClip|Sound|TextField>.roundedTween(property(ies), ending value(s) [, seconds, animation type, delay, callback, extra1, extra2]);

Parameters

property(ies) : Property or properties to be tweened. This can be a single string containing one property name (as in "_x"), or an array containing a list of property names (as in ["_x", "_y"]). Properties need not be standard instance properties like "_x" or "_alpha" - they can be simple variables and refer to object-specific attributes like "counter" or "myPointer".

ending value(s) : New value or values that you want your properties to have at the end of the tween execution. This is either a numeric parameter (as in 10) or an array of numeric parameters (as in [10, 20]). The ending values count has to match the properties count - one ending value for each property.

seconds : An optional parameter indicating the time it will take for your tweening animation to be executed, in seconds. Fractional values are accepted, but zero is not. The default value is 2.

animation type : An optional parameter indicating the type of tweening you want to be executed, as a string. This indicates which of the easing equations will be used. See animation types for a reference on the available transition types. The default value is "easeOutExpo".

delay : An optional parameter indicating the time in which the animation should wait before starting, in seconds. Fractional values are accepted. With this, it's possible to create sequential animations by using several tweening methods with different delays. The default value is 0.

callback : An optional reference to a callback function that should be executed immediately after the tweening has completed. This is not a string parameter, but rather a direct reference to the function - that is, the function name, without the ending parenthesis or parameters. If parameters should be passed, wrap the function around an anonymous function (examples below). The function is executed from the tweened object's scope.

extra1 : First extra value to be used on the easing equation, if applicable. This depends on the animation type used. On "elastic" animation types, this is the amplitude and defaults to the same ammount of change on the transition value needed (for example, if there's a _x transition from 10 to 15, the default amplitude value is 5); on "back" animation types, this is the overshoot ammount and defaults to 1.70158.

extra2 : Second extra value to be used on the easing equation, if applicable. This depends on the animation type used. On "elastic" animation types, this is the period, and defaults to one third (0.3) of the total transition time (0.45 on easeInOutElastic's case).

Returns

Nothing.

Description

Method; use this to create new tweenings on any MovieClip, TextField or Sound property or attribute. This works just like the tween() method, but using only rounded positions when updating. This is useful when tweening "pixel" text or other type of pixel-aligned content.

Examples

// Simple movieclip sliding in 0.5 seconds
<MovieClip>.roundedTween("_x", 10, 0.5);

// Two different transitions
<MovieClip>.roundedTween(["_x", "_alpha"], [10, 100], 0.5);

See Also

tween()

MC Tween· Zeh Fernando, 2003-2006 · Proudly hosted at DreamHost · Disclaimer