Need help with interpolating text effects

Godot Version

Godot Engine v4.5.1.stable.steam.f62fdbde1

Question

I have a script in the main menu of my game, which is just interpolating the glyph spacing of the title, the issue is towards the end of the interpolation it appears to be "skipping frames" even though the game is running at a high framerate, how can I assure the effect goes smoothly?

Relevant code

var font
var embolden = -1.5
var glyph_spacing = -20.0

func _ready() → void:
font = label_title.get_theme_font(“font”)

func _process(delta: float) → void:
# Title font effects
if font:
if layer_menu.visible:
label_title.global_position.y = lerp(label_title.global_position.y,88.0, 0.05)
glyph_spacing = lerp(glyph_spacing, 20.0, 0.025)
#if embolden <= -1.4:
#embolden = lerp(font.embolden, 1.5, 0.05)
#if embolden >= 1.4:
#embolden = lerp(font.embolden, -1.5, 0.05)
else:
glyph_spacing = 100.0
font.set_spacing(TextServer.SPACING_GLYPH, float(glyph_spacing))

Notes

When I use move_toward() it works fine, but it’s not easing like lerp()
Is it the case that the font spacing can’t work with very low float values?

I would also like to interpolate the embolding of the font, could anyone help me with that?
I tried set_embolding() like set_spacing() but it seems as it doesn’t exist.

Video

I don’t understand the way you are doing it. It doesn’t mean it’s wrong. It just means I’m dumb :slight_smile: But I think I’d use animationplayer to get the effect you wanted.

1 Like

You’re not dumb haha, I’m changing the letter spacing gradually with lerp() and applying it with font.set_spacing()

But can you do that with the animationplayer?

1 Like

Thank you, you literally erased multiple lines of unnecessary complicated code.
can’t believe I didn’t think of this :joy:

No worries at all.

Animation player is actually very powerful but a lot of people, including myself, forgets it can move everything however you want.

By the way, I wasn’t also sure if you could change the spacing with animationplayer, but I’m glad it works.

1 Like

Yeah it did help, but when increasing the letter spacing it still looks like it’s low framerate

EDIT: it’s because it’s measured in pixels which are integer values :confused: