Organic circle

Kim Christiansen @ Feb 17 2008 9:16 pm

Creating organic and natural moving objects was always a big joy for me. Now i made a organic circle data class. This class does not display anything. Instead it returns a pointfield with point objects. Encapsulating the view from the data, enables the posibility to display the data like you want. I made the organic circle class for as2 and as3 as well. In this example i played with some filter effects and bitmap redrawing. If you press the mouse the circle radius will be reduced.

How to use:

var _organiccircle:OrganicCircle = new OrganicCircle();
_organiccircle.radius = 40;
_organiccircle.pointamount = 64;
_organiccircle.fractalsize = 60;
_organiccircle.intensity = .4;
_organiccircle.speed = 1;
_organiccircle.startAnimation();var _circle:Sprite = new Sprite();
_circle.x = 200;
_circle.y = 200;

addChild(_circle);

var _timer:Timer = new Timer(50,0);
_timer.addEventListener("timer",onRedraw);
_timer.start();

private function onRedraw(event:TimerEvent) : void
{
   var ar_points : Array = _organiccircle.pointfield;
   var n : int = ar_points.length;
   var p : SimplePoint = ar_points[0];
_circle.graphics.clear();
   _circle.graphics.lineStyle(1, 0x000000, 100);
   _circle.graphics.moveTo(p.x, p.y);
while (n--)
   {
      p = ar_points[n];
      _circle.graphics.lineTo(p.x, p.y);
   }

}

Download example and class: organiccircle.zip

Your comment