removeAt method

void removeAt(
  1. int index
)

Removes the particle at index by swapping the last live particle into its slot.

Implementation

void removeAt(int index) {
  final last = --_length;
  if (index != last) {
    posX[index] = posX[last];
    posY[index] = posY[last];
    velX[index] = velX[last];
    velY[index] = velY[last];
    age[index] = age[last];
    invLifespan[index] = invLifespan[last];
    baseSize[index] = baseSize[last];
    size[index] = size[last];
    rotation[index] = rotation[last];
    spin[index] = spin[last];
    color[index] = color[last];
  }
}