Hi, i'm using a layer named "fade" wich is full black at the start of the layout, fade out with : every tick -> set layer opacity to LayerOpacity("fade")-(dt*60)
How can i make it fade in ?
I'm trying with : every tick -> set layer opacity to LayerOpacity("fade")+10 but the opacity goes to 97% then stop.
Can you help me guys ?
You could use the Fade behavior on a black tiledBG or sprite.
or lerp the opacity of the layer like:
every tick set opacity lerp(currentOpacity,targetOpacity,Speed*dt)
Develop games in your browser. Powerful, performant & highly capable.
thanks for your help, it work too, but the problem is that even if the layer opacity is at 100%, the real opacity is 97%, idk why
I tested it and it works.
wdym with real opacity?
when i run my game with debug, i check the layer opacity and it's like "97.79999999%" every time.
If it doesn't work, i'm gonna make it with a png+fade behavior
you mean it goes up to 99.9999.... (at least in the example I send) I think that is just a lerp*dt thing not having perfect accuracy. As it's only getting closer and closer to target but never actually arrives.
If that is really important to you, you might want to look into this:
or just use an object with the tween behavior and use tween value, this goes accurately to the value. Just use that value to set the layer opacity to.