0 votes

I am trying to make a Tween display an animation of a VBoxContainer scaling while its parent HSplitContainer's split_offset is shrinking, to achieve a drawer effect. So far, I am doing this:

func drawer_display():
#drawer is a VBoxContainer
#and hsplitter is an HSplitContainer
var tween = get_node("Tween")
drawer.visible = true
drawer.rect_scale = Vector2(0,1)

tween.interpolate_property(hsplitter,
"split_offset", get_viewport().size.x,
get_viewport().size.x - 50, 2,
Tween.TRANS_LINEAR, Tween.EASE_IN)

tween.interpolate_property(drawer,
"rect_scale", Vector2(0, 1), Vector2(1, 1), 2,
Tween.TRANS_LINEAR, Tween.EASE_IN)

tween.start()

However, drawer.rect_scale = Vector2(0,1) at the beginning is ignored, and VBoxContainer appears at full size instantly, ignoring the Tween animation. Any tips?

in Engine by (36 points)

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.