19 lines
676 B
GDScript
19 lines
676 B
GDScript
extends RichTextEffect
|
|
## Per-word motions driven entirely by the owning speech group's saved clock.
|
|
|
|
var bbcode: String = "speechmotion"
|
|
|
|
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
|
|
var env: Dictionary = char_fx.env
|
|
var kind: String = String(env.get("kind", ""))
|
|
var clock: float = float(env.get("clock", 0.0))
|
|
var index: float = float(char_fx.relative_index)
|
|
match kind:
|
|
"shake":
|
|
char_fx.offset += Vector2(sin(clock * 34.0 + index * 11.0) * 2.8, cos(clock * 41.0 + index * 7.0) * 1.8)
|
|
"wave":
|
|
char_fx.offset.y += sin(clock * 11.0 - index * 0.72) * 6.0
|
|
"bounce":
|
|
char_fx.offset.y -= absf(sin(clock * 7.0 - index * 0.42)) * 8.0
|
|
return true
|