update method

void update(
  1. double dt
)

Implementation

void update(double dt) {
  _time += dt;
  camera.update(dt);

  for (final p in particles) {
    final freqFactor = 1.0 + normalizedFrequency * 0.5;
    p.energy = 0.3 + 0.7 * ((sin(_time * 2 * freqFactor + p.pulsePhase) + 1) / 2) * audioAmplitude;
    final newRadius = p.baseRadius * wavelength;
    (p.vrElement as VRParticle)
      ..position = Offset3D.fromSpherical(p.theta, p.phi, newRadius)
      ..color = Color.lerp(_getRandomStarColor(), frequencyModulatedColor, normalizedFrequency * 0.3)!
          .withValues(alpha: 0.5 + 0.5 * p.energy);
  }

  for (final r in rings) {
    final freqSpeed = 0.5 + normalizedFrequency * 1.5;
    final pulse = sin(_time * audioBeat * freqSpeed + r.pulsePhase) * audioAmplitude * 0.1;
    final newRadius = (r.baseRadius + pulse) * wavelength;
    (r.vrElement as VRParticle)
      ..position = Offset3D.fromSpherical(r.theta, r.phi, newRadius)
      ..color = Color.lerp(secondaryColor, frequencyModulatedColor, normalizedFrequency * 0.5)!
          .withValues(alpha: 0.6 + audioAmplitude * 0.4);
  }

  for (final c in constellations) {
    c.energy = 0.5 + 0.5 * sin(_time * 1.5 + c.pulsePhase) * audioCoherence;
    (c.vrElement as VRParticle).color = Colors.white.withValues(alpha: 0.5 + 0.5 * c.energy);
  }

  notifyListeners();
}