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

Commit 8c001fc

Browse files
author
Yuncong Zhang
committed
Code cleanup.
1 parent 4df1a6d commit 8c001fc

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

Runtime/animation/animation_controller.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public TickerFuture animateTo(float target, TimeSpan? duration = null, Curve cur
204204
this._direction = _AnimationDirection.forward;
205205
return this._animateToInternal(target, duration: duration, curve: curve);
206206
}
207-
207+
208208
public TickerFuture animateBack(float target, TimeSpan? duration, Curve curve = null) {
209209
D.assert(
210210
this._ticker != null,
@@ -262,7 +262,8 @@ TickerFuture _animateToInternal(float target, TimeSpan? duration = null, Curve c
262262
new _InterpolationSimulation(this._value, target, simulationDuration.Value, curve));
263263
}
264264

265-
public TickerFuture repeat(float? min = null, float? max = null, bool reverse = false, TimeSpan? period = null) {
265+
public TickerFuture repeat(float? min = null, float? max = null, bool reverse = false,
266+
TimeSpan? period = null) {
266267
min = min ?? this.lowerBound;
267268
max = max ?? this.upperBound;
268269
period = period ?? this.duration;
@@ -278,7 +279,7 @@ public TickerFuture repeat(float? min = null, float? max = null, bool reverse =
278279

279280
return true;
280281
});
281-
282+
282283
D.assert(max >= min);
283284
D.assert(max <= this.upperBound && min >= this.lowerBound);
284285
return this.animateWith(new _RepeatingSimulation(this._value, min.Value, max.Value, reverse, period.Value));
@@ -438,7 +439,8 @@ internal _RepeatingSimulation(float initialValue, float min, float max, bool rev
438439
this._min = min;
439440
this._max = max;
440441
this._periodInSeconds = (float) period.Ticks / TimeSpan.TicksPerSecond;
441-
this._initialT = (max == min) ? 0.0f : (initialValue / (max - min)) * (period.Ticks / TimeSpan.TicksPerSecond);
442+
this._initialT =
443+
(max == min) ? 0.0f : (initialValue / (max - min)) * (period.Ticks / TimeSpan.TicksPerSecond);
442444
this._reverse = reverse;
443445
D.assert(this._periodInSeconds > 0.0f);
444446
D.assert(this._initialT >= 0.0f);
@@ -454,11 +456,12 @@ public override float x(float timeInSeconds) {
454456
D.assert(timeInSeconds >= 0.0f);
455457
float totalTimeInSeconds = timeInSeconds + this._initialT;
456458
float t = (totalTimeInSeconds / this._periodInSeconds) % 1.0f;
457-
bool _isPlayingReverse = ((int)(totalTimeInSeconds / this._periodInSeconds)) % 2 == 1;
459+
bool _isPlayingReverse = ((int) (totalTimeInSeconds / this._periodInSeconds)) % 2 == 1;
458460

459461
if (this._reverse && _isPlayingReverse) {
460462
return MathUtils.lerpFloat(this._max, this._min, t);
461-
} else {
463+
}
464+
else {
462465
return MathUtils.lerpFloat(this._min, this._max, t);
463466
}
464467
}

Runtime/animation/tween.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,18 @@ public override Offset lerp(float t) {
212212
return (this.begin + (this.end - this.begin) * t);
213213
}
214214
}
215-
215+
216216
class ConstantTween<T> : Tween<T> {
217217
public ConstantTween(T value) : base(begin: value, end: value) {
218218
}
219219

220-
public override T lerp(float t) => this.begin;
221-
public override string ToString() => $"{this.GetType()}(value: {this.begin})";
220+
public override T lerp(float t) {
221+
return this.begin;
222+
}
223+
224+
public override string ToString() {
225+
return $"{this.GetType()}(value: {this.begin})";
226+
}
222227
}
223228

224229
public class CurveTween : Animatable<float> {

0 commit comments

Comments
 (0)