Skip to content

Commit 9a9d6ea

Browse files
committed
更新动画控制
1 parent 06a71b5 commit 9a9d6ea

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/widget/pull/gsy_flare_pull_controller.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ mixin GSYFlarePullController implements FlareController {
77

88
double pulledExtentFlare = 0;
99
double _refreshTriggerPullDistance = 140;
10+
double _speed = 2.0;
11+
double _rockTime = 0.0;
1012

1113
@override
1214
void initialize(FlutterActorArtboard artboard) {
@@ -18,16 +20,17 @@ mixin GSYFlarePullController implements FlareController {
1820

1921
@override
2022
bool advance(FlutterActorArtboard artboard, double elapsed) {
21-
if(getPlayAuto) {
22-
return false;
23+
if (getPlayAuto) {
24+
_rockTime += elapsed * _speed;
25+
_pullAnimation.apply(_rockTime % _pullAnimation.duration, artboard, 1.0);
26+
return true;
2327
}
2428
double animationPosition = pulledExtentFlare / _refreshTriggerPullDistance;
2529
animationPosition *= animationPosition;
26-
_pullAnimation.apply(
27-
_pullAnimation.duration * animationPosition, artboard, 1.0);
30+
_rockTime = _pullAnimation.duration * animationPosition;
31+
_pullAnimation.apply(_rockTime, artboard, 1.0);
2832
return true;
2933
}
3034

3135
bool get getPlayAuto;
32-
3336
}

0 commit comments

Comments
 (0)