Extends :: Obj

A class that defines a line with two coordinates The position vector pos and endPos.

This class must be accessed through the iio package.



These functions are used to instantiate new instances of the Line class. Constructor functions must be preceded by the new keyword.

iio.Line( Vector: v1, v2 )

iio.Line( Number: x1, y1, x2, y2 )

iio.Line( Number: x1, y1, Vector v2 )

iio.Line( Vector v1, Number: x2, y2 )

- Creates a line starting at the first given vector and ending at the second given vector. The default value for any undefined coordinate is 0.

var l1 = new iio.Line();

var l2 = new iio.Line(0,0,io.canvas.width,io.canvas.height);

var topRight = new iio.Vec(io.canvas.width,0);
var l3 = new iio.Line(topRight,;

var l4 = new iio.Line(0,io.canvas.height,topRight);

var l5 = new iio.Line(,0,0);

Inherited Properties

Line :: Obj

Obj.pos :: ioVec

Obj.rotation :: Number


Graphics Properties

The following properties can are attached by the iio Graphics Engine. Note that these properties are 'undefined' by default, so you must define them with their set functions or set their values directly.

.styles.alpha :: Number

.styles.strokeStyle :: Color||Pattern||Gradient

.styles.lineWidth :: Number

.styles.shadow :: Object

.styles.fxFade :: Object



The new data added by the Line class.


.endPos :: Vec

- the end position of this line.

//get a line's endPos
var end = line.endPos;

Inherited Functions

Line :: Obj





Graphics Functions

The following functions can are attached by the iio Graphics Engine.



These functions are added by the Line class, and available to all instantiated Line objects.



:: Returns Line

- returns a new Line with the same properties as this one. Makes a hard copy of the object.

//clone a line
var lineClone = line.clone();

.set( Line line )

.set( Vector: v1, v2 )

.set( Number: x1, y1, x2, y2 )

:: Returns this

- sets this line's start and end positions to the given coordinates.

//change a line's position properties

.setEndPos( Vector point )

.setEndPos( Number: x, y )

:: Returns this

- sets the end position of this line to the given vector.

//change a line's end position

//change it again