The script uses two functions: createMovieClip and doAnim. The createMovieClip function attaches a picture on stage, creates an empty movie clip and sets it as the mask of the picture. Since we are stacking pics one on top of the other, a counter variable is set up to keep track of instances.
The doAnim function is called every 17 milliseconds. The animIndex variable keeps track of the current point in the anim. As I mentioned in the first part, the animation takes place in three steps corresponding to the three intermediate shapes of the mask.
This time, I've decided to use the 'easing in and out' function as sketched above. Now, it's simply matter of drawing the shapes using the drawing API functions. For the first and last straight bottom lines, the position of the control point can be moved to the left and right. Playing with this parameter will influence the intermediary shapes obtained and will give a more or less pleasing result. Experimenting is the way to go.
After each transition, a new pic is added using the createMovieClip function and it starts all over again.
In this tutorial, I've shown you how to create a 'swoosh' mask transition using the drawing API and dynamic masking. By now, you should understand the curveTo method, the basics of shape morphing and how to easily create easing and bouncing transitions. Of course, there's no better way to get a hand on your new knowledge than with practice. The techniques shown here are quite general; here is another version of the same file but with different parameters:
If you need professional help with ActionScript, please visit 5etdemi.com for my portfolio and contact info. Happy flashing!
|» Level Advanced|
Rating: 8 Votes: 12
|The author is a math enthusiast. He nows studies Physics at McGill University.|
|Download the files used in this tutorial.|
|Download (209 kb)|
|More help? Search our boards for quick answers!|