TWEEN ANIMATION

Custom Easing Function

Custom your easing function.

easing: (el, i, total) => {
    return (t, b, c, d) => {
        return ((i + 1) / total) * c * Math.sin(t / d * (Math.PI / 2)) + b
    }
}
PARAMETER type example
t number The current time stamp
b number The from number
c number The increment number equals (to - from)
d number The duration time

CODE EXAMPLE

new TweenAnim({
    keys: {
        translateX: 250
    },
    loop: 3,
    duration: 2000,
    easing: (el, i, total) => {
      return (t, b, c, d) => {
          return ((i + 1) / total) * c * Math.sin(t / d * (Math.PI / 2)) + b
      }
    }
}).targets($L('.el'));