tweeny icon indicating copy to clipboard operation
tweeny copied to clipboard

Certain easing functions appear to never fully complete

Open harryr0se opened this issue 9 months ago • 2 comments

Heya 👋

I've noticed that for some easing functions the value passed to to() is never reached, I'm not sure if this is on purpose or not but I didn't see it mentioned in the docs (I might have missed it)

I wrote the following loop to test

for (int i = 1; i <= 32; ++i)
{
    auto easing = static_cast<tweeny::easing::enumerated>(i);
    int expectedEnd = -369;
    auto tween = tweeny::from(0).to(expectedEnd).during(500).via(easing);
    tween.seek(1.0f);
    auto actualEnd = tween.step(1);
    if (actualEnd != expectedEnd)
        printf("Easing %s: never reached expected value %i, finished at %i\n", toString(easing), expectedEnd, actualEnd);
}

Which found the following easing values to have this behaviour

Easing stepped: never reached expected value -369, finished at 0
Easing quadraticInOut: never reached expected value -369, finished at -368
Easing cubicInOut: never reached expected value -369, finished at -368
Easing quarticInOut: never reached expected value -369, finished at -368
Easing quinticInOut: never reached expected value -369, finished at -368
Easing sinusoidalInOut: never reached expected value -369, finished at -368
Easing exponentialOut: never reached expected value -369, finished at -368
Easing exponentialInOut: never reached expected value -369, finished at -367
Easing circularInOut: never reached expected value -369, finished at -368
Easing backInOut: never reached expected value -369, finished at -368

Do you know it this is expected behaviour?

harryr0se avatar May 17 '25 13:05 harryr0se

Clearly a bug. Does this behaviour also occurs when reaching positive values? It might be a problem when dealing with negative numbers.

mobius3 avatar May 18 '25 00:05 mobius3

Clearly a bug. Does this behaviour also occurs when reaching positive values? It might be a problem when dealing with negative numbers.

Issue appears to also occur with positive values, changed -369 to 369, I get the following output:

Easing stepped: never reached expected value 369, finished at 0
Easing quadraticInOut: never reached expected value 369, finished at 368
Easing cubicInOut: never reached expected value 369, finished at 368
Easing quarticInOut: never reached expected value 369, finished at 368
Easing quinticInOut: never reached expected value 369, finished at 368
Easing sinusoidalInOut: never reached expected value 369, finished at 368
Easing exponentialOut: never reached expected value 369, finished at 368
Easing exponentialInOut: never reached expected value 369, finished at 367
Easing circularInOut: never reached expected value 369, finished at 368
Easing backInOut: never reached expected value 369, finished at 368

harryr0se avatar May 18 '25 09:05 harryr0se