Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scilla-core
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
scilla-core
Commits
55e84ae4
Commit
55e84ae4
authored
May 08, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加onLoopComplete和onComplete回调
parent
a158773f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
7 deletions
+25
-7
Tween.ts
src/support/Tween.ts
+25
-7
No files found.
src/support/Tween.ts
View file @
55e84ae4
...
...
@@ -53,6 +53,14 @@ export interface TweenOptions {
* 支持对象展开的字段名列表
*/
fields
?:
string
[];
/**
* 一次循环完成回调
*/
onLoopComplete
?:
Function
;
/**
* 完成回调
*/
onComplete
?:
Function
;
}
/**
...
...
@@ -122,6 +130,8 @@ export class Tween extends HashObject {
protected
toProps
:
any
;
protected
ease
:
Function
;
protected
duration
:
number
;
protected
onLoopComplete
:
Function
;
protected
onComplete
:
Function
;
constructor
(
host
:
any
,
target
:
any
,
options
?:
TweenOptions
,
plugins
=
[])
{
super
();
...
...
@@ -131,6 +141,8 @@ export class Tween extends HashObject {
this
.
loop
=
options
?
options
.
loop
:
0
;
this
.
autoPlay
=
options
?
(
options
.
hasOwnProperty
(
'autoPlay'
)
?
options
.
autoPlay
:
true
)
:
true
;
this
.
fields
=
options
?
options
.
fields
:
null
;
this
.
onLoopComplete
=
options
.
onLoopComplete
;
this
.
onComplete
=
options
.
onComplete
;
this
.
plugins
=
plugins
;
...
...
@@ -388,13 +400,19 @@ export class Tween extends HashObject {
break
;
}
}
else
{
if
(
this
.
loop
<
0
)
{
this
.
_doStart
();
}
else
if
(
this
.
loopCounting
<
this
.
loop
)
{
this
.
_doStart
();
}
else
{
this
.
status
=
STATUS
.
IDLE
;
}
this
.
_onEnd
();
}
};
protected
_onEnd
(){
this
.
onLoopComplete
&&
this
.
onLoopComplete
();
if
(
this
.
loop
<
0
)
{
this
.
_doStart
();
}
else
if
(
this
.
loopCounting
<
this
.
loop
)
{
this
.
_doStart
();
}
else
{
this
.
status
=
STATUS
.
IDLE
;
this
.
onComplete
&&
this
.
onComplete
();
}
}
}
\ No newline at end of file
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