Cool Animation Effect


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

fades in and moves UI Elements from opposite sides towards their final positions.


Copy this code and paste it in your HTML
  1. import com.greensock.*;
  2.  
  3. function tweenElements(arr:Array, last:Boolean){
  4. var tweens= [];
  5. for(var i=0; i<arr.length; i++){
  6. var tgt = arr[i];
  7. var mult = i%2==0?1:-1;
  8. tgt._alpha = 0;
  9. t = TweenLite.to(tgt, .5, {_x:getTX(tgt, mult), _alpha:100, onStart:onAnimStart, onStartParams:[tgt,i, mult], delay:.2*i, onComplete:function(){
  10. if(last) return;
  11. setInterval(function(){
  12. var t2 = tweens.shift()
  13. t2.reverse();
  14. }, 2000);
  15.  
  16. }});
  17. tweens.push(t);
  18.  
  19. if(last){
  20. TweenLite.to(bottombar, .5, {_y:235.5, _alpha:100, onStart:function(){
  21. bottombar._visible = true;
  22. }, delay:2})
  23. }
  24.  
  25. }
  26. }
  27.  
  28.  
  29.  
  30. var tgtX;
  31. function getTX(tgt, mult){
  32. tgtX = tgt._x;
  33. tgt._x -= mult*40;
  34. return tgtX;
  35. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.