I want to introduce you to Greensock.com. Greensock is the site for a family of Flash Actionscript tweening engines that are super lightweight and extremely easy to use. As a banner ad developer you need this tool because it gives you the ability to script beautiful animations in your ads while adding only 1.6k to your compiled SWF file if you’re using Actionscript 3.0. If you’re not using AS 3.0, it’s time to start! If you don’t have a lot of art in your SWF file you can even step up to TweenLite (4.7k in the compiled SWF file) but I have found that using TweenNano to script animation chains is super easy, super lightweight, and very professional looking.

Once you download TweenNano and add it to your Actionscript 3.0 classpath this is how you import it into your FLA:

import com.greensock.TweenNano;
import com.greensock.easing.Strong;

The first line imports the tweening classes into your file, the second one imports the Strong family of easing equations. I like this one, but there are others to choose from.

After that moving a movie clip on-screen is as easy as typing:

TweenNano.to(myClip, 1, {x:300, alpha:.5, ease:Strong.easeOut});

This breaks down to meaning you want to use TweenNano to move movie clip ‘myClip’ over a duration of 1 second to an X coordinate of 300 and an alpha value of .5 and use a Strong.easeOut easing equation on the movement. The result is beautiful and fluid.

Let’s say you want to move the clip across the screen from x:0 to x:300, then have it stop and fade out. Just chain two tweens together like this:

TweenNano.to(myClip, 1, (x:300, ease:Strong.easeOut)};
TweenNano.to(myClip, 1, {delay:1, alpha:0, ease:Strong.easeOut, overwrite:false)};

This means that the first tween will send the clip to an X value of 300 over a duration of 1 second. The second line says to fade the same clip to alpha 0 over 1 second but delay the animation for 1 second (giving time for the first animation to complete), and NOT to overwrite any other animations already assigned to the movie clip ‘myClip.’ I don’t think it can get any easier than that, and that includes using basic timeline animation.

TweenNano will help your animations look more professional, it will save having to animate on the timeline, and it will decrease the size of your compiled SWF files over using Flash’s built-in tweening classes. What is there NOT to love about that?

Check it out at Greensock.com.

Buffer

Tagged with:
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>