# \[DBarbarian Entry 1\] - Fireworks

**URL:** <https://forum.kirupa.com/t/dbarbarian-entry-1-fireworks/175389>\
**Category:** contests\
**Created:** [January 13, 2006, 9:12pm UTC](https://forum.kirupa.com/t/dbarbarian-entry-1-fireworks/175389 "2006-01-13T21:12:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbarbarian](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dbarbarian/32/609_2.png) [@dbarbarian](https://forum.kirupa.com/u/dbarbarian)\
**Post date:** [January 13, 2006, 9:12pm UTC](https://forum.kirupa.com/t/dbarbarian-entry-1-fireworks/175389/1 "2006-01-13T21:12:34Z")

</div>

I made two versions. One regular and one rainbow.  
Let me know which one you like better, because I can’t decide.

The rainbow code is the same as this one, but with different color settings.

EDIT: This code should be legal.

```auto
this.headA = new Array();

this.drawCircle = function(col,siz,x,y,d) {
	this.createEmptyMovieClip("c"+d,d)._x = x;
	this["c"+d]._y = y;
	this["c"+d].lineStyle(siz,col,100);
	this["c"+d].lineTo(1,0);
	return this["c"+d];
}

this.removeParticle = function(n,ind) {
	n.removeMovieClip();
	this.headA.splice(ind,1);
}

this.onEnterFrame = function() {
	for (i in this.headA) {
		this.headA*[0]._x += (this.headA*[5]!="head2") ? this.headA*[3]:(this.headA*[1]-this.headA*[0]._x)/8;
		this.headA*[0]._y += (this.headA*[5]!="head2") ? this.headA*[4]:(this.headA*[2]-this.headA*[0]._y)/8;
		this.headA*[0]._xscale = this.headA*[0]._yscale = (80+random(70)-35);
		this.headA*[2] += (this.headA*[5]=="head2") ? 2:0;
		col = new Color(this.headA*[0]).setRGB("0xFFFF"+((random(2)==0) ? "FF":((random(2)==0) ? "CC":"99")));
		if (this.headA*[5] == "head" and (this.headA*[0]._x-this.headA*[1])*(this.headA*[0]._x-this.headA*[1])+(this.headA*[0]._y-this.headA*[2])*(this.headA*[0]._y-this.headA*[2])<100) {
			for(j=0; j<16; j++) {
				this.headA.push([this.drawCircle("0xFFFFFF",5,this.headA*[0]._x,this.headA*[0]._y,this.d++),this.headA*[0]._x+((j<8) ? (random(20)+100):(random(10)+55))*Math.cos(j*Math.PI/4+Math.random()*Math.PI/8),this.headA*[0]._y+((j<8) ? (random(20)+100):(random(10)+55))*Math.sin(j*Math.PI/4+Math.random()*Math.PI/8),0,0,"head2"]);
			}
			this.removeParticle(this.headA*[0],i);
		} else if (this.headA*[5] == "head2" and this.headA*[0].clicks++>20+random(15)) {
			this.removeParticle(this.headA*[0],i);
		} else if (this.headA*[5] == "trail" and this.headA*[2]-this.headA*[0]._y<2) {
			this.removeParticle(this.headA*[0],i);
		}
		(this.headA*[5]!="trail" and random(2)==0) ? this.headA.push([this.drawCircle("0xFFFFFF",2,this.headA*[0]._x+random(8)-4,this.headA*[0]._y+random(8)-4,this.d++),this.headA*[0]._x,this.headA*[0]._y+random(20)+5,0,1,"trail"]):0;
	}
}
this.onMouseDown = function() {
	this.tempx = random(400);
	this.headA.push([this.drawCircle("0xFFFFFF",5,this.tempx,415,this.d++),this._xmouse,this._ymouse,7*Math.cos(Math.atan2(this._ymouse-415,this._xmouse-this.tempx)),7*Math.sin(Math.atan2(this._ymouse-415,this._xmouse-this.tempx)),"head"]);
}

```

\*NOTE: Do not click too many times. I recommend having 2 fireworks onscreen at one time.  
[http://dounanthebarb.tripod.com/Kirupa25LineContest/cdb25LineEntry1Fireworks.html](http://dounanthebarb.tripod.com/Kirupa25LineContest/cdb25LineEntry1Fireworks.html)  
[http://dounanthebarb.tripod.com/Kirupa25LineContest/cdb25LineEntry1RbFireworks.html](http://dounanthebarb.tripod.com/Kirupa25LineContest/cdb25LineEntry1RbFireworks.html)

**NOTE 2** \*\*\*  
Do NOT view the swf file below. For some strange reason, the particles are not removed. The html files are working correctly though.

---

<div class="post-metadata">

**Author:** ![saxx](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@saxx](https://forum.kirupa.com/u/saxx)\
**Post date:** [July 11, 2008, 4:22am UTC](https://forum.kirupa.com/t/dbarbarian-entry-1-fireworks/175389/2 "2008-07-11T04:22:55Z")

</div>

yep after three or four consecutive clicks it totally owns my computer. I really love it regardless
