Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
pausableTween.js
Step.svelte
<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()
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */