Flash Star Particle Illusion by Virusescu

Hello there fellow flashers. Here’s my second entry for this fine and fun contest.


Stage.scaleMode = "noScale";
function onEnterFrame() {
	newShape = this.createEmptyMovieClip("shape"+t, t);
	newShape.vars = {born:getTimer(),rotation:Math.random()*6.2831};
	drawShape(newShape, _xmouse,_ymouse, 15,7,8, t++);
	newShape.onEnterFrame = function () {
		this._x += Math.cos(this.vars.rotation)*3;
		this._y += Math.sin(this.vars.rotation)*3;
		this._xscale = this._yscale = this._xscale - 2;
		getTimer() - this.vars.born > 1000 ? this.removeMovieClip() : null;
		var color = new Color(this);
		color.setRGB(newRgb(getTimer()-this.vars.born));
		this._rotation += 10;
                this._alpha *= 0.9
	}
}
function drawShape(mc, cx,cy, rmax,rmin, corners, rotation) {
	mc.lineStyle(0, 0xFFFFFF, 0, 0, 0, 0, 0, 0);
	mc.beginFill(newRgb(0),100);
	mc.moveTo(rmax,0);
	mc._x = cx;
	mc._y = cy;
	for (var x = 0; x<=6.283185; x += 6.283185/corners) {
		mc.lineTo(rmax*Math.cos(x),rmax*Math.sin(x));
		mc.lineTo(rmin*Math.cos(x+3.14/corners), rmin*Math.sin(x+3.14/corners));
	}
}
function newRgb(t) {
	return (255 << 16)+(Math.floor(t/5) << 8)+Math.floor(Math.abs(Math.min(_ymouse, 400))/400*255);
}
this.createEmptyMovieClip("shape", 10);
t = 10;