qreal value(qreal t) { qreal o = (_o < 0) ? 1.70158f : _o; switch(_t) { case In: return easeInBack(t, o); case Out: return easeOutBack(t, o); case InOut: return easeInOutBack(t, o); case OutIn: return easeOutInBack(t, o); default: return t; } }
double valueForProgress ( double a_fProgress ) const { double fOvershoot = (m_fOvershoot < 0) ? 1.70158 : m_fOvershoot; switch ( m_eType ) { case In: return easeInBack(a_fProgress, fOvershoot); case Out: return easeOutBack(a_fProgress, fOvershoot); case InOut: return easeInOutBack(a_fProgress, fOvershoot); case OutIn: return easeOutInBack(a_fProgress, fOvershoot); default: return a_fProgress; } }
static qreal easeInBack(qreal t) { const qreal s = 1.70158; return easeInBack(t, s); }
/** * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration. * * @param t Current time (in frames or seconds). * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). * @return The correct value. */ static qreal easeOutInBack(qreal t, qreal s) { if (t < 0.5) return easeOutBack (2*t, s)/2; return easeInBack(2*t - 1, s)/2 + 0.5; }