Ensure progress is 1 at end of animation
This commit is contained in:
parent
de73171451
commit
9d8a5d303a
1 changed files with 5 additions and 7 deletions
12
src/anim.c
12
src/anim.c
|
@ -42,20 +42,18 @@ int hexagram_anim_step(hexagram_anim *anim, hexagram_anim_progress_fn *fn) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interval <= offset + duration) {
|
if (offset + duration >= interval) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += duration;
|
offset += duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine progress through current stop */
|
||||||
if (i == anim->count) {
|
if (i == anim->count) {
|
||||||
/* We are apparently at the end. */
|
i--;
|
||||||
return 0;
|
progress = 1.0;
|
||||||
}
|
} else if (fn) {
|
||||||
|
|
||||||
/* Determine current progress through current stop */
|
|
||||||
if (fn) {
|
|
||||||
progress = fn(&anim->stops[i],
|
progress = fn(&anim->stops[i],
|
||||||
(interval - offset) / anim->stops[i].duration);
|
(interval - offset) / anim->stops[i].duration);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue