tilemap-parser 6.0.1__tar.gz → 6.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. {tilemap_parser-6.0.1/src/tilemap_parser.egg-info → tilemap_parser-6.1.0}/PKG-INFO +1 -1
  2. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/README.md +62 -0
  3. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/pyproject.toml +1 -1
  4. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/__init__.py +8 -0
  5. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/parser/__init__.py +10 -0
  6. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/parser/animation.py +35 -1
  7. tilemap_parser-6.1.0/src/tilemap_parser/parser/collision.py +881 -0
  8. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/parser/collision_loader.py +23 -1
  9. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/parser/map_parse.py +49 -0
  10. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/__init__.py +13 -1
  11. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/animation_player.py +46 -10
  12. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/collision/hit.py +48 -14
  13. tilemap_parser-6.1.0/src/tilemap_parser/runtime/collision/manager.py +490 -0
  14. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/collision/shapes.py +5 -5
  15. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/collision_cache.py +47 -2
  16. tilemap_parser-6.1.0/src/tilemap_parser/runtime/hitbox.py +227 -0
  17. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/map_loader.py +143 -25
  18. tilemap_parser-6.1.0/src/tilemap_parser/runtime/protocols.py +69 -0
  19. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0/src/tilemap_parser.egg-info}/PKG-INFO +1 -1
  20. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser.egg-info/SOURCES.txt +5 -0
  21. tilemap_parser-6.1.0/tests/test_animation_spans.py +63 -0
  22. tilemap_parser-6.1.0/tests/test_character_hitboxes.py +1241 -0
  23. tilemap_parser-6.1.0/tests/test_object_animation_regions.py +116 -0
  24. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_object_collision.py +179 -1
  25. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_render_scale.py +241 -0
  26. tilemap_parser-6.1.0/tests/test_tile_placements.py +107 -0
  27. tilemap_parser-6.1.0/tests/test_v6_contract.py +138 -0
  28. tilemap_parser-6.0.1/src/tilemap_parser/parser/collision.py +0 -427
  29. tilemap_parser-6.0.1/src/tilemap_parser/runtime/collision/manager.py +0 -189
  30. tilemap_parser-6.0.1/src/tilemap_parser/runtime/protocols.py +0 -33
  31. tilemap_parser-6.0.1/tests/test_v6_contract.py +0 -71
  32. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/LICENSE +0 -0
  33. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/pypi-readme.md +0 -0
  34. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/setup.cfg +0 -0
  35. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/parser/node_parse.py +0 -0
  36. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/parser/particle.py +0 -0
  37. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/parser/tileanim.py +0 -0
  38. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/parser/tmx_converter.py +0 -0
  39. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/area_node.py +0 -0
  40. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/body.py +0 -0
  41. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/camera.py +0 -0
  42. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/collision/__init__.py +0 -0
  43. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/map_object.py +0 -0
  44. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/movement/__init__.py +0 -0
  45. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/movement/grounded.py +0 -0
  46. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/movement/platformer.py +0 -0
  47. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/movement/queries.py +0 -0
  48. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/movement/rpg.py +0 -0
  49. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/movement/runner.py +0 -0
  50. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/movement/slide.py +0 -0
  51. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/movement/types.py +0 -0
  52. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/navigation/__init__.py +0 -0
  53. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/navigation/nav_grid.py +0 -0
  54. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/navigation/path_follower.py +0 -0
  55. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/navigation/pathfinder.py +0 -0
  56. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/particles.py +0 -0
  57. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/polygon_query.py +0 -0
  58. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/renderer.py +0 -0
  59. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/runtime/world.py +0 -0
  60. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/utils/__init__.py +0 -0
  61. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser/utils/geometry.py +0 -0
  62. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser.egg-info/dependency_links.txt +0 -0
  63. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser.egg-info/requires.txt +0 -0
  64. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/src/tilemap_parser.egg-info/top_level.txt +0 -0
  65. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_background_layer.py +0 -0
  66. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_body.py +0 -0
  67. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_camera.py +0 -0
  68. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_character_flip.py +0 -0
  69. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_collision.py +0 -0
  70. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_collision_debug.py +0 -0
  71. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_docs_snippets.py +0 -0
  72. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_geometry.py +0 -0
  73. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_gid_collision.py +0 -0
  74. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_gid_override.py +0 -0
  75. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_gid_routing.py +0 -0
  76. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_ground_info.py +0 -0
  77. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_integration_animation.py +0 -0
  78. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_integration_collision.py +0 -0
  79. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_integration_map_loader.py +0 -0
  80. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_layer_union.py +0 -0
  81. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_map_loader.py +0 -0
  82. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_map_object.py +0 -0
  83. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_map_offset.py +0 -0
  84. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_move_grounded.py +0 -0
  85. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_navigation.py +0 -0
  86. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_object_animation.py +0 -0
  87. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_object_surfaces.py +0 -0
  88. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_particle_emitter.py +0 -0
  89. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_tile_anim_clips.py +0 -0
  90. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_tile_collision.py +0 -0
  91. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_tile_flips.py +0 -0
  92. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_tile_layer_renderer_y_sort.py +0 -0
  93. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_tile_layers.py +0 -0
  94. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_tileset_surfaces.py +0 -0
  95. {tilemap_parser-6.0.1 → tilemap_parser-6.1.0}/tests/test_tmx_converter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tilemap-parser
3
- Version: 6.0.1
3
+ Version: 6.1.0
4
4
  Summary: Standalone parser/loader for tilemap-editor JSON maps, sprite animations, and collision detection runtime.
5
5
  Author: tilemap parser contributors
6
6
  License: MIT
@@ -67,6 +67,24 @@ particle_config = ParticleSystemConfig(
67
67
  particles = ParticleSystem(particle_config)
68
68
  ```
69
69
 
70
+ ## Multi-cell animation frames
71
+
72
+ `tile_size` is the spritesheet grid-cell size. A frame may cover a rectangular
73
+ run of cells by adding `span`; its `variant_id` remains the top-left cell.
74
+ This keeps 16px effects and 64px characters in the same atlas:
75
+
76
+ ```json
77
+ {"variant_id": 128, "span": [4, 4], "duration_ms": 150}
78
+ ```
79
+
80
+ `SpriteAnimationSet.get_image(128, span_w=4, span_h=4)` returns the matching
81
+ 64×64 crop. Files without `span` retain the previous 1×1 behavior. Span-aware
82
+ files require tilemap-parser 6.1 or later; older parsers ignore the key and
83
+ render the top-left cell.
84
+
85
+ Tile-layer `.tanim` clips still animate one cell per frame; span is not
86
+ supported there in 6.1.0.
87
+
70
88
  ## Physics bodies
71
89
 
72
90
  A `PhysicsWorld` is a single space holding the tile layer plus solid `Body` objects (static walls, kinematic crates). Attach a `CollisionRunner` to the world once and every move method resolves tiles and bodies through it — no per-call tile arguments.
@@ -101,6 +119,50 @@ if result.hit_wall_x:
101
119
 
102
120
  `Body` accepts primitive shapes only (`RectangleShape`, `CircleShape`, `CapsuleShape`); use `MapObject` for polygon solids. Collision pairs honor both sides' `collision_layer` / `collision_mask`, and bodies are landing surfaces for platformer step-up (small crates are climbed, tall ones block like walls).
103
121
 
122
+ ## Frame-data hitboxes and flipped facing
123
+
124
+ Detection hitboxes (`<name>.hitbox.json`) are authored sprite-local against the **unscaled** animation frames; `parse_character_hitboxes` scales them by `render_scale` for gameplay.
125
+
126
+ **Render scale consistency (important when the game renders at a custom `render_scale`):** pass the *same* animation library instance your game renders with (e.g. the one a `SpriteAnimationSet` loaded with that `render_scale` - it carries a matching `render_scale` and a render-scaled `tile_size`). The parser rejects a library whose `render_scale` disagrees with the parse's `render_scale` at load time; a mismatched pairing would otherwise corrupt flipped-facing shapes during play.
127
+
128
+ On match, `CharacterHitboxes.frame_size` holds the render-scaled atlas cell size. `HitboxState` mirrors around the selected frame’s full atlas region, including its cell span. You can omit `sprite_size`; if supplied, it must match the selected frame’s dimensions.
129
+
130
+ ```python
131
+ # Game renders at 3x: load both sides at the same scale.
132
+ anim = SpriteAnimationSet.load("data/animations/bullet.anim.json", render_scale=3.0)
133
+ hitboxes = get_cached_character_hitboxes(
134
+ "data/character_collision/bullet.hitbox.json",
135
+ anim_library=anim.library, # same instance you render with
136
+ render_scale=3.0,
137
+ )
138
+ state = HitboxState(hitboxes, owner) # the selected frame drives the flip
139
+ manager.add_object(owner, hitbox_state=state) # add + attach atomically
140
+ state.sync("shoot", frame_index, flip_h=facing_left)
141
+
142
+ # One event per target per active window; body-vs-body hits stay raw.
143
+ for hit in manager.check_all_collisions(hit_once=True):
144
+ # hits carry the state in CollisionHit.hitbox_a / hitbox_b
145
+ ...
146
+ ```
147
+
148
+ Attached states are fixture-style: the manager tests the owner's body and each attached state as separate collision candidates, removing the owner removes its states, and an idle window contributes nothing. Hits keep naming the owners in `CollisionHit.object_a` / `object_b`; `hitbox_a` / `hitbox_b` name the state that produced each side, and `hit.via_hitbox` flags them. `add_object(owner, hitbox_state=state)` is the atomic form; `attach_hitboxes(owner, state)` is for attaching later and raises if the owner is not managed.
149
+
150
+ `check_all_collisions(hit_once=True)` (and the same flag on `check_object` / `check_object_first`) suppresses repeat attached-state hits for the same window and target. A new window, a reactivated state, or a different clip resets the set; body-vs-body hits are not deduplicated.
151
+
152
+ When the game draws an animation frame somewhere other than the owner's `x`/`y` - for example, a content crop anchored at the character's feet - pass the frame's owner-local top-left as `origin`:
153
+
154
+ ```python
155
+ # (owner.x + dx, owner.y + dy) is the animation frame's top-left.
156
+ state.sync(
157
+ "attack",
158
+ frame_index,
159
+ flip_h=facing_left,
160
+ origin=(frame_left - owner.x, frame_top - owner.y),
161
+ )
162
+ ```
163
+
164
+ `origin` is applied after flip mirroring, is part of the sync cache key, and never mutates parsed shapes. Omit it when the frame top-left already coincides with the owner origin.
165
+
104
166
  ## Links
105
167
 
106
168
  - **Docs**: [https://tilemap-parser.vercel.app/](https://tilemap-parser.vercel.app/)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tilemap-parser"
7
- version = "6.0.1"
7
+ version = "6.1.0"
8
8
  description = "Standalone parser/loader for tilemap-editor JSON maps, sprite animations, and collision detection runtime."
9
9
  readme = "pypi-readme.md"
10
10
  requires-python = ">=3.10"
@@ -13,7 +13,9 @@ __all__ = [
13
13
  "BackgroundLayer",
14
14
  "CapsuleShape",
15
15
  "CharacterCollision",
16
+ "CharacterHitboxes",
16
17
  "CircleShape",
18
+ "ClipHitboxes",
17
19
  "CollisionCache",
18
20
  "CollisionHit",
19
21
  "CollisionInfo",
@@ -22,9 +24,12 @@ __all__ = [
22
24
  "CollisionResult",
23
25
  "CollisionRunner",
24
26
  "GroundInfo",
27
+ "HitboxState",
28
+ "HitWindow",
25
29
  "ICollidable",
26
30
  "ICollidableObject",
27
31
  "ICollidableSprite",
32
+ "ICollidableView",
28
33
  "LayerRenderStats",
29
34
  "MapParseError",
30
35
  "MovementMode",
@@ -93,11 +98,13 @@ __all__ = [
93
98
  "circle_vs_circle",
94
99
  "clear_collision_cache",
95
100
  "get_cached_character_collision",
101
+ "get_cached_character_hitboxes",
96
102
  "get_cached_object_collision",
97
103
  "get_cached_tileset_collision",
98
104
  "get_shape_aabb",
99
105
  "iter_cell_ids",
100
106
  "load_character_collision",
107
+ "load_character_hitboxes",
101
108
  "load_map",
102
109
  "load_object_collision",
103
110
  "load_tile_anim_file",
@@ -106,6 +113,7 @@ __all__ = [
106
113
  "parse_animation_file",
107
114
  "parse_animation_json",
108
115
  "parse_character_collision",
116
+ "parse_character_hitboxes",
109
117
  "parse_map_dict",
110
118
  "parse_map_file",
111
119
  "parse_map_json",
@@ -11,9 +11,12 @@ from .animation import (
11
11
  from .collision import (
12
12
  CapsuleShape,
13
13
  CharacterCollision,
14
+ CharacterHitboxes,
14
15
  CircleShape,
16
+ ClipHitboxes,
15
17
  CollisionParseError,
16
18
  CollisionPolygon,
19
+ HitWindow,
17
20
  ObjectCollisionData,
18
21
  ObjectCollisionRegionData,
19
22
  RectangleShape,
@@ -22,11 +25,13 @@ from .collision import (
22
25
  TilesetCollision,
23
26
  flip_character_shape,
24
27
  parse_character_collision,
28
+ parse_character_hitboxes,
25
29
  parse_object_collision,
26
30
  parse_tileset_collision,
27
31
  )
28
32
  from .collision_loader import (
29
33
  load_character_collision,
34
+ load_character_hitboxes,
30
35
  load_object_collision,
31
36
  load_tileset_collision,
32
37
  )
@@ -91,9 +96,12 @@ __all__ = [
91
96
  "AnimationParseError",
92
97
  "CapsuleShape",
93
98
  "CharacterCollision",
99
+ "CharacterHitboxes",
94
100
  "CircleShape",
101
+ "ClipHitboxes",
95
102
  "CollisionParseError",
96
103
  "CollisionPolygon",
104
+ "HitWindow",
97
105
  "MapParseError",
98
106
  "MODE_DEFAULT",
99
107
  "MODE_RANDOM_START",
@@ -132,6 +140,7 @@ __all__ = [
132
140
  "parse_animation_json",
133
141
  "parse_character_collision",
134
142
  "load_character_collision",
143
+ "load_character_hitboxes",
135
144
  "load_object_collision",
136
145
  "load_tileset_collision",
137
146
  "parse_map_dict",
@@ -142,6 +151,7 @@ __all__ = [
142
151
  "parse_tmx_file",
143
152
  "parse_tsx_file",
144
153
  "parse_object_collision",
154
+ "parse_character_hitboxes",
145
155
  "parse_tileset_collision",
146
156
  "resolve_clip_sheet",
147
157
  "ALPHA_FADE_MODES",
@@ -66,6 +66,8 @@ class AnimationMarker:
66
66
  class AnimationFrame:
67
67
  variant_id: int
68
68
  duration_ms: float = 100.0
69
+ span_w: int = 1
70
+ span_h: int = 1
69
71
 
70
72
 
71
73
  @dataclass
@@ -99,6 +101,12 @@ class AnimationLibrary:
99
101
  tile_size: Tuple[int, int] = (32, 32)
100
102
  grid_offset: Tuple[int, int] = (0, 0)
101
103
  trim_transparent: bool = False
104
+ # Provenance for scale-sensitive consumers: the render scale this
105
+ # library's tile_size/grid_offset are expressed in (1.0 for a freshly
106
+ # parsed, unscaled library). Collision parsing cross-checks this against
107
+ # its own render_scale so flipped-shape math can never run on mismatched
108
+ # units - a wrong setup fails loudly at load, not silently in gameplay.
109
+ render_scale: float = 1.0
102
110
 
103
111
  def get(self, name: str) -> Optional[AnimationClip]:
104
112
  return self.animations.get(name)
@@ -109,7 +117,33 @@ def _parse_marker(d: Dict[str, Any], ctx: str) -> AnimationMarker:
109
117
 
110
118
 
111
119
  def _parse_frame(d: Dict[str, Any], ctx: str) -> AnimationFrame:
112
- return AnimationFrame(variant_id=_coerce_int(d.get("variant_id"), f"{ctx}.variant_id"), duration_ms=_coerce_float(d.get("duration_ms", 100.0), f"{ctx}.duration_ms"))
120
+ span_raw = d.get("span")
121
+ if span_raw is not None:
122
+ if (
123
+ not isinstance(span_raw, (list, tuple))
124
+ or len(span_raw) != 2
125
+ or any(isinstance(value, bool) or not isinstance(value, int) or value < 1 for value in span_raw)
126
+ ):
127
+ raise AnimationParseError(f"{ctx}.span: expected [w, h] with w,h >= 1")
128
+ span_w, span_h = span_raw
129
+ else:
130
+ span_w = d.get("span_w", 1)
131
+ span_h = d.get("span_h", 1)
132
+ if (
133
+ isinstance(span_w, bool)
134
+ or not isinstance(span_w, int)
135
+ or span_w < 1
136
+ or isinstance(span_h, bool)
137
+ or not isinstance(span_h, int)
138
+ or span_h < 1
139
+ ):
140
+ raise AnimationParseError(f"{ctx}.span: expected [w, h] with w,h >= 1")
141
+ return AnimationFrame(
142
+ variant_id=_coerce_int(d.get("variant_id"), f"{ctx}.variant_id"),
143
+ duration_ms=_coerce_float(d.get("duration_ms", 100.0), f"{ctx}.duration_ms"),
144
+ span_w=span_w,
145
+ span_h=span_h,
146
+ )
113
147
 
114
148
 
115
149
  def _parse_animation(name: str, d: Dict[str, Any], ctx: str) -> AnimationClip: