Model

Linen. Model

All other Linen elements extend this Model.

Constructor

new Model(Linen)

Source:
Parameters:
Name Type Description
Linen Linen The instance of Linen.

Methods

dpi() → {number}

Source:
Get the dpi of the Linen instance
Returns:
dpi
Type
number

width() → {number}

Source:
Get the width of the element
Returns:
px
Type
number

height() → {number}

Source:
Get the height of the element
Returns:
px
Type
number

x() → {number}

Source:
Get the x positioning of the element with reference point considered.
Returns:
px
Type
number

y() → {number}

Source:
Get the y positioning of the element with reference point considered.
Returns:
px
Type
number

setWidth(val) → {self}

Source:
Set the width of the element
Parameters:
Name Type Description
val number width
Returns:
self
Type
self

setHeight(val) → {self}

Source:
Set the height of the element
Parameters:
Name Type Description
val number height
Returns:
self
Type
self

setX(val) → {self}

Source:
Set the x positioning of the element
Parameters:
Name Type Description
val number x positioning
Returns:
self
Type
self

setY(val) → {self}

Source:
Set the y positioning of the element
Parameters:
Name Type Description
val number y positioning
Returns:
self
Type
self

setXY(x, y) → {self}

Source:
Shorthand to set the x and y positioning of the element
Parameters:
Name Type Description
x number x positioning
y number y positioning
Returns:
self
Type
self

setAlignment(alignmentopt) → {self}

Source:
Set the x reference point for positioning
Parameters:
Name Type Attributes Default Description
alignment 'left' | 'center' | 'right' <optional>
left left|center|right
Returns:
self
Type
self

center() → {self}

Source:
Shorthand to set the reference point for positioning to center
Returns:
self
Type
self

setVAlignment(v_alignmentopt) → {self}

Source:
Set the y reference point for positioning
Parameters:
Name Type Attributes Default Description
v_alignment 'top' | 'middle' | 'bottom' <optional>
top top|middle|bottom
Returns:
self
Type
self

middle() → {self}

Source:
Shorthand to set the y reference point for positioning to bottom
Returns:
self
Type
self

setTransorm(a, b, c, d, e, f) → {self}

Source:
See:
Set the transform to be used on
Parameters:
Name Type Default Description
a type 1 Horizontal scaling. A value of 1 results in no scaling.
b type 0 Vertical skewing.
c type 0 Horizontal skewing.
d type 1 Vertical scaling. A value of 1 results in no scaling.
e type 0 Horizontal translation (moving).
f type 0 Vertical translation (moving).
Returns:
self
Type
self

setFill(bool) → {self}

Source:
Enable or disable rendering the fill
Parameters:
Name Type Default Description
bool bool true TRUE|FALSE
Returns:
self
Type
self

setStroke(bool) → {self}

Source:
Enable or disable rendering the stroke
Parameters:
Name Type Default Description
bool bool true TRUE|FALSE
Returns:
self
Type
self

setClip(bool) → {self}

Source:
Enable or disable using the path as a clipping mask.
Parameters:
Name Type Default Description
bool bool true TRUE|FALSE
Returns:
self
Type
self

setDimension(dimension, value) → {self}

Source:
Set the value of a given dimension.
Parameters:
Name Type Description
dimension string dimension name.
value * mixed value
Returns:
self
Type
self

getSetting(setting) → {string}

Source:
Get the value of a given setting.
Parameters:
Name Type Description
setting string setting name.
Returns:
value
Type
string

setSetting(setting, value) → {self}

Source:
Set the value of a given setting.
Parameters:
Name Type Description
setting string setting name.
value * mixed value
Returns:
self
Type
self

setProp(prop, value) → {self}

Source:
Set the value of a given property. This should probably not be used directly.
Parameters:
Name Type Description
prop string property name.
value * mixed value
Returns:
self
Type
self

setFillStyle(fillStyle) → {self}

Source:
See:
Set the fillStyle to be used for rendering.
Parameters:
Name Type Description
fillStyle string color|gradient|pattern
Returns:
self
Type
self

setFilter(filter) → {self}

Source:
See:
Set the filter to be used for rendering.
Parameters:
Name Type Description
filter string none | blur() | brightness() | contrast() | drop-shadow() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia() | url();
Returns:
self
Type
self

setGlobalAlpha(globalAlpha) → {self}

Source:
See:
Set the globalAlpha to be used for rendering.
Parameters:
Name Type Description
globalAlpha float 1 being completely opaque and 0 being completely transparent
Returns:
self
Type
self

setLineCap(lineCap) → {self}

Source:
See:
Set the lineCap to be used for rendering.
Parameters:
Name Type Description
lineCap string butt|round|square
Returns:
self
Type
self

setLineJoin(lineJoin) → {self}

Source:
See:
Set the lineJoin to be used for rendering.
Parameters:
Name Type Description
lineJoin string bevel|round|miter
Returns:
self
Type
self

setLineWidth(lineWidth) → {self}

Source:
See:
Set the lineWidth to be used for rendering.
Parameters:
Name Type Description
lineWidth * size in px, pt, inches (in), or percentage (%)
Returns:
self
Type
self

setMiterLimit(miterLimit) → {self}

Source:
See:
Set the miterLimit to be used for rendering.
Parameters:
Name Type Description
miterLimit number A positive number that specifies the maximum miter length.
Returns:
self
Type
self

setShadowBlur(shadowBlur) → {self}

Source:
See:
Set the shadowBlur to be used for rendering.
Parameters:
Name Type Description
shadowBlur number The blur level for the shadow.
Returns:
self
Type
self

setShadowColor(shadowColor) → {self}

Source:
See:
Set the shadowColor to be used for rendering.
Parameters:
Name Type Description
shadowColor string color|gradient|pattern
Returns:
self
Type
self

setShadowOffsetX(shadowOffsetX) → {self}

Source:
See:
Set the shadowOffsetX to be used for rendering.
Parameters:
Name Type Description
shadowOffsetX number A positive or negative number that defines the horizontal distance of the shadow from the shape.
Returns:
self
Type
self

setShadowOffsetY(shadowOffsetY) → {self}

Source:
See:
Set the shadowOffsetY to be used for rendering.
Parameters:
Name Type Description
shadowOffsetY number A positive or negative number that defines the vertical distance of the shadow from the shape.
Returns:
self
Type
self

setStrokeStyle(strokeStyle) → {self}

Source:
See:
Set the strokeStyle to be used for rendering.
Parameters:
Name Type Description
strokeStyle string color|gradient|pattern
Returns:
self
Type
self

setTextAlign(textAlign) → {self}

Source:
See:
Set the textAlign to be used for rendering.
Parameters:
Name Type Description
textAlign string center|end|left|right|start
Returns:
self
Type
self

setTextBaseline(textBaseline) → {self}

Source:
See:
Set the textBaseline to be used for rendering.
Parameters:
Name Type Description
textBaseline string alphabetic|top|hanging|middle|ideographic|bottom
Returns:
self
Type
self

setCallback(callback) → {self}

Source:
Add a callback for when the afterRender() in ran.
Parameters:
Name Type Description
callback function
Returns:
self
Type
self