⏱️ タイムライン実装
class Timeline {
constructor() {
this.animations = [];
this.currentIndex = 0;
}
add(animation, delay = 0) {
this.animations.push({ animation, delay });
}
play() {
const current = this.animations[this.currentIndex];
if (!current) return;
setTimeout(() => {
current.animation();
this.currentIndex++;
this.play();
}, current.delay);
}
}
ボタンを押してタイムラインを開始