feat(gif preview): add utils functions

This commit is contained in:
wryk 2019-04-05 19:27:45 +02:00 committed by Tixie
parent c361e6b8ac
commit da154ef249

View file

@ -1,3 +1,17 @@
export function delay(duration) {
return new Promise((resolve, _) => {
setTimeout(() => {
resolve()
}, duration)
})
}
export function* cycle(xs) {
while (true) {
yield* xs
}
}
export function calcProgress (from, to, value) { export function calcProgress (from, to, value) {
return from + ((to - from) * value) return from + ((to - from) * value)
} }