Classes
- AbstractText
- AnimatedSprite
- BitmapText
- Container
- Culler
- Graphics
- GraphicsContext
- HTMLText
- Mesh
- MeshGeometry
- MeshPlane
- MeshRope
- MeshSimple
- NineSliceGeometry
- NineSlicePlane
- NineSliceSprite
- PlaneGeometry
- RenderContainer
- RopeGeometry
- ShapePath
- Sprite
- Text
- TilingSprite
Interface Definitions
-
Base destroy options.
Properties:
Name Type Description childrenboolean Destroy children recursively.
Example
// Destroy the sprite and all its children. sprite.destroy({ children: true }); -
Constructor options used for
Containerinstances.const container = new Container({ position: new Point(100, 200), scale: new Point(2, 2), rotation: Math.PI / 2, });- See:
Properties:
Name Type Description alphanumber anglenumber blendModeBLEND_MODES boundsAreaRectangle childrenContainer[] culledboolean isRenderGroupboolean parentContainer pivotPointData | number positionPointData renderableboolean rotationnumber scalePointData | number skewPointData tintColorSource visibleboolean xnumber ynumber -
A fill style object.
Properties:
Name Type Description alphanumber The alpha value to use for the fill.
colorColorSource The color to use for the fill.
fillFillPattern | FillGradient | null The fill pattern to use.
matrixMatrix | null The matrix to apply.
textureTexture | null The texture to use for the fill.
-
A reference to a frame in an AnimatedSprite
Properties:
Name Type Description textureTexture The Texture of the frame.
timenumber The duration of the frame, in milliseconds.
-
Constructor options used for
Graphicsinstances.const graphics = new Graphics({ fillStyle: { color: 0xff0000, alpha: 0.5 }, strokeStyle: { color: 0x00ff00, width: 2 }, });- See:
Properties:
Name Type Description contextGraphicsContext The GraphicsContext to use, useful for reuse and optimisation
roundPixelsboolean Whether or not to round the x/y position.
-
Options for the mesh geometry.
Properties:
Name Type Description indicesUint32Array The indices of the mesh.
positionsFloat32Array The positions of the mesh.
shrinkBuffersToFitboolean Whether to shrink the buffers to fit the data.
topologyTopology The topology of the mesh.
uvsFloat32Array The UVs of the mesh.
-
Properties:
Name Type Description geometryGEOMETRY Includes vertex positions, face indices, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU. Can be shared between multiple Mesh objects.
roundPixelsboolean Whether or not to round the x/y position.
shaderSHADER Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. Can be shared between multiple Mesh objects.
stateState The state of WebGL required to render the mesh.
textureTexture The texture that the Mesh uses. Null for non-MeshMaterial shaders
-
Constructor options used for
MeshPlaneinstances.const meshPlane = new MeshPlane({ texture: Texture.from('snake.png'), verticesX: 20, verticesY: 20, }); -
Constructor options used for
MeshRopeinstances.const meshRope = new MeshRope({ texture: Texture.from('snake.png'), points: [new Point(0, 0), new Point(100, 0)], textureScale: 0, });- See:
Properties:
Name Type Description pointsPointLike[] An array of points that determine the rope.
textureTexture The texture to use on the rope.
textureScalenumber 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.
-
Options for the NineSliceGeometry.
Properties:
Name Type Description bottomHeightnumber The height of the bottom row.
heightnumber The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.
leftWidthnumber The width of the left column.
originalHeightnumber The original height of the texture
originalWidthnumber The original width of the texture
rightWidthnumber The width of the right column.
textureMatrixMatrix The texture matrix of the NineSlicePlane.
topHeightnumber The height of the top row.
widthnumber The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.
-
Constructor options used for
NineSliceSpriteinstances.const nineSliceSprite = new NineSliceSprite({ texture: Texture.from('button.png'), leftWidth: 20, topHeight: 20, rightWidth: 20, bottomHeight: 20, });- See:
Properties:
Name Type Description bottomHeightnumber Height of the bottom horizontal bar (D)
heightnumber Height of the NineSliceSprite, setting this will actually modify the vertices and not UV's of this plane.
leftWidthnumber Width of the left vertical bar (A)
rightWidthnumber Width of the right vertical bar (B)
roundPixelsboolean Whether or not to round the x/y position.
textureTexture The texture to use on the NineSliceSprite.
topHeightnumber Height of the top horizontal bar (C)
widthnumber Width of the NineSliceSprite, setting this will actually modify the vertices and not the UV's of this plane.
-
Constructor options used for
PlaneGeometryinstances.const planeGeometry = new PlaneGeometry({ width: 100, height: 100, verticesX: 10, verticesY: 10, });- See:
Properties:
Name Type Description heightnumber Height of plane
verticesXnumber Number of vertices on x-axis
verticesYnumber Number of vertices on y-axis
widthnumber Width of plane
-
Options for the RenderContainer constructor.
Properties:
Name Type Description addBounds(bounds: BoundsData) => void how to add the bounds of this object when measuring
containsPoint(point: Point) => boolean how to know if the custom render logic contains a point or not, used for interaction
renderRenderFunction the optional custom render function if you want to inject the function via the constructor
-
Constructor options used for
RopeGeometryinstances.const ropeGeometry = new RopeGeometry({ points: [new Point(0, 0), new Point(100, 0)], width: 10, textureScale: 0, });- See:
Properties:
Name Type Description pointsPointLike[] An array of points that determine the rope.
textureScalenumber 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.
widthnumber The width (i.e., thickness) of the rope.
-
Options for the simple mesh.
-
Options for the Sprite constructor.
-
A stroke style object.
Properties:
Name Type Description alignmentnumber The alignment of the stroke.
capLineCap The line cap style to use.
joinLineJoin The line join style to use.
miterLimitnumber The miter limit to use.
widthnumber The width of the stroke.
-
Options when destroying textures. Most of these use cases are internal.
// destroy the graphics context and its texture graphicsContext.destroy({ texture: true });Properties:
Name Type Description textureboolean Destroy the texture as well.
textureSourceboolean Destroy the texture source as well.
-
Constructor options used for
TilingSpriteinstances. Extends scene.TilingSpriteViewOptionsconst tilingSprite = new TilingSprite({ texture: Texture.from('assets/image.png'), width: 100, height: 100, tilePosition: { x: 100, y: 100 }, tileScale: { x: 2, y: 2 }, });- See:
-
- TilingSprite
- scene.TilingSpriteViewOptions
Properties:
Name Type Default Description anchorPointData {x: 0, y: 0}The anchor point of the sprite
applyAnchorToTextureboolean falseheightnumber 256The height of the tiling sprite.
roundPixelsboolean Whether or not to round the x/y position.
textureTexture Texture.WHITEThe texture to use for the sprite.
tilePositionPointData {x: 0, y: 0}The offset of the image that is being tiled.
tileRotationnumber 0The rotation of the image that is being tiled.
tileScalePointData {x: 1, y: 1}Scaling of the image that is being tiled.
widthnumber 256The width of the tiling sprite. #
-
A view is something that is able to be rendered by the renderer.
Properties:
Name Type Description _roundPixels0 | 1 this is an int because it is packed directly into an attribute in the shader
addBounds(bounds: Bounds) => void Adds the current bounds of this view to the supplied bounds
batchedboolean whether or not this view should be batched
boundsBoundsData this is the AABB rectangle bounds of the view in local untransformed space.
containsPoint(point: Point) => boolean Checks if the point is within the view
renderPipeIdstring an identifier that is used to identify the type of system that will be used to render this renderable eg, 'sprite' will use the sprite system (based on the systems name
uidnumber a unique id for this view
Type Definitions
Options for destroying a container.
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
children |
boolean |
<optional> |
false
|
Destroy the children of the container as well. |
context |
boolean |
<optional> |
false
|
Destroy the context of the container's children. |
texture |
boolean |
<optional> |
false
|
Destroy the texture of the container's children. |
textureSource |
boolean |
<optional> |
false
|
Destroy the texture source of the container's children. |