diff --git a/src/internal/animations.ts b/src/internal/animations.ts index b6c7ae2df2..8d52b3ca7a 100644 --- a/src/internal/animations.ts +++ b/src/internal/animations.ts @@ -22,15 +22,14 @@ export function create_animation(node, from, fn, params) { let started = false; let name; - const css_text = node.style.cssText; - function start() { if (css) { - if (delay) node.style.cssText = css_text; // TODO create delayed animation instead? - name = create_rule(node, 0, 1, duration, 0, easing, css); + name = create_rule(node, 0, 1, duration, delay, easing, css); } - started = true; + if (!delay) { + started = true; + } } function stop() { @@ -40,7 +39,7 @@ export function create_animation(node, from, fn, params) { loop(now => { if (!started && now >= start_time) { - start(); + started = true; } if (started && now >= end) { @@ -61,11 +60,7 @@ export function create_animation(node, from, fn, params) { return true; }); - if (delay) { - if (css) node.style.cssText += css(0, 1); - } else { - start(); - } + start(); tick(0, 1);