How to make when I press a button it will have an animation without having to hold the button

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

extends KinematicBody2D
export var spe = 150
var move1 = Vector2.ZERO

func _ready():
$AnimationTree.active = true

func _physics_process(_delta):
var move1 = Vector2.ZERO
if Input.is_action_pressed(“ui_left”):
move1.x -= 1
move1.y = 0

if Input.is_action_pressed("ui_right"):
	move1.x += 1
	move1.y = 0 

if Input.is_action_pressed("ui_down"):
	move1.x = 0
	move1.y += 1
	
if Input.is_action_pressed("ui_up"):
	move1.x = 0
	move1.y -= 1

move1 = move1.normalized()

if move1 == Vector2.ZERO:
	$AnimationTree.get("parameters/playback").travel("Stay")

else:
	$AnimationTree.get("parameters/playback").travel("Move")
	$AnimationTree.set("parameters/Stay/blend_position",move1)
	$AnimationTree.set("parameters/Move/blend_position",move1)
	move_and_slide(move1 * spe  )