cirnogodot/addons/dialogic/Modules/Character/DefaultAnimations/slide_left_in_out.gd

27 lines
738 B
GDScript3
Raw Permalink Normal View History

2025-02-06 11:36:21 +01:00
extends DialogicAnimation
func animate() -> void:
var tween := (node.create_tween() as Tween)
tween.set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
2026-01-05 16:00:41 +01:00
var end_position_x: float = base_position.x + node.get_parent().global_position.x
2025-02-06 11:36:21 +01:00
if is_reversed:
2026-01-05 16:00:41 +01:00
end_position_x = - get_node_size().x + get_node_origin().x
tween.set_ease(Tween.EASE_IN)
2025-02-06 11:36:21 +01:00
else:
2026-01-05 16:00:41 +01:00
node.global_position.x = -get_node_size().x + get_node_origin().x
2025-02-06 11:36:21 +01:00
2026-01-05 16:00:41 +01:00
tween.tween_property(node, 'global_position:x', end_position_x, time)
2025-02-06 11:36:21 +01:00
await tween.finished
finished_once.emit()
func _get_named_variations() -> Dictionary:
return {
2026-01-05 16:00:41 +01:00
"slide from left": {"reversed": false, "type": AnimationType.IN},
"slide to left": {"reversed": true, "type": AnimationType.OUT},
2025-02-06 11:36:21 +01:00
}