/ Published in: ActionScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package nl.hnk.animations { import flash.events.Event; import nl.hnk.animations.components.Box; import com.greensock.TweenLite; import com.greensock.easing.Strong; import flash.display.Sprite; /** * @author alexanderdehaas */ public class ClockInAnimation extends Sprite { private var clock:Box; public function ClockInAnimation() { addEventListener(Event.ADDED_TO_STAGE, init); } private function init(event:Event):void { clock = new Box(); clock.x = 200; clock.y = stage.stageHeight; addChild(clock); clock.scaleX = clock.scaleY = 0; TweenLite.to(clock, 3, {bezier:[{scaleX: 0, scaleY: 0, y:300}, {y: 150}, {scaleX: 1, scaleY: 1, y:200}], onUpdate:update, ease:Strong.easeOut}); } private function update():void { clock.x = Math.round((stage.stageWidth - clock.width) * 0.5); } } }