hi, I try to make my own shake effect of RichTextEffect so I can add more options for choose. After a bit, I still can't reach the build-in shake effect, it just doesn't feel right. Could someone give me some advice?

tool
extends RichTextEffect

var bbcode = "myshake"

func _roll_rand() -> float:
    return rand_range(-1, 1)

func _process_custom_fx(char_fx):
    
    var scale:float = char_fx.env.get("scale", 1.0)
    var freq:float = char_fx.env.get("freq", 2.0)
    
    var new_random_pos: Vector2 = Vector2(_roll_rand(), _roll_rand()) * scale
    var previous_pos: Vector2 = char_fx.offset
    
    var offset = lerp(previous_pos, new_random_pos, freq)
    char_fx.offset = offset
    return true

It looks like your effect is quite close – it's just that it's too strong. Try using less strong parameters for your custom shake effect, and it will likely look closer to the original shake effect.

I mean, when I try to slow down the frequency, it starts to show the difference between the original one and the custom. It is more like changing all the time for my effect and is step by step for the original one. Is it some kind of coroutine? How can I achieve this effect?

a year later