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.
WladekProd
Newbie
Posts: 5 Joined: Fri Apr 05, 2024 3:48 pm
Contact:
#1
Post
by WladekProd » Fri Apr 05, 2024 4:01 pm
Hello, I want to implement a smooth style change like in css. That-so that when you hover over the text smoothly changed the color parameter.
Example:
Is it possible to create a custom textbutton class for a similar task or is it easier to implement than mine ?
utils.rpy:
Code: Select all
transform smooth_button(text_color, outline_color, text_zoom, smooth_time):
zoom text_zoom
on idle:
matrixcolor ColorizeMatrix(outline_color[1], text_color[1])
linear smooth_time matrixcolor ColorizeMatrix(outline_color[0], text_color[0])
on hover:
matrixcolor ColorizeMatrix(outline_color[0], text_color[0])
linear smooth_time matrixcolor ColorizeMatrix(outline_color[1], text_color[1])
screen stextbutton(text, action_func = Return(), style_class = None, smooth_time = .1, text_zoom = 1.0, text_color = [gui.selected_color, gui.hover_color_smooth], outline_color = [gui.outline_color, gui.outline_color]):
textbutton (text) action action_func at smooth_button(text_color, outline_color, text_zoom, smooth_time):
style style_class
screens.rpy:
Code: Select all
use stextbutton(_("Exit"), Quit(confirm=not main_menu))
jeffster
Veteran
Posts: 431 Joined: Wed Feb 03, 2021 9:55 pm
Contact:
#2
Post
by jeffster » Fri Apr 05, 2024 8:38 pm
If you prefer creator defined displayables to ATL transforms, there are interesting examples like BGQueue and SmoothHover:
viewtopic.php?t=63219
If the problem is solved, please edit the original post and add [SOLVED] to the title.
Users browsing this forum: No registered users