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 )
- 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,io.canvas.center); var l4 = new iio.Line(0,io.canvas.height,topRight); var l5 = new iio.Line(io.canvas.center,0,0);
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.strokeStyle :: Color||Pattern||Gradient
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;
The following functions can are attached by the iio Graphics Engine.
:: 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 line.set(10,10,50,50);