init method

void init()

Initializes the StarfieldController by creating the Stars.

Implementation

void init() {
  absoluteVelocity = calcAbsVelo(velocity);

  for (var i = 0; i < number; i++) {
    random = Math.Random();
    double dx = (random.nextDouble() * minX) - minX / 2;
    double dy = (random.nextDouble() * maxY) - maxY / 2;
    double dz = (random.nextDouble() * absoluteVelocity) + absoluteVelocity;
    stars.add(
      Star(
        baseDepth: revisedDepth,
        baseVelocity: absoluteVelocity,
        dx: dx,
        dy: dy,
        dz: dz,
      ),
    );
    transformStar(stars[i]);
  }
}