Transition/animation for default GUI items?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
vorgbardo
Regular
Posts: 31
Joined: Sun Jan 14, 2018 8:28 am
Projects: Head Case
Contact:

Transition/animation for default GUI items?

#1 Post 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.
A dyslexic man walks into a bra.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Transition/animation for default GUI items?

#2 Post 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

User avatar
vorgbardo
Regular
Posts: 31
Joined: Sun Jan 14, 2018 8:28 am
Projects: Head Case
Contact:

Re: Transition/animation for default GUI items?

#3 Post 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.
A dyslexic man walks into a bra.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]