I want to use easing functions but the way my game is built, I cannot use the built in ones. In my game, the player can move while an easing function is triggered on them and using a transition on the player object prevents the user from moving for that brief moment. So I went with the path of using deltaPerFrame and I want to apply easing functions on the player's x motion.
I am looking at this Easing Library on Github and trying to make use of it. Now in my game let's say the player is at x = 480px, they hit an object and I want to move them back 100px in the duration of 100ms. So their ending would be x = 380px.
Here is a visualization of what I'm trying to do:
Here are my variables (let me know what I'm doing wrong)
t = 0 -- Need to increment this from 0 to duration b = player.startX player.endX = player.startX - 100 c = player.endX - player.startX d = 100 -- milliseconds outExpo(t, b, c, d) -- Need to call this function repeatedly until t reaches d
I tried using a performWithDelay call but I'm getting unexpected results.