Particle class

The basic particle used by ParticleField. It includes properties common to most particle effects.

This class can be extended to add additional data or methods.

Constructors

Particle({double x = 0.0, double y = 0.0, double scale = 1.0, double rotation = 0.0, int frame = 0, Color color = Colors.black, double vx = 0.0, double vy = 0.0, double lifespan = 0.0, double age = 0.0})
Constructs a Particle instance.

Properties

age double
Value that can be useful for managing particle lifecycles. By default update adds 1 to this value.
getter/setter pair
color Color
A color that can be composited with the image frame via ParticleField.blendMode. For example, you could modify the opacity of particles by using BlendMode.srcIn (the default) and adjusting the opacity of the particle color:
getter/setter pair
frame int
The index of the frame to display from the particle field's ImageFrameProvider. For SpriteSheet this can exceed length, and will loop.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
lifespan double
Value that can be useful for managing particle lifecycles.
getter/setter pair
rotation double
The rotation of this particle in radians.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale double
The scale of this particle.
getter/setter pair
vx double
Horizontal velocity. By default update adds this value to x.
getter/setter pair
vy double
Vertical velocity. By default update adds this value to y.
getter/setter pair
x double
The horizontal position of this particle.
getter/setter pair
y double
The vertical position of this particle.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toOffset([Matrix4? transform]) Offset
Returns an Offset representing this particle's position, optionally with a transformation applied.
toString() String
A string representation of this object.
inherited
update({double? x, double? y, double? scale, double? rotation, int? frame, Color? color, double? vx, double? vy, double? lifespan, double? age}) → void
Sets any values specified, and runs basic logic:

Operators

operator ==(Object other) bool
The equality operator.
inherited