I've been trying to control the alpha of individual characters in a string by a transform. Since I didn't know how to go about this, I created a bunch of Text displayables, one for each letter. I wanted an effect where once you hovered over a button (which had this kind of text), the transparency of each of the letters would change randomly
Here are the transforms:
Code: Select all
transform test_trans(time):
choice:
pause time alpha 1.0
choice:
pause time alpha 0.75
choice:
pause time alpha 0.5
choice:
pause time alpha 0.25
choice:
pause time alpha 0.0
repeat
ease time alpha 1.0
transform test_normal:
alpha 1.0
Code: Select all
screen hbox_text(string, act):
button action act:
hovered:
hbox:
for c in string:
text "[c]" at test_text(0.1):
style "navigation_button_text"
unhovered:
hbox:
for c in string:
text "[c]" at test_normal:
style "navigation_button_text"
Code: Select all
screen hbox_text(string, act):
default r = 0
button unhovered SetScreenVariable("r", 0) hovered SetScreenVariable("i", 1) action act:
hbox:
if r==1:
for c in string:
text "[c]" at test_text(0.1):
style "navigation_button_text"
else:
for c in string:
text "[c]" at test_normal:
style "navigation_button_text"
So I created 10 variables v0, v1, ..., v9 each for one of my buttons to see if atleast that worked.
Code: Select all
screen hbox_text(string, act, i):
button unhovered SetVariable("i", 0) hovered SetVariable("i", 1) action act:
hbox:
if i==1:
for c in string:
text "[c]" at test_text(0.1):
style "navigation_button_text"
else:
for c in string:
text "[c]" at test_normal:
style "navigation_button_text"