Opacity lerp

0 favourites
  • 3 posts
  • 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 ) what I'm doing wrong?

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your reply but....that didn't help me at all

    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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)