Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 9b87c45

Browse files
author
Yuncong Zhang
committed
Update animation_controller.
1 parent a22f7c3 commit 9b87c45

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Runtime/animation/animation_controller.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ public TickerFuture repeat(float? min = null, float? max = null, bool reverse =
281281

282282
D.assert(max >= min);
283283
D.assert(max <= this.upperBound && min >= this.lowerBound);
284-
D.assert(reverse != null);
285284
return this.animateWith(new _RepeatingSimulation(this._value, min.Value, max.Value, reverse, period.Value));
286285
}
287286

@@ -298,6 +297,11 @@ public TickerFuture fling(float velocity = 1.0f) {
298297

299298

300299
public TickerFuture animateWith(Simulation simulation) {
300+
D.assert(
301+
this._ticker != null,
302+
"AnimationController.animateWith() called after AnimationController.dispose()\n" +
303+
"AnimationController methods should not be used after calling dispose."
304+
);
301305
this.stop();
302306
return this._startSimulation(simulation);
303307
}
@@ -317,6 +321,11 @@ TickerFuture _startSimulation(Simulation simulation) {
317321
}
318322

319323
public void stop(bool canceled = true) {
324+
D.assert(
325+
this._ticker != null,
326+
"AnimationController.stop() called after AnimationController.dispose()\n" +
327+
"AnimationController methods should not be used after calling dispose."
328+
);
320329
this._simulation = null;
321330
this._lastElapsedDuration = null;
322331
this._ticker.stop(canceled: canceled);
@@ -430,6 +439,7 @@ internal _RepeatingSimulation(float initialValue, float min, float max, bool rev
430439
this._max = max;
431440
this._periodInSeconds = (float) period.Ticks / TimeSpan.TicksPerSecond;
432441
this._initialT = (max == min) ? 0.0f : (initialValue / (max - min)) * (period.Ticks / TimeSpan.TicksPerSecond);
442+
this._reverse = reverse;
433443
D.assert(this._periodInSeconds > 0.0f);
434444
D.assert(this._initialT >= 0.0f);
435445
}

0 commit comments

Comments
 (0)