SpriteInstance¶
Overview¶
Represents a single instance on the screen of a given Sprite object. It can have its own transformation matrix, and is set up as a lightweight container of information, for high-performance usage (with pooling).
Its individual parameters should generally be mutated directly by the client.
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class SpriteInstance¶
Constructor¶
new SpriteInstance()¶
Instance Methods¶
initialize() : this¶
For pooling. Please use SpriteInstance.pool.fetch() to grab a copy
getShape() : Shape¶
Returns a Shape that represents the hit-testable area of this SpriteInstance.
containsPoint( point : Vector2 ) : boolean¶
Returns whether a given point is considered "inside" the SpriteInstance
freeToPool()¶
Instance Properties¶
sprite : Sprite | null¶
This should be set to a Sprite
object which is the sprite that should be displayed. This field is expected to be set by the client whenever it needs to change.
matrix : Matrix3¶
Please just mutate the given Matrix3 for performance. If the matrix represents something other than just a translation, please update the transformType
to the type that represents the possible values.
transformType : SpriteInstanceTransformType¶
alpha : number¶
The general opacity/alpha of the displayed sprite (see Node's opacity)
Static Properties¶
pool : Pool¶
(readonly)
Class SpriteInstanceTransformType¶
Static Properties¶
TRANSLATION : SpriteInstanceTransformType¶
(readonly)
TRANSLATION_AND_SCALE : SpriteInstanceTransformType¶
(readonly)
TRANSLATION_AND_ROTATION : SpriteInstanceTransformType¶
(readonly)
AFFINE : SpriteInstanceTransformType¶
(readonly)
enumeration : Enumeration¶
(readonly)
Source Code¶
See the source for SpriteInstance.ts in the scenery repository.