Page 1 of 1

Better notification system help

Posted: Sat Jun 01, 2019 11:40 pm
by richycapy
Hi you all

Here is a what I think is a simple question for you most advanced users

I created this small notification system, here is the example:
Image

And the code is:

Code: Select all

screen notificacion(message, tipo):
    zorder 100

    fixed:
        area 1035, 80, 620, 200
        add "images/gui/notify-[tipo].png"
        hbox:
                yalign 0.09
                xalign 0.03
                text _('{size=17}{color=#ffffff}[message]{/color}{/size}')

    timer 3.25 action Hide('notificacion')
And you use it like this:

Code: Select all

show screen notificacion('hola', 'love-down')
Is there a way to animate it? Disolve in, disolve out?

I know it has something to do with transform, but I cant seem to make it work :(

Re: Better notification system help

Posted: Sat Jun 01, 2019 11:46 pm
by Imperf3kt
ATL is your solution here.

Something like:

Code: Select all

transform dissolve_screen:
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0

screen notificacion(message, tipo):
    zorder 100

    fixed at dissolve_screen:
        area 1035, 80, 620, 200
        add "images/gui/notify-[tipo].png"
        hbox:
                yalign 0.09
                xalign 0.03
                text _('{size=17}{color=#ffffff}[message]{/color}{/size}')

    timer 3.25 action Hide('notificacion')
    
This should make the screen fade in from invisible to completely visible, over the course of 0.25 seconds and then fade out to completely invisible over 0.5 seconds once hidden

Re: Better notification system help

Posted: Sat Jun 01, 2019 11:57 pm
by richycapy
That's perfect! thanks a lot!

Now that I know how is implement it... I modify it a bit so now it moves up while appearing, and down while disappearing for anybody out there looking
for somethink like this.

Code: Select all

transform dissolve_screen:
    on show:
        ypos 100
        alpha 0
        linear .25 alpha 1.0 ypos 80
    on hide:
        linear .25 alpha 0.0 ypos 100