Fix direction when looping.

Fixes hang @caudetgit caught. Fixes same issue that we caught on the runtime yesterday in #4776

Diffs=
53a8f9517 Fix direction when looping. (#4786)
diff --git a/.rive_head b/.rive_head
index 4ead8a7..5a706f9 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-4c5a576adaf493b2a152fb69b68021c07aca385f
+53a8f95178fbcfce0a775b6217c8108c48af4591
diff --git a/src/animation/linear_animation_instance.cpp b/src/animation/linear_animation_instance.cpp
index 702398e..56609d8 100644
--- a/src/animation/linear_animation_instance.cpp
+++ b/src/animation/linear_animation_instance.cpp
@@ -114,18 +114,12 @@
                 if (direction == 1 && frames >= end)
                 {
                     m_SpilledTime = (frames - end) / fps;
-                    m_Direction *= -1;
                     frames = end + (end - frames);
-                    m_Time = frames / fps;
-                    didLoop = true;
                 }
                 else if (direction == -1 && frames < start)
                 {
                     m_SpilledTime = (start - frames) / fps;
-                    m_Direction *= -1;
                     frames = start + (start - frames);
-                    m_Time = frames / fps;
-                    didLoop = true;
                 }
                 else
                 {
@@ -136,7 +130,10 @@
                     // where animations are not advanced on regular intervals.
                     break;
                 }
-                direction = speed() < 0 ? -m_Direction : m_Direction;
+                m_Time = frames / fps;
+                m_Direction *= -1;
+                direction *= -1;
+                didLoop = true;
             }
             break;
     }