Godot Version
4.2.1
Question
Hey there fellas!
I’ve been trying to make a button that scales up when the mouse is over it
but when I do that, the button and the text doesn’t seem to be centered
here’s the Scaler code:
And the scene structure:
I have tried many solutions, but I didn’t figure out what is wrong
I centered everything in the button:
Even the pivot:
BUT none of it fixed it
Anyone can help me??
put the button inside a control Node first
I did that but it still doesn’t center, is there like another sizing variable other than the Scale one??
it’s matter of how you layout the control and button etc
i will need to screenshots alot
VBoxContainer:
Control Node:
PlayButton Node:
the Script
var tw=create_tween().bind_node(%PlayButton).set_loops(-1).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_SINE)
tw.tween_property(%PlayButton,"scale",Vector2(1.2,1.2),2).from(Vector2.ONE)
tw.tween_property(%PlayButton,"scale",Vector2.ONE,2)
GIF:
2 Likes
mrcdk
January 22, 2024, 7:47am
8
You need to set the Control.pivot_offset
to the center of the button.
2 Likes
OH MY GOD THANK YOU SO MUCH!! it worked!!
i apologies my knowledge of UI is limited, And thanks again!
2 Likes
system
Closed
February 21, 2024, 7:56am
11
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.