How do I use unlerp?

Get help using Construct 2

Post » Sat Dec 19, 2015 3:30 pm

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?
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
53
S
17
G
90
Posts: 1,111
Reputation: 59,095

Post » Sat Dec 19, 2015 4:17 pm

Just change the target value, 100 to 0
Image ImageImage
B
165
S
49
G
146
Posts: 8,038
Reputation: 96,066

Post » Sat Dec 19, 2015 4:57 pm

newt wrote: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
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
53
S
17
G
90
Posts: 1,111
Reputation: 59,095

Post » Sat Dec 19, 2015 5:18 pm

The same mechanism you used to raise the value.
lerp(Self.Opacity, 0, 9.8 * dt)
Image ImageImage
B
165
S
49
G
146
Posts: 8,038
Reputation: 96,066

Post » Sat Dec 19, 2015 6:07 pm

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



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
53
S
17
G
90
Posts: 1,111
Reputation: 59,095

Post » Sat Dec 19, 2015 6:47 pm

chadorireborn wrote: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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 19, 2015 7:13 pm

LittleStain wrote:
chadorireborn wrote: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.
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
53
S
17
G
90
Posts: 1,111
Reputation: 59,095

Post » Sat Dec 19, 2015 7:13 pm

newt wrote:The same mechanism you used to raise the value.
lerp(Self.Opacity, 0, 9.8 * dt)


Thanks it works.
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
53
S
17
G
90
Posts: 1,111
Reputation: 59,095

Post » Sat Dec 19, 2015 7:23 pm

But what does unlerp really do?
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
53
S
17
G
90
Posts: 1,111
Reputation: 59,095

Post » Sat Dec 19, 2015 8:23 pm

lerp(0,100,0.5)=50
unlerp(0,100,50)=?

You can use it to find out the percent something was interpolated.
Image ImageImage
B
165
S
49
G
146
Posts: 8,038
Reputation: 96,066

Next

Return to How do I....?

Who is online

Users browsing this forum: PreacH and 11 guests