brackeys-12/small_wave.gd

30 lines
690 B
GDScript3
Raw Permalink Normal View History

2024-09-15 02:50:11 +00:00
@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:
2024-09-15 05:37:02 +00:00
char_fx.offset = Vector2(0, -1 * (sin(local_time * PI)))
2024-09-15 02:50:11 +00:00
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
2024-09-15 06:15:37 +00:00
char_fx.color.a = (sin(color_time / 5 * PI)) * 0.15 + 0.85
2024-09-15 02:50:11 +00:00
else:
2024-09-15 06:15:37 +00:00
char_fx.color.a = 0.85
2024-09-15 02:50:11 +00:00
return true