# Generate spirals

**URL:** https://forum.kirupa.com/t/generate-spirals/175586
**Category:** Uncategorized
**Created:** [January 16, 2006, 4:59am UTC](https://forum.kirupa.com/t/generate-spirals/175586 "2006-01-16T04:59:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![treatkor](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/treatkor/32/680_2.png) [@treatkor](https://forum.kirupa.com/u/treatkor)
#### Post date: [January 16, 2006, 4:59am UTC](https://forum.kirupa.com/t/generate-spirals/175586/1 "2006-01-16T04:59:21Z")

</div>

more spirally goodness.  
click to generate a new one, then click again to make another, etc…

\*edit - much improved version here: [http://www.kirupa.com/forum/attachment.php?attachmentid=32647&d=1137412554](http://www.kirupa.com/forum/attachment.php?attachmentid=32647&d=1137412554)  
improved code here: [http://www.kirupa.com/forum/showthread.php?p=1754527#post1754527](http://www.kirupa.com/forum/showthread.php?p=1754527#post1754527)

```auto

var randomNum = function (Min, Max) {
	return Min+random(((Max+1)-Min));
};
var myRefArray = [];
var HH=this.createEmptyMovieClip("HH", this.getNextHighestDepth());
HH._x = HH._y=200;
onMouseDown = function () {
	startRotate(randomNum(-30, 60), randomNum(-100, 100), 0, randomNum(60, 600));
};
startRotate = function(aaa, bbb, c, scl) {
	for (var p = 0; p<30; p++) {
		var hw = (200/(p+1))+6;
		var aHH = HH.createEmptyMovieClip("aHH", 300+p);
		var cHH = aHH.createEmptyMovieClip("cHH", 2000+p);
		var eHH = cHH.createEmptyMovieClip("eHH", this.getNextHighestDepth()+1);
		eHH.lineStyle(0.8, 0xFFFFFF, (6*p)+10);
		for (i=0; i<4; i++) {
			eHH.curveTo(hw*Math.cos(aaa), hw*Math.sin(bbb), hw*Math.cos(aaa), hw*Math.cos(bbb));
			eHH.curveTo(hw*Math.cos(bbb), hw*Math.sin(aaa), 0, 0);
		}
		myRefArray[p] = cHH;
	}
	this.onEnterFrame = function() {
		myRefArray[c]._parent._yscale = myRefArray[c]._parent._xscale=scl;
		myRefArray[c].onEnterFrame = function() {
			this._parent._rotation -= aaa;
			this._rotation += bbb;
		};
		if (c<myRefArray.length) {
			c++;
		} else {
			c = 0;
		}
	};
};

```

can someone check if i’m meeting the \<=25 lines requirement? i think i’m counting this right, but i hope i’m not over.
