@remotion/lottie 4.0.314 → 4.0.315

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,13 @@ const utils_1 = require("../utils");
8
8
  (0, bun_test_1.expect)((0, utils_1.getLottieFrame)({ currentFrame: 23, totalFrames: 56 })).toBe(23);
9
9
  });
10
10
  (0, bun_test_1.it)('returns the last frame if current frame is bigger than total frames', () => {
11
- (0, bun_test_1.expect)((0, utils_1.getLottieFrame)({ currentFrame: 23, totalFrames: 20 })).toBe(20);
11
+ (0, bun_test_1.expect)((0, utils_1.getLottieFrame)({ currentFrame: 23, totalFrames: 20 })).toBe(19);
12
+ });
13
+ (0, bun_test_1.it)('freezes on last valid frame to prevent animation disappearing', () => {
14
+ // This test specifically validates the fix for the issue where
15
+ // non-looping animations disappear after playing once
16
+ (0, bun_test_1.expect)((0, utils_1.getLottieFrame)({ currentFrame: 100, totalFrames: 30 })).toBe(29);
17
+ (0, bun_test_1.expect)((0, utils_1.getLottieFrame)({ currentFrame: 1000, totalFrames: 60 })).toBe(59);
12
18
  });
13
19
  });
14
20
  (0, bun_test_1.describe)('when loop is truthy', () => {
@@ -32,7 +38,7 @@ const utils_1 = require("../utils");
32
38
  currentFrame: 23,
33
39
  totalFrames: 20,
34
40
  direction: 'backward',
35
- })).toBe(0);
41
+ })).toBe(1);
36
42
  });
37
43
  });
38
44
  (0, bun_test_1.describe)('when direction is reverse and loop is truthy', () => {
package/dist/cjs/utils.js CHANGED
@@ -4,7 +4,7 @@ exports.getLottieFrame = void 0;
4
4
  const getLottieFrame = ({ currentFrame, direction, loop, totalFrames, }) => {
5
5
  const nextFrame = loop
6
6
  ? currentFrame % totalFrames
7
- : Math.min(currentFrame, totalFrames);
7
+ : Math.min(currentFrame, totalFrames - 1);
8
8
  if (direction === 'backward') {
9
9
  return totalFrames - nextFrame;
10
10
  }
@@ -27,7 +27,7 @@ var getLottieFrame = ({
27
27
  loop,
28
28
  totalFrames
29
29
  }) => {
30
- const nextFrame = loop ? currentFrame % totalFrames : Math.min(currentFrame, totalFrames);
30
+ const nextFrame = loop ? currentFrame % totalFrames : Math.min(currentFrame, totalFrames - 1);
31
31
  if (direction === "backward") {
32
32
  return totalFrames - nextFrame;
33
33
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/lottie"
4
4
  },
5
5
  "name": "@remotion/lottie",
6
- "version": "4.0.314",
6
+ "version": "4.0.315",
7
7
  "description": "Include Lottie animations in Remotion",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
- "remotion": "4.0.314"
22
+ "remotion": "4.0.315"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "lottie-web": "^5",
@@ -39,7 +39,7 @@
39
39
  "react": "19.0.0",
40
40
  "react-dom": "19.0.0",
41
41
  "eslint": "9.19.0",
42
- "@remotion/eslint-config-internal": "4.0.314"
42
+ "@remotion/eslint-config-internal": "4.0.315"
43
43
  },
44
44
  "keywords": [
45
45
  "remotion",