(Solved) Color Gradient on Screen Text?

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
SypherZent
Veteran
Posts: 331
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Soundcloud: Chrysopoeist
Location: Puerto Rico
Contact:

(Solved) Color Gradient on Screen Text?

#1 Post by SypherZent » Sun Aug 23, 2020 4:20 am

What is the simplest way to achieve a color gradient on text that is in a screen?

Code: Select all

screen test():
    text "Sample Text" size 64
So, for example, a simple screen like this. I want to color the text with a linear gradient that begins red at the top, blends to blue at the bottom.

What is the simplest way to achieve this in an optimal (not laggy) manner?
Last edited by SypherZent on Sun Aug 23, 2020 11:31 am, edited 1 time in total.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Color Gradient on Screen Text?

#2 Post by hell_oh_world » Sun Aug 23, 2020 4:33 am

Not possible with an ordinary text displayable. Use alphamask instead to achieve that.

Code: Select all

screen something():
  add AlphaMask("gradient.png", Text("The Text", size=64))
  # add AlphaMask(Transform("gradient.png", rotate=90), Text("The Text", size=64))
  #gradient direction rotated 90 deg.

User avatar
SypherZent
Veteran
Posts: 331
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Soundcloud: Chrysopoeist
Location: Puerto Rico
Contact:

Re: Color Gradient on Screen Text?

#3 Post by SypherZent » Sun Aug 23, 2020 11:30 am

Hmm, I thought AlphaMask would only cause the image to fade to transparency. I will give it a try. In any case, if it does only fade to transparency, I can layer two texts above one another and alpha fade the top, so I am sure I can solve it with this. Thank you!

Post Reply

Who is online

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