diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 4f57663c..f3139010 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -897,20 +897,17 @@ void main () -(defn get-looped-animation-point [^Animation animation total-time] - (loop [time total-time] - (if (> (- time (animation! animation :get-animation-duration)) 0) - (recur (- time (animation! animation :get-animation-duration))) - time))) +(defn get-looped-animation-point [^Animation animation ^double total-time] + (mod total-time (animation! animation :get-animation-duration))) (defn animate [{:keys [anim anim-loop? anim-merges anim-start] :or {anim-loop? true} :as entity} {:keys [delta-time total-time] :or {delta-time 0} :as screen}] (let [current-frame-index (animation! ^Animation anim :get-key-frame-index (if anim-loop? - (get-looped-animation-point anim (- total-time anim-start)) + (get-looped-animation-point anim ^double (- total-time anim-start)) (- total-time anim-start))) previous-frame-index (animation! ^Animation anim :get-key-frame-index (if anim-loop? - (get-looped-animation-point anim (- total-time anim-start delta-time)) + (get-looped-animation-point anim ^double (- total-time anim-start delta-time)) (- total-time anim-start delta-time)))] (merge entity (animation->texture (update-in screen [:total-time] #(- % anim-start)) anim