Option 1 is to use an empty control node, or position 2D as a parent. Use it as a faux pivot point by moving the (child) button until the center point of that empty parent node is the center of the button. From there, just scale the control/position2D parent node. It’s transforms will carry over.
Option 2, use math in script to offset the position after scaling. Here is an example with scaling by 50%, contained inside the button itself.
extends Button
func _on_Button_pressed():
var scale = Vector2(.5, .5)
var button_size = self.get_size()
var button_pos = self.get_global_pos()
self.set_scale(scale)
self.set_global_pos(button_pos + button_size * scale / 2)
It works,hhhh.
Because I need to scale with animation, the option 1 is what I wanted.
Thank you my brother !