Source Code Progress as of Day 2

GitHub - yjlintw/Tweenie at blog-day2

Bug-Fix Param does not need return type

ITweener To<T>(Func<T, T> param, T fromValue, T toValue, float duration, Func<T,T,float,T> lerpFunc)

The first argument of the To method Func<T, T> param was unnecessarily return a value type T . I’ve updated the function signature to use an Action<T> instead.

This is the new To method:

ITweener To<T>(Action<T> param, T fromValue, T toValue, float duration, Func<T,T,float,T> lerpFunc)

Bug-Fix Avoid modifying set while iterating

Another bug I fixed was related to iterating through a HashSet while modifying it at the same time. To avoid this issue, I've added a new HashSet to hold all the new Tweeners that are created during the Update loop, and then add them to the main set at the beginning of the next loop.

New SetEase Method

The new feature SetEase is a function allows users to apply an animation curve to your ITweener,giving users even more control over the way your animations look and feel. There are two overloaded methods for SetEase – one that lets you use built-in animation curves like Linear and EaseInOut, and another that allows you to pass in a custom curve of your own design.

ITweener SetEase(AnimationCurve curve)
ITweener SetEase(Ease easeType)

While researching online, I came across an interesting thread suggesting that AnimationCurve.Evaluate may outperform Mathf.Lerp. While I haven't yet confirmed this myself, it's a fascinating observation that's worth exploring further.

Surprise: AnimationCurve.Evaluate is faster than Mathf.Lerp! But why?

Todo List

Not in any particular order

Tween Control

Looping

Animation

Optimization

Quality of Life

Testing

Refactor