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

Commit a97616e

Browse files
author
Yuncong Zhang
committed
Implement ConstantTween
1 parent 0a5accc commit a97616e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Runtime/animation/tween.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,15 @@ public override Offset lerp(float t) {
212212
return (this.begin + (this.end - this.begin) * t);
213213
}
214214
}
215+
216+
class ConstantTween<T> : Tween<T> {
217+
public ConstantTween(T value) : base(begin: value, end: value) {
218+
}
219+
220+
public override T lerp(float t) => this.begin;
221+
222+
String toString() => $"{this.GetType()}(value: {this.begin})";
223+
}
215224

216225
public class CurveTween : Animatable<float> {
217226
public CurveTween(Curve curve = null) {

0 commit comments

Comments
 (0)