# Dt when multiplying

0 favourites
• 7 posts
• 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

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• 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%

lerp(Self.Height,0,1-0.01^dt)

Increase by 1%

Self.Height+Self.Height-lerp(Self.Height,0,1-0.01^dt)

• 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)

• I'm thinking they should just use the Tween behavior.

• 7 posts