add option to reset animation state when removing animation from queue

This commit is contained in:
2026-02-03 19:38:09 +02:00
parent 2e205553ff
commit ff6418c244
+5 -1
View File
@@ -40,9 +40,13 @@ class MotionEngine {
}); });
}; };
this.clear = function (object) { this.clear = function (object, reset = false) {
for (var i = aq.length - 1; i >= 0; i--) { for (var i = aq.length - 1; i >= 0; i--) {
if (object && aq[i].o == object || !object && (aq[i].ct == aq[i].t || aq[i].rr)) { if (object && aq[i].o == object || !object && (aq[i].ct == aq[i].t || aq[i].rr)) {
if (reset){
aq[i].ct = 0;
this.animate(aq[i], 0);
}
aq.splice(i, 1); aq.splice(i, 1);
} }
} }