Fixed player animation hiccups
This commit is contained in:
parent
997ac70c1d
commit
320bbae131
2 changed files with 8 additions and 2 deletions
|
@ -12,4 +12,4 @@ calculateAnimation current cycle range =
|
||||||
rangeDiff =
|
rangeDiff =
|
||||||
end - start
|
end - start
|
||||||
in
|
in
|
||||||
(toFloat (current % cycle)) / (toFloat (cycle)) * rangeDiff + start
|
(toFloat (current % (cycle + 1))) / (toFloat (cycle)) * rangeDiff + start
|
||||||
|
|
|
@ -33,8 +33,14 @@ render model =
|
||||||
maxOpen =
|
maxOpen =
|
||||||
90
|
90
|
||||||
|
|
||||||
|
frameCount =
|
||||||
|
calculateAnimation (model.time |> inMilliseconds |> round) cycleTime ( 0, maxOpen * 2 )
|
||||||
|
|
||||||
openness =
|
openness =
|
||||||
calculateAnimation (model.time |> inMilliseconds |> round) cycleTime ( 0, maxOpen )
|
if frameCount > maxOpen then
|
||||||
|
maxOpen - toFloat (round (frameCount) % maxOpen)
|
||||||
|
else
|
||||||
|
frameCount
|
||||||
in
|
in
|
||||||
pacman ( 250, 450 ) (degrees openness)
|
pacman ( 250, 450 ) (degrees openness)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue