challenge-editor/scene/auction_card.gd
2024-10-08 17:01:28 +08:00

20 lines
602 B
GDScript

extends TextureRect
class_name AuctionCard
@export var animation_time:float=0.2
func set_item_texture(texture:Texture2D):
$TextureRect.texture=texture
var tween:Tween
func move_size_to(pos:Vector2,_size:Vector2,is_queue_free_finish:bool=false):
if tween!=null:
tween.kill()
tween=create_tween()
tween.tween_property(self,"global_position",pos,animation_time)
tween.parallel().tween_property(self,"size",_size,animation_time)
tween.set_parallel(false)
if is_queue_free_finish:
tween.tween_callback(queue_free)
else:
tween.parallel().tween_property(self,"modulate:a",1,animation_time)