Hi all,
I’d like to customize a few easing functions such as
transition=easing.outBounce
or
transition=easing.outBack
For example, I’d like to reduce the bounce height of the easing.outBounce function. What’s the best way to achieve this?
Hi all,
I’d like to customize a few easing functions such as
transition=easing.outBounce
or
transition=easing.outBack
For example, I’d like to reduce the bounce height of the easing.outBounce function. What’s the best way to achieve this?
You can code your own easings like this:
local shakeEasing = function(currentTime, duration, startValue, targetDelta) local shakeAmplitude = amplitude local timeFactor = (duration-currentTime)/duration local scaledShake = (timeFactor\*shakeAmplitude)+1 local randomShake = math.random(scaledShake) return startValue + randomShake - scaledShake \* 0.5 end transition.to(obj , { time = 1000, x = obj.x, y = obj.y, transition = shakeEasing} )
You can find the original Robert Penner easings here:
https://github.com/EmmanuelOga/easing/blob/master/lib/easing.lua
You can code your own easings like this:
local shakeEasing = function(currentTime, duration, startValue, targetDelta) local shakeAmplitude = amplitude local timeFactor = (duration-currentTime)/duration local scaledShake = (timeFactor\*shakeAmplitude)+1 local randomShake = math.random(scaledShake) return startValue + randomShake - scaledShake \* 0.5 end transition.to(obj , { time = 1000, x = obj.x, y = obj.y, transition = shakeEasing} )
You can find the original Robert Penner easings here:
https://github.com/EmmanuelOga/easing/blob/master/lib/easing.lua