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

0 votes

Trying to animate a PanelContainer with a Tween in and out of screen (in this example between 0 and 200 y position), where going away is slow (5 sec) and going in fast (1 sec).

For some reason calling tween stop_all does not interrupt a currently running animation, as seen here If the slow animation is interrupted it is resumed as soon as the fast animation is completed. Only after the slow animation is done can the quick animation complete and stay at the target position.

Scene structure and code (script of Node):

- PanelContainer
- - Label
- Tween

extends Node

onready var tween = get_node("Tween")
onready var node = get_node("PanelContainer")
onready var msg = get_node("PanelContainer/Label")

func _input(event):
    if event.is_action_pressed("ui_down"):
        msg.text = "down"

    elif event.is_action_pressed("ui_up"):
        msg.text = "up"

func go_in(duration=.5):
    tween.interpolate_property(node, "rect_position:y", node.rect_position.y, 200, duration, Tween.TRANS_LINEAR, Tween.EASE_OUT)

func go_away(duration=1.0):
    var rect_position_y = 0
    tween.interpolate_property(node, "rect_position:y", node.rect_position.y, rect_position_y, duration, Tween.TRANS_LINEAR, Tween.EASE_OUT)
Godot version v3.4.beta3
in Engine by (46 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 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.