0 votes

I am trying to make a pause with a transition, here is the code

if get_tree().paused == true:
        get_tree().paused = false
        $Tween.interpolate_property($VBoxContainer,"rect_position",´ 
                    $VBoxContainer.rect_position,$VBoxContainer.rect_position + 
                   Vector2(0,-720),1,Tween.TRANS_BOUNCE,Tween.TRANS_ELASTIC)
        $Tween.start()

else:
        get_tree().paused = true
        $Tween.interpolate_property($VBoxContainer,"rect_position", 
                    $VBoxContainer.rect_position,$VBoxContainer.rect_position + 
                    Vector2(0,720),1,Tween.TRANS_BOUNCE,Tween.TRANS_ELASTIC)
        $Tween.start()

it´s a simply interpolate property but I get this error :
buildinterpolation: Invalid easing type provided to Tween.
I have others tweens that works good, maybe is that you can´t apply a tween in a container? I tried with Control and it's the same

in Engine by (126 points)

2 Answers

+1 vote
Best answer

Last (required) argument of interpolate_property is easing, not transition (for a second time):

bool interpolate_property ( Object object, NodePath property, Variant initial_val, Variant final_val, float duration, TransitionType trans_type, EaseType ease_type, float delay=0 )

You are using Tween.TRANS_ELASTIC, but that should be an easing constant (starting with EASE_). For example Tween.EASE_IN (more in docs).

Try something like this:

$Tween.interpolate_property($VBoxContainer,"rect_position",
  $VBoxContainer.rect_position,$VBoxContainer.rect_position + 
  Vector2(0,-720),1,Tween.TRANS_BOUNCE,Tween.EASE_IN)
by (124 points)
selected by

thanks! it solved the problem. I thought that you can put any transition in the two last arguments, I read the docs but i don´t understand very well some english technique words like the difference between "ease" and "trans" I just thought that both are transitions

+1 vote

This is from the documentation of interpolate_property:

bool interpolate_property(object: Object, property: NodePath, initial_val: Variant, final_val: Variant, duration: float, trans_type: TransitionType = 0, ease_type: EaseType = 2, delay: float = 0)

And this is the error message you got, emphasized by me:

Invalid easing type provided to Tween.

The easing type is the penultimate argument of interpolate_property and the last argument you pass explicitly (as you use the default value for delay).

Here are all valid options for ease_type:

  • EASE_IN = 0
  • EASE_OUT = 1
  • EASEINOUT = 2
  • EASEOUTIN = 3

However, you're passing TRANS_ELASTIC = 6.

by (10,221 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 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.