How to make a simple button animation using tweens
Author: PopCode | Email Website : myfiles.netto.ro/Tutorials/Animated-Button-Tutorial.html
Advertisement
We got to the part when we should animate the button. The code bellow is going to scale FoB as to shrink it, the textColoring will change the color of out text and the BackShadow will make the button drop shadow.
var StripShrink = new Tween(FoB, "_yscale", Bounce.easeOut, 95, 0, 10, false);
var textColoring = new ColorTween(TextLine, Strong.easeOut, "current", "663300", 8, false);
var BackShadow = new FilterTween(BoB, new DropShadowFilter(1, 90, 0x000000, .5, 5, 5, 1, 3),"distance",Strong.easeOut,"current",10,20,false);
As you can see there were used three types of Tweens each very simple to understand having to mention the instance of the movie clip it refers to, the property the tween will change, the easing type, the starting value, the ending value, the duration and if the tween starts automatically or not.
As we have chosen “false” for the “autostart” property, the tweens will start when having the mouse over:
this.onRollOver = function() {
StripShrink.start();
BackShadow.start();
textColoring.start();
};
this.onRollOut = function() {
StripShrink.reverse(Regular.easeIn);
BackShadow.reverse(Regular.easeOut);
textColoring.reverse(Regular.easeOut);
};
When the mouse is no longer on our button the tweens will be reversed with different easing functions.
Closing
To summarize all that I have achieved through this simple animation I should begin by reminding you that with 6 code lines in 15 minutes or less, without any timeline modification there was created a button animation.
Thank you for reading this tutorial and hope you will find useful this tutorial, and the tool I’ve used to make the animated button.
Download Source File
We hope the information helped you. If you have any questions
or comments, please don't hesitate to post them on the
Forums section
Submit your Tutorial at Click Here
|