An ImageButton allows us to define different image filepaths depending on what state it's in: "idle", "hover", "selected_idle", etc.
How can I also change the xzoom and yzoom of "idle" image, and change it to something else when it's in a "hover" state? Is this possible with an ImageButton?
Basically I would like a way to change the size of an image button depending on its state, as kind of a UX feedback to the user.
Is there a way to change xzoom/yzoom for different states in an ImageButton?
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.
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.
-
- Regular
- Posts: 85
- Joined: Tue Dec 19, 2017 1:36 pm
- Contact:
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3792
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Is there a way to change xzoom/yzoom for different states in an ImageButton?
Use an ATL transform and the on hover attribute
I haven't got time to post an example, but I hope this helps a bit.
https://www.renpy.org/doc/html/atl.html?highlight=atl#
I haven't got time to post an example, but I hope this helps a bit.
https://www.renpy.org/doc/html/atl.html?highlight=atl#
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
-
- Regular
- Posts: 159
- Joined: Fri Jan 04, 2019 3:44 pm
- Contact:
Re: Is there a way to change xzoom/yzoom for different states in an ImageButton?
Here's an example using transform events to scale the button to 1.25 when hovered (and back). Plenty more information on events in Imperf3kt's link :)
Code: Select all
screen example():
imagebutton:
align .5, .5
idle Solid('f777', xysize=(160, 90))
hover Solid('7f77', xysize=(160, 90))
action NullAction()
at transform:
on idle:
linear .25 zoom 1.0
on hover:
linear .25 zoom 1.25
Who is online
Users browsing this forum: apocolocyntose