Sprite class
A Sprite is a Node that renders a bitmap image to the screen.
- Inheritance
- Object
- Node
- NodeWithSize
- Sprite
- Mixes-in
Constructors
- Sprite([SpriteTexture texture ])
-
Creates a new sprite from the provided
texture
. [...] - Sprite.fromImage(Image image)
-
Creates a new sprite from the provided
image
. [...]
Properties
- constrainProportions ↔ bool
-
If true, constrains the proportions of the image by scaling it down, if its proportions doesn't match the
size
. [...]read / write - texture ↔ SpriteTexture
-
The texture that the sprite will render to screen. [...]
read / write
- actions → ActionController
-
The ActionController associated with this node. [...]
read-only, inherited
- children → List<Node>
-
A list of the children of this node. [...]
read-only, inherited
- colorOverlay ↔ Color
-
The color to draw on top of the sprite, null if no color overlay is used. [...]
read / write, inherited
- constraints ↔ List<Constraint>
-
A List of Constraints that will be applied to the node.
The constraints are applied after the update method has been called.
read / write, inherited
- handleMultiplePointers ↔ bool
-
If set to true the node will receive multiple pointers, otherwise it will only receive events the first pointer. [...]
read / write, inherited
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- inverseTransformMatrix → Matrix4
-
The inverse transform matrix used by this node.
read-only, inherited
- opacity ↔ double
-
The opacity of the sprite in the range 0.0 to 1.0. [...]
read / write, inherited
- parent → Node
-
The parent of this node, or null if it doesn't have a parent. [...]
read-only, inherited
- paused ↔ bool
-
Decides if the node and its children is currently paused. [...]
read / write, inherited
- pivot ↔ Offset
-
The normalized point which the node is transformed around. [...]
read / write, inherited
- position ↔ Offset
-
The position of this node relative to its parent. [...]
read / write, inherited
- rotation ↔ double
-
The rotation of this node in degrees. [...]
read / write, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- scale ↔ double
-
The scale of this node relative its parent. [...]
read / write, inherited
- scaleX ↔ double
-
The horizontal scale of this node relative its parent. [...]
read / write, inherited
- scaleY ↔ double
-
The vertical scale of this node relative its parent. [...]
read / write, inherited
- size ↔ Size
-
Changing the size will affect the size of the rendering of the node. [...]
read / write, inherited
- skewX ↔ double
-
The skew along the x-axis of this node in degrees. [...]
read / write, inherited
- skewY ↔ double
-
The skew along the y-axis of this node in degrees. [...]
read / write, inherited
- spriteBox → SpriteBox
-
The SpriteBox this node is added to, or null if it's not currently added to a SpriteBox. [...]
read-only, inherited
- transferMode ↔ BlendMode
-
The transfer mode used when drawing the sprite to screen. [...]
read / write, inherited
- transformMatrix → Matrix4
-
The transformMatrix describes the transformation from the node's parent. [...]
read-only, inherited
- userInteractionEnabled ↔ bool
-
The node will receive user interactions, such as pointer (touch or mouse) events. [...]
read / write, inherited
- visible ↔ bool
-
The visibility of this node and its children.
read / write, inherited
- zPosition ↔ double
-
The draw order of this node compared to its parent and its siblings. [...]
read / write, inherited
Methods
-
paint(
Canvas canvas) → void - Paints this node to the canvas. [...]
-
addChild(
Node child) → void -
Adds a child to this node. [...]
inherited
-
applyConstraints(
double dt) → void -
Called to apply the constraints to the node. Normally, this method is
called automatically by the SpriteBox, but it can be called manually
if the constraints need to be applied immediately.
inherited
-
applyTransformForPivot(
Canvas canvas) → void -
Call this method in your paint method if you want the origin of your drawing to be the top left corner of the
node's bounding box. [...]
inherited
-
computeTransformMatrix(
) → Matrix4 -
Computes the transformation matrix of this node. This method can be
overriden if a custom matrix is required. There is usually no reason to
call this method directly.
inherited
-
convertPointFromNode(
Offset point, Node node) → Offset -
Converts a
point
from anothernode
s coordinate system into the local coordinate system of this node. [...]inherited -
convertPointToBoxSpace(
Offset nodePoint) → Offset -
Converts a point from the local coordinate system of the node to the coordinate system of the SpriteBox. [...]
inherited
-
convertPointToNodeSpace(
Offset boxPoint) → Offset -
Converts a point from the coordinate system of the SpriteBox to the local coordinate system of the node. [...]
inherited
-
handleEvent(
SpriteBoxEvent event) → bool -
Handles an event, such as a pointer (touch or mouse) event. [...]
inherited
-
invalidateTransformMatrix(
) → void -
Invalidates the current transform matrix. If the computeTransformMatrix
method is overidden, this method should be called whenever a property
changes that affects the matrix.
inherited
-
isPointInside(
Offset nodePoint) → bool -
Returns true if the
point
is inside the node, thepoint
is in the local coordinate system of the node. [...]inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
removeAllChildren(
) → void -
Removes all children of this node. [...]
inherited
-
removeChild(
Node child) → void -
Removes a child from this node. [...]
inherited
-
removeFromParent(
) → void -
Removes this node from its parent node. [...]
inherited
-
spriteBoxPerformedLayout(
) → void -
Called whenever the SpriteBox is modified or resized, or if the device is rotated. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
-
update(
double dt) → void -
Called before a frame is drawn. [...]
inherited
Operators
-
operator ==(
other) → bool -
The equality operator. [...]
inherited