as3翻牌动画

----------------------------------------------------

主要利用了rotationY属性来进行处理,Pseudocode:

   1: import com.greensock.*;
   2: import com.greensock.easing.*;
   3:  
   4: //startValues for the card back
   5: flipper.back.rotationY = -90;
   6: flipper.back.alpha=0;
   7:  
   8: //speed of 90 degrees of flip
   9: var flipSpeed:Number = .5; 
  10:  
  11: //create TimelineMax instance
  12: var tl:TimelineMax = new TimelineMax({paused:true});
  13:  
  14: //flip the front 90 degrees
  15: tl.append(TweenMax.to(flipper.front, flipSpeed, {rotationY:90, visible:false, ease:Linear.easeNone}))
  16:  
  17: //set the back to alpha of 0 as soon as front finishes
  18: tl.append(TweenMax.to(flipper.back, 0, {alpha:1, immediateRender:false}))
  19:  
  20: //flip the back 90 degrees
  21: tl.append(TweenMax.to(flipper.back, flipSpeed, {rotationY:0, ease:Linear.easeNone}))
  22:  
  23: //basic button code
  24: flip1_mc.addEventListener(MouseEvent.CLICK, flip1);
  25:  
  26: function flip1(e:MouseEvent){
  27: // play to the beginning of the timeline
  28:     tl.tweenTo(0);
  29: }
  30:  
  31: flip2_mc.addEventListener(MouseEvent.CLICK, flip2);
  32: function flip2(e:MouseEvent){
  33: // play to the end of the timeline
  34:     tl.tweenTo(tl.duration);
  35: }

参考链接:Easy Breezy 3D Card Flip Effect with Flash, AS3 and Our Good Buddy TimelineMax

本示例下载链接:flipper_new_cs4.zip (需flash cs4+ 才能打开)

原文地址:https://www.cnblogs.com/meteoric_cry/p/2725138.html