For every equation (Sine,Expo,Quint..) we have defined:
- easeIn
- easeOut
- easeInOut
Based on my template usage suggestion, we could extend the Animation mode:
enum
{
EaseIn,
EaseOut,
EaseInOut,
EaseOutIn
}
Then, assuming we have these variables setup this way:
iFrom = from:
iTo = to;
iDistance = to-from;
and let b=from and c=distance, now we can extend the switch statement this way:
template< class T, int mode >
float ease( float lastFrameTime )
{
...
float ret = iFrom;
switch( mode )
{
case EaseIn:
{
ret = T::easeIn( t, b, c, d );
break;
}
case EaseOut:
{
ret = T::easeOut( t, b, c, d );
break;
}
case EaseIn:
{
ret = T::easeInOut( t, b, c, d );
break;
}
case EaseOutIn:
{
float halfDistance = iDistance / 2.f;
if ( iTimeAccu < iDurationSecs / 2 )
ret = T::easeOut( t * 2, b, halfDistance, d );
else
ret = T::easeIn( ( t * 2 ) - d, b + halfDistance, halfDistance, d );
break;
}
}
return ret;
}
Original issue reported on code.google.com by manuel....@gmail.com on 14 Feb 2010 at 4:03
Original issue reported on code.google.com by
manuel....@gmail.com
on 14 Feb 2010 at 4:03Attachments: