Namespace: scene

scene

Classes

AnimatedSprite
BitmapText
Container
Culler
Graphics
HTMLText
Mesh
MeshPlane
MeshRope
MeshSimple
NineSliceSprite
PlaneGeometry
RopeGeometry
Sprite
Text
TextStyle
TilingSprite

Interface Definitions

BaseDestroyOptions

Base destroy options.

Properties:
Name Type Description
children boolean

Destroy children recursively.

ContainerOptions

Constructor options use for Container instances.

Properties:
Name Type Description
alpha number
angle number
blendMode BLEND_MODES
boundsArea Rectangle
children Container[]
isRenderGroup boolean
parent Container
pivot PointData
position PointData
renderable boolean
rotation number
scale PointData
skew PointData
tint ColorSource
view T
visible boolean
x number
y number
See:

FrameObject

Properties:
Name Type Description
texture core

The Texture of the frame.

time number

The duration of the frame, in milliseconds.

GraphicsOptions

Options for the Graphics.

Properties:
Name Type Description
context GraphicsContext

The GraphicsContext to use.

fillStyle FillStyleInputs

The fill style to use.

strokeStyle FillStyleInputs

The stroke style to use.

MeshPlaneOptions

Options for the MeshPlane constructor.

Properties:
Name Type Description
texture core

The texture to use on the plane.

verticesX number

The number of vertices in the x-axis

verticesY number

The number of vertices in the y-axis

MeshRopeOptions

Options for the MeshRope constructor.

Properties:
Name Type Description
points PointLike[]

An array of points that determine the rope.

texture core

The texture to use on the rope.

textureScale number

Rope texture scale, if zero then the rope texture is stretched. Positive values scale rope texture keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture and downsampling here. If set to zero, texture will be stretched instead.

NineSliceSpriteOptions

Options for the NineSliceSprite constructor.

Properties:
Name Type Description
bottomHeight number

Height of the bottom horizontal bar (D)

leftWidth number

Width of the left vertical bar (A)

rightWidth number

Width of the right vertical bar (B)

texture core

The texture to use on the NineSlicePlane.

topHeight number

Height of the top horizontal bar (C)

PlaneGeometryOptions

Options for the PlaneGeometry constructor.

Properties:
Name Type Description
height number

Height of plane

verticesX number

Number of vertices on x-axis

verticesY number

Number of vertices on y-axis

width number

Width of plane

RopeGeometryOptions

Options for the PlaneGeometry constructor.

Properties:
Name Type Description
points PointLike[]

An array of points that determine the rope.

textureScale number

Rope texture scale, if zero then the rope texture is stretched. By default the rope texture will be stretched to match rope length. If textureScale is positive this value will be treated as a scaling factor and the texture will preserve its aspect ratio instead. To create a tiling rope set baseTexture.wrapMode to 'repeat' and use a power of two texture, then set textureScale=1 to keep the original texture pixel size. In order to reduce alpha channel artifacts provide a larger texture and downsample - i.e. set textureScale=0.5 to scale it down twice.

width number

The width (i.e., thickness) of the rope.

SpriteOptions

Options for the Sprite constructor.

Properties:
Name Type Description
anchor PointLike

The anchor point of the sprite.

texture core

The texture to use for the sprite.

TextStyleOptions

Generic interface for TextStyle options.

Properties:
Name Type Description
align 'left' | 'center' | 'right' | 'justify'

Alignment for multiline text, does not affect single line text

breakWords boolean

Indicates if lines can be wrapped within words, it needs wordWrap to be set to true

dropShadow boolean | TextDropShadow

Set a drop shadow for the text

fill string | Array<string> | number | Array<number> | CanvasGradient | CanvasPattern

A canvas fillstyle that will be used on the text e.g., 'red', '#00FF00'. Can be an array to create a gradient, e.g., ['#000000','#FFFFFF'] MDN

fontFamily string | string[]

The font family, can be a single font name, or a list of names where the first is the preferred font.

fontSize number | string

The font size (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')

fontStyle 'normal' | 'italic' | 'oblique'

The font style.

fontVariant 'normal' | 'small-caps'

The font variant.

fontWeight 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'

The font weight.

leading number

The height of the line, a number that represents the vertical space that a letter uses.

letterSpacing number

The amount of spacing between letters, default is 0

lineHeight number

The line height, a number that represents the vertical space that a letter uses

padding number

Occasionally some fonts are cropped. Adding some padding will prevent this from happening by adding padding to all sides of the text.

stroke FillStyleInputs

A canvas fillstyle that will be used on the text stroke, e.g., 'blue', '#FCFF00'

textBaseline 'alphabetic' | 'top' | 'hanging' | 'middle' | 'ideographic' | 'bottom'

The baseline of the text that is rendered.

whiteSpace 'normal' | 'pre' | 'pre-line'

Determines whether newlines & spaces are collapsed or preserved "normal" (collapse, collapse), "pre" (preserve, preserve) | "pre-line" (preserve, collapse). It needs wordWrap to be set to true.

wordWrap boolean

Indicates if word wrap should be used

wordWrapWidth number

The width at which text will wrap, it needs wordWrap to be set to true

TextureDestroyOptions

Texture destroy options.

Properties:
Name Type Description
texture boolean

Destroy the texture as well.

textureSource boolean

Destroy the texture source as well.

TilingSpriteOptions

Options for the TilingSprite constructor.

Properties:
Name Type Default Description
anchor PointData {x: 0, y: 0}

The anchor point of the sprite

tilePosition PointData {x: 0, y: 0}

The offset of the image that is being tiled.

tileRotation number 0

The rotation of the image that is being tiled.

tileScale PointData {x: 1, y: 1}

Scaling of the image that is being tiled.

TilingSpriteViewOptions

Options for the TilingSprite constructor.

Properties:
Name Type Default Description
applyAnchorToTexture boolean false
height number 256

The height of the tiling sprite.

texture core Texture.WHITE

The texture to use for the sprite.

width number 256

The width of the tiling sprite. #

Type Definitions

MeshOptions

Options for the Mesh constructor.

TextDropShadow

A drop shadow effect.

Properties:
Name Type Description
alpha number

Set alpha for the drop shadow

angle number

Set a angle of the drop shadow

blur number

Set a shadow blur radius

color ColorSource

A fill style to be used on the e.g., 'red', '#00FF00'

distance number

Set a distance of the drop shadow

TextOptions

Options for the Text class.

Properties:
Name Type Description
anchor PointLike

The anchor point of the text.