Particle class

The Particle class represents a single particle in the particle network. It contains properties for position, velocity, color, size, and visibility.

Constructors

Particle({required Offset position, required Offset velocity, required Color color, required double size, bool isVisible = true})
Constructor to initialize the particle's properties.

Properties

acceleration Offset
Accumulated acceleration from forces applied during this frame.
getter/setter pair
color Color
The color of the particle.
getter/setter pair
defaultVelocity Offset
The default velocity of the particle, used to reset its speed.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isVisible bool
A flag indicating whether the particle is visible within the viewport.
getter/setter pair
mass double
The mass of the particle, affects how much force is needed to move it.
final
position Offset
The current position of the particle.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
The size of the particle.
getter/setter pair
velocity Offset
The current velocity of the particle.
getter/setter pair
wasAccelerated bool
A flag indicating whether the particle was affected by touch interaction.
getter/setter pair

Methods

applyForce(Offset force) → void
Applies a force to the particle based on F = ma (a = F/m).
handleScreenBoundaries(Size bounds) → void
Handles collisions with the screen boundaries by reversing the velocity.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
update(Size bounds) → void
Updates the particle's position and velocity based on its current state.
updateVisibility(Size bounds) → void
Updates the visibility status of the particle based on its position.

Operators

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