Exemplo n.º 1
0
void ofxPenner::update() {
    float t = ofGetElapsedTimef();
    for (map<int,parameter>::iterator iter=params.begin(); iter!=params.end(); iter++) {
        parameter &p = iter->second;
        if (p.bEasing) {
       
            float delta = t-p.time;
            if (delta<p.duration) {
                switch (p.ease_function) {
                    case EASE_OUT_BACK:
                        p.v = easeOutBack(delta, p.b, p.c, p.duration);
                        break;
                    case EASE_OUT_QUAD:
                        p.v = easeOutQuad(delta, p.b, p.c, p.duration);
                        
                    default:
                        break;
                }
                
            } else {
                p.v = p.e;
                p.bEasing = false;
            }
        }
    }
}
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
static qreal easeOutBack(qreal t)
{
	const qreal s = 1.70158;
	return easeOutBack(t, s);
}
Exemplo n.º 5
0
/**
 * 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;
}