Opacity lerp

Get help using Construct 2

Post » Fri Apr 20, 2018 11:31 am

Hi, I've spent last two hours trying to find a simple answer for this but without any luck. So here's my question.

I'm trying to figure out how to use lerp to have a text go from 0 opacity to 100 and then back to 0. I'm using this:
Every tick - Set Text to "Whatever"
- lerp(Self.Opacity, 100, 2*dt)
- wait 3 seconds
- lerp(Self.Opacity, 0, 2*dt)

The first lerp works nicely, text shows up with a nice fade in. The wait function works too. But the second lerp stops half way and the text stays semi-transparent. It doesn't get to 0 opacity and I have no idea why.
What I'm trying to do is to have a random text to show up (through choose), stay visible for a few seconds, then fade away and then the whole thing should repeat again and again. Can anyone explain me (as simply as possible :D) what I'm doing wrong?
B
4
S
1
Posts: 5
Reputation: 310

Post » Fri Apr 20, 2018 12:53 pm

Hi @Davoo .

You can implement this effect with many ways i suggest you to use the sine behaviour.
Here is a little example with lerp and sine behaviour.

https://1drv.ms/u/s!ApR3LloJSC99g9ItuudVXvyOtw0GAg

Cheers !
B
43
S
18
G
1
Posts: 64
Reputation: 3,903

Post » Fri Apr 20, 2018 1:33 pm

Thanks for your reply @saour but....that didn't help me at all :D I guess I should've said I'm a huge noob in the beginning. I've never used Sine behaviour, I've never used boolean instance variable on a sprite and I have literaly no idea what those things do. I know there's probably a bazillion better ways to do it but I'm trying to understand this specific one right now because it seems simple enough for me to understand it. And once I'll get it, I can move on to something more complex and better. :)
If you can simply explain to me why my code doesn't work I'd be extremely thankful but suggesting a completely new and unknown method is probably not gonna work for me :)
B
4
S
1
Posts: 5
Reputation: 310


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests