Game Development Reference
In-Depth Information
double ease_out(double t)
{
return 1.0 - ease_in<function>( 1.0 - t );
}
Ease In/Out
Ease In/Out combines both previous ease functions, during the lower half of the curve tra-
versaltheeaseinbehaviorwillbeapplied,sinceweareapplyingittoonlyhalfofthefunc-
tion we bias the parameter by two and scale it down by 0.5, and on the upper half of the
curve, the ease out behavior will be applied, this time we apply the bias to ensure the curve
starts from 0.5 and fits the remaining space up to 1.
template <double (*function)(double)>
double ease_in_out(double t)
{
if ( t < 0.5 )
{ return ease_in<function>( 2.0 * t ) * 0.5; }
else
{ return 0.5 + ease_out<function>( 2.0 * t - 1.0 ) * 0.5;
}
}
There are a number of well-defined curves used by different libraries and applications, we
will implement the most popular ones, it is definitely possible to provide custom curve
functions and extend the library of animation effects as needed.
7.1.2 Ease Curves
The following few pages provide a reference for the different type of ease curves that we
will implement. This is notanexhaustive list ofcurves, butenoughtodevelop alargevari-
ety of effects.
Having this library of curves is useful, but there needs to be a system that can be used to
animate parameters over the different set of curves, over a specified amount of time, para-
metersthatwillcontrolmovement,colors,fades,etc.Inthenextsectionwewillimplement
a system to interpolate values along the curves presented here.
Search WWH ::




Custom Search