Skip to content

Latest commit

Β 

History

History
791 lines (657 loc) Β· 23.6 KB

api.md

File metadata and controls

791 lines (657 loc) Β· 23.6 KB

Classes

Base
Circle
CoordinateSystem
Hierarchy
Matrix
Path
Point
RasterRenderer

todo

  • rectangle
  • bezier curve
Shape
TerminalRenderer

Base

Kind: global class

new Base()

Shape

base.rotation$

set the absolute rotation

Kind: instance property of Base

Param
angle

base.position

Kind: instance property of Base

Param Type Description
p Point position passed to Point

base.position β‡’ Point

Kind: instance property of Base

base._positionCache$

TODO to be replaced by super._changed() when the super implementations performance is better

Kind: instance property of Base

base._positionCache$

TODO to be replaced by super._parentChanged() when the super implementations performance is better

Kind: instance property of Base

base.matrix

Kind: instance property of Base

Param Type
m Matrix

base.matrix β‡’ Matrix

Kind: instance property of Base

base.getRotation$([levels]) β‡’ Number

Kind: instance method of Base

Param Type Description
[levels] Number how many levels to travel up the hierarchy

base.getMatrix$([levels]) β‡’ Matrix

Kind: instance method of Base

Param Type
[levels] Number

Circle

Kind: global class

new Circle(position, radius)

Shape

Param Type Description
position Array | Object Point
radius Number _radius

CoordinateSystem

Kind: global class

Hierarchy

Kind: global class

hierarchy.children β‡’ Array.<Hierarchy>

Kind: instance property of Hierarchy

hierarchy.parent

Kind: instance property of Hierarchy

Param Type
p Hierarchy

hierarchy.parent β‡’ Hierarchy

Kind: instance property of Hierarchy

hierarchy.addChildren(children) β‡’ Hierarchy

Kind: instance method of Hierarchy

Param Type
children Hierarchy

hierarchy.hasChildren() β‡’ boolean

Kind: instance method of Hierarchy

hierarchy.hasParent() β‡’ boolean

Kind: instance method of Hierarchy

hierarchy.setParent(p) β‡’ Hierarchy

Kind: instance method of Hierarchy

Param
p

hierarchy.removeChild(child)

Kind: instance method of Hierarchy

Param Type
child Hierarchy

hierarchy.removeChildren(children)

Kind: instance method of Hierarchy

Param Type
children Array.<Hierarchy>

Matrix

Kind: global class

matrix.a β‡’ Number

Kind: instance property of Matrix
Returns: Number - - a

matrix.b β‡’ Number

Kind: instance property of Matrix
Returns: Number - - b

matrix.c β‡’ Number

Kind: instance property of Matrix
Returns: Number - - c

matrix.d β‡’ Number

Kind: instance property of Matrix
Returns: Number - - d

matrix.tx β‡’ Number

Kind: instance property of Matrix
Returns: Number - - tx

matrix.ty β‡’ Number

Kind: instance property of Matrix
Returns: Number - - ty

matrix.multiply(m)

mul

Kind: instance method of Matrix

Param Type Description
m Matrix [ a b tx ] [ a b tx ] [ c d ty ] [ c d ty ] [ 0 0 1 ] [ 0 0 1 ]

matrix.multiplySelf(m)

post this * m

Kind: instance method of Matrix

Param Type Description
m Matrix [ a b tx ] [ a b tx ] [ c d ty ] [ c d ty ] [ 0 0 1 ] [ 0 0 1 ]

matrix.multiplySelf_(m)

pre m * this

Kind: instance method of Matrix

Param Type Description
m Matrix [ a b tx ] [ a b tx ] [ c d ty ] [ c d ty ] [ 0 0 1 ] [ 0 0 1 ]

matrix.scale(sx, [sy])

Kind: instance method of Matrix

Param Type Default Description
sx Number scaling in x, y or only x if no sy given
[sy] Number sx scaling in y direction

matrix.inverse() β‡’ Matrix

Kind: instance method of Matrix

matrix.determinant() β‡’ Number

Kind: instance method of Matrix

matrix.isInvertible() β‡’ boolean

Returns true if matrix is invertible

Kind: instance method of Matrix

Path

Kind: global class

new Path([arg0])

Param Type
[arg0] Array | number

Example

new Path([Segment0, Segment1])
new Path([[3, 5], [3, 6]])
new Path([3, 5])
new Path()

path.appendSegment(segment)

add a segment to the path

Kind: instance method of Path

Param
segment

path._calculatePointAtPosition(p0, h0o, h1i, p1, t) β‡’ number

Kind: instance method of Path

Param Type Description
p0 Number start Point
h0o Number start Point handle out, relative to p0
h1i Number end Point handle in, relative to p1
p1 Number end Point
t Number value between {0-1} => 0%-100% of the length

Path.Segment

Kind: static class of Path

new Path.Segment(position, [handleIn], [handleOut])

Param Type
position Point
[handleIn] Point
[handleOut] Point

segment.hasHandleIn() β‡’ boolean

Kind: instance method of Segment

Point

Kind: global class

point.constructor

Creates a Point object with the given x and y coordinates.

Kind: instance property of Point

Param Type Default
[arg0] Number | Array | Object 0
[arg1] Number

Example

new Point(5, 7);
new Point([5, 7]);
new Point({x:5, y:7});
new Point(new Point(5, 7));

point.set β‡’ Object

sets the coordinates

Kind: instance property of Point
Returns: Object - Point

Param Type Description
arg0 Number | Array | Object x
[arg1] Number y

Example

point.add(5, 7);
point.add([5, 7]);
point.add({x:5, y:7});
point.add(new Point(5, 7));

point.set$ β‡’ Object

sets the absolute coordinates

Kind: instance property of Point
Returns: Object - Point

Param Type Description
arg0 Number | Array | Object x
[arg1] Number y

Example

point.add(5, 7);
point.add([5, 7]);
point.add({x:5, y:7});
point.add(new Point(5, 7));

point.coordinateSystem

Kind: instance property of Point

Param
cos

point.position$ β‡’ Point

Kind: instance property of Point

point.absoluteX β‡’ Number

Kind: instance property of Point

point.absoluteY β‡’ Number

Kind: instance property of Point

point.relativeX β‡’ Number

todo relative coordinates with capital chars

Kind: instance property of Point

point.relativeY β‡’ Number

Kind: instance property of Point

point.x β‡’ Number

Kind: instance property of Point

point.x

Kind: instance property of Point

Param Type
x Number

point.x$ β‡’ Number

Kind: instance property of Point

point.x$

Kind: instance property of Point

Param Type
x$ Number

point.y$ β‡’ Number

Kind: instance property of Point

point.y$

Kind: instance property of Point

Param Type
y$ Number

point.y β‡’ Number

Kind: instance property of Point

point.y

Kind: instance property of Point

Param Type
y Number

point.position

Kind: instance property of Point

Param Type
pos Number | Array | Object

Example

Point.position = [5, 7];
Point.position = {x:5, y:7};
Point.position = new Point(5, 7);

point.length

The the vector to given length

Kind: instance property of Point

Param Type Description
l Number target length of the vector

point.length β‡’ Number

returns the current length

Kind: instance property of Point

point.add β‡’ Object

adds and returns a new point

Kind: instance property of Point
Returns: Object - Point

Param Type
arg0 Number
arg1 Number

Example

point.add(5, 7);

point.addSelf β‡’ Object

adds to the current point

Kind: instance property of Point
Returns: Object - Point

Param Type
arg0 Number | Array | Object
[arg1] Number

Example

point.add(5, 7);
point.add([5, 7]);
point.add({x:5, y:7});
point.add(new Point(5, 7));

point.add β‡’ Object

multiplies

Kind: instance property of Point
Returns: Object - Point

Param Type
arg0 Number
arg1 Number

Example

point.add(5, 7);

point.distance β‡’ Point

returns the distance between the absolute coordinates and a given point

Kind: instance property of Point

Param Type
arg0 Number | Array | Object
[arg1] Number

Example

Point.distance(5, 7);
Point.distance([5, 7]);
Point.distance({x:5, y:7});
Point.distance(new Point(5, 7)); //relative x,y of Point
Point.distance((new Point(5, 7)).position$); //absolute x,y of Point

point.distance$ β‡’ Point

returns the distance between the absolute coordinates and a given point

Kind: instance property of Point

Param Type
arg0$ Number | Array | Object
[arg1$] Number

Example

Point.distance$(5, 7);
Point.distance$([5, 7]);
Point.distance$({x:5, y:7});
Point.distance$(new Point(5, 7)); //relative x,y of Point
Point.distance$((new Point(5, 7)).position$); //absolute x,y of Point

point.lerp β‡’ Point

Kind: instance property of Point

Param Type
arg0 Number | Array | Object
[arg1] Number
p

Example

Point.lerp(5, 7);
Point.lerp([5, 7]);
Point.lerp({x:5, y:7});
Point.lerp(new Point(5, 7));

point.lerpSelf β‡’ Point

Kind: instance property of Point

Param Type
arg0 Number | Array | Object
[arg1] Number
p

Example

Point.lerpSelf(5, 7);
Point.lerpSelf([5, 7]);
Point.lerpSelf({x:5, y:7});
Point.lerpSelf(new Point(5, 7));

point._parsePositionArgs β‡’ Object

parses the input args and returns a point object with x and y coordinates

Kind: instance property of Point

Param Type
arg0 Number | Array | Object
[arg1] Number

Example

_parsePositionArgs(5, 7);
_parsePositionArgs([5, 7]);
_parsePositionArgs({x:5, y:7});
_parsePositionArgs(new Point(5, 7));

point.transform(matrix) β‡’ Point

returns a new transformed Point

Kind: instance method of Point

Param
matrix

point.clone() β‡’ Point

returns a copy of the point

Kind: instance method of Point

point.transformSelf(m) β‡’ Point

returns a new transformed Point

Kind: instance method of Point
Returns: Point - [a b tx] [ x ] [c d ty] [ y ] [0 0 1 ] [ 1 ]

Param
m

point.multiplySelf(arg0, arg1) β‡’ Point

Kind: instance method of Point

Param Description
arg0 x
arg1 y

RasterRenderer

todo

  • rectangle
  • bezier curve

Kind: global class

rasterRenderer.render([Item])

renders all attached items or just the one given

Kind: instance method of RasterRenderer

Param Type
[Item] Object

rasterRenderer.add(Item, [data])

Kind: instance method of RasterRenderer

Param Type Description
Item Object Geometry Item
[data] Object e.g Array [R, G, B] colors range 0-255

Shape

Kind: global class

new Shape()

Shape

TerminalRenderer

Kind: global class

new TerminalRenderer(width, height, scale)

Param Type Description
width Number Width of the canvas
height Number Height of the canvas
scale Number Scale of the canvas

terminalRenderer.debug

Kind: instance property of TerminalRenderer

Param Type
debug Boolean

terminalRenderer.debug β‡’ Boolean

Kind: instance property of TerminalRenderer