Skip to content

Commit e5a1e99

Browse files
committed
Yay memory management
1 parent 7218e66 commit e5a1e99

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tick.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
rafCallbacks = [];
4040
if (t < timeline.currentTime)
4141
t = timeline.currentTime;
42+
timeline._animations.sort(compareAnimations);
4243
timeline._animations = tick(t, true, timeline._animations);
4344
processing.forEach(function(entry) { entry[1](t); });
4445
applyPendingEffects();
@@ -100,7 +101,8 @@
100101
}
101102
animation._markTarget();
102103
var animations = animation._targetAnimations();
103-
var remainingAnimations = tick(scope.timeline.currentTime, false, animations);
104+
animations.sort(compareAnimations);
105+
var remainingAnimations = tick(scope.timeline.currentTime, false, animations.slice());
104106
if (remainingAnimations.indexOf(animation) === -1) {
105107
timeline._animations.splice(timeline._animations.indexOf(animation), 1);
106108
}
@@ -118,7 +120,6 @@
118120
var inTick = false;
119121
function tick(t, isAnimationFrame, updatingAnimations) {
120122
inTick = true;
121-
updatingAnimations.sort(compareAnimations);
122123
hasRestartedThisFrame = false;
123124
var timeline = scope.timeline;
124125

0 commit comments

Comments
 (0)