<script>
import Step from './Step.svelte'
import { onDestroy } from 'svelte'
import { get } from 'svelte/store'
import { tweened } from './pausableTween'
import { elasticInOut } from 'svelte/easing'
const duration = 1000
const commands = [
{
label: '#1',
tween: tweened(0, {duration})
},
{
label: '#2',
tween: tweened(0, {duration})
},
{
label: '#3',
tween: tweened(0, {duration})
}
]
const pos = tweened(0, {duration: duration * commands.length})
let stack = []
let current
let timeout
onDestroy(() => {
if (timeout) clearTimeout(timeout)
})
function play() {
commands.forEach(step => step.tween.reset())
stack = []
pos.reset()