Merge pull request #2872 from Harald-1/master

Update animations.js
pull/2881/head
Rich Harris 6 years ago committed by GitHub
commit 60a2a512dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save