TableTower/ui/text_effects/flash_effect.gd

15 lines
531 B
GDScript3
Raw Normal View History

class_name FlashEffect
extends RichTextEffect
## [flash]…[/flash]: the text snaps between its own colour and another one.
## [flash color=#ffd24a freq=1.5] sets the other colour and how often.
var bbcode := "flash"
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
var freq := float(char_fx.env.get("freq", 1.5))
var other := Color.from_string(str(char_fx.env.get("color", "#ffd24a")), Color("#ffd24a"))
if fmod(char_fx.elapsed_time * freq, 1.0) < 0.5:
char_fx.color = Color(other, char_fx.color.a)
return true