speedSqr property

double get speedSqr

Gets the square of the speed of this particle.

Implementation

double get speedSqr => dx * dx + dy * dy;
set speedSqr (double value)

Sets the square of the speed of this particle.

If a negative value is provided the direction is flipped and the absolute value is used to calculate the square root.

Implementation

set speedSqr(double value) {
  speed = math.sqrt(value.abs()) * value.sign;
}