Commit a59966a6 authored by wildfirecode13's avatar wildfirecode13

1

parent adaa47d7
...@@ -23,7 +23,7 @@ export default Pageindex; ...@@ -23,7 +23,7 @@ export default Pageindex;
``` ```
# 防连点 # 防连点 debounce
js js
```js ```js
import {debounce } from "teddi"; import {debounce } from "teddi";
...@@ -35,5 +35,35 @@ or ...@@ -35,5 +35,35 @@ or
<button onClick={debounce(clickHandler,3000)}></button> <button onClick={debounce(clickHandler,3000)}></button>
``` ```
[点击查看API](./globals.html#debounce) [了解更多,请点击查看API](./globals.html#debounce)
#
# 快速装载一个svga动画 getSVGA
加载一个循环播放的动画,比如角色待机动画。
html
```html
<div className="svga-placeholder" ></div>
```
js
```js
import {getSVGA } from "teddi";
const url = '';
getSVGA(url, 'svga-placeholder');
```
加载一个动画,它只播放一次,监听播放完成事件。一般用于角色动作切换。
html
```html
<div className="svga-placeholder" ></div>
```
js
```js
import {getSVGA} from "teddi";
const url = '';
const svga = await getSVGA(url, 'svga-placeholder',1);//加载动画
svga.startAnimation();
svga.onFinished(() => {
//单次动作播放完成,此时可以切回待机状态
});
```
[了解更多,请点击查看API](./globals.html#getsvga)
...@@ -13,9 +13,9 @@ export const loadSVGA = (url:string) => { ...@@ -13,9 +13,9 @@ export const loadSVGA = (url:string) => {
} }
/** /**
* 加载一个svga * 加载一个svga
* @param url * @param url 资源URL
* @param className * @param className 挂载元素的class name
* @param loops * @param loops 播放次数。默认为空,循环播放。
* @param clearsAfterStop * @param clearsAfterStop
*/ */
export const getSVGA = async (url:string, className:string, loops:number, clearsAfterStop:boolean) => { export const getSVGA = async (url:string, className:string, loops:number, clearsAfterStop:boolean) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment