Skip to content

Commit 5d20b18

Browse files
committed
feat: update examples
1 parent e1fd042 commit 5d20b18

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

examples/lottie.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const { FFCreatorCenter, FFScene, FFImage, FFLottie, FFCreator } = require('../'
55

66
const createFFTask = () => {
77
const logo2 = path.join(__dirname, './assets/imgs/logo/logo2.png');
8-
const img6 = path.join(__dirname, './assets/lottie/images/img1.png');
8+
const img1 = path.join(__dirname, './assets/lottie/images/img1.png');
9+
const img2 = path.join(__dirname, './assets/lottie/images/img2.png');
910
const file1 = path.join(__dirname, './assets/lottie/data1.json');
1011
const file2 = path.join(__dirname, './assets/lottie/data2.json');
1112
const outputDir = path.join(__dirname, './output/');
@@ -49,7 +50,8 @@ const createFFTask = () => {
4950
loop: true,
5051
});
5152
flottie2.addEffect('fadeInDown', 1, 12);
52-
flottie2.replaceAsset('img_6', img6);
53+
flottie2.replaceAsset('image_1', img1);
54+
flottie2.replaceAsset('image_6', img2);
5355
scene.addChild(flottie2);
5456

5557
// add logo image

lib/node/lottie.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,9 @@ class FFLottie extends FFImage {
8585
}
8686

8787
/**
88-
* Start rendering
89-
* @public
88+
* Initialize the Lottie instance
89+
* @private
9090
*/
91-
start() {
92-
this.initTexture();
93-
this.ani.loadNow();
94-
this.animations.start();
95-
TimelineUpdate.addFrameCallback(this.updateCallback);
96-
}
97-
9891
initLottie() {
9992
const { loop, data, file } = this;
10093
const [width, height] = this.getWH();
@@ -119,6 +112,17 @@ class FFLottie extends FFImage {
119112
this.canvas = canvas;
120113
}
121114

115+
/**
116+
* Start rendering
117+
* @public
118+
*/
119+
start() {
120+
this.initTexture();
121+
this.ani.loadNow();
122+
this.animations.start();
123+
TimelineUpdate.addFrameCallback(this.updateCallback);
124+
}
125+
122126
initTexture() {
123127
const { canvas, display } = this;
124128

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ffcreator",
3-
"version": "6.5.10",
3+
"version": "6.6.2",
44
"description": "FFCreator is a lightweight and flexible short video production library",
55
"main": "lib/index.js",
66
"types": "types/index.d.ts",
@@ -38,7 +38,7 @@
3838
"inkpaint": "^2.7.1",
3939
"left-pad": "^1.3.0",
4040
"lodash": "^4.17.20",
41-
"lottie-nodejs": "^5.5.97",
41+
"lottie-nodejs": "^5.5.98",
4242
"mtempy": "^1.0.0",
4343
"ndarray": "^1.0.19",
4444
"rmfr": "^2.0.0",

0 commit comments

Comments
 (0)