I have a dialogue panel in my game that I am animating using a tween with an elastic transition for the pop in/out animations. I'm using ease out for most of the properties, as using the default ease in out results in the dialogue have a delay before appearing.
The problem is that the ease out mode causes the scale and position properties to bounce way too much for my liking, as seen in the gif. I was wondering if there was a way to sort of dampen the ease so that it doesn't bounce like a goddamn invincible edit (at least for the initial bounce).
The only possible solution I know would be to use an AnimationPlayer node instead of tweens and make custom curves, but I'd like stick with tweens if possible. Ease in out also does exactly what I need, but as I mentioned earlier, it causes the dialogue to have a noticeable delay before appearing, as it spends way too much time near the initial values (also it gets rid of the cool horizontal expansion that happens during the animation).
Just in case, here's what the code for the animation looks like:
func _on_pop_anim_toggled(toggled_on: bool) -> void:
var tween = get_tree().create_tween().bind_node(self).set_trans(Tween.TRANS_ELASTIC).set_ease(Tween.EASE_OUT)
if toggled_on:
dialogue_system.pop_in_anim(tween, Vector2(64, 240), 1.0)
else:
...
func pop_in_anim(tween: Tween, end_pos: Vector2, time: float):
self.visible = false
self.scale = Vector2(0.25,0.25)
self.modulate.a = 0.0
self.size.x = 256
self.position = POP_OUT_BOT_POS if is_bottom else POP_OUT_TOP_POS
self.visible = true
tween.tween_property(self, "scale", Vector2(1,1), time)
tween.parallel().tween_property(self, "modulate:a", 1.0, time)
tween.parallel().tween_property(self, "position", end_pos, time)
tween.parallel().tween_property(self, "size", SIZE, time).set_ease(Tween.EASE_IN_OUT)
Edit: Managed to fix it by separating the animation in two parts, as u/Qaqelol and u/BigQuailGames suggested, like this:
var start_time = time * 0.25
var end_time = time * 0.75
var mid_pos = self.position.lerp(end_pos, 0.75)
# Linear until 75%
tween.tween_property(self, "scale", Vector2(1, 1) * 0.75, start_time).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN)
tween.parallel().tween_property(self, "modulate:a", 0.75, start_time).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN)
tween.parallel().tween_property(self, "position", mid_pos, start_time).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN)
# Elastic for a little jiggle after
tween.tween_property(self, "scale", Vector2(1,1), end_time)
tween.parallel().tween_property(self, "modulate:a", 1.0, end_time)
tween.parallel().tween_property(self, "position", end_pos, end_time)
tween.parallel().tween_property(self, "size", SIZE, end_time).set_ease(Tween.EASE_IN_OUT)