How do I tween label's font shadow color property?

Godot Version

4.7

Question

I am trying to tween my label’s shadow color, but I get this error:

Cannot call method ‘set_trans’ on a null value.

Which probably means I am trying to change a property that doesn’t really exist?

Here’s the code:

extends ButtonTMP
func activate():
	state = STATE.TRANSITION
	self.self_modulate.a = 0.1
	var _f = create_tween()
	_f.tween_property(self,"theme_override_colors/font_shadow_color",
    Color("8400ffaf"),0.4).set_trans(Tween.TRANS_QUAD)
	await _f.finished
	state = STATE.ACTIVE
	

tween_property() returns a Tweener, but set_trans() should be called on the Tween itself. Try:

var tween := create_tween()
tween.set_trans(Tween.TRANS_QUAD)
tween.tween_property(self, "theme_override_colors/font_shadow_color", Color("8400ffaf"), 0.4)

If that still doesn’t work, does ButtonTMP actually inherit from a Control that supports font_shadow_color?.

Thank you for replying!

I am pretty sure that this is not an issue, as the official Godot documentation contains this line of code:

var tween = get_tree().create_tween()
tween.tween_property($Sprite, "modulate", Color.RED, 1).set_trans(Tween.TRANS_SINE)

But I tried your solution, and it works in a sense because I don’t get an error, but it doesn’t actually change the property once I launch the game—or, if it does, it has no visible effect. (I will check it)

As for ButtonTMP, it inherits from a Label node.

Is font_shadow_color enabled in the theme overrides?

Yes.

Tho I think I solved it myself already.

Not sure what the problem was, but I just use tween_method, method instead.

Here it is just in case:

func activate():
var _f = create_tween()
_f.tween_method(change_color,Color("8400ff00"),Color("8400ffaf"),0.4)
await _t.finished
state = STATE.ACTIVE

I accidentally sent the wrong thing my bad…

Here’s my solution for real this time:

func activate():
    var _f = create_tween()
    _f.tween_method(change_color,Color("8400ff00"),Color("8400ffaf"),0.4)
    await _f.finished
    state = STATE.ACTIVE

func change_color(value: Color):
    self.add_theme_color_override(“font_shadow_color”, value)

Not sure if this is the right way to do it, but if it works, it works, I guess.