闲来无事,发个as效果

需要 Flash Player 10 代码:

package org.mousebomb.effectlab.flyParticle
{
import flash.display.GradientType;
import flash.display.BlendMode;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;

[SWF(width = 900, height = 600, frameRate = 50)]

/**
* @author Mousebomb
* @date 2009-9-4
*/
public class Main extends Sprite
{
privatevar scont : Sprite = new Sprite();

public function Main()
{
scont.x = 450;
scont.y = 300;
addChild(scont);
scont.rotationY = 90;
for(var i : int = 0 ;i < 48; i++)
{
var s : Shape = new Shape();
s.graphics.beginFill((0xcc0000 + (i % 16) * 0x10000),.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(event : 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;
}
}
}

flash地址 虽然电闪雷鸣之类的更逼真更常用,但我自己玩的时候还是比较喜欢这样抽象的效果。 万事万物的道理都在这个旋转的flash里体现了。


技术内容转载请注明来源,个人日记不允许转载,欢迎指出任何有错误或不够清晰的表达。可以邮件至 mousebomb@gmail.com