TableTower/ui/text_effects/shimmer_effect.gd

15 lines
569 B
GDScript3
Raw Normal View History

class_name ShimmerEffect
extends RichTextEffect
## [shimmer]…[/shimmer]: a band of golden light sweeps across the text, left to right.
## [shimmer speed=1.0] sets how fast.
var bbcode := "shimmer"
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
var speed := float(char_fx.env.get("speed", 1.0))
var sweep := fmod(char_fx.elapsed_time * speed * 10.0, 24.0) - 4.0
var near := clampf(1.0 - absf(float(char_fx.relative_index) - sweep) / 3.0, 0.0, 1.0)
char_fx.color = char_fx.color.lerp(Color(1.0, 0.85, 0.35, char_fx.color.a), near * 0.8)
return true