Commit 39eff6a2 authored by wildfirecode13's avatar wildfirecode13

1

parent a59966a6
...@@ -67,3 +67,12 @@ svga.onFinished(() => { ...@@ -67,3 +67,12 @@ svga.onFinished(() => {
}); });
``` ```
[了解更多,请点击查看API](./globals.html#getsvga) [了解更多,请点击查看API](./globals.html#getsvga)
# 快速加载svga资源,但不装载 loadSVGA
js
```js
import {loadSVGA } from "teddi";
const url = '';
const videoItem = await loadSVGA(url);
```
[了解更多,请点击查看API](./globals.html#loadsvga)
\ No newline at end of file
...@@ -2,6 +2,10 @@ import SVGA = require("svgaplayerweb"); ...@@ -2,6 +2,10 @@ import SVGA = require("svgaplayerweb");
var svgaParser = new SVGA.Parser(); var svgaParser = new SVGA.Parser();
/**
* 快速加载svga资源,但不装载
* @param url 资源URL
*/
export const loadSVGA = (url:string) => { export const loadSVGA = (url:string) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
svgaParser.load(url, (videoItem:SVGA.VideoEntity) => { svgaParser.load(url, (videoItem:SVGA.VideoEntity) => {
...@@ -12,7 +16,7 @@ export const loadSVGA = (url:string) => { ...@@ -12,7 +16,7 @@ export const loadSVGA = (url:string) => {
}) })
} }
/** /**
* 加载一个svga * 快速装载一个svga动画
* @param url 资源URL * @param url 资源URL
* @param className 挂载元素的class name * @param className 挂载元素的class name
* @param loops 播放次数。默认为空,循环播放。 * @param loops 播放次数。默认为空,循环播放。
......
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