Fixed player animation hiccups

This commit is contained in:
John Shaver 2017-06-24 22:06:23 -07:00
parent 997ac70c1d
commit 320bbae131
2 changed files with 8 additions and 2 deletions

View File

@ -12,4 +12,4 @@ calculateAnimation current cycle range =
rangeDiff =
end - start
in
(toFloat (current % cycle)) / (toFloat (cycle)) * rangeDiff + start
(toFloat (current % (cycle + 1))) / (toFloat (cycle)) * rangeDiff + start

View File

@ -33,8 +33,14 @@ render model =
maxOpen =
90
frameCount =
calculateAnimation (model.time |> inMilliseconds |> round) cycleTime ( 0, maxOpen * 2 )
openness =
calculateAnimation (model.time |> inMilliseconds |> round) cycleTime ( 0, maxOpen )
if frameCount > maxOpen then
maxOpen - toFloat (round (frameCount) % maxOpen)
else
frameCount
in
pacman ( 250, 450 ) (degrees openness)