Packagesekati.layout
Classpublic class Sort

Sort provides various visual sorting arrangements for arrays of DisplayObject's.



Protected Properties
 PropertyDefined by
  _items : Array
Sort
  _sort : Array
Sort
Public Methods
 MethodDefined by
  
Sort(items:Array)
Sort Constructor
Sort
  
circle(center:Point, radius:Number):Array
Sort items in a circle.
Sort
  
flower(center:Point, radius:Number):Array
Sort items in a flower.
Sort
  
grid(start:Point, numPerRow:uint, offset:Number = 0):Array
Sort items in a grid.
Sort
  
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).
Sort
  
hexagon(center:Point, heightCap:Number):Array
Sort items in a hexagon.
Sort
  
sine(waves:uint, width:Number, yPos:Number, widthCap:Number, heightCap:Number):Array
Sort items in a sine wave.
Sort
  
square(center:Point, heightCap:Number = 0.8):Array
Sort items in a square.
Sort
  
star(center:Point, corners:uint = 5, heightCap:Number = 0.8, rotate:uint = 0):Array
Sort items in a Star shape.
Sort
  
triangle(center:Point, sideLength:Number):Array
Sort items in a triangle.
Sort
  
unsort(topLeft:Point, bottomRight:Point):Array
Unsort items in to a random arrangement.
Sort
Property detail
_itemsproperty
protected var _items:Array
_sortproperty 
protected var _sort:Array
Constructor detail
Sort()constructor
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] );
   

Method detail
circle()method
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 );
   

flower()method 
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 );
   

grid()method 
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 );
   

hedron()method 
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.
   

hexagon()method 
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 ) );
   

sine()method 
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 );
   

square()method 
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 );
   

star()method 
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 );
   

triangle()method 
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 );
   

unsort()method 
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 ) );