创建粒子拖尾效果

import flash.events.Event;
import flash.filters.BlurFilter;
import flash.filters.GlowFilter;
import crawlingtosea.utils.MathUtil;
import flash.display.Shape;
//@author mengtianwxs
var arr:Array = [];
var angle:Number = 0;
var radius:Number = 150;
var len:int = 0;
function p(radius:int,color:uint):Shape
{
	var c:Shape=new Shape();
	c.graphics.beginFill(color);
	c.graphics.drawCircle(0,0,radius);
	c.graphics.endFill();
	return c;
}

for (var i:uint=0; i<60; i++)
{

	this["p" + i] = p(2,0xff0000);
	this.addChild(this["p"+i]);
	arr.push(this["p"+i]);

}
len = arr.length - 1;

for (var j:int=0; j 0; i--)
	{
		arr[i].x = arr[i - 1].x;
		arr[i].y = arr[i - 1].y;
	}
}

this.addEventListener(Event.ENTER_FRAME,update);
//绕圆形运动
function update(e:Event)
{
	queue();

	//arr[0].x = this.mouseX;
	//arr[0].y = this.mouseY;
	arr[0].x = Math.cos(MathUtil.r2d(angle)) * radius + 225;
	arr[0].y = Math.sin(MathUtil.r2d(angle)) * radius + 200;
	angle +=  0.0004;
}


*各种运动效果需要自己调节相应参数实现。

你可能感兴趣的:(actionscript,3.0)