void ActorBarline::Run(double TimeDelta, double Ratio) { if (AnimationProgress > 0) { float PosY = pow(AnimationProgress / AnimationTime, 2) * PlayfieldHeight + ScreenOffset; Alpha = 1 - AnimationProgress; SetPositionY(PosY); AnimationProgress -= TimeDelta; if (AnimationProgress <= 0) AnimationProgress = 0; return; } if (Parent->GetMeasure() % 2) { Red = 1; Blue = Green = 0; if (Ratio > RadioThreshold) // Red to blue { double diff = Ratio - RadioThreshold; double duration = (1 - RadioThreshold); Red = LerpRatio(1.0, 0.0, diff, duration ); Blue = LerpRatio(0.0, BLUE_CONSTANT, diff, duration); } }else { Red = 0.0; Blue = 200.f / 255.f; if (Ratio > RadioThreshold) // Blue to red { float diff = Ratio - RadioThreshold; double duration = (1 - RadioThreshold); Red = LerpRatio(0.0, 1.0, diff, duration); Blue = LerpRatio(BLUE_CONSTANT, 0.0, diff, duration); } } SetPositionY(Ratio * (float)PlayfieldHeight); if (Parent->GetMeasure() % 2) SetPositionY(PlayfieldHeight - GetPosition().y); SetPositionY(GetPosition().y + ScreenOffset); // assert(GetPosition().y > ScreenOffset); }
void ActorJudgment::Run(double delta) { if (AnimTime > 0) { SetScale( Vec2(LerpRatio (GetScale().x, 1.0f, AnimDuration - AnimTime, AnimDuration), LerpRatio (GetScale().y, 1.0f, AnimDuration - AnimTime, AnimDuration) ) ); } AnimTime -= delta; if (AnimTime < -1) { Alpha -= delta; // Fade out in one second } }
void GameObject::Animate(float delta, float songTime) { if (GetPosition().x == 0) { Alpha = 0; return; } if (AnimationStatus == 0) { if (fadein_time >= 0) { Alpha = 0; if (waiting_time) { waiting_time -= delta; } if (waiting_time <= 0) { Alpha = LerpRatio(0.0, 1.0, FADEIN_DURATION - fadein_time, FADEIN_DURATION); SetScale(LerpRatio(1.5, 1.0, FADEIN_DURATION - fadein_time, FADEIN_DURATION)); fadein_time -= delta; } return; } Alpha = 1; SetScale(1); AnimationStatus = 1; } else if (AnimationStatus == 1) { if (fadeout_time) AnimationStatus = 2; } else { fadeout_time -= delta * 2; // alpha out Alpha = LerpRatio(1.0, 0.0, FADEOUT_DURATION - fadeout_time, FADEOUT_DURATION); if (fadeout_time <= 0) { Alpha = 0; AnimationStatus = 3; // Remove only } // scale in if (endTime == 0) { SetScale(LerpRatio(1.0, 2.0, FADEOUT_DURATION - fadeout_time, FADEOUT_DURATION)); } else // Holds have a bigger scale-in SetScale(LerpRatio(1.3, 3.0, FADEOUT_DURATION - fadeout_time, FADEOUT_DURATION)); return; } if (BeingHeld == true) { float holdDuration = endTime - startTime; float Progress = songTime - startTime; SetScale(LerpRatio(1.0, 1.3, Progress, holdDuration)); Green = LerpRatio(0.5, 0.0, Progress, holdDuration); } }