TableTower/ui/text_effects/flash_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
531 B
GDScript

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