Flash AS3 学习4 - 方块的旋转效果

xiaoxiao2021-02-28  98

package {  import flash.display.GradientType;   import flash.display.BlendMode;   import flash.display.Shape;  import flash.display.Sprite;  import flash.events.Event;    [SWF(width = 550, height =400, frameRate = 50)]  public class Main extends Sprite  {   private var scont : Sprite = new Sprite();     public function Main()   {    scont.x = 275;    scont.y = 200;    addChild(scont);    scont.rotationY = 90;    for(var i : int = 0 ;i < 48; i++)    {     var s : Shape = new Shape();     s.graphics.beginFill((0xffffff*Math.random ()),.6);     //s.graphics.drawCircle(Math.floor(i / 3) * 15, i, 25);     s.graphics.drawRect(Math.floor(i / 3) * 15 - 25, i - 25, 50,50);     s.graphics.endFill();     scont.addChild(s);    }        addEventListener(Event.ENTER_FRAME, onEnterFrame);   }     private function onEnterFrame(evt : Event) : void   {    for(var i : int = 0 ;i < 48;i++)    {     var s : Shape = scont.getChildAt(i) as Shape;     s.rotation += (i / 6) * .7;    }    scont.rotation += .7;    scont.rotationY += .3;   }  } }

 

更多详情请点击  http://blog.sina.com.cn/zhaojianjunzjj

转载请注明原文地址: https://www.6miu.com/read-75095.html

最新回复(0)