extends AnimatedSprite3D
class_name Afterimage

@export var duration_max:float = 0.2
@export var is_moving:bool = true

var duration:float
var velocity:Vector3

func _ready():
	duration = duration_max

func _process(delta):
	if is_moving:
		position += velocity*delta
	
	var rate = duration / duration_max
	modulate.a = rate
	
	duration-=delta
	if duration<=0:
		queue_free()
