Sort provides various visual sorting arrangements for arrays of
DisplayObject
's.
protected var _items:Array
protected var _sort:Array
public function Sort(items:Array)
Sort Constructor
Parameters
| items:Array — Array of DisplayObjects
|
Throws
| — if any element in items array is not a DisplayObject.
|
Example
var sort : Sort = new Sort( [do0, do1, do2, do3] );
public function circle(center:Point, radius:Number):Array
Sort items in a circle.
Parameters
| center:Point — Point to radiate from.
|
|
| radius:Number — of the circle sort.
|
Returns
| Array — Array of Point positions.
|
Example
var positions : Array = new Sort( itemArr ).circle( new Point( 250, 250 ), 255 );
public function flower(center:Point, radius:Number):Array
Sort items in a flower.
Parameters
| center:Point — Point to sort from.
|
|
| radius:Number — of each petal.
|
Returns
| Array — Array of Point positions.
|
Example
var positions : Array = new Sort( itemArr ).flower( new Point( 250, 250 ), 250 );
public function grid(start:Point, numPerRow:uint, offset:Number = 0):Array
Sort items in a grid.
Parameters
| start:Point — Point to begin positioning.
|
|
| numPerRow:uint — items per row.
|
|
| offset:Number (default = 0 ) — spacing between items.
|
Returns
| Array — Array of sort Point positions.
|
Example
var positions : Array = new Sort( itemArr ).grid( new Point( 100, 100 ), 10, 1 );
public function hedron(center:Point, corners:uint, heightCap:Number = 0.8, rotate:uint = 0, isIntraRadial:Boolean = false):Array
Sort items in hedron (star, square, triangle, hexagon, octagon, etc).
Parameters
| center:Point — Point to sort from.
|
|
| corners:uint — to create.
|
|
| heightCap:Number (default = 0.8 ) — use n percent of the height.
|
|
| rotate:uint (default = 0 ) — of the sort.
|
|
| isIntraRadial:Boolean (default = false ) — if true star shapes will be drawn else closed hedrons.
|
Returns
| Array — Array of Point positions.
|
Example
var positions : Array = new Sort( itemArr ).hedron( new Point( 250, 250 ), 8, 0.6, 90 ); // create a octagon and rotate 90 degrees.
public function hexagon(center:Point, heightCap:Number):Array
Sort items in a hexagon.
Parameters
| center:Point — Point to sort from.
|
|
| heightCap:Number — use n percent of the height.
|
Returns
| Array — Array of Point positions.
|
See also
Example
var positions : Array = new Sort( itemArr ).hexagon( new Point( 250, 250 ) );
public function sine(waves:uint, width:Number, yPos:Number, widthCap:Number, heightCap:Number):Array
Sort items in a sine wave.
Parameters
| waves:uint — number of waves to sort within.
|
|
| width:Number — each sine waves width.
|
|
| yPos:Number — sine wave y position.
|
|
| widthCap:Number — use n percent of the width.
|
|
| heightCap:Number — use n percent of the height.
|
Returns
| Array — Array of Point positions.
|
Example
var positions : Array = new Sort( itemArr ).sine( 1.5, StageDisplay.$.width, StageDisplay.$.height / 2, 0.9, 0.5 );
public function square(center:Point, heightCap:Number = 0.8):Array
Sort items in a square.
Parameters
| center:Point — Point to sort from.
|
|
| heightCap:Number (default = 0.8 ) — use n percent of the height.
|
Returns
| Array — Array of Point positions.
|
See also
Example
var positions : Array = new Sort( itemArr ).square( new Point( 250, 250 ), 0.8 );
public function star(center:Point, corners:uint = 5, heightCap:Number = 0.8, rotate:uint = 0):Array
Sort items in a Star shape.
Parameters
| center:Point — Point to sort from.
|
|
| corners:uint (default = 5 ) — to create.
|
|
| heightCap:Number (default = 0.8 ) — use n percent of the height.
|
|
| rotate:uint (default = 0 ) — of the sort.
|
Returns
| Array — Array of Point positions.
|
See also
Example
var positions : Array = new Sort( itemArr ).star( new Point( 250, 250 ), 0.6, 5, 180 );
public function triangle(center:Point, sideLength:Number):Array
Sort items in a triangle.
Parameters
| center:Point — Point to center sort on.
|
|
| sideLength:Number — of each triangle side.
|
Returns
| Array — Array of Point positions.
|
Example
var positions : Array = new Sort( itemArr ).triangle( new Point( 250, 250 ), 500 );
public function unsort(topLeft:Point, bottomRight:Point):Array
Unsort items in to a random arrangement.
Parameters
| topLeft:Point — arrangement confine.
|
|
| bottomRight:Point — arrangement confine.
|
Returns
| Array — Array of Point positions.
|
Example
var positions : Array = new Sort( itemArr ).unsort( new Point( 0, 0 ), new Point( StageDisplay.$.width, StageDisplay.$.height ) );
Copyright © 2008-2012 jason m horwitz, Sekati LLC. All Rights Reserved.