Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
teddi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
teddi
Commits
a59966a6
Commit
a59966a6
authored
Nov 17, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
adaa47d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
6 deletions
+36
-6
readme.md
readme.md
+33
-3
svga.ts
src/svga.ts
+3
-3
No files found.
readme.md
View file @
a59966a6
...
...
@@ -23,7 +23,7 @@ export default Pageindex;
```
# 防连点
# 防连点
debounce
js
```
js
import
{
debounce
}
from
"teddi"
;
...
...
@@ -35,5 +35,35 @@ or
<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
)
src/svga.ts
View file @
a59966a6
...
...
@@ -13,9 +13,9 @@ export const loadSVGA = (url:string) => {
}
/**
* 加载一个svga
* @param url
* @param className
* @param loops
* @param url
资源URL
* @param className
挂载元素的class name
* @param loops
播放次数。默认为空,循环播放。
* @param clearsAfterStop
*/
export
const
getSVGA
=
async
(
url
:
string
,
className
:
string
,
loops
:
number
,
clearsAfterStop
:
boolean
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment