30 lines
687 B
GDScript3
30 lines
687 B
GDScript3
|
@tool
|
||
|
extends RichTextEffect
|
||
|
class_name SmallWaveEffect
|
||
|
|
||
|
var bbcode = "smallwave"
|
||
|
|
||
|
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
|
||
|
var time = fmod(char_fx.elapsed_time * 8 - char_fx.relative_index + 100, 10)
|
||
|
var local_time = fmod(time, 1)
|
||
|
|
||
|
if time < 1:
|
||
|
char_fx.offset = Vector2(0, -1 * (sin(local_time * PI)))
|
||
|
if time < 3 or time >= 8:
|
||
|
var color_time = local_time
|
||
|
if time >= 1 and time < 3:
|
||
|
color_time += 1
|
||
|
if time >= 2 and time < 3:
|
||
|
color_time += 1
|
||
|
if time >= 0 and time < 3:
|
||
|
color_time += 1
|
||
|
if time >= 9 or time < 3:
|
||
|
color_time += 1
|
||
|
|
||
|
|
||
|
char_fx.color.a = (sin(color_time / 5 * PI)) * 0.1 + 0.9
|
||
|
else:
|
||
|
char_fx.color.a = 0.9
|
||
|
|
||
|
return true
|