Adding New Easing Functions

Adding new easing functions is very simple, the first step you need is to define the easing function let's see how the linear function is defined to know how we can add a new function:

Local Function linear(t, b, c, d) Return(c * t / d + b) EndFunction

As you can see each function needs four arguments with the following meanings:

  • t : How much time has to pass for the tweening to complete
  • b : Property starting value
  • c : Property ending value - property starting value
  • d : How much time has passed until now

When you have defined your easing function you have to add a member to the table tween.easing with the name of your new function.

Suppose you have added a function named 'customfunc' you have to add it with:

tween.easing.customfunc = customfunc

That's all!

hollywoodlibs/easing/neweasing.txt · Ultima modifica: 2016/10/06 16:23 da admin
CC Attribution-Noncommercial 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0