18#define USE_ELASTIC_BLEND
21 float time,
float begin,
float change,
float duration,
float overshoot)
24 return change * time * time * ((overshoot + 1) * time - overshoot) +
begin;
28 float time,
float begin,
float change,
float duration,
float overshoot)
30 time = time / duration - 1;
31 return change * (time * time * ((overshoot + 1) * time + overshoot) + 1) +
begin;
35 float time,
float begin,
float change,
float duration,
float overshoot)
38 if ((time /= duration / 2) < 1.0f) {
39 return change / 2 * (time * time * ((overshoot + 1) * time - overshoot)) +
begin;
42 return change / 2 * (time * time * ((overshoot + 1) * time + overshoot) + 2) +
begin;
48 if (time < (1 / 2.75f)) {
49 return change * (7.5625f * time * time) +
begin;
51 if (time < (2 / 2.75f)) {
52 time -= (1.5f / 2.75f);
53 return change * ((7.5625f * time) * time + 0.75f) +
begin;
55 if (time < (2.5f / 2.75f)) {
56 time -= (2.25f / 2.75f);
57 return change * ((7.5625f * time) * time + 0.9375f) +
begin;
59 time -= (2.625f / 2.75f);
60 return change * ((7.5625f * time) * time + 0.984375f) +
begin;
70 if (time < duration / 2) {
74 change * 0.5f +
begin;
80 return -change * (
sqrtf(1 - time * time) - 1) +
begin;
85 time = time / duration - 1;
86 return change *
sqrtf(1 - time * time) +
begin;
91 if ((time /= duration / 2) < 1.0f) {
92 return -change / 2 * (
sqrtf(1 - time * time) - 1) +
begin;
95 return change / 2 * (
sqrtf(1 - time * time) + 1) +
begin;
101 return change * time * time * time +
begin;
106 time = time / duration - 1;
107 return change * (time * time * time + 1) +
begin;
112 if ((time /= duration / 2) < 1.0f) {
113 return change / 2 * time * time * time +
begin;
116 return change / 2 * (time * time * time + 2) +
begin;
119#ifdef USE_ELASTIC_BLEND
125 float time,
float change,
float duration,
float amplitude,
float s,
float f)
130 const float t =
fabsf(s);
132 f *= amplitude /
fabsf(change);
138 if (
fabsf(time * duration) < t) {
139 float l =
fabsf(time * duration) / t;
140 f = (f *
l) + (1.0f -
l);
149 float time,
float begin,
float change,
float duration,
float amplitude,
float period)
158 if ((time /= duration) == 1.0f) {
159 return begin + change;
163 period = duration * 0.3f;
165 if (!amplitude || amplitude <
fabsf(change)) {
167#ifdef USE_ELASTIC_BLEND
176 return (-f * (amplitude *
powf(2, 10 * time) *
177 sinf((time * duration - s) * (2 *
float(
M_PI)) / period))) +
182 float time,
float begin,
float change,
float duration,
float amplitude,
float period)
190 if ((time /= duration) == 1.0f) {
191 return begin + change;
195 period = duration * 0.3f;
197 if (!amplitude || amplitude <
fabsf(change)) {
199#ifdef USE_ELASTIC_BLEND
208 return (f * (amplitude *
powf(2, 10 * time) *
209 sinf((time * duration - s) * (2 *
float(
M_PI)) / period))) +
214 float time,
float begin,
float change,
float duration,
float amplitude,
float period)
222 if ((time /= duration / 2) == 2.0f) {
223 return begin + change;
227 period = duration * (0.3f * 1.5f);
229 if (!amplitude || amplitude <
fabsf(change)) {
231#ifdef USE_ELASTIC_BLEND
242 return (f * (amplitude *
powf(2, 10 * time) *
243 sinf((time * duration - s) * (2 *
float(
M_PI)) / period))) +
249 return (f * (amplitude *
powf(2, 10 * time) *
250 sinf((time * duration - s) * (2 *
float(
M_PI)) / period))) +
255static const float pow_scale = 1.0f / (1.0f - 0.0009765625f);
275 float duration_half = duration / 2.0f;
276 float change_half = change / 2.0f;
277 if (time <= duration_half) {
281 time - duration_half,
begin + change_half, change_half, duration_half);
286 return change * time / duration +
begin;
292 return change * time * time +
begin;
298 return -change * time * (time - 2) +
begin;
303 if ((time /= duration / 2) < 1.0f) {
304 return change / 2 * time * time +
begin;
307 return -change / 2 * (time * (time - 2) - 1) +
begin;
313 return change * time * time * time * time +
begin;
318 time = time / duration - 1;
319 return -change * (time * time * time * time - 1) +
begin;
324 if ((time /= duration / 2) < 1.0f) {
325 return change / 2 * time * time * time * time +
begin;
328 return -change / 2 * (time * time * time * time - 2) +
begin;
334 return change * time * time * time * time * time +
begin;
338 time = time / duration - 1;
339 return change * (time * time * time * time * time + 1) +
begin;
343 if ((time /= duration / 2) < 1.0f) {
344 return change / 2 * time * time * time * time * time +
begin;
347 return change / 2 * (time * time * time * time * time + 2) +
begin;
352 return -change *
cosf(time / duration *
float(
M_PI_2)) + change +
begin;
362 return -change / 2 * (
cosf(
float(
M_PI) * time / duration) - 1) +
begin;
float BLI_easing_elastic_ease_in(float time, float begin, float change, float duration, float amplitude, float period)
float BLI_easing_quint_ease_out(float time, float begin, float change, float duration)
float BLI_easing_sine_ease_in(float time, float begin, float change, float duration)
float BLI_easing_back_ease_in_out(float time, float begin, float change, float duration, float overshoot)
float BLI_easing_expo_ease_in_out(float time, float begin, float change, float duration)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
float BLI_easing_quad_ease_out(float time, float begin, float change, float duration)
static float elastic_blend(float time, float change, float duration, float amplitude, float s, float f)
float BLI_easing_cubic_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_quart_ease_out(float time, float begin, float change, float duration)
float BLI_easing_cubic_ease_out(float time, float begin, float change, float duration)
float BLI_easing_sine_ease_out(float time, float begin, float change, float duration)
float BLI_easing_back_ease_out(float time, float begin, float change, float duration, float overshoot)
static const float pow_scale
float BLI_easing_linear_ease(float time, float begin, float change, float duration)
float BLI_easing_expo_ease_in(float time, float begin, float change, float duration)
float BLI_easing_bounce_ease_out(float time, float begin, float change, float duration)
float BLI_easing_circ_ease_out(float time, float begin, float change, float duration)
float BLI_easing_circ_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_quint_ease_in(float time, float begin, float change, float duration)
static const float pow_min
float BLI_easing_quad_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_back_ease_in(float time, float begin, float change, float duration, float overshoot)
float BLI_easing_quart_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_bounce_ease_in(float time, float begin, float change, float duration)
float BLI_easing_expo_ease_out(float time, float begin, float change, float duration)
float BLI_easing_bounce_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_quint_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_circ_ease_in(float time, float begin, float change, float duration)
float BLI_easing_elastic_ease_in_out(float time, float begin, float change, float duration, float amplitude, float period)
float BLI_easing_quad_ease_in(float time, float begin, float change, float duration)
float BLI_easing_quart_ease_in(float time, float begin, float change, float duration)
float BLI_easing_sine_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_cubic_ease_in(float time, float begin, float change, float duration)
float BLI_easing_elastic_ease_out(float time, float begin, float change, float duration, float amplitude, float period)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float