Ategon revised this gist . Go to revision
1 file changed, 29 insertions
small_wave.gd(file created)
@@ -0,0 +1,29 @@ | |||
1 | + | @tool | |
2 | + | extends RichTextEffect | |
3 | + | class_name SmallWaveEffect | |
4 | + | ||
5 | + | var bbcode = "smallwave" | |
6 | + | ||
7 | + | func _process_custom_fx(char_fx: CharFXTransform) -> bool: | |
8 | + | var time = fmod(char_fx.elapsed_time * 8 - char_fx.relative_index + 100, 10) | |
9 | + | var local_time = fmod(time, 1) | |
10 | + | ||
11 | + | if time < 1: | |
12 | + | char_fx.offset = Vector2(0, -5 * (sin(local_time * PI))) | |
13 | + | if time < 3 or time >= 8: | |
14 | + | var color_time = local_time | |
15 | + | if time >= 1 and time < 3: | |
16 | + | color_time += 1 | |
17 | + | if time >= 2 and time < 3: | |
18 | + | color_time += 1 | |
19 | + | if time >= 0 and time < 3: | |
20 | + | color_time += 1 | |
21 | + | if time >= 9 or time < 3: | |
22 | + | color_time += 1 | |
23 | + | ||
24 | + | ||
25 | + | char_fx.color.a = (sin(color_time / 5 * PI)) * 0.3 + 0.7 | |
26 | + | else: | |
27 | + | char_fx.color.a = 0.7 | |
28 | + | ||
29 | + | return true |
Newer
Older