10 #define _USE_MATH_DEFINES
16 template<
typename KeyType >
56 template<
typename KeyType >
66 template<
typename KeyType >
69 TimeType timeInterval = right.Time - left.Time;
70 TimeType progress = ( time - left.Time ) / timeInterval;
72 progress = 0.5 + 0.5 * cos( progress * M_PI );
74 auto leftResult = ( 1.0 + (-1.0f) * progress ) * left.Value;
75 auto rightResult = progress * right.Value;
77 return static_cast< KeyType
>( leftResult + rightResult );
82 template<
typename KeyType >
91 template<
typename KeyType >
99 template<
typename KeyType >
virtual KeyType RightTangent(const Key< KeyType > &left, const Key< KeyType > &right) const override
Returns curve tangent. Function can be used by surrounding interpolators to smooth curve...
Definition: CosinusInterpolator.h:100
Base class for interpolators.
Definition: IInterpolator.h:38
virtual void Update(const Key< KeyType > &leftKey, const Key< KeyType > &rightKey, UPtr< const IInterpolator< KeyType > > &leftInterpolator, UPtr< const IInterpolator< KeyType > > &rightInterpolator) override
Function updates interpolator, when left or right key value changes.
Definition: CosinusInterpolator.h:83
Cosinus interpolator.
Definition: CosinusInterpolator.h:17
virtual KeyType Interpolate(TimeType time, Key< KeyType > &left, Key< KeyType > &right) override
Main function invoked by evaluator.
Definition: CosinusInterpolator.h:67
Animation key.
Definition: IInterpolator.h:21
virtual KeyType LeftTangent(const Key< KeyType > &left, const Key< KeyType > &right) const override
Returns curve tangent. Function can be used by surrounding interpolators to smooth curve...
Definition: CosinusInterpolator.h:92