TableTower/ui/text_effects/shimmer_effect.gd
RobinFiredrake bd077ebadc Formatting: right-click Format menu in text fields, more toolbar buttons, sparkle/shimmer/flash
Every text field's right-click menu gains Format: Bold, Italic, Underline,
Strike-through, Colour, Size and Effect (Godot's wave, tornado, shake,
rainbow, pulse, fade plus the app's own sparkle, shimmer and flash, drawn
by RichTextEffects in ui/text_effects). The details toolbar adds U, S and
Effect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 14:32:46 -06:00

14 lines
569 B
GDScript

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