Liu Song’s Projects


~/Projects/FFCreator

git clone https://code.lsong.org/FFCreator

Commit

Commit
fa76340afea4a963bbe0c62d41c4a0c71f582ac3
Author
javaSwing <[email protected]>
Date
2021-09-07 21:43:22 +0800 +0800
Diffstat
 types/index.d.ts | 1 
 types/lib/FFCreatorCenter.d.ts | 2 
 types/lib/FFSubtitle.d.ts | 13 +++
 types/lib/FFVideo.d.ts | 2 
 types/lib/FFVideoAlbum.d.ts | 42 ++++++++++++
 types/test/animate.ts | 15 ++-
 types/test/custome.ts | 10 ++
 types/test/fps.ts | 120 ++++++++++++++++++++++++++++++++++
 types/test/gif.ts | 104 ++++++++++++++++++++++++++++++
 types/test/image.ts | 119 ++++++++++++++++++++++++++++++++++
 types/test/mvvideo.ts | 105 ++++++++++++++++++++++++++++++
 types/test/preload.ts | 124 ++++++++++++++++++++++++++++++++++++
 types/test/resize.ts | 119 ++++++++++++++++++++++++++++++++++
 types/test/subtitle.ts | 123 +++++++++++++++++++++++++++++++++++
 types/test/transition.ts | 99 ++++++++++++++++++++++++++++
 types/test/video.ts | 101 +++++++++++++++++++++++++++++

feat: complete first version


diff --git a/types/index.d.ts b/types/index.d.ts
index b374f0be879c8ba89c8d48f2fe4de17089ea4f51..08af545f53f8681043de681274fdf37e996b4b0f 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -13,6 +13,7 @@ /// 
 /// <reference path="./lib/FFAnimation.d.ts" />
 /// <reference path="./lib/FFAudio.d.ts" />
 /// <reference path="./lib/FFVideo.d.ts" />
+/// <reference path="./lib/FFVideoAlbum.d.ts" />
 /// <reference path="./lib/FFAlbum.d.ts" />
 /// <reference path="./lib/FFSubtitle.d.ts" />
 /// <reference path="./lib/FFScene.d.ts" />




diff --git a/types/lib/FFCreatorCenter.d.ts b/types/lib/FFCreatorCenter.d.ts
index 4298f30e619b8eab66d7f391497b42f8b1fff7c9..1e33f78d5c1cf6ded6ee75f116f755de99bc5bde 100644
--- a/types/lib/FFCreatorCenter.d.ts
+++ b/types/lib/FFCreatorCenter.d.ts
@@ -109,6 +109,8 @@     /**
      * reset all tasks
      */
     resetTasks(): void;
+
+    getInfo(): string;
   }
 
   const FFCreatorCenter:FFCreatorCenter;




diff --git a/types/lib/FFSubtitle.d.ts b/types/lib/FFSubtitle.d.ts
index 10f945119d9b7d91e408240f1390f66d26ffd75b..f1d27f492361222b99f59eccfd9c799ca3a49d43 100644
--- a/types/lib/FFSubtitle.d.ts
+++ b/types/lib/FFSubtitle.d.ts
@@ -1,8 +1,16 @@
 /// <reference path="FFNode.d.ts" />
 declare namespace FFCreatorSpace {
-  interface FFSubtitleConf extends Omit<FFNodeConf, 'type'> {
+    style?: Record<string, any>;
     text: string;
     style?: Record<string, any>;
+    style?: Record<string, any>;
+    comma?: boolean;
+    backgroundColor?: string;
+    color?: string;
+    fontSize?: number;
+    style?: Record<string, any>;
+    x?: number;
+    y?: number;
   }
 
   /**
@@ -15,6 +23,9 @@    *     const subtitle = new FFSubtitle({ x: 320, y: 520 });
    *     subtitle.setText(text);
    */
   class FFSubtitle extends FFNode {
+
+    frameBuffer: number;
+
     constructor(conf: FFSubtitleConf);
 
     /**




diff --git a/types/lib/FFVideo.d.ts b/types/lib/FFVideo.d.ts
index 2e29bd467bda8f9de2b4c5ab650c438278ea4f9e..c06806be5c9e643960ee45a2c0c5a8dcf09a5596 100644
--- a/types/lib/FFVideo.d.ts
+++ b/types/lib/FFVideo.d.ts
@@ -2,6 +2,8 @@ declare namespace FFCreatorSpace {
   interface FFVideoConf extends FFImageConf {
     width: number;
   }
+    to?: string | number
+  }
 
   /**
    * FFVideo - Video component-based display component




diff --git a/types/lib/FFVideoAlbum.d.ts b/types/lib/FFVideoAlbum.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e7920f9785ff560630ee65f6d9be787a53de7b40
--- /dev/null
+++ b/types/lib/FFVideoAlbum.d.ts
@@ -0,0 +1,42 @@
+declare namespace FFCreatorSpace {
+  interface FFVideoAlbumConf extends FFNodeCommonConf {
+    list: string[];
+    ss?: number | string;
+    /**
+     * string example hh:mm:ss
+     */
+    to?: number | string;
+    width?: number;
+    height?: number;
+  }
+  /**
+   * FFVideoAlbum - A Videos Album component that supports multiple switching animation effects
+   *
+   * @example
+   *
+   *     const album = new FFVideoAlbum({
+   *        list: [v01, v01, v01, v01],
+   *        x: 100,
+   *        y: 100,
+   *        width: 500,
+   *        height: 300
+   *    });
+   *
+   *
+   */
+  class FFVideoAlbum extends FFVideo {
+    constructor(conf: FFVideoAlbumConf);
+
+    /**
+     * Get the path to get the Image
+     * @return {string} img path
+     */
+    getPath(): string;
+
+    /**
+     * Material preprocessing
+     * @return {Promise}
+     */
+    preProcessing(): Promise<unknown>;
+  }
+}




diff --git a/types/test/animate.ts b/types/test/animate.ts
index e3f86cf46332872d30e80d331fc956cf4d675ead..c14fc16fb118b299298ce8b3b52592738cab6d14 100644
--- a/types/test/animate.ts
+++ b/types/test/animate.ts
@@ -4,19 +4,22 @@ const path = require('path');
 const colors = require('colors');
 
 const createFFTask = () => {
-    const bg1 = path.join(__dirname, './assets/imgs/bg/h01.jpg');
+    const bg1 = path.join(__dirname, '../../examples/assets/imgs/bg/h01.jpg');
-    const bg2 = path.join(__dirname, './assets/imgs/bg/h04.jpg');
+    const bg2 = path.join(__dirname, '../../examples/assets/imgs/bg/h04.jpg');
-    const logo1 = path.join(__dirname, './assets/imgs/logo/logo1.png');
-    const logo2 = path.join(__dirname, './assets/imgs/logo/logo2.png');
+    const logo1 = path.join(__dirname, '../../examples/assets/imgs/logo/logo1.png');
 import { FFAudio, FFCreator, FFGifImage, FFImage, FFScene, FFText, FFTween } from "ffcreator";
+    // @todo 测试下是否支持
 import { FFAudio, FFCreator, FFGifImage, FFImage, FFScene, FFText, FFTween } from "ffcreator";
+    fbg1.addEffect({ type: 'zoomingIn', time: 9 });
 import { FFAudio, FFCreator, FFGifImage, FFImage, FFScene, FFText, FFTween } from "ffcreator";
+    scene1.addChild(fbg1);
 import { FFAudio, FFCreator, FFGifImage, FFImage, FFScene, FFText, FFTween } from "ffcreator";
-
+    // add fmoney image
     const elephant = path.join(__dirname, './assets/imgs/elephant.png');
+    const logo2 = path.join(__dirname, './assets/imgs/logo/logo2.png');
     const money = path.join(__dirname, './assets/imgs/gif/m.gif');
 import { FFAudio, FFCreator, FFGifImage, FFImage, FFScene, FFText, FFTween } from "ffcreator";
-const createFFTask = () => {
+      type: 'fadeInLeft',
     const outputDir = path.join(__dirname, './output/');
     const cacheDir = path.join(__dirname, './cache/');
 




diff --git a/types/test/custome.ts b/types/test/custome.ts
index a95fe0d4f839446f5244eb7f6f36dbab9253afe6..549c99d9dc43721aab477f970fc722bacaf2f1f2 100644
--- a/types/test/custome.ts
+++ b/types/test/custome.ts
@@ -4,14 +4,18 @@ const path = require('path');
 const colors = require('colors')
 
 const createFFTask = () => {
+    const img1 = path.join(__dirname, './assets/imgs/album/01.jpeg');
     const logo2 = path.join(__dirname, './assets/imgs/logo/logo2.png');
+    const img1 = path.join(__dirname, './assets/imgs/album/01.jpeg');
     const img1 = path.join(__dirname, './assets/imgs/album/01.jpeg');
+    const img1 = path.join(__dirname, './assets/imgs/album/01.jpeg');
     const img2 = path.join(__dirname, './assets/imgs/album/02.jpeg');
+    const img1 = path.join(__dirname, './assets/imgs/album/01.jpeg');
     const img3 = path.join(__dirname, './assets/imgs/album/03.jpeg');
-import { FFAlbum, FFCreator, FFImage, FFScene, FFText } from "ffcreator"
+    const img2 = path.join(__dirname, './assets/imgs/album/02.jpeg');
-import { FFAlbum, FFCreator, FFImage, FFScene, FFText } from "ffcreator"
+    const img2 = path.join(__dirname, './assets/imgs/album/02.jpeg');
 import { FFAlbum, FFCreator, FFImage, FFScene, FFText } from "ffcreator"
-import { FFAlbum, FFCreator, FFImage, FFScene, FFText } from "ffcreator"
+    const img2 = path.join(__dirname, './assets/imgs/album/02.jpeg');
 
     const outputDir = path.join(__dirname, './output/');
     const cacheDir = path.join(__dirname, './cache/');




diff --git a/types/test/fps.ts b/types/test/fps.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e3e6fb077822ffdeec3315a87688f3cc696b6359
--- /dev/null
+++ b/types/test/fps.ts
@@ -0,0 +1,120 @@
+import { FFCreator, FFImage, FFScene } from "ffcreator";
+
+const path = require('path');
+const colors = require('colors');
+
+const createFFTask = () => {
+    const bg1 = path.join(__dirname, '../../examples/assets/imgs/bg/05.jpg');
+    const bg2 = path.join(__dirname, '../../examples/assets/imgs/bg/04.jpeg');
+    const logo2 = path.join(__dirname, '../../examples/assets/imgs/logo/logo2.png');
+    const cloud = path.join(__dirname, '../../examples/assets/imgs/cloud.png');
+    const mars = path.join(__dirname, '../../examples/assets/imgs/mars.png');
+    const rock = path.join(__dirname, '../../examples/assets/imgs/rock.png');
+    const title = path.join(__dirname, '../../examples/assets/imgs/title.png');
+    const audio = path.join(__dirname, '../../examples/assets/audio/05.wav');
+    const outputDir = path.join(__dirname, './output/');
+    const cacheDir = path.join(__dirname, './cache/');
+
+    // create creator instance
+    const width = 576;
+    const height = 1024;
+    const creator = new FFCreator({
+      cacheDir,
+      outputDir,
+      fps: 24,
+      crf: 28,
+      width,
+      height,
+      highWaterMark: '3mb',
+      parallel: 8,
+      audio,
+    });
+
+    // create FFScene
+    const scene1 = new FFScene();
+    const scene2 = new FFScene();
+    scene1.setBgColor('#0b0be6');
+    scene2.setBgColor('#b33771');
+
+    // add scene1 background
+    const fbg1 = new FFImage({ path: bg1, x: width / 2, y: height / 2 });
+    scene1.addChild(fbg1);
+
+    // add bottom cloud
+    const fcloud = new FFImage({ path: cloud, x: width });
+    fcloud.setAnchor(1);
+    fcloud.addAnimate({
+      from: { y: height + 180 },
+      to: { y: height },
+      time: 0.8,
+      ease: 'Back.Out',
+    });
+    scene1.addChild(fcloud);
+
+    // add mars ball
+    const fmars = new FFImage({ path: mars, x: width / 2, y: height / 2 });
+    fmars.addEffect('rotateIn', 1, 0.8);
+    scene1.addChild(fmars);
+
+    // add rock image
+    const frock = new FFImage({ path: rock, x: width / 2 + 100 });
+    frock.addAnimate({
+      from: { y: height / 2 + 720 },
+      to: { y: height / 2 + 80 },
+      time: 1,
+      delay: 2.3,
+      ease: 'Cubic.InOut',
+    });
+    scene1.addChild(frock);
+
+    // add rock image
+    const ftitle = new FFImage({ path: title, x: width / 2, y: height / 2 - 300 });
+    ftitle.addEffect('fadeInUp', 1, 4);
+    scene1.addChild(ftitle);
+
+    // add logo
+    const flogo1 = new FFImage({ path: logo2, x: width / 2, y: 50 });
+    flogo1.setScale(0.5);
+    scene1.addChild(flogo1);
+
+    scene1.setDuration(8);
+    scene1.setTransition('InvertedPageCurl', 1.5);
+    creator.addChild(scene1);
+
+    // add scene2 background
+    const fbg2 = new FFImage({ path: bg2, x: width / 2, y: height / 2 });
+    scene2.addChild(fbg2);
+    // add logo
+    const flogo2 = new FFImage({ path: logo2, x: width / 2, y: height / 2 - 80 });
+    flogo2.setScale(0.9);
+    flogo2.addEffect('fadeInDown', 1, 1.2);
+    scene2.addChild(flogo2);
+
+    scene2.setDuration(5);
+    creator.addChild(scene2);
+
+    creator.start();
+    //creator.openLog();
+
+    creator.on('start', () => {
+      console.log(`FFCreator start`);
+    });
+
+    creator.on('error', e => {
+      console.log(colors.red(`FFCreator error: ${e.error}`));
+    });
+
+    creator.on('progress', e => {
+      console.log(colors.yellow(`FFCreator progress: ${(e.percent * 100) >> 0}%`));
+    });
+
+    creator.on('complete', e => {
+      console.log(
+        colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
+      );
+
+      console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+    });
+
+    return creator;
+  };




diff --git a/types/test/gif.ts b/types/test/gif.ts
new file mode 100644
index 0000000000000000000000000000000000000000..590fe0bbf54e2ce62154360e0b62dd1608bbb768
--- /dev/null
+++ b/types/test/gif.ts
@@ -0,0 +1,104 @@
+import { FFAudio, FFCreator, FFGifImage, FFImage, FFScene } from "ffcreator";
+
+const path = require('path');
+const colors = require('colors');
+
+const createFFTask = () => {
+    const bg1 = path.join(__dirname, '../../examples/assets/imgs/bg/06.jpg');
+    const bg2 = path.join(__dirname, '../../examples/assets/imgs/bg/01.jpeg');
+    const logo1 = path.join(__dirname, '../../examples/assets/imgs/logo/logo1.png');
+    const logo2 = path.join(__dirname, '../../examples/assets/imgs/logo/logo2.png');
+    const cart = path.join(__dirname, '../../examples/assets/imgs/gif/cart.gif');
+    const hert = path.join(__dirname, '../../examples/assets/imgs/gif/hert.gif');
+    const girl = path.join(__dirname, '../../examples/assets/imgs/gif/girl.gif');
+    const audio = path.join(__dirname, '../../examples/assets/audio/05.wav');
+    const outputDir = path.join(__dirname, './output/');
+    const cacheDir = path.join(__dirname, './cache/');
+
+    // create creator instance
+    const width = 576;
+    const height = 1024;
+    const creator = new FFCreator({
+      cacheDir,
+      outputDir,
+      width,
+      height,
+      debug: false,
+      highWaterMark: '3mb',
+      parallel: 8,
+    });
+
+    creator.addAudio(new FFAudio({ path: audio, volume: 0.9, fadeIn: 3 }));
+
+    // create FFScene
+    const scene1 = new FFScene();
+    const scene2 = new FFScene();
+    scene1.setBgColor('#0b0be6');
+    scene2.setBgColor('#b33771');
+
+    // add scene1 background
+    const fbg1 = new FFImage({ path: bg1, x: width / 2, y: height / 2 });
+    scene1.addChild(fbg1);
+
+    // add gif image
+    const fcart = new FFGifImage({ path: cart, x: width / 2, y: height / 2 - 100 });
+    fcart.addEffect('zoomIn', 2, 1);
+    fcart.setScale(0.8);
+    scene1.addChild(fcart);
+
+    const fgirl = new FFGifImage({ path: girl, x: width / 2, y: height + 100 });
+    fgirl.addEffect('backInUp', 1.2, 1.5);
+    fgirl.setAnchor(0.5, 1);
+    scene1.addChild(fgirl);
+
+    const fhert = new FFGifImage({ path: hert, x: width / 2, y: height / 2 - 250 });
+    fhert.addEffect('fadeIn', 1.5, 0.5);
+    fhert.addEffect('fadeOut', 1.5, 3.5);
+    scene1.addChild(fhert);
+
+    // add logo
+    const flogo1 = new FFImage({ path: logo2, x: width / 2, y: 100 });
+    flogo1.setScale(0.65);
+    scene1.addChild(flogo1);
+
+    scene1.setDuration(8);
+    scene1.setTransition('ButterflyWaveScrawler', 1.5);
+    creator.addChild(scene1);
+
+    // add scene2 background
+    const fbg2 = new FFImage({ path: bg2, x: width / 2, y: height / 2 });
+    scene2.addChild(fbg2);
+    // add logo
+    const flogo2 = new FFImage({ path: logo2, x: width / 2, y: height / 2 - 80 });
+    flogo2.setScale(0.9);
+    flogo2.addEffect('fadeInDown', 1, 1.2);
+    scene2.addChild(flogo2);
+
+    scene2.setDuration(5);
+    creator.addChild(scene2);
+
+    creator.start();
+    //creator.openLog();
+
+    creator.on('start', () => {
+      console.log(`FFCreator start`);
+    });
+
+    creator.on('error', e => {
+      console.log(colors.red(`FFCreator error: ${e.error}`));
+    });
+
+    creator.on('progress', e => {
+      console.log(colors.yellow(`FFCreator progress: ${(e.percent * 100) >> 0}%`));
+    });
+
+    creator.on('complete', e => {
+      console.log(
+        colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
+      );
+
+      console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+    });
+
+    return creator;
+  };




diff --git a/types/test/image.ts b/types/test/image.ts
new file mode 100644
index 0000000000000000000000000000000000000000..0049e8aa3e47316b4175ae856583b8a1748cf12d
--- /dev/null
+++ b/types/test/image.ts
@@ -0,0 +1,119 @@
+const path = require('path');
+const colors = require('colors');
+import { FFCreator, FFImage, FFScene } from "ffcreator";
+
+const createFFTask = () => {
+    const bg1 = path.join(__dirname, '../../examples/assets/imgs/bg/05.jpg');
+    const bg2 = path.join(__dirname, '../../examples/assets/imgs/bg/04.jpeg');
+    const logo2 = path.join(__dirname, '../../examples/assets/imgs/logo/logo2.png');
+    const cloud = path.join(__dirname, '../../examples/assets/imgs/cloud.png');
+    const mars = path.join(__dirname, '../../examples/assets/imgs/mars.png');
+    const rock = path.join(__dirname, '../../examples/assets/imgs/rock.png');
+    const title = path.join(__dirname, '../../examples/assets/imgs/title.png');
+    const audio = path.join(__dirname, '../../examples/assets/audio/05.wav');
+    const outputDir = path.join(__dirname, './output/');
+    const cacheDir = path.join(__dirname, './cache/');
+
+    // create creator instance
+    const width = 576;
+    const height = 1024;
+    const creator = new FFCreator({
+      cacheDir,
+      outputDir,
+      width,
+      height,
+      //log: true,
+      highWaterMark: '3mb',
+      parallel: 8,
+      fps: 30,
+      audio,
+    });
+
+    // create FFScene
+    const scene1 = new FFScene();
+    const scene2 = new FFScene();
+    scene1.setBgColor('#0b0be6');
+    scene2.setBgColor('#b33771');
+
+    // add scene1 background
+    const fbg1 = new FFImage({ path: bg1, x: width / 2, y: height / 2 });
+    scene1.addChild(fbg1);
+
+    // add bottom cloud
+    const fcloud = new FFImage({ path: cloud, x: width });
+    fcloud.setAnchor(1);
+    fcloud.addAnimate({
+      from: { y: height + 180 },
+      to: { y: height },
+      time: 0.8,
+      ease: 'Back.Out',
+    });
+    scene1.addChild(fcloud);
+
+    // add mars ball
+    const fmars = new FFImage({ path: mars, x: width / 2, y: height / 2 });
+    fmars.addEffect('rotateIn', 1, 0.8);
+    scene1.addChild(fmars);
+
+    // add rock image
+    const frock = new FFImage({ path: rock, x: width / 2 + 100 });
+    frock.addAnimate({
+      from: { y: height / 2 + 720 },
+      to: { y: height / 2 + 80 },
+      time: 1,
+      delay: 2.3,
+      ease: 'Cubic.InOut',
+    });
+    scene1.addChild(frock);
+
+    // add rock image
+    const ftitle = new FFImage({ path: title, x: width / 2, y: height / 2 - 300 });
+    ftitle.addEffect('fadeInUp', 1, 4);
+    scene1.addChild(ftitle);
+
+    // add logo
+    const flogo1 = new FFImage({ path: logo2, x: width / 2, y: 50 });
+    flogo1.setScale(0.5);
+    scene1.addChild(flogo1);
+
+    scene1.setDuration(8);
+    scene1.setTransition('InvertedPageCurl', 1.5);
+    creator.addChild(scene1);
+
+    // add scene2 background
+    const fbg2 = new FFImage({ path: bg2, x: width / 2, y: height / 2 });
+    scene2.addChild(fbg2);
+    // add logo
+    const flogo2 = new FFImage({ path: logo2, x: width / 2, y: height / 2 - 80 });
+    flogo2.setScale(0.9);
+    flogo2.addEffect('fadeInDown', 1, 1.2);
+    scene2.addChild(flogo2);
+
+    scene2.setDuration(5);
+    creator.addChild(scene2);
+
+    creator.start();
+    //creator.openLog();
+
+    creator.on('start', () => {
+      console.log(`FFCreator start`);
+    });
+
+    creator.on('error', e => {
+      console.log(colors.red(`FFCreator error: ${e.error}`));
+    });
+
+    creator.on('progress', e => {
+      console.log(colors.yellow(`FFCreator progress: ${(e.percent * 100) >> 0}%`));
+    });
+
+    creator.on('complete', e => {
+      console.log(
+        colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
+      );
+
+      console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+    });
+
+    return creator;
+  };




diff --git a/types/test/mvvideo.ts b/types/test/mvvideo.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5914ac221fbf00068831f99f496d4346fea4ed25
--- /dev/null
+++ b/types/test/mvvideo.ts
@@ -0,0 +1,105 @@
+const path = require('path');
+const colors = require('colors');
+import { FFCreator, FFImage, FFScene, FFVideoAlbum } from "ffcreator";
+
+const createFFTask = () => {
+    const bg1 = path.join(__dirname, './assets/imgs/bg/h03.jpg');
+    const bg2 = path.join(__dirname, './assets/imgs/bg/h02.jpg');
+    const logo1 = path.join(__dirname, './assets/imgs/logo/logo1.png');
+    const logo2 = path.join(__dirname, './assets/imgs/logo/logo2.png');
+    const dragon = path.join(__dirname, './assets/imgs/dragon.png');
+    const video1 = path.join(__dirname, './assets/video/video1.mp4');
+    const video2 = path.join(__dirname, './assets/video/video2.mp4');
+    const outputDir = path.join(__dirname, './output/');
+    const cacheDir = path.join(__dirname, './cache/');
+
+    // create creator instance
+    const width = 800;
+    const height = 600;
+    const creator = new FFCreator({
+      cacheDir,
+      outputDir,
+      width,
+      height,
+      fps: 24,
+      log: false,
+      debug: true,
+      highWaterMark: '3mb',
+    });
+
+    // create FFScene
+    const scene1 = new FFScene();
+    const scene2 = new FFScene();
+    scene1.setBgColor('#7e5fff');
+    scene2.setBgColor('#2c3a47');
+
+    const fbg1 = new FFImage({ path: bg1, x: width / 2, y: height / 2 });
+    scene1.addChild(fbg1);
+
+    // add new album
+    const album = new FFVideoAlbum({
+      list: [video1, video2],
+      x: width / 2,
+      y: height / 2,
+      width: width * 0.7,
+      height: 423 * 0.7,
+      ss: '00:00:00',
+      to: '00:00:06',
+    });
+
+    album.addEffect('fadeInUp', 1, 1);
+    scene1.addChild(album);
+
+    // add dragon image
+    const fdragon = new FFImage({ path: dragon, x: 100, y: height / 2 + 100 });
+    fdragon.setScale(0.7);
+    fdragon.addEffect('fadeInUp', 1, 3);
+    scene1.addChild(fdragon);
+
+    // add logo
+    const flogo1 = new FFImage({ path: logo2, x: width / 2, y: 50 });
+    flogo1.setScale(0.5);
+    scene1.addChild(flogo1);
+
+    scene1.setDuration(12);
+    scene1.setTransition('Windows4', 2);
+    creator.addChild(scene1);
+
+    // add scene2 background
+    const fbg2 = new FFImage({ path: bg2, x: width / 2, y: height / 2 });
+    scene2.addChild(fbg2);
+
+    // add logo
+    const flogo2 = new FFImage({ path: logo2, x: width / 2, y: height / 2 - 20 });
+    flogo2.setScale(0.9);
+    flogo2.addEffect('zoomIn', 1, 1.2);
+    scene2.addChild(flogo2);
+
+    scene2.setDuration(5);
+    creator.addChild(scene2);
+
+    creator.start();
+    //creator.openLog();
+
+    creator.on('start', () => {
+      console.log(`FFCreator start`);
+    });
+
+    creator.on('error', e => {
+      console.log(`FFCreator error: ${e.error}`);
+    });
+
+    creator.on('progress', e => {
+      console.log(colors.yellow(`FFCreator progress: ${(e.percent * 100) >> 0}%`));
+    });
+
+    creator.on('complete', e => {
+      console.log(
+        colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
+      );
+
+      console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+    });
+
+    return creator;
+  };




diff --git a/types/test/preload.ts b/types/test/preload.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c2ff101bc1c4f191f1cd940293e9c35a99269ac9
--- /dev/null
+++ b/types/test/preload.ts
@@ -0,0 +1,124 @@
+const path = require('path');
+const colors = require('colors');
+import { FFCreator, FFImage, FFScene } from "ffcreator";
+
+const createFFTask = () => {
+    const bg1 = path.join(__dirname, '../../examples/assets/imgs/album/02.jpeg');
+    const bg2 = path.join(__dirname, '../../examples/assets/imgs/album/03.jpeg');
+    const logo1 = path.join(__dirname, '../../examples/assets/imgs/logo/logo1.png');
+    const logo2 = path.join(__dirname, '../../examples/assets/imgs/logo/logo2.png');
+    const img1 =
+      'https://gw.alicdn.com/imgextra/i3/O1CN01uRz3de23mzWofmPYX_!!6000000007299-2-tps-143-59.png';
+    const img2 = 'http://qzonestyle.gtimg.cn/qz-proj/weishi-pc/img/index/[email protected]';
+    const img3 = 'https://mat1.gtimg.com/sports/sports/3.png';
+    const img4 = 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png';
+    const img5 = path.join(__dirname, '../../examples/assets/imgs/txlogo.png');
+    const img6 = path.join(__dirname, '../../examples/assets/imgs/baidu.png');
+    const audio = path.join(__dirname, '../../examples/assets/audio/05.wav');
+    const outputDir = path.join(__dirname, './output/');
+    const cacheDir = path.join(__dirname, './cache/');
+
+    const imgs = [img1, img2, img3, img4, img5, img6];
+    const effects = shuffle([
+      'backIn',
+      'rotateIn',
+      'backInLeft',
+      'fadeInUp',
+      'zoomIn',
+      'fadeInDown',
+      'fadeInDownBig',
+    ]);
+
+    // create creator instance
+    const width = 800;
+    const height = 600;
+    const creator = new FFCreator({
+      cacheDir,
+      outputDir,
+      width,
+      height,
+      log: true,
+      parallel: 8,
+      //renderClarity: 'high',
+      // render: 'canvas',
+      // audio,
+    });
+
+    // create FFScene
+    const scene1 = new FFScene();
+    const scene2 = new FFScene();
+    scene1.setBgColor('#00cd1d');
+    scene2.setBgColor('#b33771');
+    // scene1.setFXAA(true);
+
+    // add scene1 background
+    const fbg1 = new FFImage({ path: bg1, x: width / 2, y: height / 2 });
+    scene1.addChild(fbg1);
+
+    for (let i = 0; i < imgs.length; i++) {
+      const d = 80;
+      const x = randomA2B(d, width - d);
+      const y = randomA2B(d, height - d);
+      const fimg = new FFImage({ path: imgs[i], x, y });
+      fimg.addEffect(effects[i], randomA2B(1, 2), randomA2B(0.8, 5));
+      scene1.addChild(fimg);
+    }
+
+    // add logo
+    const flogo1 = new FFImage({ path: logo1, x: width / 2 - 200, y: 100 });
+    flogo1.setScale(0.5);
+    scene1.addChild(flogo1);
+
+    const flogo2 = new FFImage({ path: logo1, x: width / 2 + 200, y: 100 });
+    scene1.addChild(flogo2);
+
+    scene1.setDuration(8);
+    scene1.setTransition('InvertedPageCurl', 1.5);
+    creator.addChild(scene1);
+
+    // add scene2 background
+    const fbg2 = new FFImage({ path: bg2, x: width / 2, y: height / 2 });
+    scene2.addChild(fbg2);
+    // add logo
+    const flogo3 = new FFImage({ path: logo2, x: width / 2, y: height / 2 - 80 });
+    flogo3.setScale(0.9);
+    flogo3.addEffect('fadeInDown', 1, 1.2);
+    scene2.addChild(flogo3);
+
+    scene2.setDuration(5);
+    creator.addChild(scene2);
+
+    creator.start();
+    //creator.openLog();
+
+    creator.on('start', () => {
+      console.log(`FFCreator start`);
+    });
+
+    creator.on('error', e => {
+      console.log(colors.red(`FFCreator error: ${e.error}`));
+    });
+
+    creator.on('progress', e => {
+      console.log(colors.yellow(`FFCreator progress: ${(e.percent * 100) >> 0}%`));
+    });
+
+    creator.on('complete', e => {
+      console.log(
+        colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
+      );
+
+      console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+    });
+
+    return creator;
+  };
+
+  function randomA2B(a:number, b: number, int?: number) {
+    const result = Math.random() * (b - a) + a;
+    return int ? Math.floor(result) : result;
+  }
+
+  function shuffle(array: string[]) {
+    return array.sort(() => 0.5 - Math.random());
+  }




diff --git a/types/test/resize.ts b/types/test/resize.ts
new file mode 100644
index 0000000000000000000000000000000000000000..066fc9b32ed08b1f37f1ec875407c116f1d810f9
--- /dev/null
+++ b/types/test/resize.ts
@@ -0,0 +1,119 @@
+const path = require('path');
+const colors = require('colors');
+
+import { FFCreator, FFCreatorCenter, FFImage, FFScene } from "ffcreator";
+const createFFTask = () => {
+    const bg1 = path.join(__dirname, '../../examples/assets/imgs/bg/05.jpg');
+    const bg2 = path.join(__dirname, '../../examples/assets/imgs/bg/04.jpeg');
+    const logo1 = path.join(__dirname, '../../examples/assets/imgs/logo/logo1.png');
+    const logo2 = path.join(__dirname, '../../examples/assets/imgs/logo/logo2.png');
+    const cloud = path.join(__dirname, '../../examples/assets/imgs/cloud.png');
+    const mars = path.join(__dirname, '../../examples/assets/imgs/mars.png');
+    const rock = path.join(__dirname, '../../examples/assets/imgs/rock.png');
+    const title = path.join(__dirname, '../../examples/assets/imgs/title.png');
+    const audio = path.join(__dirname, '../../examples/assets/audio/05.wav');
+    const outputDir = path.join(__dirname, './output/');
+    const cacheDir = path.join(__dirname, './cache/');
+
+    // create creator instance
+    const width = (576 * Math.random()) >> 0;
+    const height = (1024 * Math.random()) >> 0;
+
+    console.log('wxh', width, height);
+    const creator = new FFCreator({
+      cacheDir,
+      outputDir,
+      width,
+      height,
+      highWaterMark: '10mb',
+      parallel: 12,
+      pool: true,
+      audio,
+    });
+
+    // create FFScene
+    const scene1 = new FFScene();
+    const scene2 = new FFScene();
+    scene1.setBgColor('#000000');
+    scene2.setBgColor('#b33771');
+
+    // add scene1 background
+    const fbg1 = new FFImage({ path: bg1, x: width / 2, y: height / 2 });
+    scene1.addChild(fbg1);
+
+    // add bottom cloud
+    const fcloud = new FFImage({ path: cloud, x: width });
+    fcloud.setAnchor(1);
+    fcloud.addAnimate({
+      from: { y: height + 180 },
+      to: { y: height },
+      time: 0.8,
+      ease: 'Back.Out',
+    });
+    scene1.addChild(fcloud);
+
+    // add mars ball
+    const fmars = new FFImage({ path: mars, x: width / 2, y: height / 2 });
+    fmars.addEffect('rotateIn', 1, 0.8);
+    scene1.addChild(fmars);
+
+    // add rock image
+    const frock = new FFImage({ path: rock, x: width / 2 + 100 });
+    frock.addAnimate({
+      from: { y: height / 2 + 720 },
+      to: { y: height / 2 + 80 },
+      time: 1,
+      delay: 2.3,
+      ease: 'Cubic.InOut',
+    });
+    scene1.addChild(frock);
+
+    // add rock image
+    const ftitle = new FFImage({ path: title, x: width / 2, y: height / 2 - 300 });
+    ftitle.addEffect('fadeInUp', 1, 4);
+    scene1.addChild(ftitle);
+
+    // add logo
+    const flogo1 = new FFImage({ path: logo2, x: width / 2, y: 50 });
+    flogo1.setScale(0.5);
+    scene1.addChild(flogo1);
+
+    scene1.setDuration(8);
+    scene1.setTransition('Colorful', 1.5);
+    creator.addChild(scene1);
+
+    // add scene2 background
+    const fbg2 = new FFImage({ path: bg2, x: width / 2, y: height / 2 });
+    scene2.addChild(fbg2);
+    // add logo
+    const flogo2 = new FFImage({ path: logo2, x: width / 2, y: height / 2 - 80 });
+    flogo2.setScale(0.9);
+    flogo2.addEffect('fadeInDown', 1, 1.2);
+    scene2.addChild(flogo2);
+
+    scene2.setDuration(5);
+    creator.addChild(scene2);
+
+    creator.start();
+
+    creator.on('error', e => {
+      console.log(`FFCreator error: ${e.error}`);
+    });
+
+    creator.on('progress', e => {
+      console.log(colors.yellow(`FFCreator progress: ${(e.percent * 100) >> 0}%`));
+    });
+
+    creator.on('complete', e => {
+      let info = FFCreatorCenter.getInfo();
+      info = JSON.stringify(info);
+      console.log(
+        colors.magenta(
+          `FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} \n ${info} `,
+        ),
+      );
+      console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+    });
+
+    return creator;
+  };




diff --git a/types/test/subtitle.ts b/types/test/subtitle.ts
new file mode 100644
index 0000000000000000000000000000000000000000..fddb1848d0a082fd92200adc67e2c3ade011e643
--- /dev/null
+++ b/types/test/subtitle.ts
@@ -0,0 +1,123 @@
+const path = require('path');
+const colors = require('colors');
+import { FFAlbum, FFCreator, FFImage, FFScene, FFSubtitle, FFText } from "ffcreator";
+const createFFTask = () => {
+    const bg = path.join(__dirname, '../../examples/assets/imgs/bg/04.jpeg');
+    const img1 = path.join(__dirname, '../../examples/assets/imgs/album/06.jpeg');
+    const img2 = path.join(__dirname, '../../examples/assets/imgs/album/05.jpeg');
+    const img3 = path.join(__dirname, '../../examples/assets/imgs/album/04.jpeg');
+    const img4 = path.join(__dirname, '../../examples/assets/imgs/album/03.jpeg');
+    const img5 = path.join(__dirname, '../../examples/assets/imgs/album/02.jpeg');
+    const logo = path.join(__dirname, '../../examples/assets/imgs/logo/logo2.png');
+    const font1 = path.join(__dirname, '../../examples/assets/font/font1.ttf');
+    const tts = path.join(__dirname, '../../examples/assets/audio/tts.wav');
+    const outputDir = path.join(__dirname, './output/');
+    const cacheDir = path.join(__dirname, './cache/');
+
+    // create creator instance
+    const width = 576;
+    const height = 1024;
+    const creator = new FFCreator({
+      cacheDir,
+      outputDir,
+      width,
+      height,
+      debug: false,
+    });
+
+    // create FFScene
+    const scene1 = new FFScene();
+    const scene2 = new FFScene();
+    scene1.setBgColor('#fc427b');
+    scene2.setBgColor('#019333');
+
+    // add image album
+    const album = new FFAlbum({
+      list: [img1, img2, img3, img4, img5],
+      x: width / 2,
+      y: height / 2,
+      width: width,
+      height: 384,
+      showCover: true, // 默认显示封面
+    });
+    album.setTransition('fadeInLeft');
+    album.setDuration(2.5);
+    scene1.addChild(album);
+
+    // add title text
+    const text = new FFText({ text: 'FFCreator字幕DEMO', x: width / 2, y: 150, fontSize: 40 });
+    text.setColor('#ffffff');
+    text.setBackgroundColor('#019333');
+    text.addEffect('fadeInUp', 1, 1);
+    text.alignCenter();
+    text.setStyle({ padding: 10 });
+    scene1.addChild(text);
+
+    // add logo
+    const flogo2 = new FFImage({ path: logo, x: width / 2, y: 60 });
+    flogo2.setScale(0.6);
+    scene1.addChild(flogo2);
+
+    // add audio to scene1
+    scene1.addAudio(tts);
+
+    // subtitle
+    const title =
+      '跟计算机工作酷就酷在这里,它们不会生气,能记住所有东西,还有,它们不会喝光你的啤酒。计算机就跟比基尼一样,省去了人们许多的胡思乱想。';
+    const subtitle = new FFSubtitle({
+      comma: true, // 是否逗号分割
+      backgroundColor: '#00219C',
+      color: '#fff',
+      fontSize: 24,
+      x: width / 2,
+      y: height / 2 + 300,
+    });
+    subtitle.setText(title);
+    subtitle.setFont(font1);
+    subtitle.setSpeech(tts); // 语音配音-tts
+    subtitle.frameBuffer = 24;
+    // subtitle.setDuration(album.getTotalDuration() + 1); 没有tts配音时候可以手动设置
+    scene1.addChild(subtitle);
+
+    scene1.setDuration(album.getTotalDuration() + 1);
+    scene1.setTransition('FastSwitch', 1.5);
+    creator.addChild(scene1);
+
+    // add scene2 background
+    const fbg = new FFImage({ path: bg });
+    fbg.setXY(width / 2, height / 2);
+    scene2.addChild(fbg);
+
+    // logo
+    const flogo = new FFImage({ path: logo, x: width / 2, y: height / 2 - 150 });
+    flogo.addEffect('fadeInDown', 1, 1.2);
+    scene2.addChild(flogo);
+
+    scene2.setDuration(4);
+    creator.addChild(scene2);
+
+    creator.start();
+    creator.closeLog();
+
+    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.percent * 100) >> 0}%`));
+    });
+
+    creator.on('complete', e => {
+      console.log(
+        colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
+      );
+
+      console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+    });
+
+    return creator;
+  };




diff --git a/types/test/transition.ts b/types/test/transition.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2d89cc9d676f0e92e6281317187c0037da63448f
--- /dev/null
+++ b/types/test/transition.ts
@@ -0,0 +1,99 @@
+const path = require('path');
+const colors = require('colors');
+const shuffle = require('lodash/shuffle');
+import { FFCreator, FFImage, FFScene, FFText } from 'ffcreator';
+
+const width = 600;
+const height = 400;
+const logo1 = path.join(__dirname, './assets/imgs/logo/logo1.png');
+const logo2 = path.join(__dirname, './assets/imgs/logo/logo2.png');
+const audio = path.join(__dirname, './assets/audio/01.wav');
+const outputDir = path.join(__dirname, './output/');
+const cacheDir = path.join(__dirname, './cache/');
+
+const transitionDemoTask = () => {
+  const trans = shuffle(['Windows4', 'Stretch', 'Radiation', 'TricolorCircle', 'cube']);
+  const order = ['一', '二', '三', '四', '五'];
+
+  // create creator instance
+  const creator = new FFCreator({
+    cacheDir,
+    outputDir,
+    width,
+    height,
+    audio,
+    //cacheFormat:'jpg',
+    highWaterMark: '10mb',
+    frames: 6,
+    debug: false,
+  });
+
+  for (let i = 1; i < 6; i++) {
+    const transition = trans[i - 1];
+    const text = `这是第 ${order[i - 1]} 屏`;
+    const scene = creatScene({ index: i, transition, text });
+    creator.addChild(scene);
+  }
+
+  creator.openLog();
+  creator.start();
+
+  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.percent * 100) >> 0}%`));
+  });
+
+  creator.on('complete', e => {
+    console.log(
+      colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
+    );
+
+    console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+  });
+
+  return creator;
+};
+
+const creatScene = ({
+  index,
+  transition,
+  text,
+}: {
+  index: number;
+  transition: string;
+  text: string;
+}) => {
+  const scene = new FFScene();
+  scene.setBgColor('#3b3a98');
+  scene.setDuration(5);
+  scene.setTransition(transition, 1.5);
+
+  // bg img
+  const img = path.join(__dirname, `./assets/imgs/trans/0${index}.jpeg`);
+  const bg = new FFImage({ path: img, x: width / 2, y: height / 2 });
+  bg.addEffect({ type: 'zoomingIn', time: 5 });
+  scene.addChild(bg);
+
+  // title text
+  const ftext = new FFText({ text, x: width / 2, y: height / 2 + 50, fontSize: 38 });
+  ftext.alignCenter();
+  ftext.addEffect('fadeInRight', 1, 1.3);
+  ftext.setStyle({ color: '#30336b', backgroundColor: '#ffffff', padding: 10 });
+  scene.addChild(ftext);
+
+  // add logo2
+  const logo = index === 1 ? logo2 : logo1;
+  const flogo = new FFImage({ path: logo, x: width / 2, y: height / 2 - 100 });
+  flogo.setScale(0.6);
+  flogo.addEffect('fadeInLeft', 1, 1);
+  scene.addChild(flogo);
+
+  return scene;
+};




diff --git a/types/test/video.ts b/types/test/video.ts
new file mode 100644
index 0000000000000000000000000000000000000000..be4f9496b023d94cf2909bd401cc59a3983b42a9
--- /dev/null
+++ b/types/test/video.ts
@@ -0,0 +1,101 @@
+const path = require('path');
+const colors = require('colors');
+import { FFCreator, FFImage, FFScene, FFVideo } from 'ffcreator';
+
+const createFFTask = () => {
+    const bg1 = path.join(__dirname, './assets/imgs/bg/h03.jpg');
+    const bg2 = path.join(__dirname, './assets/imgs/bg/h02.jpg');
+    const logo1 = path.join(__dirname, './assets/imgs/logo/logo1.png');
+    const logo2 = path.join(__dirname, './assets/imgs/logo/logo2.png');
+    const dragon = path.join(__dirname, './assets/imgs/dragon.png');
+    const video1 = path.join(__dirname, './assets/video/video1.mp4');
+    const outputDir = path.join(__dirname, './output/');
+    const cacheDir = path.join(__dirname, './cache/');
+
+    // create creator instance
+    const width = 800;
+    const height = 600;
+    const creator = new FFCreator({
+      cacheDir,
+      outputDir,
+      width,
+      height,
+      fps: 30,
+      log: true,
+      highWaterMark: '3mb',
+    });
+
+    // create FFScene
+    const scene1 = new FFScene();
+    const scene2 = new FFScene();
+    scene1.setBgColor('#7e5fff');
+    scene2.setBgColor('#2c3a47');
+
+    const fbg1 = new FFImage({ path: bg1, x: width / 2, y: height / 2 });
+    scene1.addChild(fbg1);
+    // add bottom cloud
+    const fvideo = new FFVideo({
+      path: video1,
+      width: width * 0.7,
+      height: 423 * 0.7,
+      x: width / 2,
+      y: height / 2,
+      ss: '00:00:03',
+      to: '00:00:13',
+    });
+    fvideo.setAudio(true);
+    scene1.addChild(fvideo);
+
+    // add dragon image
+    const fdragon = new FFImage({ path: dragon, x: 100, y: height / 2 + 100 });
+    fdragon.setScale(0.7);
+    fdragon.addEffect('fadeInUp', 1, 3);
+    scene1.addChild(fdragon);
+
+    // add logo
+    const flogo1 = new FFImage({ path: logo2, x: width / 2, y: 50 });
+    flogo1.setScale(0.5);
+    scene1.addChild(flogo1);
+
+    scene1.setDuration(8);
+    scene1.setTransition('Magnifier', 1.5);
+    creator.addChild(scene1);
+
+    // add scene2 background
+    const fbg2 = new FFImage({ path: bg2, x: width / 2, y: height / 2 });
+    scene2.addChild(fbg2);
+
+    // add logo
+    const flogo2 = new FFImage({ path: logo2, x: width / 2, y: height / 2 - 20 });
+    flogo2.setScale(0.9);
+    flogo2.addEffect('zoomIn', 1, 1.2);
+    scene2.addChild(flogo2);
+
+    scene2.setDuration(5);
+    creator.addChild(scene2);
+
+    creator.start();
+    //creator.openLog();
+
+    creator.on('start', () => {
+      console.log(`FFCreator start`);
+    });
+
+    creator.on('error', e => {
+      console.log(`FFCreator error: ${e.error}`);
+    });
+
+    creator.on('progress', e => {
+      console.log(colors.yellow(`FFCreator progress: ${(e.percent * 100) >> 0}%`));
+    });
+
+    creator.on('complete', e => {
+      console.log(
+        colors.magenta(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
+      );
+
+      console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
+    });
+
+    return creator;
+  };