Easing transitions between current and previous values, mess up the max value.
in
Programming Questions
•
8 months ago
So I have a stream of data that gets updated once every second from a hardware device. I am using the values in that stream to determine the size of a ellipse.
To make the animation more fluid, I set up an array to ease the animation between the current value and the previous.
This is the easing code im using.
- float dCh1 = ch1 - channels[1].getPreviousValue().value;
- if (abs(dCh1) > 1) {
- eCh1 += dCh1 * easing;
- }
It works to ease the animation, but it ends up ignoring the max values of "ch1"(the value before easing). Say the maximum possible value of "ch1" is 100, "eCh1" (the output of my easing), could go beyond 100.
my easing is set to .05 and my frame rate is 30 fps.
Anyone know of a way to correct this?
1