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

来源:互联网 发布:网络贷款平台哪个靠谱 编辑:程序博客网 时间:2024/05/22 03:28

package
{
 importflash.display.GradientType; 
 importflash.display.BlendMode; 
 import flash.display.Shape;
 import flash.display.Sprite;
 importflash.events.Event;  
 [SWF(width = 550, height =400, frameRate =50)]
 public class Main extends Sprite
 {
  private varscont : 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++)
   {
    vars : 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 functiononEnterFrame(evt : Event) : void
  {
   for(var i :int = 0 ;i < 48;i++)
   {
    vars : Shape = scont.getChildAt(i) as Shape;
    s.rotation+= (i / 6) * .7;
   }
   scont.rotation+= .7;
   scont.rotationY+= .3;
  }
 }
}

 

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

阅读全文
0 0
原创粉丝点击