# Fractal Along Tangent

**URL:** <https://forum.kirupa.com/t/fractal-along-tangent/177788>\
**Category:** open source\
**Created:** [February 5, 2006, 7:06am UTC](https://forum.kirupa.com/t/fractal-along-tangent/177788 "2006-02-05T07:06:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nugget](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@nugget](https://forum.kirupa.com/u/nugget)\
**Post date:** [February 5, 2006, 7:06am UTC](https://forum.kirupa.com/t/fractal-along-tangent/177788/1 "2006-02-05T07:06:45Z")

</div>

I made a fratal generator a few weeks ago, this is v2. Instead of lines being duplicated, circles are and moved across a tangent line. It is a 25 Line script.

Here you go

```auto
createEmptyMovieClip("spiral", 400)._alpha = 20;
MovieClip.prototype.drawCircle = function(x, y, radius) {
 var r = radius;
 var cr = radius/Math.cos((45*(Math.PI/180))/2);
 var angle = 0;
 var cangle = -(45*(Math.PI/180))/2;
 this.moveTo(x+r, y);
 for (var i = 0; i<8; i++) {
  angle += (45*(Math.PI/180));
  cangle += (45*(Math.PI/180));
  this.curveTo(x+(cr*Math.cos(cangle)), y+(cr*Math.sin(cangle)), x+(r*Math.cos(angle)), y+(r*Math.sin(angle)));
 }
};
update();
onMouseDown = function() {
 update();
};
function update() {
 spiral.clear();
 spiral.lineStyle(9, 0x000000, 80);
 spiral.drawCircle(Math.random()*100-50, Math.random()*100-50, Math.random()*15);
 spiral.drawCircle(Math.random()*100-50, Math.random()*100-50, Math.random()*15);
 spiral.drawCircle(Math.random()*100-50, Math.random()*100-50, Math.random()*15);
 for (var i = 0; i<360; i++) {
  duplicateMovieClip("spiral", "s"+i, i);
  _root["s"+i]._x = _root["s"+i]._rotation=i;
  _root["s"+i]._y = 50*Math.tan(i*(Math.PI/180))+300;
 }
}

```
