Skip to content

Commit 6bff8c0

Browse files
authored
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
1 parent 0ad0f04 commit 6bff8c0

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/funny-ties-jump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: ensure that CSS is generated for the final frame of a transition

packages/svelte/src/internal/client/dom/elements/transitions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ function animate(element, options, counterpart, t2, callback) {
322322
if (css) {
323323
// WAAPI
324324
var keyframes = [];
325-
var n = duration / (1000 / 60);
325+
var n = Math.ceil(duration / (1000 / 60)); // `n` must be an integer, or we risk missing the `t2` value
326326

327327
for (var i = 0; i <= n; i += 1) {
328328
var t = t1 + delta * easing(i / n);

packages/svelte/tests/runtime-legacy/samples/transition-css-iframe/_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export default test({
1919
assert.equal(div.style.opacity, '0.25');
2020

2121
raf.tick(35);
22-
assert.equal(div.style.opacity, '0.18333333333333335');
22+
assert.equal(div.style.opacity, '0.15');
2323
}
2424
});

0 commit comments

Comments
 (0)