Skip to content

Commit

Permalink
Merge pull request #2149 from Madadog/clamp-anim-ticks-1
Browse files Browse the repository at this point in the history
Clamp input to animEffect()
  • Loading branch information
nesbox authored Mar 2, 2023
2 parents ecbcae5 + e9f68eb commit 40c5f2d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/studio/studio.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,10 @@ static inline float animEffect(AnimEffect effect, float x)
static void animTick(Movie* movie)
{
for(Anim* it = movie->items, *end = it + movie->count; it != end; ++it)
*it->value = lerp(it->start, it->end, animEffect(it->effect, (float)movie->tick / it->time));
{
float tick = (float)(movie->tick < it->time ? movie->tick : it->time);
*it->value = lerp(it->start, it->end, animEffect(it->effect, tick / it->time));
}
}

void processAnim(Movie* movie, void* data)
Expand Down

0 comments on commit 40c5f2d

Please sign in to comment.