浏览代码

Code cleanup.

/main
Yuncong Zhang 5 年前
当前提交
3ac72473
共有 2 个文件被更改,包括 17 次插入9 次删除
  1. 15
      Runtime/animation/animation_controller.cs
  2. 11
      Runtime/animation/tween.cs

15
Runtime/animation/animation_controller.cs


this._direction = _AnimationDirection.forward;
return this._animateToInternal(target, duration: duration, curve: curve);
}
public TickerFuture animateBack(float target, TimeSpan? duration, Curve curve = null) {
D.assert(
this._ticker != null,

new _InterpolationSimulation(this._value, target, simulationDuration.Value, curve));
}
public TickerFuture repeat(float? min = null, float? max = null, bool reverse = false, TimeSpan? period = null) {
public TickerFuture repeat(float? min = null, float? max = null, bool reverse = false,
TimeSpan? period = null) {
min = min ?? this.lowerBound;
max = max ?? this.upperBound;
period = period ?? this.duration;

return true;
});
D.assert(max >= min);
D.assert(max <= this.upperBound && min >= this.lowerBound);
return this.animateWith(new _RepeatingSimulation(this._value, min.Value, max.Value, reverse, period.Value));

this._min = min;
this._max = max;
this._periodInSeconds = (float) period.Ticks / TimeSpan.TicksPerSecond;
this._initialT = (max == min) ? 0.0f : (initialValue / (max - min)) * (period.Ticks / TimeSpan.TicksPerSecond);
this._initialT =
(max == min) ? 0.0f : (initialValue / (max - min)) * (period.Ticks / TimeSpan.TicksPerSecond);
this._reverse = reverse;
D.assert(this._periodInSeconds > 0.0f);
D.assert(this._initialT >= 0.0f);

D.assert(timeInSeconds >= 0.0f);
float totalTimeInSeconds = timeInSeconds + this._initialT;
float t = (totalTimeInSeconds / this._periodInSeconds) % 1.0f;
bool _isPlayingReverse = ((int)(totalTimeInSeconds / this._periodInSeconds)) % 2 == 1;
bool _isPlayingReverse = ((int) (totalTimeInSeconds / this._periodInSeconds)) % 2 == 1;
} else {
}
else {
return MathUtils.lerpFloat(this._min, this._max, t);
}
}

11
Runtime/animation/tween.cs


return (this.begin + (this.end - this.begin) * t);
}
}
public override T lerp(float t) => this.begin;
public override string ToString() => $"{this.GetType()}(value: {this.begin})";
public override T lerp(float t) {
return this.begin;
}
public override string ToString() {
return $"{this.GetType()}(value: {this.begin})";
}
}
public class CurveTween : Animatable<float> {

正在加载...
取消
保存