# How do I use unlerp?

0 favourites
• 12 posts
• I was trying to use lerp to increase my Sprites Opacity to 100 if it started from 25 like this:

lerp(Self.Opacity, 100, 9.8 * dt)

how do i do this if I want to decrease opacity using lerp? or do I have to use unlerp? But I don't know how to use unlerp. Can anyone explain how I can achieve this?

• Just change the target value, 100 to 0

• Just change the target value, 100 to 0

I mean change the opacity to a lesser value smoothly by 9.8 * dt using lerp or unlerp

• The same mechanism you used to raise the value.

lerp(Self.Opacity, 0, 9.8 * dt)

• Tried that, doesn't work. I also tried doing negative with b :/

• I also tried doing negative with b :/

I'm not sure what you mean by this..

The above expression by newt should work..

What are the conditions of the event to which the set opacity action is attached?

Could there be conflicting events?

• > I also tried doing negative with b :/

>

I'm not sure what you mean by this..

The above expression by newt should work..

What are the conditions of the event to which the set opacity action is attached?

Could there be conflicting events?

Yeah. You are right there were things that conflict. I'll try to fix it.

• The same mechanism you used to raise the value.

lerp(Self.Opacity, 0, 9.8 * dt)

Thanks it works.

• But what does unlerp really do?

• lerp(0,100,0.5)=50

unlerp(0,100,50)=?

You can use it to find out the percent something was interpolated.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• lerp(0,100,0.5)=50

unlerp(0,100,50)=?

You can use it to find out the percent something was interpolated.

Okay Thanks again XD

• lerp(0,100,0.5)=50

unlerp(0,100,50)=?

You can use it to find out the percent something was interpolated.

Thanks for the info XD

• 12 posts