common_tasks: fix common_easing_animate

Make it actually arrive at the target value
This commit is contained in:
Andrei Alexeyev 2021-06-23 05:04:55 +03:00
parent 2e5000299f
commit c1f36bf0a5
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -315,13 +315,13 @@ cmplx common_wander(cmplx origin, double dist, Rect bounds) {
}
DEFINE_EXTERN_TASK(common_easing_animate) {
float from = *ARGS.value;
float scale = ARGS.to - from;
float ftime = ARGS.duration;
float from = *ARGS.value;
float scale = ARGS.to - from;
float ftime = ARGS.duration;
for(int t = 0; t < ARGS.duration;t++) {
YIELD;
*ARGS.value = from + scale * ARGS.ease(t / ftime);
for(int t = 1; t <= ARGS.duration; t++) {
YIELD;
*ARGS.value = from + scale * ARGS.ease(t / ftime);
}
}