添加砖瓦……
结合了以上两位方案的优点,在on语句中使用function。
[RenPy] 纯文本查看 复制代码 ## 淡入淡出transform
transform button_fadeinout:
alpha 0.0
on hover:
#linear 0.5 alpha 1.0
function fadein_function
on idle:
#linear 0.5 alpha 0.0
function fadeout_function
init python:
def fadein_function(trans, st, at):
if(st >= 0.5) or (trans.alpha > 1.0):
trans.alpha = 1.0
return None
else:
trans.alpha = st * 2.0
return 0
init python:
def fadeout_function(trans, st, at):
if(st >= 0.5) or (trans.alpha < 0.0):
trans.alpha = 0.0
return None
else:
trans.alpha -= st * 2.0
return 0
|