API Docs for:
Show:

gs.TilingSprite Class

A tiling sprite tiles a bitmap or video over the screen. It also supports different kind of visual effects like tinting, blending, etc.

Constructor

gs.TilingSprite

(
  • [viewport=gs.Graphics.viewport]
  • [managed=yes]
)

Parameters:

  • [viewport=gs.Graphics.viewport] gs.Viewport optional
    • The viewport.
  • [managed=yes] Boolean optional
    • Indicates if the sprite should be managed by the graphic-system.

Methods

dispose

()

Inherited from gs.GraphicObject:

Disposes the graphic object.

draw

()

Inherited from gs.GraphicObject

Draws the sprite. Shouldn't be called manually.

initialize

() protected

Inherited from gs.GraphicObject:

Initializes the graphic object.

update

()

Inherited from gs.GraphicObject

Updates the sprite's motion-blur and other effects. Needs to be called once per frame.

Properties

anchor

gs.Point

Inherited from gs.GraphicObject:

The anchor point. For example: An anchor-point with 0,0 rotates the object around its top-left corner but with an 0.5, 0.5 anchor-point the object rotates around its center. An anchor-point of 1,1 rotates the object around its lower-right corner. It has not effect on the object's positioning. For positioning, take a look at positionAnchor property.

angle

Number

The rotation-angle in degrees. Rotates all objects assigned to this viewport around the viewport's anchor-point.

bitmap

gs.Bitmap

The bitmap to render.

blendingMode

gs.BlendMode

The blend mode used for alpha-blending.

clipRect

gs.Rect

The clip-rect. Everything outside the clip-rect is clipped and not visible.

disposed

Boolean

Inherited from gs.GraphicObject:

Indicates if the object is disposed. A disposed object is not rendered.

effects

Object

Inherited from gs.GraphicObject

The effect settings for different kind of visual effect like wobble, etc.

horizontal

Boolean

Indicates if the sprite tiles horizontally.

id

Number

Inherited from gs.GraphicObject:

The unique identifier of the graphic object.

index

Number

Inherited from gs.GraphicObject:

The current index in the global rendering list. This property is read-only and automatically calculated at runtime depending on z-property.

mask

gs.Mask

The mask used for masking-effects.

mirror

Boolean

The color. Can be used for flashing-effects, etc.

motionBlur

gs.MotionBlur

The motion-blur settings.

onIndexChange

Function

Inherited from gs.GraphicObject:

Fired if the graphic object's current index in the global rendering list was changed.

Default: null

opacity

Number

The opacity goes from 0 to 255. For example: A value of 0 means fully transparent, 255 means fully opaque and 128 means semi-transparent.

ox

Number

Inherited from gs.GraphicObject:

The x-coordinate of the origin.

oy

Number

Inherited from gs.GraphicObject:

The y-coordinate of the origin.

positionAnchor

gs.Point

Inherited from gs.GraphicObject:

The position anchor point. For example: An anchor-point with 0,0 places the object with its top-left corner at its position but with an 0.5, 0.5 anchor-point the object will be placed with its center. An anchor-point of 1,1 will place the object with its lower-right corner. It has not effect on the object's rotation/zoom anchor. For that, take a look at anchor property.

rect

gs.Rect

The tiling-area. The sprite will only be tiled over that area. To tile over the whole screen just the rectangle to the screen-size.

rect

gs.Rect

The tiling-area. The sprite will only be tiled over that area. To tile over the whole screen just the rectangle to the screen-size.

srcRect

gs.Rect

The source-rectangle. Only that area of the bitmap/video is tiled over the screen.

tone

gs.Tone

The color tone.

transform

Mat2d

Inherited from gs.GraphicObject:

The transformation matrix of the graphic object.

vertical

Boolean

Indicates if the sprite tiles vertically.

video

gs.Video

The video to render.

visible

Boolean

Inherited from gs.GraphicObject:

Indicates if the object is rendered.

x

Number

The x-coordinate of the scrolling.

y

Number

The y-coordinate of the scrolling.

z

Number

Inherited from gs.GraphicObject:

The z-index controls rendering-order/image-overlapping. An object with a smaller z-index is rendered before an object with a larger index. For example: To make sure a graphic object is always on top of the screen, it should have the largest z-index of all graphic objects.

zoomX

Number

The zoom on x-axis.

zoomY

Number

The zoom on y-axis.