Fade In

This forum is currently in read-only mode.
  • Hello,

    I would like my object to fade into existence, but not disappear once it is done fading. Setting the 'fadeout' and 'wait' times to zero still makes it disappear.

    This is for a dialog frame to appear by fading in (within half a second), then I can click it and make it fade away (which would be fade-out behavior, which is quite simple to implement, unlike the fade-in).

    Any ideas?

  • Uncheck "Activate at start", and Destroy afterward".

    Since your fade in is pretty much instant, set the on click to start fade.

    After that you can do an on fade finished in a sub or other event.

  • It fades in no problem, the problem is that it always disappears after that no matter what I do. If I do the 'on fade in finished" subevent, it keeps fading in, which is rather annoying.

  • Instead of using the fade behavior, you could just do this:

    +If Object Opacity is Less than 0

    -Set Object Opacity to Object.Opacity + 100 * TimeDelta

    You can change the 100 to anything you want, but that will make it fade in in exactly a second.

  • It fades in no problem, the problem is that it always disappears after that no matter what I do.

    Oops, that was a bug. If you disabled the 'Destroy afterwards' option it didn't destroy but left it invisible. Fixed in next build.

  • Instead of using the fade behavior, you could just do this:

    +If Object Opacity is Less than 0

    -Set Object Opacity to Object.Opacity + 100 * TimeDelta

    You can change the 100 to anything you want, but that will make it fade in in exactly a second.

    That doesn't seem to work, neither do I understand how is it supposed to work. Opacity is 0-100, how can it be less than 0?

    Anyway, I've also tried the "on fade in finished" subevent, however that just causes it to loop, no matter the action.

    Edit: I've made it work now with this:

     
    +On Start of Layout
    MyObject make Invisible
    My Object set Opacity to 0
    
    +On Left Either single or double clicked on MyObject
    

    MyObject make Visible

    +On Right mouse button Either single or double clicked

    MyObject FadeOut

    ++FadeOut Finished

    MyObject make Invisible

    + MyObject Is visible

    + MyObject Opacity Less than 100

    MyObject Set opacity to MyObject.Opacity+100*TimeDelta

    [/code:25z3cgad]

    Bit clunky, but it works: on click the object is made visible, which makes it fade in. On right click I make it fade out using the Fade behavior, then after it is done, it is set to Invisible (otherwise it just loops). So, whenever the object is made visible, it fades in. I don't know, this seems a bit complicated, plus it keeps checking for the condition instead of just executing it once.

    Surely there is a more elegant solution? We'll see after I get back from visiting mom - she's down with flu.

    Thanks for the help so far!

  • i got same problem some time ago

    and i just set "wait time" to 1000000000000 - you know many zero's

    it's kind'a cheating but well...works

    Edit:

    but anyway i think setting "wait time" to -1 should make it stay forever - just little feature request

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Blah, sorry. That should actually be less than 100, not 0. Also, to fade in within half a second, change the code to this:

    +If Object Opacity is Less than 100

    -Set Object Opacity to Object.Opacity + 200 * TimeDelta

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