Return to Snippet

Revision: 23248
at February 2, 2010 04:35 by kajyr


Initial Code
public static function circle(items:Array, center:Point, distance:Number = -1, initialAngle:Number = 0):void {
	var step:Number = (2* Math.PI) / items.length;
	var angle:Number = initialAngle;
	for each (var d:DisplayObject in items) {
		if (distance < 0) distance = d.height+10 / Math.sin(step);
		d.x = center.x + distance * Math.cos(angle);
		d.y = center.y + distance * Math.sin(angle);
		angle += step;
	}
}

Initial URL
http://www.nightdrops.com/2009/quickreference-display-elements-in-a-circle

Initial Description

                                

Initial Title
Display elements in a circle

Initial Tags

                                

Initial Language
ActionScript 3