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>
16 lines
664 B
GDScript
16 lines
664 B
GDScript
class_name SparkleEffect
|
|
extends RichTextEffect
|
|
## [sparkle]…[/sparkle]: letters glint gold at random moments, like gems (gold
|
|
## shows on light and dark cards alike).
|
|
## [sparkle freq=2.0] sets how often.
|
|
|
|
var bbcode := "sparkle"
|
|
|
|
|
|
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
|
|
var freq := float(char_fx.env.get("freq", 2.0))
|
|
# Each letter has its own rhythm, so the glints don't line up.
|
|
var phase := fmod(char_fx.elapsed_time * freq + float(char_fx.relative_index) * 0.618, 1.0)
|
|
var glint := clampf(1.0 - absf(phase - 0.5) * 8.0, 0.0, 1.0)
|
|
char_fx.color = char_fx.color.lerp(Color(1.0, 0.78, 0.2, char_fx.color.a), glint * 0.9)
|
|
return true
|