Use Array.flat in motion.js

This commit is contained in:
Mimi 2020-08-23 14:36:34 +08:00
parent 5c024800e6
commit 783b6ffe8c

View File

@ -10,12 +10,11 @@ NexT.motion.integrator = {
}, },
add(fn) { add(fn) {
const sequence = fn(); const sequence = fn();
if (CONFIG.motion.async) this.queue.push(sequence); this.queue.push(sequence);
else this.queue = this.queue.concat(sequence);
return this; return this;
}, },
bootstrap() { bootstrap() {
if (!CONFIG.motion.async) this.queue = [this.queue]; if (!CONFIG.motion.async) this.queue = [this.queue.flat()];
this.queue.forEach(sequence => { this.queue.forEach(sequence => {
const timeline = window.anime.timeline({ const timeline = window.anime.timeline({
duration: 200, duration: 200,