16#define USE_ELASTIC_BLEND
19 float time,
float begin,
float change,
float duration,
float overshoot)
22 return change * time * time * ((overshoot + 1) * time - overshoot) + begin;
26 float time,
float begin,
float change,
float duration,
float overshoot)
28 time = time / duration - 1;
29 return change * (time * time * ((overshoot + 1) * time + overshoot) + 1) + begin;
33 float time,
float begin,
float change,
float duration,
float overshoot)
36 if ((time /= duration / 2) < 1.0f) {
37 return change / 2 * (time * time * ((overshoot + 1) * time - overshoot)) + begin;
40 return change / 2 * (time * time * ((overshoot + 1) * time + overshoot) + 2) + begin;
46 if (time < (1 / 2.75f)) {
47 return change * (7.5625f * time *
time) + begin;
49 if (time < (2 / 2.75f)) {
50 time -= (1.5f / 2.75f);
51 return change * ((7.5625f *
time) * time + 0.75f) + begin;
53 if (time < (2.5f / 2.75f)) {
54 time -= (2.25f / 2.75f);
55 return change * ((7.5625f *
time) * time + 0.9375f) + begin;
57 time -= (2.625f / 2.75f);
58 return change * ((7.5625f *
time) * time + 0.984375f) + begin;
68 if (time < duration / 2) {
72 change * 0.5f + begin;
78 return -change * (
sqrtf(1 - time * time) - 1) + begin;
83 time = time / duration - 1;
84 return change *
sqrtf(1 - time * time) + begin;
89 if ((time /= duration / 2) < 1.0f) {
90 return -change / 2 * (
sqrtf(1 - time * time) - 1) + begin;
93 return change / 2 * (
sqrtf(1 - time * time) + 1) + begin;
99 return change * time * time * time + begin;
104 time = time / duration - 1;
105 return change * (time * time * time + 1) + begin;
110 if ((time /= duration / 2) < 1.0f) {
111 return change / 2 * time * time * time + begin;
114 return change / 2 * (time * time * time + 2) + begin;
117#ifdef USE_ELASTIC_BLEND
123 float time,
float change,
float duration,
float amplitude,
float s,
float f)
128 const float t =
fabsf(s);
130 f *= amplitude /
fabsf(change);
136 if (
fabsf(time * duration) < t) {
137 float l =
fabsf(time * duration) / t;
138 f = (f *
l) + (1.0f -
l);
147 float time,
float begin,
float change,
float duration,
float amplitude,
float period)
156 if ((time /= duration) == 1.0f) {
157 return begin + change;
161 period = duration * 0.3f;
163 if (!amplitude || amplitude <
fabsf(change)) {
165#ifdef USE_ELASTIC_BLEND
174 return (-f * (amplitude *
powf(2, 10 * time) *
175 sinf((time * duration - s) * (2 * (
float)
M_PI) / period))) +
180 float time,
float begin,
float change,
float duration,
float amplitude,
float period)
188 if ((time /= duration) == 1.0f) {
189 return begin + change;
193 period = duration * 0.3f;
195 if (!amplitude || amplitude <
fabsf(change)) {
197#ifdef USE_ELASTIC_BLEND
206 return (f * (amplitude *
powf(2, 10 * time) *
207 sinf((time * duration - s) * (2 * (
float)
M_PI) / period))) +
212 float time,
float begin,
float change,
float duration,
float amplitude,
float period)
220 if ((time /= duration / 2) == 2.0f) {
221 return begin + change;
225 period = duration * (0.3f * 1.5f);
227 if (!amplitude || amplitude <
fabsf(change)) {
229#ifdef USE_ELASTIC_BLEND
240 return (f * (amplitude *
powf(2, 10 * time) *
241 sinf((time * duration - s) * (2 * (
float)
M_PI) / period))) +
247 return (f * (amplitude *
powf(2, 10 * time) *
248 sinf((time * duration - s) * (2 * (
float)
M_PI) / period))) +
253static const float pow_scale = 1.0f / (1.0f - 0.0009765625f);
273 float duration_half = duration / 2.0f;
274 float change_half = change / 2.0f;
275 if (time <= duration_half) {
279 time - duration_half, begin + change_half, change_half, duration_half);
284 return change * time / duration + begin;
290 return change * time * time + begin;
296 return -change * time * (time - 2) + begin;
301 if ((time /= duration / 2) < 1.0f) {
302 return change / 2 * time * time + begin;
305 return -change / 2 * (time * (time - 2) - 1) + begin;
311 return change * time * time * time * time + begin;
316 time = time / duration - 1;
317 return -change * (time * time * time * time - 1) + begin;
322 if ((time /= duration / 2) < 1.0f) {
323 return change / 2 * time * time * time * time + begin;
326 return -change / 2 * (time * time * time * time - 2) + begin;
332 return change * time * time * time * time * time + begin;
336 time = time / duration - 1;
337 return change * (time * time * time * time * time + 1) + begin;
341 if ((time /= duration / 2) < 1.0f) {
342 return change / 2 * time * time * time * time * time + begin;
345 return change / 2 * (time * time * time * time * time + 2) + begin;
350 return -change *
cosf(time / duration * (
float)
M_PI_2) + change + begin;
355 return change *
sinf(time / duration * (
float)
M_PI_2) + begin;
360 return -change / 2 * (
cosf((
float)
M_PI * time / duration) - 1) + begin;
ATTR_WARN_UNUSED_RESULT const BMLoop * l
float BLI_easing_sine_ease_in(float time, float begin, float change, float duration)
float BLI_easing_back_ease_out(float time, float begin, float change, float duration, float overshoot)
float BLI_easing_linear_ease(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_out(float time, float begin, float change, float duration)
float BLI_easing_quart_ease_in_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_quart_ease_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_circ_ease_in(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_expo_ease_out(float time, float begin, float change, float duration)
float BLI_easing_elastic_ease_in(float time, float begin, float change, float duration, float amplitude, float period)
float BLI_easing_quad_ease_in_out(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)
float BLI_easing_cubic_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_quint_ease_in(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_bounce_ease_out(float time, float begin, float change, float duration)
float BLI_easing_quad_ease_in(float time, float begin, float change, float duration)
float BLI_easing_quad_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_cubic_ease_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)
static float elastic_blend(float time, float change, float duration, float amplitude, float s, float f)
float BLI_easing_quint_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_expo_ease_in_out(float time, float begin, float change, float duration)
static const float pow_min
float BLI_easing_quart_ease_in(float time, float begin, float change, float duration)
static const float pow_scale
float BLI_easing_back_ease_in_out(float time, float begin, float change, float duration, float overshoot)
float BLI_easing_cubic_ease_in_out(float time, float begin, float change, float duration)
float BLI_easing_sine_ease_in_out(float time, float begin, float change, float duration)
draw_view in_light_buf[] float