-
Notifications
You must be signed in to change notification settings - Fork 1
/
turn_red.gd
29 lines (21 loc) · 728 Bytes
/
turn_red.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
tool
extends RichTextEffect
class_name RichTextTurnColor
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var bbcode = "turncolor"
# Called when the node enters the scene tree for the first time.
func _init():
resource_name = "RichTextTurnColor"
func _process_custom_fx(char_fx):
var speed = char_fx.env.get("time") # time to turn entire text into the color
var chars = char_fx.env.get("chars", 10)
var color = char_fx.env.get("color", "#F48282")
if speed * (float(char_fx.relative_index) / (chars - 1)) <= char_fx.elapsed_time:
char_fx.color = color
return true
return false
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass