The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

I need to use a tween animation for change text label current scale.

But, when scaling text label, it is modified from the top-left. I wish to scale it from the center, as shown in the following example:

enter image description here

Is it possible?

Thanks in advance

in Engine by (1,488 points)

The only option may be to displace the text while scaling.

EDIT: I've just tried something: if you can, put the text on the center of a Node2D or a Control and scale that node instead.

Yes, with a control node as parent it works.

But this is not convenient, why not Godot support like "Sprite".

2 Answers

+1 vote
Best answer

If is to use tweens only and no extra nodes, can be done tweening rect/scale and rect/pos in the same tween.

Dirty example:

tween.interpolate_property(text, "rect/scale", text.get_scale(), text.get_scale()*4, 2, Tween.TRANS_LINEAR, Tween.EASE_IN)
tween.interpolate_property(text, "rect/pos", text.get_pos(), text.get_pos()-text.get_size()*1.5, 2, Tween.TRANS_LINEAR, Tween.EASE_IN)
by (7,890 points)
selected by
0 votes

Hi, I have asked a question like this.
here is the url

by (83 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.