I want to adjust height of a sprite.
It looks like this
Every tick
--- Set Height
--- Self.Height*0.99
How do I make it framerate independent.
I think the blog using lerp with delta-time covers this, since shrinking by 1% every frame is the same as lerp(height, 0, 0.01).
I am not sure if I am getting it correctly.
If we are shrinking by 1% it would look like this?
lerp(Self.Height,0,1-0.01^dt)
If we are increasing by 1% it would be this?
Self.Height+Self.Height-lerp(Self.Height,0,1-0.01^dt)
lerp(height, 0, 0.01) In that height is always changing.
if you said lerp(originalheight, 0, 0.01) it would never change
Can someone that is good with maths verify if the formulas I am using are correct when increasing and decreasing height that is frame rate independent? I think it might be incorrect.
Decrease by 1%
Increase by 1%
Not good at math, but if I understood what you need correctly then here's the answer:
If you want to add exactly 1% of original Image Width (change plus to minus to decrease)
If you want to add 1% of Current Width (change multiply to divide to decrease)
Develop games in your browser. Powerful, performant & highly capable.
I'm thinking they should just use the Tween behavior.