Liu Song’s Projects


~/Projects/FFCreator

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

Commit

Commit
829d6f3cd75154e7274e6b7b53e17d6d916915ec
Author
javaswing <[email protected]>
Date
2021-10-11 11:17:23 +0800 +0800
Diffstat
 types/index.d.ts | 2 ++
 types/lib/FFRect.d.ts | 16 ++++++++++++++++
 types/test/text.ts | 12 ++++++++++++

feat: add FFRect types


diff --git a/types/index.d.ts b/types/index.d.ts
index 3725b06c69252bd8fa7a85725e6949348ed1856e..22d45dcd66950f0884dbd06123ba7629ded68719 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -20,6 +20,8 @@ /// 
 /// <reference path="./lib/FFVtuber.d.ts" />
 /// <reference path="./lib/FFChart.d.ts" />
 // Project: https://github.com/tnfe/FFCreator
+
+// Project: https://github.com/tnfe/FFCreator
 /// <reference path="./lib/FFTween.d.ts" />
 /// <reference path="./lib/FFCreatorCenter.d.ts" />
 




diff --git a/types/lib/FFRect.d.ts b/types/lib/FFRect.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c91ab0b05e40ac4bc6830ac405737646957ce9c2
--- /dev/null
+++ b/types/lib/FFRect.d.ts
@@ -0,0 +1,16 @@
+declare namespace FFCreatorSpace {
+  interface FFFRectConf extends FFNodeCommonConf {
+    /**
+     * rect color
+     * @default #044EC5
+     */
+    color?: string;
+    width?: number;
+    height?: number;
+  }
+
+  class FFRect extends FFNode {
+    constructor(conf: FFFRectConf);
+    setColor(color: string): void;
+  }
+}




diff --git a/types/test/text.ts b/types/test/text.ts
index 9af48ec38764e080e7f7289ee15308361741049c..aa64743e8d2eb6d8bba1e260f9f61fcb2dd57ce1 100644
--- a/types/test/text.ts
+++ b/types/test/text.ts
@@ -1,4 +1,5 @@
 import { FFAudio, FFCreator, FFGifImage, FFImage, FFScene, FFText } from 'ffcreator';
+  scene1.addChild(fb1);
 const path = require('path');
 const colors = require('colors');
 
@@ -43,6 +44,17 @@   const scene2 = new FFScene();
 
   const fb1 = new FFImage({ path: bg1, x: width / 2, y: height / 2 });
   scene1.addChild(fb1);
+
+  const frect = new FFRect({
+    color: '#f6b900',
+    width: 300,
+    height: 200,
+    x: width / 2,
+    y: height / 2,
+  });
+  frect.setColor('#044EC5');
+  frect.addEffect('rotateIn', 1, 1);
+  scene1.addChild(frect);
 
   // add fmoney image
   const fmoney = new FFGifImage({ path: money, x: 100, y: 200 });