Imagebutton hover transitions

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
Lutka
Newbie
Posts: 23
Joined: Mon Apr 24, 2017 11:13 am
Contact:

Imagebutton hover transitions

#1 Post by Lutka »

Hi

I'd like to have my imagebutton instead of immediately turning in to the hovered image when hovered, have it transition to the hovered image with a dissolve animation

How could I get something like that for a basic imagebutton like this

Code: Select all

imagebutton auto "/gui/start_%s.png" action Start()

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Imagebutton hover transitions

#2 Post by Milkymalk »

Funny you ask that :D
viewtopic.php?f=8&t=45228#p462630
This post should contain everything you need. Remember that you can pass arguments to a transform too!
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Lutka
Newbie
Posts: 23
Joined: Mon Apr 24, 2017 11:13 am
Contact:

Re: Imagebutton hover transitions

#3 Post by Lutka »

Well maybe I'm just not suited for this stuff but I tried this stuff from your link, like so

Code: Select all

transform bdiss:
    on hover:
        dissolve(0.3)
    on idle:
        dissolve(0.1)
and then gave the imagebutton this

Code: Select all

imagebutton auto "/gui/start_%s.png" action Start() at bdiss
This just gives me the error Attribute error: 'float' object has no attribute 'visit_all'

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Imagebutton hover transitions

#4 Post by Milkymalk »

Well it's not that easy because you can't use "dissolve".
To be honest, I'm new to this too, but try:

Code: Select all

transform bdiss(idle, hover):
    on hover:
        linear .25 hover
    on idle:
        linear .25 idle

# put this in the screen
imagebutton "/gui/start_idle.png" action Start() at bdiss("/gui/start_idle.png", "/gui/start_hover.png")
I can't think of a way how to use auto with this method though.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Post Reply

Who is online

Users browsing this forum: No registered users