float PathAnimation::progress() { float progress = AbstractAnimation::progress(); switch(easing_) { case Easing::Linear: { return progress; break; } case Easing::InOutQuint: { return easeInOutQuint(progress, 0.0f, progress, 1.0f); break; } case Easing::InQuint: { return easeInQuint(progress, 0.0f, progress, 1.0f); break; } case Easing::OutQuint: { return easeOutQuint(progress, 0.0f, progress, 1.0f); break; } case Easing::OutElastic: { return easeOutElastic(progress); break; } } // "backup" return value return progress; }
/** * Easing equation function for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration. * * @param t Current time (in frames or seconds). * @return The correct value. */ static qreal easeOutInQuint(qreal t) { if (t < 0.5) return easeOutQuint (2*t)/2; return easeInQuint(2*t - 1)/2 + 0.5; }