521xueweihan / HelloGitHub

:octocat: 分享 GitHub 上有趣、入门级的开源项目。Share interesting, entry-level open source projects on GitHub.
https://hellogithub.com
90.52k stars 9.56k forks source link

项目推荐|FFCreator #2243

Closed aliaszz closed 2 years ago

aliaszz commented 2 years ago

推荐项目

// Create FFCreator instance const creator = new FFCreator({ cacheDir, outputDir, width: 800, height: 450 });

// Create scene const scene = new FFScene(); scene.setBgColor("#ffcc22"); scene.setDuration(6); scene.setTransition("GridFlip", 2); creator.addChild(scene);

// Create Image and add animation effect const image = new FFImage({ path: path.join(__dirname, "../assets/01.jpg") }); image.addEffect("moveInUp", 1, 1); image.addEffect("fadeOutDown", 1, 4); scene.addChild(image);

// Create Text const text = new FFText({ text: "hello 你好", x: 400, y: 300 }); text.setColor("#ffffff"); text.setBackgroundColor("#000000"); text.addEffect("fadeIn", 1, 1); scene.addChild(text);

// Create a multi-photo Album const album = new FFAlbum({ list: [img1, img2, img3, img4], // 相册的图片集合 x: 250, y: 300, width: 500, height: 300, }); album.setTransition('zoomIn'); // 设置相册切换动画 album.setDuration(2.5); // 设置单张停留时长 album.setTransTime(1.5); // 设置单张动画时长 scene.addChild(album);

// Create Video const video = new FFVideo({ path, x: 300, y: 50, width: 300, height: 200 }); video.addEffect("zoomIn", 1, 0); scene.addChild(video);

creator.output(path.join(__dirname, "../output/example.mp4");); creator.start(); // 开始加工 creator.closeLog(); // 关闭log(包含perf)

creator.on('start', () => { console.log(FFCreator start); }); creator.on('error', e => { console.log(FFCreator error: ${JSON.stringify(e)}); }); creator.on('progress', e => { console.log(colors.yellow(FFCreator progress: ${e.state} ${(e.percent * 100) >> 0}%)); }); creator.on('complete', e => { console.log(colors.magenta(FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output})); });



- 截图:
<p align="center">
  <img width="30%" src="https://github.com/tnfe/FFCreator/blob/master/docs/_media/imgs/demo/01.gif?raw=true" />
  <img width="2%" src="https://github.com/tnfe/FFCreator/blob/master/docs/_media/imgs/demo/foo.png?raw=true" />
  <img width="30%" src="https://github.com/tnfe/FFCreator/blob/master/docs/_media/imgs/demo/05.gif?raw=true" />
  <img width="2%" src="https://github.com/tnfe/FFCreator/blob/master/docs/_media/imgs/demo/foo.png?raw=true" />
  <img width="30%" src="https://github.com/tnfe/FFCreator/blob/master/docs/_media/imgs/demo/03.gif?raw=true" />
</p>

- 后续更新计划:项目会持续更新动画以及 FFmpeg 新特性
521xueweihan commented 2 years ago

您推荐的项目,已成功发布HelloGitHub 第 75 期,并把您添加到了贡献者列表中。

欢迎继续推荐如此优秀的项目、告诉其他小伙伴加入到 HelloGitHub 项目中,没有 star 本项目的请 star 一下。谢谢 🙏