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.
-
Kinmoku
- Miko-Class Veteran
- Posts: 560
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: Love IRL, Memories
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
-
Contact:
#1
Post
by Kinmoku » Wed Feb 19, 2020 9:13 am
Hi all,
Is it possible to have an animation play when a button is, not only hovered over, but hovered off/ unhovered? I'd like the hover image to fade out, like it fades in.
Button:
Code: Select all
imagebutton idle "gui/auto_off.png" selected_idle "gui/auto_select.png" hover "gui/auto_on.png" clicked Preference("auto-forward", "toggle") focus_mask None at imagehover
In script.rpy:
Code: Select all
transform imagehover:
on hover:
alpha 0.0
linear 1.0 alpha 1.0
on hide:
alpha 1.0
linear 1.0 alpha 0.0
I tried "on idle" instead of "on hide" too, but it fades out when idle, as expected lol! On hide sadly does nothing.
-
DragoonHP
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
-
Contact:
#2
Post
by DragoonHP » Thu Feb 20, 2020 9:17 am
I tried "on idle" instead of "on hide" too, but it fades out when idle, as expected lol! On hide sadly does nothing.
Isn't idle state just an unhovered state?
-
gas
- Miko-Class Veteran
- Posts: 838
- Joined: Mon Jan 26, 2009 7:21 pm
-
Contact:
#3
Post
by gas » Thu Feb 20, 2020 3:11 pm
Set the default alpha at 0.0, then use the "on idle" event to set it back to 0.
Code: Select all
transform imagehover:
alpha 0.0
on hover:
alpha 0.0
linear 1.0 alpha 1.0
on idle:
linear 1.0 alpha 0.0
(no way of actually testing it, but it worked for me on positions and offsets).
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
-
Kinmoku
- Miko-Class Veteran
- Posts: 560
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: Love IRL, Memories
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
-
Contact:
#4
Post
by Kinmoku » Wed Feb 26, 2020 6:39 am
gas wrote: ↑Thu Feb 20, 2020 3:11 pm
Set the default alpha at 0.0, then use the "on idle" event to set it back to 0.
Code: Select all
transform imagehover:
alpha 0.0
on hover:
alpha 0.0
linear 1.0 alpha 1.0
on idle:
linear 1.0 alpha 0.0
(no way of actually testing it, but it worked for me on positions and offsets).
Sorry it took me a while to get back. It doesn't work how I want it to, which is to fade out the hover image only. This code *works* but fades out the idle image instead, so no button shows after you hover off.
When I hover off, the images switch instantly, then idle fades out. I want Idle to stay and hover to fade out. I hope this is clear ^^;
-
Kinmoku
- Miko-Class Veteran
- Posts: 560
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: Love IRL, Memories
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
-
Contact:
#5
Post
by Kinmoku » Mon Mar 09, 2020 5:42 am
Any ideas on how to get this working?
Users browsing this forum: Google [Bot]