Files
rive-cpp/include/animation/cubic_interpolator.hpp
2020-08-16 18:20:11 -07:00

23 lines
652 B
C++

#ifndef _RIVE_CUBIC_INTERPOLATOR_HPP_
#define _RIVE_CUBIC_INTERPOLATOR_HPP_
#include "generated/animation/cubic_interpolator_base.hpp"
namespace rive
{
class CubicInterpolator : public CubicInterpolatorBase
{
private:
static constexpr int SplineTableSize = 11;
static constexpr float SampleStepSize = 1.0f / (SplineTableSize - 1.0f);
float m_Values[SplineTableSize];
float getT(float x) const;
public:
void onAddedClean(CoreContext* context) override {}
void onAddedDirty(CoreContext* context) override;
/// Convert a linear interpolation factor to an eased one.
float transform(float value) const;
};
} // namespace rive
#endif