// Generic Constructor public HiraTween(float time, Action <float> onIteration, HiraTweenterpolationType tweenType = HiraTweenterpolationType.Linear, HiraTweenEaseType easeType = HiraTweenEaseType.EaseIn, Action onCompletion = null) { Time = time; OnIteration = onIteration; TweenType = tweenType; EaseType = easeType; OnCompletion = onCompletion; }
// Vector2 Tween Constructor public HiraTween(Action <Vector2> setter, Vector2 a, Vector2 b, float time, HiraTweenterpolationType tweenType = HiraTweenterpolationType.Linear, HiraTweenEaseType easeType = HiraTweenEaseType.EaseIn, Action onCompletion = null) { Time = time; OnIteration = t => setter(Vector2.LerpUnclamped(a, b, t)); OnCompletion = onCompletion; TweenType = tweenType; EaseType = easeType; }
// Quaternion Tween Constructor public HiraTween(Action <Quaternion> setter, Quaternion a, Quaternion b, float time, HiraTweenterpolationType tweenType = HiraTweenterpolationType.Linear, HiraTweenEaseType easeType = HiraTweenEaseType.EaseIn, Action onCompletion = null) { Time = time; OnIteration = t => setter(Quaternion.SlerpUnclamped(a, b, t)); OnCompletion = onCompletion; TweenType = tweenType; EaseType = easeType; }
// Euler Tween Constructor public HiraTween(Action <Vector3> setter, Quaternion a, Quaternion b, float time, HiraTweenterpolationType tweenType = HiraTweenterpolationType.Linear, HiraTweenEaseType easeType = HiraTweenEaseType.EaseIn, Action onCompletion = null) { Time = time; var(x, y) = (a.eulerAngles, b.eulerAngles); OnIteration = t => setter(Vector3.SlerpUnclamped(x, y, t)); OnCompletion = onCompletion; TweenType = tweenType; EaseType = easeType; }