How to update the 'char_fx.offset' value in a RichTextLabel with a custom BBCode?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By barkingfarting

I’m using RichTextLabel with a custom BBCode which changes every character offset to a random one based on a value entered inside the tag. The function looks like this:

func _process_custom_fx(char_fx):
var offset = char_fx.env.get('offset', 0.0) # Get value from the tag
char_fx.offset = Vector2(0, rand_range(0, offset)) # Set offset based on the value
return true

The text itself looks like this: [bbcode offset=5]Word 1[/bbcode], word 2, word 3.

Is there anyway I can change the offset value once the text is written? (so it gradually goes from offset=5 to offset=1). I’m trying to make part of the text shake and then gradually revert back to normal, sort of like a one shot animation but for one specific word.