fix: ensure that CSS is generated for the final frame of a transition (#11251)

* fix: ensure that CSS is generated for the final frame of a transition

* well that makes a lot more sense
pull/11236/head
Rich Harris 1 year ago committed by GitHub
parent 0ad0f04b0b
commit 6bff8c0e93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure that CSS is generated for the final frame of a transition

@ -322,7 +322,7 @@ function animate(element, options, counterpart, t2, callback) {
if (css) {
// WAAPI
var keyframes = [];
var n = duration / (1000 / 60);
var n = Math.ceil(duration / (1000 / 60)); // `n` must be an integer, or we risk missing the `t2` value
for (var i = 0; i <= n; i += 1) {
var t = t1 + delta * easing(i / n);

@ -19,6 +19,6 @@ export default test({
assert.equal(div.style.opacity, '0.25');
raf.tick(35);
assert.equal(div.style.opacity, '0.18333333333333335');
assert.equal(div.style.opacity, '0.15');
}
});

Loading…
Cancel
Save