Page 1 of 1

Transition/animation for default GUI items?

Posted: Fri Aug 14, 2020 10:18 am
by vorgbardo
Is it possible to add transition/animation for the default GUI items? For example, choice buttons: I'd like to have my choice_idle_background.png to fade out and simultaneously choice_hover_background.png to fade in when user hovers over a choice button, and the gui.choice_button_text_idle_color to smoothly fade into gui.choice_button_text_hover_color, instead of the latter ones just immediately replacing the former ones. If this is possible, where and how it should be defined? I failed to find any mention of this in the documentation.

Re: Transition/animation for default GUI items?

Posted: Fri Aug 14, 2020 2:27 pm
by hell_oh_world
It is. But you need to do a little bit of workaround something like this in the screen.

Code: Select all

screen something():
  default hovered = False
  button:
    action NullAction()
    hovered SetScreenVariable("hovered", True)
    unhovered SetScreenVariable("hovered", False)

    showif hovered:
      add "hovered_image.png" at fader

    else:
      add "idle_image.png" at fader

    text "Something"

transform fader:
  on show:
    alpha 0.0
    easein 0.5 alpha 1.0

  on hide:
    easeout 0.5 alpha 0.0
Another way might be by this... Not tried this one though.

Code: Select all

screen something():
  button:
    action NullAction()
    
    hover_background "hovered_image"
    background "idle_image"

    text "Something"

image hovered_image:
  "hovered_image.png" with dissolve

image idle_image:
  "idle_image.png" with dissolve

Re: Transition/animation for default GUI items?

Posted: Fri Aug 14, 2020 3:04 pm
by vorgbardo
Ah, so basically I need to replace the default item with my own solution? Thank you, I'll try out what you suggested.