12constexpr float kPi = 3.14159265358979323846f;
13constexpr float kPi2 = kPi / 2.f;
39 return -(p * (p - 2.f));
46 return p < 0.5f ? 2.f * p * p : (-2.f * p * p) + (4.f * p) - 1.f;
56 const float f = (p - 1.f);
57 return f * f * f + 1.f;
65 return 4.f * p * p * p;
67 const float f = ((2.f * p) - 2.f);
68 return 0.5f * f * f * f + 1.f;
78 const float f = (p - 1.f);
79 return f * f * f * (1.f - p) + 1.f;
87 return 8.f * p * p * p * p;
89 const float f = (p - 1.f);
90 return -8.f * f * f * f * f + 1.f;
95 return p * p * p * p * p;
100 const float f = (p - 1.f);
101 return f * f * f * f * f + 1.f;
109 return 16.f * p * p * p * p * p;
111 const float f = ((2.f * p) - 2.f);
112 return 0.5f * f * f * f * f * f + 1.f;
117 return std::sin((p - 1.f) * kPi2) + 1.f;
122 return std::sin(p * kPi2);
127 return 0.5f * (1.f - std::cos(p * kPi));
132 return 1.f - std::sqrt(1.f - (p * p));
137 return std::sqrt((2.f - p) * p);
145 return 0.5f * (1.f - std::sqrt(1.f - 4.f * (p * p)));
147 return 0.5f * (std::sqrt(-((2.f * p) - 3.f) * ((2.f * p) - 1.f)) + 1.f);
152 return (p == 0.f) ? p : std::pow(2.f, 10.f * (p - 1.f));
157 return (p == 1.f) ? p : 1.f - std::pow(2.f, -10.f * p);
164 if (p == 0.f || p == 1.f) {
169 return 0.5f * std::pow(2.f, (20.f * p) - 10.f);
171 return -0.5f * std::pow(2.f, (-20.f * p) + 10.f) + 1.f;
176 return std::sin(13.f * kPi2 * p) * std::pow(2.f, 10.f * (p - 1.f));
181 return std::sin(-13.f * kPi2 * (p + 1.f)) * std::pow(2.f, -10.f * p) + 1.f;
189 return 0.5f * std::sin(13.f * kPi2 * (2.f * p)) *
190 std::pow(2.f, 10.f * ((2.f * p) - 1.f));
192 return 0.5f * (std::sin(-13.f * kPi2 * ((2.f * p - 1.f) + 1.f)) *
193 std::pow(2.f, -10.f * (2.f * p - 1.f)) +
199 return p * p * p - p * std::sin(p * kPi);
204 const float f = (1.f - p);
205 return 1.f - (f * f * f - f * std::sin(f * kPi));
213 const float f = 2.f * p;
214 return 0.5f * (f * f * f - f * std::sin(f * kPi));
216 const float f = (1.f - (2.f * p - 1.f));
217 return 0.5f * (1.f - (f * f * f - f * std::sin(f * kPi))) + 0.5f;
225 if (p < 4.f / 11.f) {
226 return (121.f * p * p) / 16.f;
229 if (p < 8.f / 11.f) {
230 return (363.f / 40.f * p * p) - (99.f / 10.f * p) + 17.f / 5.f;
233 if (p < 9.f / 10.f) {
234 return (4356.f / 361.f * p * p) - (35442.f / 1805.f * p) + 16061.f / 1805.f;
237 return (54.f / 5.f * p * p) - (513 / 25.f * p) + 268 / 25.f;
244 return 0.5f *
BounceOut(p * 2.f - 1.f) + 0.5f;
258 easing_function_(std::move(easing_function)),
266 if (current_ >= duration_) {
274 *value_ = from_ + (to_ - from_) * easing_function_(current_ / duration_);
Animator(float *from, float to=0.f, Duration duration=std::chrono::milliseconds(250), easing::Function easing_function=easing::Linear, Duration delay=std::chrono::milliseconds(0))
void OnAnimation(Params &)
Duration duration() const
このアニメーションステップが表す期間。
void RequestAnimationFrame()
RequestAnimationFrameは、次のアニメーションサイクルで新しいフレームが描画されるよう要求する関数です。
FTXUIのftxui::animation::easing::名前空間。
float CircularInOut(float p)
float BounceInOut(float p)
float CubicInOut(float p)
float Linear(float p)
直線 y = x に基づく
float CircularOut(float p)
float ExponentialInOut(float p)
float ElasticInOut(float p)
float QuarticInOut(float p)
float QuadraticInOut(float p)
float QuarticOut(float p)
float CircularIn(float p)
float ExponentialOut(float p)
float QuadraticOut(float p)
float QuinticOut(float p)
float QuadraticIn(float p)
放物線 y = x^2 に基づく
float ExponentialIn(float p)
float ElasticOut(float p)
std::function< float(float)> Function
float QuinticInOut(float p)
FTXUIのftxui::animation::名前空間。
std::chrono::duration< float > Duration