Posted By


adehaas on 03/15/13

Tagged


Statistics


Viewed 74 times
Favorited by 0 user(s)

HNK_Animation_ClockBezier


/ Published in: ActionScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. package nl.hnk.animations
  2. {
  3. import flash.events.Event;
  4. import nl.hnk.animations.components.Box;
  5.  
  6. import com.greensock.TweenLite;
  7. import com.greensock.easing.Strong;
  8.  
  9. import flash.display.Sprite;
  10.  
  11. /**
  12. * @author alexanderdehaas
  13. */
  14. public class ClockInAnimation extends Sprite
  15. {
  16. private var clock:Box;
  17.  
  18. public function ClockInAnimation()
  19. {
  20. addEventListener(Event.ADDED_TO_STAGE, init);
  21. }
  22.  
  23. private function init(event:Event):void
  24. {
  25. clock = new Box();
  26. clock.x = 200;
  27. clock.y = stage.stageHeight;
  28. addChild(clock);
  29.  
  30. clock.scaleX = clock.scaleY = 0;
  31.  
  32. TweenLite.to(clock, 3, {bezier:[{scaleX: 0, scaleY: 0, y:300}, {y: 150}, {scaleX: 1, scaleY: 1, y:200}], onUpdate:update, ease:Strong.easeOut});
  33. }
  34.  
  35. private function update():void
  36. {
  37. clock.x = Math.round((stage.stageWidth - clock.width) * 0.5);
  38. }
  39. }
  40. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.