Merge pull request #1947 from sveltejs/gh-1946

fix transitions
pull/1951/head
Rich Harris 6 years ago committed by GitHub
commit b65828b269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,7 +28,7 @@ export function animate(node, from, fn, params) {
if (css) {
if (delay) node.style.cssText = cssText;
name = create_rule({ a: 0, b: 1, delta: 1, duration }, easing, css);
name = create_rule({ a: 0, b: 1, d: 1, duration }, easing, css);
node.style.animation = (node.style.animation || '')
.split(', ')

@ -13,12 +13,12 @@ function hash(str) {
return hash >>> 0;
}
export function create_rule({ a, b, delta, duration }, ease, fn) {
export function create_rule({ a, b, d, duration }, ease, fn) {
const step = 16.666 / duration;
let keyframes = '{\n';
for (let p = 0; p <= 1; p += step) {
const t = a + delta * ease(p);
const t = a + d * ease(p);
keyframes += p * 100 + `%{${fn(t, 1 - t)}}\n`;
}

Loading…
Cancel
Save