spritewidget library

A sprite toolkit built on top of Flutter.

Classes

ColorSequence
A sequence of colors representing a gradient or a color transition over time. The sequence is represented by a list of colors and a list of stops, the stops are normalized values (0.0 to 1.0) and ordered in the list. Both lists have the same number of elements.
Constraint
A constraint limits or otherwise controls a Node's properties, such as position or rotation. Add a list of constraints by setting the Node's constraints property.
ConstraintPositionToNode
A Constraint that constrains the position of a node to equal the position of another node, optionally with dampening.
ConstraintRotationToMovement
A Constraint that aligns a nodes rotation to its movement.
ConstraintRotationToNode
A Constraint that rotates a node to point towards another node. The target node is allowed to have a different parent, but they must be in the same SpriteBox.
ConstraintRotationToNodeRotation
A Constraint that copies a node's rotation, optionally with dampening.
EffectLine
The EffectLine class is using the TexturedLine class to draw animated lines. These can be used to draw things such as smoke trails, electricity effects, or other animated types of lines.
GameMath
Provides convenience methods for calculations often carried out in graphics. Some of the methods are returning approximations.
ImageMap
The ImageMap is a helper class for loading and keeping references to multiple images.
Label
Labels are used to display a string of text in a the node tree. To align the label, the textAlign property of the TextStyle can be set.
Layer
A Node that provides an intermediate rendering surface in the sprite rendering tree. A Layer can be used to change the opacity, color, or to apply an effect to a set of nodes. All nodes that are children to the Layer will be rendered into the surface. If the area that is needed for the children to be drawn is know, the layerRect property should be set as this can enhance performance.
Motion
Motions are used to animate properties of nodes or any other type of objects. The motions are powered by an MotionController, typically associated with a Node. The most commonly used motion is the MotionTween which interpolates a property between two values over time.
MotionCallFunction
A motion that calls a custom function when it is fired.
MotionController
A class the controls the playback of motions. To play back an motion it is passed to the MotionController's run method. The MotionController itself is typically a property of a Node and powered by the SpriteBox.
MotionDelay
A motion that doesn't perform any other task than taking time. This motion is typically used in a sequence to space out other events.
MotionGroup
A motion that plays the supplied motions in parallell. The duration of the MotionGroup will be the maximum of the durations of the motions used to compose this motion.
MotionInstant
A motion that doesn't have a duration. If this class is overridden to create custom instant motions, only the fire method should be overriden.
MotionInterval
The abstract class for an motion that changes properties over a time interval, optionally using an easing curve.
MotionRemoveNode
A motion that removes the supplied node from its parent when it's fired.
MotionRepeat
An motion that repeats another motion a fixed number of times.
MotionRepeatForever
A motion that repeats a motion an indefinite number of times.
MotionSequence
A motion that plays a number of supplied motions in sequence. The duration of the MotionSequence with be the sum of the durations of the motions passed in to the constructor.
MotionSpline
The spline motion is used to animate a point along a spline definied by a set of points.
MotionTween<T>
A motion that tweens a property between two values, optionally using an animation curve. This is one of the most common building blocks when creating motions. The tween class can be used to animate properties of the type Point, Size, Rect, double, or Color.
NineSliceSprite
A NineSliceSprite is similar to a Sprite, but it it can strech its inner area to fit the size of the Node. This is ideal for fast drawing of things like buttons.
Node
A base class for all objects that can be added to the sprite node tree and rendered to screen using SpriteBox and SpriteWidget.
Node3D
An node that transforms its children using a 3D perspective projection. This node type can be used to create 3D flips and other similar effects.
NodeWithSize
The super class of any Node that has a size.
ParticleSystem
A particle system uses a large number of sprites to draw complex effects such as explosions, smoke, rain, or fire. There are a number of properties that can be set to control the look of the particle system. Most of the properties have a base value and a variance, these values are used when creating each individual particle. For instance, by setting the life to 1.0 and the lifeVar to 0.5, each particle will get a life time in the range of 0.5 to 1.5.
Sprite
A Sprite is a Node that renders a bitmap image to the screen.
SpriteBox
A RenderBox that draws a sprite world represented by a Node tree.
SpriteBoxEvent
An event that is passed down the node tree when pointer events occur. The SpriteBoxEvent is typically handled in the handleEvent method of Node.
SpritePaint
Defines properties, such as opacity and blendMode that are shared between Nodes that render textures to screen.
SpriteSheet
A sprite sheet packs a number of smaller images into a single large image.
SpriteTexture
A texture represents a rectangular area of an image and is typically used to draw a sprite to the screen.
SpriteWidget
A widget that uses a SpriteBox to render a sprite node tree to the screen.
TexturedLine
A Node that draws a polyline from a list of points using the provided SpriteTexture. The textured line draws static lines. If you want to create an animated line, consider using the EffectLine instead.
TexturedLinePainter
Draws a polyline to a Canvas from a list of points using the provided SpriteTexture.
VirtualJoystick
Provides a virtual joystick that can easily be added to your sprite scene.

Enums

EffectLineAnimationMode
Used by EffectLine to determine how the texture of the line is animated.
EffectLineWidthMode
Used by EffectLine to determine how the width of the line is calculated.
PointerEventType
Defines types for pointer events.
SpriteBoxTransformMode
Options for setting up a SpriteBox's coordinate system.

Functions

convertDegrees2Radians(double degrees) double
Converts degrees to radians.
convertRadians2Degrees(double radians) double
Converts radians to degrees.
deserializeParticleSystem(Map data, {ParticleSystem? particleSystem, SpriteTexture? texture}) ParticleSystem
Creates a particle system from a json serialization.
randomBool() bool
Returns either true or false in a most random fashion.
randomDouble() double
Returns a random double in the range of 0.0 to 1.0.
randomInt(int max) int
Returns a random int from 0 to max - 1.
randomSignedDouble() double
Returns a random double in the range of -1.0 to 1.0.
serializeParticleSystem(ParticleSystem system) Map
Creates a json serialization of the settings for a particle system.

Typedefs

MotionCallback = void Function()
Signature for callbacks used by the MotionCallFunction.
PointSetterCallback = void Function(Offset value)
Signature for callbacks used by the MotionSpline to set a Point value.
SetterCallback<T> = void Function(T value)
Signature for callbacks for setting properties, used by MotionTween.