import { tween } from './tweening-js'
const step = (n: number) => console.log('draw: ' + n)
tween({ from: -200, to: -100, step, duration: 50, done: () => {
console.log('complete1')
promiseWay()
}})
const promiseWay = () => {
tween({ from: 0, to: 100, step, duration: 50 }).promise().then( () => {
console.log('----- complete2')
asyncFunction()
})
}
const asyncFunction = async () => {
await tween({ from: 0, to: 100, step, duration: 50 }).promise()
console.log('----- complete3')
await tween({ from: 200, to: 300, step, duration: 50 }).promise()
console.log('----- complete4')
}
const concurrent = async () => {
await Promise.all([
tween({ from: 0, to: 100, step, duration: 50 }).promise(),
tween({ from: 200, to: 300, step, duration: 50 }).promise(),
])
console.log('----- complete5')
}
import { tween, easeFunctions } from './tweening-js'
const {
linear, inQuad, outQuad, inOutQuad, inCube, outCube, inOutCube, inQuart,
outQuart, inOutQuart, inQuint, outQuint, inOutQuint, inSine, outSine, inOutSine,
inExpo, outExpo, inOutExpo, inCirc, outCirc, inOutCirc, inBack, outBack,
inOutBack, inBounce, outBounce, inOutBounce,
} = easeFunctions
const step = (n: number) => console.log('draw: ' + n)
tween({ from: -200, to: -100, step, easeFunction: outQuint })