fraxel 0.1.0-alpha.1

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 (501) hide show
  1. package/dist/animation/easing.d.ts +29 -0
  2. package/dist/animation/easing.d.ts.map +1 -0
  3. package/dist/animation/easing.js +50 -0
  4. package/dist/animation/easing.js.map +1 -0
  5. package/dist/animation/index.d.ts +7 -0
  6. package/dist/animation/index.d.ts.map +1 -0
  7. package/dist/animation/index.js +7 -0
  8. package/dist/animation/index.js.map +1 -0
  9. package/dist/animation/multiple.d.ts +26 -0
  10. package/dist/animation/multiple.d.ts.map +1 -0
  11. package/dist/animation/multiple.js +27 -0
  12. package/dist/animation/multiple.js.map +1 -0
  13. package/dist/animation/properties.d.ts +30 -0
  14. package/dist/animation/properties.d.ts.map +1 -0
  15. package/dist/animation/properties.js +32 -0
  16. package/dist/animation/properties.js.map +1 -0
  17. package/dist/animation/sequences.d.ts +30 -0
  18. package/dist/animation/sequences.d.ts.map +1 -0
  19. package/dist/animation/sequences.js +50 -0
  20. package/dist/animation/sequences.js.map +1 -0
  21. package/dist/animation/sprite-sheet.d.ts +81 -0
  22. package/dist/animation/sprite-sheet.d.ts.map +1 -0
  23. package/dist/animation/sprite-sheet.js +103 -0
  24. package/dist/animation/sprite-sheet.js.map +1 -0
  25. package/dist/animation/tween.d.ts +78 -0
  26. package/dist/animation/tween.d.ts.map +1 -0
  27. package/dist/animation/tween.js +103 -0
  28. package/dist/animation/tween.js.map +1 -0
  29. package/dist/assets/index.d.ts +6 -0
  30. package/dist/assets/index.d.ts.map +1 -0
  31. package/dist/assets/index.js +5 -0
  32. package/dist/assets/index.js.map +1 -0
  33. package/dist/assets/load-sound.d.ts +17 -0
  34. package/dist/assets/load-sound.d.ts.map +1 -0
  35. package/dist/assets/load-sound.js +35 -0
  36. package/dist/assets/load-sound.js.map +1 -0
  37. package/dist/assets/load-texture.d.ts +12 -0
  38. package/dist/assets/load-texture.d.ts.map +1 -0
  39. package/dist/assets/load-texture.js +40 -0
  40. package/dist/assets/load-texture.js.map +1 -0
  41. package/dist/assets/loader.d.ts +59 -0
  42. package/dist/assets/loader.d.ts.map +1 -0
  43. package/dist/assets/loader.js +65 -0
  44. package/dist/assets/loader.js.map +1 -0
  45. package/dist/assets/texture.d.ts +36 -0
  46. package/dist/assets/texture.d.ts.map +1 -0
  47. package/dist/assets/texture.js +49 -0
  48. package/dist/assets/texture.js.map +1 -0
  49. package/dist/audio/audio-context.d.ts +14 -0
  50. package/dist/audio/audio-context.d.ts.map +1 -0
  51. package/dist/audio/audio-context.js +20 -0
  52. package/dist/audio/audio-context.js.map +1 -0
  53. package/dist/audio/index.d.ts +2 -0
  54. package/dist/audio/index.d.ts.map +1 -0
  55. package/dist/audio/index.js +2 -0
  56. package/dist/audio/index.js.map +1 -0
  57. package/dist/collision/broadphase/spatial-hash.d.ts +32 -0
  58. package/dist/collision/broadphase/spatial-hash.d.ts.map +1 -0
  59. package/dist/collision/broadphase/spatial-hash.js +87 -0
  60. package/dist/collision/broadphase/spatial-hash.js.map +1 -0
  61. package/dist/collision/collision-system.d.ts +52 -0
  62. package/dist/collision/collision-system.d.ts.map +1 -0
  63. package/dist/collision/collision-system.js +278 -0
  64. package/dist/collision/collision-system.js.map +1 -0
  65. package/dist/collision/events/collision-emitter.d.ts +38 -0
  66. package/dist/collision/events/collision-emitter.d.ts.map +1 -0
  67. package/dist/collision/events/collision-emitter.js +47 -0
  68. package/dist/collision/events/collision-emitter.js.map +1 -0
  69. package/dist/collision/index.d.ts +13 -0
  70. package/dist/collision/index.d.ts.map +1 -0
  71. package/dist/collision/index.js +11 -0
  72. package/dist/collision/index.js.map +1 -0
  73. package/dist/collision/narrowphase/detector.d.ts +26 -0
  74. package/dist/collision/narrowphase/detector.d.ts.map +1 -0
  75. package/dist/collision/narrowphase/detector.js +70 -0
  76. package/dist/collision/narrowphase/detector.js.map +1 -0
  77. package/dist/collision/narrowphase/shapes.d.ts +91 -0
  78. package/dist/collision/narrowphase/shapes.d.ts.map +1 -0
  79. package/dist/collision/narrowphase/shapes.js +52 -0
  80. package/dist/collision/narrowphase/shapes.js.map +1 -0
  81. package/dist/collision/physics/physics-body.d.ts +38 -0
  82. package/dist/collision/physics/physics-body.d.ts.map +1 -0
  83. package/dist/collision/physics/physics-body.js +53 -0
  84. package/dist/collision/physics/physics-body.js.map +1 -0
  85. package/dist/collision/physics/physics-system.d.ts +23 -0
  86. package/dist/collision/physics/physics-system.d.ts.map +1 -0
  87. package/dist/collision/physics/physics-system.js +86 -0
  88. package/dist/collision/physics/physics-system.js.map +1 -0
  89. package/dist/collision/physics/resolver.d.ts +16 -0
  90. package/dist/collision/physics/resolver.d.ts.map +1 -0
  91. package/dist/collision/physics/resolver.js +91 -0
  92. package/dist/collision/physics/resolver.js.map +1 -0
  93. package/dist/collision/types.d.ts +22 -0
  94. package/dist/collision/types.d.ts.map +1 -0
  95. package/dist/collision/types.js +2 -0
  96. package/dist/collision/types.js.map +1 -0
  97. package/dist/core/game-config.d.ts +34 -0
  98. package/dist/core/game-config.d.ts.map +1 -0
  99. package/dist/core/game-config.js +31 -0
  100. package/dist/core/game-config.js.map +1 -0
  101. package/dist/core/game.d.ts +86 -0
  102. package/dist/core/game.d.ts.map +1 -0
  103. package/dist/core/game.js +166 -0
  104. package/dist/core/game.js.map +1 -0
  105. package/dist/core/index.d.ts +6 -0
  106. package/dist/core/index.d.ts.map +1 -0
  107. package/dist/core/index.js +6 -0
  108. package/dist/core/index.js.map +1 -0
  109. package/dist/core/scene-manager.d.ts +28 -0
  110. package/dist/core/scene-manager.d.ts.map +1 -0
  111. package/dist/core/scene-manager.js +65 -0
  112. package/dist/core/scene-manager.js.map +1 -0
  113. package/dist/core/scene.d.ts +43 -0
  114. package/dist/core/scene.d.ts.map +1 -0
  115. package/dist/core/scene.js +48 -0
  116. package/dist/core/scene.js.map +1 -0
  117. package/dist/core/theme.d.ts +63 -0
  118. package/dist/core/theme.d.ts.map +1 -0
  119. package/dist/core/theme.js +59 -0
  120. package/dist/core/theme.js.map +1 -0
  121. package/dist/errors/animation.d.ts +24 -0
  122. package/dist/errors/animation.d.ts.map +1 -0
  123. package/dist/errors/animation.js +29 -0
  124. package/dist/errors/animation.js.map +1 -0
  125. package/dist/errors/assets.d.ts +34 -0
  126. package/dist/errors/assets.d.ts.map +1 -0
  127. package/dist/errors/assets.js +41 -0
  128. package/dist/errors/assets.js.map +1 -0
  129. package/dist/errors/base.d.ts +12 -0
  130. package/dist/errors/base.d.ts.map +1 -0
  131. package/dist/errors/base.js +15 -0
  132. package/dist/errors/base.js.map +1 -0
  133. package/dist/errors/env.d.ts +24 -0
  134. package/dist/errors/env.d.ts.map +1 -0
  135. package/dist/errors/env.js +29 -0
  136. package/dist/errors/env.js.map +1 -0
  137. package/dist/errors/hook.d.ts +46 -0
  138. package/dist/errors/hook.d.ts.map +1 -0
  139. package/dist/errors/hook.js +55 -0
  140. package/dist/errors/hook.js.map +1 -0
  141. package/dist/errors/index.d.ts +11 -0
  142. package/dist/errors/index.d.ts.map +1 -0
  143. package/dist/errors/index.js +11 -0
  144. package/dist/errors/index.js.map +1 -0
  145. package/dist/errors/jsx.d.ts +26 -0
  146. package/dist/errors/jsx.d.ts.map +1 -0
  147. package/dist/errors/jsx.js +45 -0
  148. package/dist/errors/jsx.js.map +1 -0
  149. package/dist/errors/lifecycle.d.ts +35 -0
  150. package/dist/errors/lifecycle.d.ts.map +1 -0
  151. package/dist/errors/lifecycle.js +42 -0
  152. package/dist/errors/lifecycle.js.map +1 -0
  153. package/dist/errors/math.d.ts +24 -0
  154. package/dist/errors/math.d.ts.map +1 -0
  155. package/dist/errors/math.js +34 -0
  156. package/dist/errors/math.js.map +1 -0
  157. package/dist/errors/node.d.ts +68 -0
  158. package/dist/errors/node.d.ts.map +1 -0
  159. package/dist/errors/node.js +87 -0
  160. package/dist/errors/node.js.map +1 -0
  161. package/dist/errors/scene.d.ts +35 -0
  162. package/dist/errors/scene.d.ts.map +1 -0
  163. package/dist/errors/scene.js +42 -0
  164. package/dist/errors/scene.js.map +1 -0
  165. package/dist/events/event.d.ts +106 -0
  166. package/dist/events/event.d.ts.map +1 -0
  167. package/dist/events/event.js +125 -0
  168. package/dist/events/event.js.map +1 -0
  169. package/dist/events/index.d.ts +2 -0
  170. package/dist/events/index.d.ts.map +1 -0
  171. package/dist/events/index.js +2 -0
  172. package/dist/events/index.js.map +1 -0
  173. package/dist/events/types.d.ts +20 -0
  174. package/dist/events/types.d.ts.map +1 -0
  175. package/dist/events/types.js +2 -0
  176. package/dist/events/types.js.map +1 -0
  177. package/dist/hooks/context.d.ts +15 -0
  178. package/dist/hooks/context.d.ts.map +1 -0
  179. package/dist/hooks/context.js +26 -0
  180. package/dist/hooks/context.js.map +1 -0
  181. package/dist/hooks/deriveds/by-nodes/index.d.ts +7 -0
  182. package/dist/hooks/deriveds/by-nodes/index.d.ts.map +1 -0
  183. package/dist/hooks/deriveds/by-nodes/index.js +7 -0
  184. package/dist/hooks/deriveds/by-nodes/index.js.map +1 -0
  185. package/dist/hooks/deriveds/by-nodes/use-animation.d.ts +44 -0
  186. package/dist/hooks/deriveds/by-nodes/use-animation.d.ts.map +1 -0
  187. package/dist/hooks/deriveds/by-nodes/use-animation.js +61 -0
  188. package/dist/hooks/deriveds/by-nodes/use-animation.js.map +1 -0
  189. package/dist/hooks/deriveds/by-nodes/use-audio.d.ts +33 -0
  190. package/dist/hooks/deriveds/by-nodes/use-audio.d.ts.map +1 -0
  191. package/dist/hooks/deriveds/by-nodes/use-audio.js +43 -0
  192. package/dist/hooks/deriveds/by-nodes/use-audio.js.map +1 -0
  193. package/dist/hooks/deriveds/by-nodes/use-clickable.d.ts +32 -0
  194. package/dist/hooks/deriveds/by-nodes/use-clickable.d.ts.map +1 -0
  195. package/dist/hooks/deriveds/by-nodes/use-clickable.js +43 -0
  196. package/dist/hooks/deriveds/by-nodes/use-clickable.js.map +1 -0
  197. package/dist/hooks/deriveds/by-nodes/use-collider.d.ts +35 -0
  198. package/dist/hooks/deriveds/by-nodes/use-collider.d.ts.map +1 -0
  199. package/dist/hooks/deriveds/by-nodes/use-collider.js +55 -0
  200. package/dist/hooks/deriveds/by-nodes/use-collider.js.map +1 -0
  201. package/dist/hooks/deriveds/by-nodes/use-ray-cast.d.ts +35 -0
  202. package/dist/hooks/deriveds/by-nodes/use-ray-cast.d.ts.map +1 -0
  203. package/dist/hooks/deriveds/by-nodes/use-ray-cast.js +47 -0
  204. package/dist/hooks/deriveds/by-nodes/use-ray-cast.js.map +1 -0
  205. package/dist/hooks/deriveds/by-nodes/use-timer.d.ts +34 -0
  206. package/dist/hooks/deriveds/by-nodes/use-timer.d.ts.map +1 -0
  207. package/dist/hooks/deriveds/by-nodes/use-timer.js +48 -0
  208. package/dist/hooks/deriveds/by-nodes/use-timer.js.map +1 -0
  209. package/dist/hooks/deriveds/index.d.ts +5 -0
  210. package/dist/hooks/deriveds/index.d.ts.map +1 -0
  211. package/dist/hooks/deriveds/index.js +5 -0
  212. package/dist/hooks/deriveds/index.js.map +1 -0
  213. package/dist/hooks/deriveds/use-condition.d.ts +37 -0
  214. package/dist/hooks/deriveds/use-condition.d.ts.map +1 -0
  215. package/dist/hooks/deriveds/use-condition.js +47 -0
  216. package/dist/hooks/deriveds/use-condition.js.map +1 -0
  217. package/dist/hooks/deriveds/use-match.d.ts +26 -0
  218. package/dist/hooks/deriveds/use-match.d.ts.map +1 -0
  219. package/dist/hooks/deriveds/use-match.js +38 -0
  220. package/dist/hooks/deriveds/use-match.js.map +1 -0
  221. package/dist/hooks/deriveds/use-partial-node.d.ts +22 -0
  222. package/dist/hooks/deriveds/use-partial-node.d.ts.map +1 -0
  223. package/dist/hooks/deriveds/use-partial-node.js +25 -0
  224. package/dist/hooks/deriveds/use-partial-node.js.map +1 -0
  225. package/dist/hooks/deriveds/use-when.d.ts +28 -0
  226. package/dist/hooks/deriveds/use-when.d.ts.map +1 -0
  227. package/dist/hooks/deriveds/use-when.js +35 -0
  228. package/dist/hooks/deriveds/use-when.js.map +1 -0
  229. package/dist/hooks/index.d.ts +16 -0
  230. package/dist/hooks/index.d.ts.map +1 -0
  231. package/dist/hooks/index.js +16 -0
  232. package/dist/hooks/index.js.map +1 -0
  233. package/dist/hooks/use-child.d.ts +24 -0
  234. package/dist/hooks/use-child.d.ts.map +1 -0
  235. package/dist/hooks/use-child.js +37 -0
  236. package/dist/hooks/use-child.js.map +1 -0
  237. package/dist/hooks/use-computed.d.ts +28 -0
  238. package/dist/hooks/use-computed.d.ts.map +1 -0
  239. package/dist/hooks/use-computed.js +41 -0
  240. package/dist/hooks/use-computed.js.map +1 -0
  241. package/dist/hooks/use-context.d.ts +58 -0
  242. package/dist/hooks/use-context.d.ts.map +1 -0
  243. package/dist/hooks/use-context.js +77 -0
  244. package/dist/hooks/use-context.js.map +1 -0
  245. package/dist/hooks/use-effect.d.ts +24 -0
  246. package/dist/hooks/use-effect.d.ts.map +1 -0
  247. package/dist/hooks/use-effect.js +63 -0
  248. package/dist/hooks/use-effect.js.map +1 -0
  249. package/dist/hooks/use-event.d.ts +29 -0
  250. package/dist/hooks/use-event.d.ts.map +1 -0
  251. package/dist/hooks/use-event.js +30 -0
  252. package/dist/hooks/use-event.js.map +1 -0
  253. package/dist/hooks/use-game.d.ts +17 -0
  254. package/dist/hooks/use-game.d.ts.map +1 -0
  255. package/dist/hooks/use-game.js +35 -0
  256. package/dist/hooks/use-game.js.map +1 -0
  257. package/dist/hooks/use-mount.d.ts +21 -0
  258. package/dist/hooks/use-mount.d.ts.map +1 -0
  259. package/dist/hooks/use-mount.js +33 -0
  260. package/dist/hooks/use-mount.js.map +1 -0
  261. package/dist/hooks/use-node.d.ts +42 -0
  262. package/dist/hooks/use-node.d.ts.map +1 -0
  263. package/dist/hooks/use-node.js +63 -0
  264. package/dist/hooks/use-node.js.map +1 -0
  265. package/dist/hooks/use-ref.d.ts +27 -0
  266. package/dist/hooks/use-ref.d.ts.map +1 -0
  267. package/dist/hooks/use-ref.js +33 -0
  268. package/dist/hooks/use-ref.js.map +1 -0
  269. package/dist/hooks/use-script.d.ts +33 -0
  270. package/dist/hooks/use-script.d.ts.map +1 -0
  271. package/dist/hooks/use-script.js +40 -0
  272. package/dist/hooks/use-script.js.map +1 -0
  273. package/dist/hooks/use-signal.d.ts +25 -0
  274. package/dist/hooks/use-signal.d.ts.map +1 -0
  275. package/dist/hooks/use-signal.js +36 -0
  276. package/dist/hooks/use-signal.js.map +1 -0
  277. package/dist/hooks/use-spawn.d.ts +27 -0
  278. package/dist/hooks/use-spawn.d.ts.map +1 -0
  279. package/dist/hooks/use-spawn.js +39 -0
  280. package/dist/hooks/use-spawn.js.map +1 -0
  281. package/dist/hooks/use-trigger.d.ts +51 -0
  282. package/dist/hooks/use-trigger.d.ts.map +1 -0
  283. package/dist/hooks/use-trigger.js +68 -0
  284. package/dist/hooks/use-trigger.js.map +1 -0
  285. package/dist/index.d.ts +11 -0
  286. package/dist/index.d.ts.map +1 -0
  287. package/dist/index.js +11 -0
  288. package/dist/index.js.map +1 -0
  289. package/dist/input/input.d.ts +46 -0
  290. package/dist/input/input.d.ts.map +1 -0
  291. package/dist/input/input.js +159 -0
  292. package/dist/input/input.js.map +1 -0
  293. package/dist/jsx/components/fragment.d.ts +3 -0
  294. package/dist/jsx/components/fragment.d.ts.map +1 -0
  295. package/dist/jsx/components/fragment.js +7 -0
  296. package/dist/jsx/components/fragment.js.map +1 -0
  297. package/dist/jsx/components/game.d.ts +21 -0
  298. package/dist/jsx/components/game.d.ts.map +1 -0
  299. package/dist/jsx/components/game.js +17 -0
  300. package/dist/jsx/components/game.js.map +1 -0
  301. package/dist/jsx/components/index.d.ts +5 -0
  302. package/dist/jsx/components/index.d.ts.map +1 -0
  303. package/dist/jsx/components/index.js +5 -0
  304. package/dist/jsx/components/index.js.map +1 -0
  305. package/dist/jsx/components/list.d.ts +88 -0
  306. package/dist/jsx/components/list.d.ts.map +1 -0
  307. package/dist/jsx/components/list.js +93 -0
  308. package/dist/jsx/components/list.js.map +1 -0
  309. package/dist/jsx/components/scene.d.ts +40 -0
  310. package/dist/jsx/components/scene.d.ts.map +1 -0
  311. package/dist/jsx/components/scene.js +20 -0
  312. package/dist/jsx/components/scene.js.map +1 -0
  313. package/dist/jsx/index.d.ts +5 -0
  314. package/dist/jsx/index.d.ts.map +1 -0
  315. package/dist/jsx/index.js +5 -0
  316. package/dist/jsx/index.js.map +1 -0
  317. package/dist/jsx/jsx.d.ts +3 -0
  318. package/dist/jsx/jsx.d.ts.map +1 -0
  319. package/dist/jsx/jsx.js +4 -0
  320. package/dist/jsx/jsx.js.map +1 -0
  321. package/dist/jsx/render/game.d.ts +41 -0
  322. package/dist/jsx/render/game.d.ts.map +1 -0
  323. package/dist/jsx/render/game.js +86 -0
  324. package/dist/jsx/render/game.js.map +1 -0
  325. package/dist/jsx/render/index.d.ts +3 -0
  326. package/dist/jsx/render/index.d.ts.map +1 -0
  327. package/dist/jsx/render/index.js +3 -0
  328. package/dist/jsx/render/index.js.map +1 -0
  329. package/dist/jsx/render/to-nodes.d.ts +10 -0
  330. package/dist/jsx/render/to-nodes.d.ts.map +1 -0
  331. package/dist/jsx/render/to-nodes.js +52 -0
  332. package/dist/jsx/render/to-nodes.js.map +1 -0
  333. package/dist/jsx/render/types/class-component.d.ts +4 -0
  334. package/dist/jsx/render/types/class-component.d.ts.map +1 -0
  335. package/dist/jsx/render/types/class-component.js +8 -0
  336. package/dist/jsx/render/types/class-component.js.map +1 -0
  337. package/dist/jsx/render/types/func-components.d.ts +4 -0
  338. package/dist/jsx/render/types/func-components.d.ts.map +1 -0
  339. package/dist/jsx/render/types/func-components.js +8 -0
  340. package/dist/jsx/render/types/func-components.js.map +1 -0
  341. package/dist/jsx/render/types/instrinsic-elements.d.ts +6 -0
  342. package/dist/jsx/render/types/instrinsic-elements.d.ts.map +1 -0
  343. package/dist/jsx/render/types/instrinsic-elements.js +41 -0
  344. package/dist/jsx/render/types/instrinsic-elements.js.map +1 -0
  345. package/dist/jsx/types.d.ts +41 -0
  346. package/dist/jsx/types.d.ts.map +1 -0
  347. package/dist/jsx/types.js +2 -0
  348. package/dist/jsx/types.js.map +1 -0
  349. package/dist/jsx/utils.d.ts +4 -0
  350. package/dist/jsx/utils.d.ts.map +1 -0
  351. package/dist/jsx/utils.js +15 -0
  352. package/dist/jsx/utils.js.map +1 -0
  353. package/dist/jsx-runtime.d.ts +6 -0
  354. package/dist/jsx-runtime.d.ts.map +1 -0
  355. package/dist/jsx-runtime.js +6 -0
  356. package/dist/jsx-runtime.js.map +1 -0
  357. package/dist/math/index.d.ts +3 -0
  358. package/dist/math/index.d.ts.map +1 -0
  359. package/dist/math/index.js +2 -0
  360. package/dist/math/index.js.map +1 -0
  361. package/dist/math/types.d.ts +13 -0
  362. package/dist/math/types.d.ts.map +1 -0
  363. package/dist/math/types.js +2 -0
  364. package/dist/math/types.js.map +1 -0
  365. package/dist/math/vector2.d.ts +145 -0
  366. package/dist/math/vector2.d.ts.map +1 -0
  367. package/dist/math/vector2.js +164 -0
  368. package/dist/math/vector2.js.map +1 -0
  369. package/dist/nodes/_node.d.ts +283 -0
  370. package/dist/nodes/_node.d.ts.map +1 -0
  371. package/dist/nodes/_node.js +371 -0
  372. package/dist/nodes/_node.js.map +1 -0
  373. package/dist/nodes/animation-player.d.ts +208 -0
  374. package/dist/nodes/animation-player.d.ts.map +1 -0
  375. package/dist/nodes/animation-player.js +249 -0
  376. package/dist/nodes/animation-player.js.map +1 -0
  377. package/dist/nodes/audio-player.d.ts +128 -0
  378. package/dist/nodes/audio-player.d.ts.map +1 -0
  379. package/dist/nodes/audio-player.js +173 -0
  380. package/dist/nodes/audio-player.js.map +1 -0
  381. package/dist/nodes/group.d.ts +55 -0
  382. package/dist/nodes/group.d.ts.map +1 -0
  383. package/dist/nodes/group.js +54 -0
  384. package/dist/nodes/group.js.map +1 -0
  385. package/dist/nodes/index.d.ts +8 -0
  386. package/dist/nodes/index.d.ts.map +1 -0
  387. package/dist/nodes/index.js +7 -0
  388. package/dist/nodes/index.js.map +1 -0
  389. package/dist/nodes/lib/enum.d.ts +42 -0
  390. package/dist/nodes/lib/enum.d.ts.map +1 -0
  391. package/dist/nodes/lib/enum.js +43 -0
  392. package/dist/nodes/lib/enum.js.map +1 -0
  393. package/dist/nodes/lib/index.d.ts +5 -0
  394. package/dist/nodes/lib/index.d.ts.map +1 -0
  395. package/dist/nodes/lib/index.js +5 -0
  396. package/dist/nodes/lib/index.js.map +1 -0
  397. package/dist/nodes/lib/registry.d.ts +43 -0
  398. package/dist/nodes/lib/registry.d.ts.map +1 -0
  399. package/dist/nodes/lib/registry.js +46 -0
  400. package/dist/nodes/lib/registry.js.map +1 -0
  401. package/dist/nodes/lib/types.d.ts +89 -0
  402. package/dist/nodes/lib/types.d.ts.map +1 -0
  403. package/dist/nodes/lib/types.js +2 -0
  404. package/dist/nodes/lib/types.js.map +1 -0
  405. package/dist/nodes/lib/utils.d.ts +35 -0
  406. package/dist/nodes/lib/utils.d.ts.map +1 -0
  407. package/dist/nodes/lib/utils.js +58 -0
  408. package/dist/nodes/lib/utils.js.map +1 -0
  409. package/dist/nodes/node2d/_node2d.d.ts +59 -0
  410. package/dist/nodes/node2d/_node2d.d.ts.map +1 -0
  411. package/dist/nodes/node2d/_node2d.js +57 -0
  412. package/dist/nodes/node2d/_node2d.js.map +1 -0
  413. package/dist/nodes/node2d/camera.d.ts +64 -0
  414. package/dist/nodes/node2d/camera.d.ts.map +1 -0
  415. package/dist/nodes/node2d/camera.js +72 -0
  416. package/dist/nodes/node2d/camera.js.map +1 -0
  417. package/dist/nodes/node2d/clickable.d.ts +96 -0
  418. package/dist/nodes/node2d/clickable.d.ts.map +1 -0
  419. package/dist/nodes/node2d/clickable.js +117 -0
  420. package/dist/nodes/node2d/clickable.js.map +1 -0
  421. package/dist/nodes/node2d/collider.d.ts +96 -0
  422. package/dist/nodes/node2d/collider.d.ts.map +1 -0
  423. package/dist/nodes/node2d/collider.js +116 -0
  424. package/dist/nodes/node2d/collider.js.map +1 -0
  425. package/dist/nodes/node2d/index.d.ts +12 -0
  426. package/dist/nodes/node2d/index.d.ts.map +1 -0
  427. package/dist/nodes/node2d/index.js +11 -0
  428. package/dist/nodes/node2d/index.js.map +1 -0
  429. package/dist/nodes/node2d/lib/index.d.ts +2 -0
  430. package/dist/nodes/node2d/lib/index.d.ts.map +1 -0
  431. package/dist/nodes/node2d/lib/index.js +2 -0
  432. package/dist/nodes/node2d/lib/index.js.map +1 -0
  433. package/dist/nodes/node2d/lib/utils.d.ts +4 -0
  434. package/dist/nodes/node2d/lib/utils.d.ts.map +1 -0
  435. package/dist/nodes/node2d/lib/utils.js +14 -0
  436. package/dist/nodes/node2d/lib/utils.js.map +1 -0
  437. package/dist/nodes/node2d/ray-cast.d.ts +115 -0
  438. package/dist/nodes/node2d/ray-cast.d.ts.map +1 -0
  439. package/dist/nodes/node2d/ray-cast.js +129 -0
  440. package/dist/nodes/node2d/ray-cast.js.map +1 -0
  441. package/dist/nodes/node2d/rectangle.d.ts +87 -0
  442. package/dist/nodes/node2d/rectangle.d.ts.map +1 -0
  443. package/dist/nodes/node2d/rectangle.js +60 -0
  444. package/dist/nodes/node2d/rectangle.js.map +1 -0
  445. package/dist/nodes/node2d/rigid-body.d.ts +65 -0
  446. package/dist/nodes/node2d/rigid-body.d.ts.map +1 -0
  447. package/dist/nodes/node2d/rigid-body.js +56 -0
  448. package/dist/nodes/node2d/rigid-body.js.map +1 -0
  449. package/dist/nodes/node2d/sprite.d.ts +285 -0
  450. package/dist/nodes/node2d/sprite.d.ts.map +1 -0
  451. package/dist/nodes/node2d/sprite.js +226 -0
  452. package/dist/nodes/node2d/sprite.js.map +1 -0
  453. package/dist/nodes/node2d/text.d.ts +62 -0
  454. package/dist/nodes/node2d/text.d.ts.map +1 -0
  455. package/dist/nodes/node2d/text.js +52 -0
  456. package/dist/nodes/node2d/text.js.map +1 -0
  457. package/dist/nodes/node2d/transform.d.ts +32 -0
  458. package/dist/nodes/node2d/transform.d.ts.map +1 -0
  459. package/dist/nodes/node2d/transform.js +30 -0
  460. package/dist/nodes/node2d/transform.js.map +1 -0
  461. package/dist/nodes/timer.d.ts +107 -0
  462. package/dist/nodes/timer.d.ts.map +1 -0
  463. package/dist/nodes/timer.js +108 -0
  464. package/dist/nodes/timer.js.map +1 -0
  465. package/dist/reactivity/index.d.ts +5 -0
  466. package/dist/reactivity/index.d.ts.map +1 -0
  467. package/dist/reactivity/index.js +5 -0
  468. package/dist/reactivity/index.js.map +1 -0
  469. package/dist/reactivity/reactive.d.ts +4 -0
  470. package/dist/reactivity/reactive.d.ts.map +1 -0
  471. package/dist/reactivity/reactive.js +50 -0
  472. package/dist/reactivity/reactive.js.map +1 -0
  473. package/dist/reactivity/register.d.ts +7 -0
  474. package/dist/reactivity/register.d.ts.map +1 -0
  475. package/dist/reactivity/register.js +18 -0
  476. package/dist/reactivity/register.js.map +1 -0
  477. package/dist/reactivity/signal.d.ts +126 -0
  478. package/dist/reactivity/signal.d.ts.map +1 -0
  479. package/dist/reactivity/signal.js +152 -0
  480. package/dist/reactivity/signal.js.map +1 -0
  481. package/dist/reactivity/types.d.ts +31 -0
  482. package/dist/reactivity/types.d.ts.map +1 -0
  483. package/dist/reactivity/types.js +2 -0
  484. package/dist/reactivity/types.js.map +1 -0
  485. package/dist/scripts/index.d.ts +2 -0
  486. package/dist/scripts/index.d.ts.map +1 -0
  487. package/dist/scripts/index.js +2 -0
  488. package/dist/scripts/index.js.map +1 -0
  489. package/dist/scripts/script.d.ts +80 -0
  490. package/dist/scripts/script.d.ts.map +1 -0
  491. package/dist/scripts/script.js +75 -0
  492. package/dist/scripts/script.js.map +1 -0
  493. package/dist/utils/dpr.d.ts +2 -0
  494. package/dist/utils/dpr.d.ts.map +1 -0
  495. package/dist/utils/dpr.js +14 -0
  496. package/dist/utils/dpr.js.map +1 -0
  497. package/dist/utils/ternaries.d.ts +6 -0
  498. package/dist/utils/ternaries.d.ts.map +1 -0
  499. package/dist/utils/ternaries.js +17 -0
  500. package/dist/utils/ternaries.js.map +1 -0
  501. package/package.json +56 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * An easing function that maps progress `t` (0 to 1) to an eased value.
3
+ */
4
+ export type EasingFn = (t: number) => number;
5
+ /** Linear interpolation — no easing. */
6
+ export declare const linear: EasingFn;
7
+ /** Accelerating from zero velocity. */
8
+ export declare const easeInQuad: EasingFn;
9
+ /** Decelerating to zero velocity. */
10
+ export declare const easeOutQuad: EasingFn;
11
+ /** Accelerating then decelerating. */
12
+ export declare const easeInOutQuad: EasingFn;
13
+ /** Cubic acceleration. */
14
+ export declare const easeInCubic: EasingFn;
15
+ /** Cubic deceleration. */
16
+ export declare const easeOutCubic: EasingFn;
17
+ /** Cubic acceleration then deceleration. */
18
+ export declare const easeInOutCubic: EasingFn;
19
+ /** Overshoot then settle — dramatic entrance. */
20
+ export declare const easeBackOut: EasingFn;
21
+ /** Overshoot in both directions — bouncy. */
22
+ export declare const easeBackInOut: EasingFn;
23
+ /** Bounce effect at the end. */
24
+ export declare const easeOutBounce: EasingFn;
25
+ /** Bounce effect at the start. */
26
+ export declare const easeInBounce: EasingFn;
27
+ /** Elastic effect — spring-like overshoot. */
28
+ export declare const easeOutElastic: EasingFn;
29
+ //# sourceMappingURL=easing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"easing.d.ts","sourceRoot":"","sources":["../../src/animation/easing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AAE5C,wCAAwC;AACxC,eAAO,MAAM,MAAM,EAAE,QAAmB,CAAA;AAExC,uCAAuC;AACvC,eAAO,MAAM,UAAU,EAAE,QAAuB,CAAA;AAEhD,qCAAqC;AACrC,eAAO,MAAM,WAAW,EAAE,QAA6B,CAAA;AAEvD,sCAAsC;AACtC,eAAO,MAAM,aAAa,EAAE,QAA8D,CAAA;AAE1F,0BAA0B;AAC1B,eAAO,MAAM,WAAW,EAAE,QAA2B,CAAA;AAErD,0BAA0B;AAC1B,eAAO,MAAM,YAAY,EAAE,QAAiC,CAAA;AAE5D,4CAA4C;AAC5C,eAAO,MAAM,cAAc,EAAE,QACsC,CAAA;AAEnE,iDAAiD;AACjD,eAAO,MAAM,WAAW,EAAE,QAGzB,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,aAAa,EAAE,QAI3B,CAAA;AAED,gCAAgC;AAChC,eAAO,MAAM,aAAa,EAAE,QAU3B,CAAA;AAED,kCAAkC;AAClC,eAAO,MAAM,YAAY,EAAE,QAA0C,CAAA;AAErE,8CAA8C;AAC9C,eAAO,MAAM,cAAc,EAAE,QAG5B,CAAA"}
@@ -0,0 +1,50 @@
1
+ /** Linear interpolation — no easing. */
2
+ export const linear = (t) => t;
3
+ /** Accelerating from zero velocity. */
4
+ export const easeInQuad = (t) => t * t;
5
+ /** Decelerating to zero velocity. */
6
+ export const easeOutQuad = (t) => t * (2 - t);
7
+ /** Accelerating then decelerating. */
8
+ export const easeInOutQuad = (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t);
9
+ /** Cubic acceleration. */
10
+ export const easeInCubic = (t) => t * t * t;
11
+ /** Cubic deceleration. */
12
+ export const easeOutCubic = (t) => --t * t * t + 1;
13
+ /** Cubic acceleration then deceleration. */
14
+ export const easeInOutCubic = (t) => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
15
+ /** Overshoot then settle — dramatic entrance. */
16
+ export const easeBackOut = (t) => {
17
+ const c = 1.70158;
18
+ return 1 + --t * t * ((c + 1) * t + c);
19
+ };
20
+ /** Overshoot in both directions — bouncy. */
21
+ export const easeBackInOut = (t) => {
22
+ const c = 1.70158 * 1.525;
23
+ if ((t *= 2) < 1)
24
+ return 0.5 * (t * t * ((c + 1) * t - c));
25
+ return 0.5 * ((t -= 2) * t * ((c + 1) * t + c) + 2);
26
+ };
27
+ /** Bounce effect at the end. */
28
+ export const easeOutBounce = (t) => {
29
+ if (t < 1 / 2.75) {
30
+ return 7.5625 * t * t;
31
+ }
32
+ else if (t < 2 / 2.75) {
33
+ return 7.5625 * (t -= 1.5 / 2.75) * t + 0.75;
34
+ }
35
+ else if (t < 2.5 / 2.75) {
36
+ return 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375;
37
+ }
38
+ else {
39
+ return 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;
40
+ }
41
+ };
42
+ /** Bounce effect at the start. */
43
+ export const easeInBounce = (t) => 1 - easeOutBounce(1 - t);
44
+ /** Elastic effect — spring-like overshoot. */
45
+ export const easeOutElastic = (t) => {
46
+ if (t === 0 || t === 1)
47
+ return t;
48
+ return Math.pow(2, -10 * t) * Math.sin((t - 0.1) * 5 * Math.PI) + 1;
49
+ };
50
+ //# sourceMappingURL=easing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"easing.js","sourceRoot":"","sources":["../../src/animation/easing.ts"],"names":[],"mappings":"AAKA,wCAAwC;AACxC,MAAM,CAAC,MAAM,MAAM,GAAa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAExC,uCAAuC;AACvC,MAAM,CAAC,MAAM,UAAU,GAAa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;AAEhD,qCAAqC;AACrC,MAAM,CAAC,MAAM,WAAW,GAAa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AAEvD,sCAAsC;AACtC,MAAM,CAAC,MAAM,aAAa,GAAa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AAE1F,0BAA0B;AAC1B,MAAM,CAAC,MAAM,WAA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7 @@
1
+ export * from './easing.js';
2
+ export * from './multiple.js';
3
+ export * from './properties.js';
4
+ export * from './sequences.js';
5
+ export * from './sprite-sheet.js';
6
+ export * from './tween.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,7 @@
1
+ export * from './easing.js';
2
+ export * from './multiple.js';
3
+ export * from './properties.js';
4
+ export * from './sequences.js';
5
+ export * from './sprite-sheet.js';
6
+ export * from './tween.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animation/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,26 @@
1
+ import type { AnimationKeyframe } from '../nodes/animation-player.js';
2
+ /**
3
+ * The **`multiKF`** function returns a keyframe using multiple keyframes.
4
+ * @param kfs The keyframes
5
+ * @returns A keyframe
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * animPlayer
10
+ * .add('idle', {
11
+ * fps: 4,
12
+ * keyframes: [
13
+ * multiKF([ // In the same frame `multiKF` executes both keyframes.
14
+ * () => sprite.textureId = 'idle',
15
+ * () => sprite.margin.x = 0,
16
+ * ]),
17
+ * () => sprite.margin.x = 16,
18
+ * () => sprite.margin.x = 32,
19
+ * () => sprite.margin.x = 48,
20
+ * ],
21
+ * loop: true,
22
+ * })
23
+ * ```
24
+ */
25
+ export declare function multiKF(kfs: AnimationKeyframe[]): AnimationKeyframe;
26
+ //# sourceMappingURL=multiple.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiple.d.ts","sourceRoot":"","sources":["../../src/animation/multiple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,CAEnE"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The **`multiKF`** function returns a keyframe using multiple keyframes.
3
+ * @param kfs The keyframes
4
+ * @returns A keyframe
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * animPlayer
9
+ * .add('idle', {
10
+ * fps: 4,
11
+ * keyframes: [
12
+ * multiKF([ // In the same frame `multiKF` executes both keyframes.
13
+ * () => sprite.textureId = 'idle',
14
+ * () => sprite.margin.x = 0,
15
+ * ]),
16
+ * () => sprite.margin.x = 16,
17
+ * () => sprite.margin.x = 32,
18
+ * () => sprite.margin.x = 48,
19
+ * ],
20
+ * loop: true,
21
+ * })
22
+ * ```
23
+ */
24
+ export function multiKF(kfs) {
25
+ return (time) => kfs.forEach((kf) => kf(time));
26
+ }
27
+ //# sourceMappingURL=multiple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiple.js","sourceRoot":"","sources":["../../src/animation/multiple.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,OAAO,CAAC,GAAwB;IAC9C,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAChD,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { AnimationKeyframe } from '../nodes/animation-player.js';
2
+ import type { Node } from '../nodes/_node.js';
3
+ /**
4
+ * The **`kfFromProp`** function returns a keyframe that sets a property in a `Node`.
5
+ * @param node A instance of `Node`
6
+ * @param property A key
7
+ * @param value A value
8
+ * @returns A keyframe
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * animPlayer
13
+ * .add('idle', {
14
+ * fps: 4,
15
+ * keyframes: [
16
+ * multiKF([
17
+ * kfFromProp(sprite, 'textureId', 'idle'),
18
+ * // () => sprite.margin.x = 0,
19
+ * kfFromProp(sprite, 'margin', new Vector2(0, 0)),
20
+ * ]),
21
+ * kfFromProp(sprite, 'margin', new Vector2(16, 0)),
22
+ * kfFromProp(sprite, 'margin', new Vector2(32, 0)),
23
+ * kfFromProp(sprite, 'margin', new Vector2(48, 0)),
24
+ * ],
25
+ * loop: true,
26
+ * })
27
+ * ```
28
+ */
29
+ export declare function kfFromProp<T extends Node, K extends keyof T>(node: T, property: K, value: T[K]): AnimationKeyframe;
30
+ //# sourceMappingURL=properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/animation/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,MAAM,CAAC,EAC1D,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GACV,iBAAiB,CAInB"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The **`kfFromProp`** function returns a keyframe that sets a property in a `Node`.
3
+ * @param node A instance of `Node`
4
+ * @param property A key
5
+ * @param value A value
6
+ * @returns A keyframe
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * animPlayer
11
+ * .add('idle', {
12
+ * fps: 4,
13
+ * keyframes: [
14
+ * multiKF([
15
+ * kfFromProp(sprite, 'textureId', 'idle'),
16
+ * // () => sprite.margin.x = 0,
17
+ * kfFromProp(sprite, 'margin', new Vector2(0, 0)),
18
+ * ]),
19
+ * kfFromProp(sprite, 'margin', new Vector2(16, 0)),
20
+ * kfFromProp(sprite, 'margin', new Vector2(32, 0)),
21
+ * kfFromProp(sprite, 'margin', new Vector2(48, 0)),
22
+ * ],
23
+ * loop: true,
24
+ * })
25
+ * ```
26
+ */
27
+ export function kfFromProp(node, property, value) {
28
+ return () => {
29
+ node[property] = value;
30
+ };
31
+ }
32
+ //# sourceMappingURL=properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/animation/properties.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,UAAU,CACxB,IAAO,EACP,QAAW,EACX,KAAW;IAEX,OAAO,GAAG,EAAE;QACV,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;IACxB,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { TweenController } from './tween.js';
2
+ /**
3
+ * Executes tweens sequentially — each tween starts after the previous one completes.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { tween, sequence } from 'dinix/animation'
8
+ *
9
+ * sequence([
10
+ * tween({ target: sprite, prop: 'opacity', from: 0, to: 1, duration: 0.5 }),
11
+ * tween({ target: sprite, prop: 'position', from: 0, to: 100, duration: 1 }),
12
+ * ])
13
+ * ```
14
+ */
15
+ export declare function sequence(tweens: TweenController[]): void;
16
+ /**
17
+ * Executes tweens in parallel — all tweens start simultaneously.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { tween, parallel } from 'dinix/animation'
22
+ *
23
+ * parallel([
24
+ * tween({ target: sprite, prop: 'opacity', from: 0, to: 1, duration: 0.5 }),
25
+ * tween({ target: sprite, prop: 'position', from: 0, to: 100, duration: 1 }),
26
+ * ])
27
+ * ```
28
+ */
29
+ export declare function parallel(tweens: TweenController[]): void;
30
+ //# sourceMappingURL=sequences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequences.d.ts","sourceRoot":"","sources":["../../src/animation/sequences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAoBxD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAIxD"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Executes tweens sequentially — each tween starts after the previous one completes.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { tween, sequence } from 'dinix/animation'
7
+ *
8
+ * sequence([
9
+ * tween({ target: sprite, prop: 'opacity', from: 0, to: 1, duration: 0.5 }),
10
+ * tween({ target: sprite, prop: 'position', from: 0, to: 100, duration: 1 }),
11
+ * ])
12
+ * ```
13
+ */
14
+ export function sequence(tweens) {
15
+ if (tweens.length === 0)
16
+ return;
17
+ for (let i = tweens.length - 1; i > 0; i--) {
18
+ const current = tweens[i];
19
+ const prev = tweens[i - 1];
20
+ current.pause();
21
+ const check = () => {
22
+ if (prev.isPlaying) {
23
+ requestAnimationFrame(check);
24
+ return;
25
+ }
26
+ current.resume();
27
+ };
28
+ requestAnimationFrame(check);
29
+ }
30
+ tweens[0].resume();
31
+ }
32
+ /**
33
+ * Executes tweens in parallel — all tweens start simultaneously.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { tween, parallel } from 'dinix/animation'
38
+ *
39
+ * parallel([
40
+ * tween({ target: sprite, prop: 'opacity', from: 0, to: 1, duration: 0.5 }),
41
+ * tween({ target: sprite, prop: 'position', from: 0, to: 100, duration: 1 }),
42
+ * ])
43
+ * ```
44
+ */
45
+ export function parallel(tweens) {
46
+ for (const t of tweens) {
47
+ t.resume();
48
+ }
49
+ }
50
+ //# sourceMappingURL=sequences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequences.js","sourceRoot":"","sources":["../../src/animation/sequences.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAyB;IAChD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAM;IAE/B,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAE,CAAA;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAE,CAAA;QAE3B,OAAO,CAAC,KAAK,EAAE,CAAA;QAEf,MAAM,KAAK,GAAG,GAAG,EAAE;YACjB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACnB,qBAAqB,CAAC,KAAK,CAAC,CAAA;gBAC5B,OAAM;YACR,CAAC;YACD,OAAO,CAAC,MAAM,EAAE,CAAA;QAClB,CAAC,CAAA;QACD,qBAAqB,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;IAED,MAAM,CAAC,CAAC,CAAE,CAAC,MAAM,EAAE,CAAA;AACrB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAyB;IAChD,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,CAAC,CAAC,MAAM,EAAE,CAAA;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,81 @@
1
+ import type { NodeReference } from '../hooks/use-node.js';
2
+ import type { Animation, AnimationKeyframe } from '../nodes/animation-player.js';
3
+ import type { PrimaryNode } from '../nodes/index.js';
4
+ import { Sprite } from '../nodes/node2d/sprite.js';
5
+ /**
6
+ * The **`keyframesFromSheet`** function generates keyframes from a sprite sheet texture.
7
+ * It automatically calculates frame dimensions and margins based on the grid layout.
8
+ *
9
+ * @param sprite A sprite instance of `Sprite`
10
+ * @param textureId A texture id. If it is null, the sprite texture will not change.
11
+ * @param columns Count of sprites in horizontal.
12
+ * @param rows Count of sprites in vertical.
13
+ * @param range Optional `[from, to]` tuple (0-indexed, inclusive) to select a subset of frames from the sheet.
14
+ * @returns A keyframes array
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // Full sprite sheet (all frames)
19
+ * const allFrames = keyframesFromSheet(sprite, texture, 4, 2)
20
+ *
21
+ * // Only frames 0-3 (first row of a 4x2 sheet)
22
+ * const walkFrames = keyframesFromSheet(sprite, texture, 4, 2, [0, 3])
23
+ *
24
+ * // Only frames 4-7 (second row of a 4x2 sheet)
25
+ * const runFrames = keyframesFromSheet(sprite, texture, 4, 2, [4, 7])
26
+ * ```
27
+ */
28
+ export declare function keyframesFromSheet(sprite: Sprite, textureId: symbol | null | undefined, columns?: number, rows?: number, range?: [number, number]): AnimationKeyframe[];
29
+ /**
30
+ * Options for creating an animation from a sprite sheet.
31
+ */
32
+ export interface SpriteSheetAnimationOptions {
33
+ /** Number of columns in the sprite sheet grid. @default 1 */
34
+ columns?: number;
35
+ /** Number of rows in the sprite sheet grid. @default 1 */
36
+ rows?: number;
37
+ /** Optional `[from, to]` tuple (0-indexed, inclusive) to select a subset of frames. */
38
+ range?: [number, number];
39
+ /** Total duration of the animation in seconds. FPS is calculated as `(columns * rows) / duration`. */
40
+ duration: number;
41
+ /** Whether the animation should loop. @default undefined */
42
+ loop?: boolean;
43
+ }
44
+ /**
45
+ * The **`animationFromSheet`** function creates a complete `Animation` object from a sprite sheet.
46
+ * It combines `keyframesFromSheet` with automatic FPS calculation based on the total frame count
47
+ * and desired duration.
48
+ *
49
+ * @param sprite A `Sprite` instance or a `NodeReference` to a sprite node
50
+ * @param textureId A texture id. If `null`, the sprite texture will not change. If `undefined`, uses the sprite's current texture.
51
+ * @param options Animation options including grid dimensions, duration, and loop settings
52
+ * @returns A complete `Animation` object ready for `AnimationPlayer`
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * // Basic usage — 4-column sprite sheet, 1 second animation
57
+ * const idle = animationFromSheet(sprite, IDLE_TEXTURE, {
58
+ * columns: 4,
59
+ * duration: 1,
60
+ * loop: true,
61
+ * })
62
+ *
63
+ * // With range — only first 3 frames
64
+ * const walk = animationFromSheet(sprite, WALK_TEXTURE, {
65
+ * columns: 4,
66
+ * rows: 2,
67
+ * range: [0, 2],
68
+ * duration: 0.75,
69
+ * loop: true,
70
+ * })
71
+ *
72
+ * // Using a NodeReference (deferred)
73
+ * const sprite = useNode(PrimaryNode.Sprite)
74
+ * const anim = animationFromSheet(sprite, TEXTURE, {
75
+ * columns: 4,
76
+ * duration: 1,
77
+ * })
78
+ * ```
79
+ */
80
+ export declare function animationFromSheet(sprite: Sprite | NodeReference<PrimaryNode.Sprite>, textureId: symbol | null | undefined, options: SpriteSheetAnimationOptions): Animation;
81
+ //# sourceMappingURL=sprite-sheet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sprite-sheet.d.ts","sourceRoot":"","sources":["../../src/animation/sprite-sheet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAIlD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,MAAU,EACnB,IAAI,GAAE,MAAU,EAChB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GACvB,iBAAiB,EAAE,CA8BrB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uFAAuF;IACvF,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxB,sGAAsG;IACtG,QAAQ,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,EAClD,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,EAAE,2BAA2B,GACnC,SAAS,CAmBX"}
@@ -0,0 +1,103 @@
1
+ import { getTexture } from '../assets/texture.js';
2
+ import { Vector2 } from '../math/vector2.js';
3
+ import { Sprite } from '../nodes/node2d/sprite.js';
4
+ import { multiKF } from './multiple.js';
5
+ import { kfFromProp } from './properties.js';
6
+ /**
7
+ * The **`keyframesFromSheet`** function generates keyframes from a sprite sheet texture.
8
+ * It automatically calculates frame dimensions and margins based on the grid layout.
9
+ *
10
+ * @param sprite A sprite instance of `Sprite`
11
+ * @param textureId A texture id. If it is null, the sprite texture will not change.
12
+ * @param columns Count of sprites in horizontal.
13
+ * @param rows Count of sprites in vertical.
14
+ * @param range Optional `[from, to]` tuple (0-indexed, inclusive) to select a subset of frames from the sheet.
15
+ * @returns A keyframes array
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // Full sprite sheet (all frames)
20
+ * const allFrames = keyframesFromSheet(sprite, texture, 4, 2)
21
+ *
22
+ * // Only frames 0-3 (first row of a 4x2 sheet)
23
+ * const walkFrames = keyframesFromSheet(sprite, texture, 4, 2, [0, 3])
24
+ *
25
+ * // Only frames 4-7 (second row of a 4x2 sheet)
26
+ * const runFrames = keyframesFromSheet(sprite, texture, 4, 2, [4, 7])
27
+ * ```
28
+ */
29
+ export function keyframesFromSheet(sprite, textureId, columns = 1, rows = 1, range) {
30
+ const texture = textureId ? getTexture(textureId) : sprite.getTexture();
31
+ const spriteWidth = texture?.width ?? 0;
32
+ const spriteHeight = texture?.height ?? 0;
33
+ const sizeX = spriteWidth / columns;
34
+ const sizeY = spriteHeight / rows;
35
+ const count = columns * rows;
36
+ const from = Math.min(range?.[0] ?? 0, count - 1);
37
+ const to = Math.max(range?.[1] ?? count - 1, from);
38
+ sprite.sourceSize = new Vector2(sizeX, sizeY);
39
+ const kfs = Array.from({ length: to - from + 1 }, (_, i) => {
40
+ const index = i + from;
41
+ const x = index % columns;
42
+ const y = Math.floor(index / columns);
43
+ return kfFromProp(sprite, 'margin', new Vector2(x * sizeX, y * sizeY));
44
+ });
45
+ return [
46
+ multiKF([
47
+ ...(textureId ? [kfFromProp(sprite, 'textureId', textureId)] : []),
48
+ ...(kfs[0] ? [kfs[0]] : []),
49
+ ]),
50
+ ...kfs.slice(1),
51
+ ];
52
+ }
53
+ /**
54
+ * The **`animationFromSheet`** function creates a complete `Animation` object from a sprite sheet.
55
+ * It combines `keyframesFromSheet` with automatic FPS calculation based on the total frame count
56
+ * and desired duration.
57
+ *
58
+ * @param sprite A `Sprite` instance or a `NodeReference` to a sprite node
59
+ * @param textureId A texture id. If `null`, the sprite texture will not change. If `undefined`, uses the sprite's current texture.
60
+ * @param options Animation options including grid dimensions, duration, and loop settings
61
+ * @returns A complete `Animation` object ready for `AnimationPlayer`
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * // Basic usage — 4-column sprite sheet, 1 second animation
66
+ * const idle = animationFromSheet(sprite, IDLE_TEXTURE, {
67
+ * columns: 4,
68
+ * duration: 1,
69
+ * loop: true,
70
+ * })
71
+ *
72
+ * // With range — only first 3 frames
73
+ * const walk = animationFromSheet(sprite, WALK_TEXTURE, {
74
+ * columns: 4,
75
+ * rows: 2,
76
+ * range: [0, 2],
77
+ * duration: 0.75,
78
+ * loop: true,
79
+ * })
80
+ *
81
+ * // Using a NodeReference (deferred)
82
+ * const sprite = useNode(PrimaryNode.Sprite)
83
+ * const anim = animationFromSheet(sprite, TEXTURE, {
84
+ * columns: 4,
85
+ * duration: 1,
86
+ * })
87
+ * ```
88
+ */
89
+ export function animationFromSheet(sprite, textureId, options) {
90
+ const node = sprite instanceof Sprite ? sprite : sprite.signal();
91
+ if (node == null)
92
+ return {
93
+ keyframes: [],
94
+ fps: 1,
95
+ loop: false,
96
+ };
97
+ return {
98
+ keyframes: keyframesFromSheet(node, textureId ?? null, options.columns, options.rows, options.range),
99
+ fps: ((options.columns ?? 1) * (options.rows ?? 1)) / options.duration,
100
+ loop: options.loop,
101
+ };
102
+ }
103
+ //# sourceMappingURL=sprite-sheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sprite-sheet.js","sourceRoot":"","sources":["../../src/animation/sprite-sheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,SAAoC,EACpC,UAAkB,CAAC,EACnB,OAAe,CAAC,EAChB,KAAwB;IAExB,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;IAEvE,MAAM,WAAW,GAAG,OAAO,EAAE,KAAK,IA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C,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5B,CAAC;QACF,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;KAChB,CAAA;AACH,CAAC;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAkD,EAClD,SAAoC,EACpC,OAAoC;IAEpC,MAAM,IAAI,GAAG,MAAM,YAAY,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;IAChE,IAAI,IAAI,IAAI,IAAI;QACd,OAAO;YACL,SAAS,EAAE,EAAE;YACb,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,KAAK;SACZ,CAAA;IACH,OAAO;QACL,SAAS,EAAE,kBAAkB,CAC3B,IAAI,EACJ,SAAS,IAAI,IAAI,EACjB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,KAAK,CACd;QACD,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ;QACtE,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAA;AACH,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type { EasingFn } from './easing.js';
2
+ /**
3
+ * Options for creating a tween.
4
+ */
5
+ export interface TweenOptions<T> {
6
+ /** The object whose property will be interpolated. */
7
+ target: T;
8
+ /** The property name to interpolate. */
9
+ prop: keyof T;
10
+ /** Start value. */
11
+ from: number;
12
+ /** End value. */
13
+ to: number;
14
+ /** Duration in seconds. */
15
+ duration: number;
16
+ /** Easing function (default: linear). */
17
+ easing?: EasingFn;
18
+ /** Called every frame with the current interpolated value. */
19
+ onUpdate?: (value: number) => void;
20
+ /** Called when the tween completes. */
21
+ onComplete?: () => void;
22
+ }
23
+ /**
24
+ * Controls a running tween.
25
+ */
26
+ export interface TweenController {
27
+ /** Whether the tween is currently playing. */
28
+ readonly isPlaying: boolean;
29
+ /** Current progress from 0 to 1. */
30
+ readonly progress: number;
31
+ /** Pauses the tween. */
32
+ pause(): void;
33
+ /** Resumes the tween. */
34
+ resume(): void;
35
+ /** Stops the tween and resets progress. */
36
+ stop(): void;
37
+ }
38
+ /**
39
+ * Creates a tween that interpolates a numeric property on a target object.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import { tween, easeOutQuad } from 'dinix/animation'
44
+ *
45
+ * const controller = tween({
46
+ * target: sprite,
47
+ * prop: 'opacity',
48
+ * from: 0,
49
+ * to: 1,
50
+ * duration: 0.5,
51
+ * easing: easeOutQuad,
52
+ * onComplete: () => console.log('fade in done'),
53
+ * })
54
+ *
55
+ * // Later:
56
+ * controller.pause()
57
+ * controller.resume()
58
+ * ```
59
+ */
60
+ export declare function tween<T>(options: TweenOptions<T>): TweenController;
61
+ /**
62
+ * Creates a tween that updates a callback with interpolated values.
63
+ * Useful for animating values without a target object.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * import { tweenValue } from 'dinix/animation'
68
+ *
69
+ * tweenValue({
70
+ * from: 0,
71
+ * to: 100,
72
+ * duration: 1,
73
+ * onUpdate: (value) => console.log(value),
74
+ * })
75
+ * ```
76
+ */
77
+ export declare function tweenValue(options: Omit<TweenOptions<Record<string, number>>, 'target' | 'prop'>): TweenController;
78
+ //# sourceMappingURL=tween.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tween.d.ts","sourceRoot":"","sources":["../../src/animation/tween.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG3C;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,sDAAsD;IACtD,MAAM,EAAE,CAAC,CAAA;IACT,wCAAwC;IACxC,IAAI,EA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