The alpha opacity of the Node.
The alpha value is a number between 0 and 1, where 0 is fully transparent and 1 is fully opaque.
1
Autosize mode
When enabled, when a texture is loaded into the Node, the Node will automatically resize to the dimensions of the texture.
Text Nodes are always autosized based on their text content regardless of this mode setting.
false
Clipping Mode
Enable Clipping Mode when you want to prevent the drawing of a Node and its descendants from overflowing outside of the Node's x/y/width/height bounds.
For WebGL, clipping is implemented using the high-performance WebGL operation scissor. As a consequence, clipping does not work for non-rectangular areas. So, if the element is rotated (by itself or by any of its ancestors), clipping will not work as intended.
TODO: Add support for non-rectangular clipping either automatically or via Render-To-Texture.
false
The color of the Node.
The color value is a number in the format 0xRRGGBBAA, where RR is the red component, GG is the green component, BB is the blue component, and AA is the alpha component.
Gradient colors may be set by setting the different color sub-properties: colorTop, colorBottom, colorLeft, colorRight, colorTl, colorTr, colorBr, colorBl accordingly.
0xffffffff
(opaque white)
The color of the bottom-left corner of the Node for gradient rendering.
See color for more information about color values and gradient rendering.
The color of the bottom edge of the Node for gradient rendering.
See color for more information about color values and gradient rendering.
The color of the bottom-right corner of the Node for gradient rendering.
See color for more information about color values and gradient rendering.
The color of the left edge of the Node for gradient rendering.
See color for more information about color values and gradient rendering.
The color of the right edge of the Node for gradient rendering.
See color for more information about color values and gradient rendering.
The color of the top-left corner of the Node for gradient rendering.
See color for more information about color values and gradient rendering.
The color of the top edge of the Node for gradient rendering.
See color for more information about color values and gradient rendering.
The color of the top-right corner of the Node for gradient rendering.
See color for more information about color values and gradient rendering.
Contain mode for text
The contain mode determines how the text is contained within the bounds
of the Text Node. The default value is 'none'
, which means that the
Text Renderer will not constrain the text in any way. 'width'
mode will
constrain the text to the set width wrapping lines as necessary, and
'both'
mode will constrain the text to both the set width and height
wrapping lines and truncating text as necessary.
Depending on the set contain mode, after the text 'loaded' event is emitted, the text node may have either its width and height updated to match the rendered size of the text.
When contain mode is 'none', both the width and height properties are updated.
When contain mode is 'width', only the height property is updated.
When contain mode is 'both', neither property is updated.
'none'
Optional
dataNode data element for custom data storage (optional)
This property is used to store custom data on the Node as a key/value data store. Data values are limited to string, numbers, booleans. Strings will be truncated to a 2048 character limit for performance reasons.
This is not a data storage mechanism for large amounts of data please use a dedicated data storage mechanism for that.
The custom data will be reflected in the inspector as part of data-*
attributes
undefined
Font Family
fontFamily
is defined currently as single string, but in the future we may want to
support multiple font family fallbacks, as this is supported by CSS / Canvas2d. We can
do this in a backwards compatible way by unioning an array of strings to the
fontFamily
property.
Font Size
The font size to use when looking up the font face.
The font size is specified in pixels and is the height of the font's em-square. The em-square is essentially the height of the capital letters for the font. The actual height of the text can be larger than the specified font size, as the font may have ascenders and descenders that extend beyond the em-square.
16
Font Stretch
The font stretch to use when looking up the font face. This can be one of the following strings:
'normal'
'ultra-condensed'
'extra-condensed'
'condensed'
'semi-condensed'
'semi-expanded'
'expanded'
'extra-expanded'
'ultra-expanded'
'normal'
Font Style
The font style to use when looking up the font face. This can be one of the following strings:
'normal'
'italic'
'oblique'
Font Weight
The font weight to use when looking up the font face. This can be a numeric value between 1 and 1000, or one of the following strings:
'normal'
- same as 400'bold'
- same as 700'bolder'
- (Not yet properly supported)The height of the Node.
0
Optional
imageImage Type to explicitly set the image type that is being loaded
This property must be used with a src
that points at an image. In some cases
the extension doesn't provide a reliable representation of the image type. In such
cases set the ImageType explicitly.
regular
is used for normal images such as png, jpg, etc
compressed
is used for ETC1/ETC2 compressed images with a PVR or KTX container
svg
is used for scalable vector graphics
undefined
Letter spacing for text (in pixels)
This property sets additional (or reduced, if value is negative) spacing between characters in the text.
0
Line height for text (in pixels)
This property sets the height of each line. If set to undefined
, the
line height will be calculated based on the font and font size to be the
minimal height required to completely contain a line of text.
See: https://github.com/lightning-js/renderer/issues/170
undefined
Max lines for text
This property sets max number of lines of a text paragraph. Not yet implemented in the SDF renderer.
0
Combined position of the Node's Mount Point
The value can be any number between 0.0
and 1.0
:
0.0
defines the Mount Point at the top-left corner of the Node.0.5
defines it at the center of the Node.1.0
defines it at the bottom-right corner of the node.Use the mountX and mountY props seperately for more control of the Mount Point.
When assigned, the same value is also passed to both the mountX and mountY props.
0 (top-left)
X position of the Node's Mount Point
The value can be any number between 0.0
and 1.0
:
0.0
defines the Mount Point's X position as the left-most edge of the
Node0.5
defines it as the horizontal center of the Node1.0
defines it as the right-most edge of the Node.The combination of mountX and mountY define the Mount Point
0 (left-most edge)
Y position of the Node's Mount Point
The value can be any number between 0.0
and 1.0
:
0.0
defines the Mount Point's Y position as the top-most edge of the
Node0.5
defines it as the vertical center of the Node1.0
defines it as the bottom-most edge of the Node.The combination of mountX and mountY define the Mount Point
0 (top-most edge)
Vertical offset for text
Overflow Suffix for text
The suffix to be added when text is cropped due to overflow. Not yet implemented in the SDF renderer.
"..."
Combined position of the Node's Pivot Point
The value can be any number between 0.0
and 1.0
:
0.0
defines the Pivot Point at the top-left corner of the Node.0.5
defines it at the center of the Node.1.0
defines it at the bottom-right corner of the node.Use the pivotX and pivotY props seperately for more control of the Pivot Point.
When assigned, the same value is also passed to both the pivotX and pivotY props.
0.5 (center)
X position of the Node's Pivot Point
The value can be any number between 0.0
and 1.0
:
0.0
defines the Pivot Point's X position as the left-most edge of the
Node0.5
defines it as the horizontal center of the Node1.0
defines it as the right-most edge of the Node.The combination of pivotX and pivotY define the Pivot Point
0.5 (centered on x-axis)
Y position of the Node's Pivot Point
The value can be any number between 0.0
and 1.0
:
0.0
defines the Pivot Point's Y position as the top-most edge of the
Node0.5
defines it as the vertical center of the Node1.0
defines it as the bottom-most edge of the Node.The combination of pivotX and pivotY define the Pivot Point
0.5 (centered on y-axis)
Whether to prevent the node from being cleaned up
false
Rotation of the Node (in Radians)
Sets the amount to rotate the Node by around it's Pivot Point (defined by the pivot props). Positive values rotate the Node clockwise, while negative values rotate it counter-clockwise.
Example values:
-Math.PI / 2
: 90 degree rotation counter-clockwise0
: No rotationMath.PI / 2
: 90 degree rotation clockwiseMath.PI
: 180 degree rotation clockwise3 * Math.PI / 2
: 270 degree rotation clockwise2 * Math.PI
: 360 rotation clockwiseWhether the Node is rendered to a texture
TBD
false
Scale to render the Node at
The scale value multiplies the provided width and height of the Node around the Node's Pivot Point (defined by the pivot props).
Behind the scenes, setting this property sets both the scaleX and scaleY props to the same value.
NOTE: When the scaleX and scaleY props are explicitly set to different values,
this property returns null
. Setting null
on this property will have no
effect.
1.0
Scale to render the Node at (X-Axis)
Scale to render the Node at (Y-Axis)
Vertical scroll position for text
The vertical scroll position of the text. This property is only used if
scrollable is true
.
0
Whether or not the text is scrollable
If scrollable
is true
, the text can be scrolled vertically within the
bounds of the Text Node. You can set the scroll position using the
scrollY property.
false
The Node's shader
The shader
defines a Shader used to draw the Node. By default,
the Default Shader is used which simply draws the defined texture
or color(s) within the Node without any special effects.
To create a Shader in order to set it on this property, call RendererMain.createShader.
Note: If this is a Text Node, the Shader will be managed by the Node's TextRenderer and should not be set explicitly.
Image URL
When set, the Node's texture is automatically set to an ImageTexture using the source image URL provided (with all other settings being defaults)
Optional
srcThe height of the rectangle from which the Image Texture will be extracted. This value can be negative. If not provided, the image's source natural height will be used.
Optional
srcShe width of the rectangle from which the Image Texture will be extracted. This value can be negative. If not provided, the image's source natural width will be used.
Optional
srcXThe x coordinate of the reference point of the rectangle from which the Texture
will be extracted. width
and height
are provided. And only works when
createImageBitmap is available. Only works when createImageBitmap is supported on the browser.
Optional
srcYThe y coordinate of the reference point of the rectangle from which the Texture
will be extracted. Only used when source srcWidth
width and srcHeight
height
are provided. Only works when createImageBitmap is supported on the browser.
By enabling Strict bounds the renderer will not process & render child nodes of a node that is out of the visible area
When enabled out of bound nodes, i.e. nodes that are out of the visible area, will NOT have their children processed and renderer anymore. This means the children of a out of bound node will not receive update processing such as positioning updates and will not be drawn on screen. As such the rest of the branch of the update tree that sits below this node will not be processed anymore
This is a big performance gain but may be disabled in cases where the width of the parent node is unknown and the render must process the child nodes regardless of the viewport status of the parent node
false
Text to display
''
Text alignment
Baseline for text
This property sets the text baseline used when drawing text. Not yet implemented in the SDF renderer.
alphabetic
Force Text Node to use a specific Text Renderer
By default, Text Nodes resolve the Text Renderer to use based on the font that is matched using the font family and other font selection properties.
If two fonts supported by two separate Text Renderers are matched setting this override forces the Text Node to resolve to the Text Renderer defined here.
null
The Node's Texture.
The texture
defines a rasterized image that is contained within the
width and height dimensions of the Node. If null, the
Node will use an opaque white ColorTexture when being drawn, which
essentially enables colors (including gradients) to be drawn.
If set, by default, the texture will be drawn, as is, stretched to the dimensions of the Node. This behavior can be modified by setting the TBD and TBD properties.
To create a Texture in order to set it on this property, call RendererMain.createTexture.
If the src is set on a Node, the Node will use the ImageTexture by default and the Node will simply load the image at the specified URL.
Note: If this is a Text Node, the Texture will be managed by the Node's TextRenderer and should not be set explicitly.
Options to associate with the Node's Texture
Vertical Align for text when lineHeight > fontSize
This property sets the vertical align of the text. Not yet implemented in the SDF renderer.
middle
The width of the Node.
0
The x coordinate of the Node's Mount Point.
The y coordinate of the Node's Mount Point.
The Node's z-index.
TBD
Generated using TypeDoc
Properties used to create a new Text Node