Whatsis wrong with this tween code ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Pelli

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

if get_tree().paused == true:
		get_tree().paused = false
                    $VBoxContainer.rect_position,$VBoxContainer.rect_position + 
		get_tree().paused = true
                    $VBoxContainer.rect_position,$VBoxContainer.rect_position + 

it´s a simply interpolate property but I get this error :
_build_interpolation: 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

:bust_in_silhouette: Reply From: monnef

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:

  $VBoxContainer.rect_position,$VBoxContainer.rect_position + 

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

Pelli | 2020-04-21 13:20

:bust_in_silhouette: Reply From: njamster

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
  • EASE_IN_OUT = 2
  • EASE_OUT_IN = 3

However, you’re passing TRANS_ELASTIC = 6.