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) {
const sequence = fn();
if (CONFIG.motion.async) this.queue.push(sequence);
else this.queue = this.queue.concat(sequence);
this.queue.push(sequence);
return this;
},
bootstrap() {
if (!CONFIG.motion.async) this.queue = [this.queue];
if (!CONFIG.motion.async) this.queue = [this.queue.flat()];
this.queue.forEach(sequence => {
const timeline = window.anime.timeline({
duration: 200,