12var current_frame := -1
16func configure(next_frames:Array, options:Dictionary = {}) -> void:
17 frames = next_frames.duplicate()
18 fps = max(0.1, float(options.get(
"fps", 8.0)))
19 loop = bool(options.get(
"loop", true))
20 playing = bool(options.get(
"autoplay", true))
21 elapsed = float(options.get(
"offset_seconds", 0.0))
22 stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
23 expand_mode = TextureRect.EXPAND_IGNORE_SIZE
24 mouse_filter = Control.MOUSE_FILTER_IGNORE
36func _process(delta:float) -> void:
37 if not playing
or frames.size() <= 1:
43func _update_frame() -> void:
48 var frame = int(floor(elapsed * fps))
50 frame = frame % frames.size()
52 frame = min(frame, frames.size() - 1)
53 if frame == current_frame:
56 texture = frames[current_frame]