initialize method
void
initialize({})
Inicializa el engine
Implementation
void initialize({
required double width,
required double height,
double? inhaleSec,
double? holdInSec,
double? exhaleSec,
double? holdOutSec,
}) {
canvasWidth = width;
canvasHeight = height;
if (inhaleSec != null) inhaleTime = inhaleSec;
if (holdInSec != null) holdInTime = holdInSec;
if (exhaleSec != null) exhaleTime = exhaleSec;
if (holdOutSec != null) holdOutTime = holdOutSec;
_totalCycleTime = inhaleTime + holdInTime + exhaleTime + holdOutTime;
// Iniciar en fase de inhalación
phase = BreathingPhase.inhale;
spherePosition = 0.0;
_phaseTimer = 0.0;
attentionScore = 0.0;
sessionAttentionAvg = 0.0;
_attentionSamples = 0;
// Para modo libre
freeBounceVelocity = 0.3 + _random.nextDouble() * 0.2;
}