@nice2dev/game-engine 0.1.0 → 1.0.3

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 (294) hide show
  1. package/CHANGELOG.md +193 -1
  2. package/dist/cjs/ai/BehaviorTree.js +1215 -0
  3. package/dist/cjs/ai/BehaviorTree.js.map +1 -0
  4. package/dist/cjs/ai/StateMachine.js +783 -0
  5. package/dist/cjs/ai/StateMachine.js.map +1 -0
  6. package/dist/cjs/audio/AudioBridge.js +454 -0
  7. package/dist/cjs/audio/AudioBridge.js.map +1 -0
  8. package/dist/cjs/devtools/GameplayAnalytics.js +651 -0
  9. package/dist/cjs/devtools/GameplayAnalytics.js.map +1 -0
  10. package/dist/cjs/dialogue/DialogueSystem.js +1023 -0
  11. package/dist/cjs/dialogue/DialogueSystem.js.map +1 -0
  12. package/dist/cjs/editor/NiceGameEditor.js +569 -71
  13. package/dist/cjs/editor/NiceGameEditor.js.map +1 -1
  14. package/dist/cjs/editor/ShaderGraph.js +1616 -0
  15. package/dist/cjs/editor/ShaderGraph.js.map +1 -0
  16. package/dist/cjs/editor/TimelineEditor.js +819 -0
  17. package/dist/cjs/editor/TimelineEditor.js.map +1 -0
  18. package/dist/cjs/engine/SaveSystemV2.js +494 -0
  19. package/dist/cjs/engine/SaveSystemV2.js.map +1 -0
  20. package/dist/cjs/export/GodotExporter.js +1102 -0
  21. package/dist/cjs/export/GodotExporter.js.map +1 -0
  22. package/dist/cjs/export/PlatformExporter.js +236 -0
  23. package/dist/cjs/export/PlatformExporter.js.map +1 -0
  24. package/dist/cjs/export/ThreeJSExporter.js +1116 -0
  25. package/dist/cjs/export/ThreeJSExporter.js.map +1 -0
  26. package/dist/cjs/export/UnityExporter.js +1193 -0
  27. package/dist/cjs/export/UnityExporter.js.map +1 -0
  28. package/dist/cjs/export/WebExporter.js +1036 -0
  29. package/dist/cjs/export/WebExporter.js.map +1 -0
  30. package/dist/cjs/export/index.js +58 -0
  31. package/dist/cjs/export/index.js.map +1 -0
  32. package/dist/cjs/i18n/useTranslation.js +11 -11
  33. package/dist/cjs/import/AsepriteImporter.js +761 -0
  34. package/dist/cjs/import/AsepriteImporter.js.map +1 -0
  35. package/dist/cjs/import/DragonBonesImporter.js +499 -0
  36. package/dist/cjs/import/DragonBonesImporter.js.map +1 -0
  37. package/dist/cjs/import/GameMakerImporter.js +559 -0
  38. package/dist/cjs/import/GameMakerImporter.js.map +1 -0
  39. package/dist/cjs/import/GodotSceneImporter.js +824 -0
  40. package/dist/cjs/import/GodotSceneImporter.js.map +1 -0
  41. package/dist/cjs/import/LDtkImporter.js +481 -0
  42. package/dist/cjs/import/LDtkImporter.js.map +1 -0
  43. package/dist/cjs/import/Live2DImporter.js +553 -0
  44. package/dist/cjs/import/Live2DImporter.js.map +1 -0
  45. package/dist/cjs/import/NdgFormat.js +499 -0
  46. package/dist/cjs/import/NdgFormat.js.map +1 -0
  47. package/dist/cjs/import/OgmoImporter.js +529 -0
  48. package/dist/cjs/import/OgmoImporter.js.map +1 -0
  49. package/dist/cjs/import/RPGMakerImporter.js +520 -0
  50. package/dist/cjs/import/RPGMakerImporter.js.map +1 -0
  51. package/dist/cjs/import/SceneImporter.js +449 -0
  52. package/dist/cjs/import/SceneImporter.js.map +1 -0
  53. package/dist/cjs/import/SpineImporter.js +583 -0
  54. package/dist/cjs/import/SpineImporter.js.map +1 -0
  55. package/dist/cjs/import/SpriterImporter.js +652 -0
  56. package/dist/cjs/import/SpriterImporter.js.map +1 -0
  57. package/dist/cjs/import/TiledMapImporter.js +859 -0
  58. package/dist/cjs/import/TiledMapImporter.js.map +1 -0
  59. package/dist/cjs/import/UnitySceneImporter.js +732 -0
  60. package/dist/cjs/import/UnitySceneImporter.js.map +1 -0
  61. package/dist/cjs/import/index.js +305 -0
  62. package/dist/cjs/import/index.js.map +1 -0
  63. package/dist/cjs/index.js +291 -1
  64. package/dist/cjs/index.js.map +1 -1
  65. package/dist/cjs/input/GamepadNavigation.js +21 -21
  66. package/dist/cjs/input/useGamepads.js +6 -6
  67. package/dist/cjs/integration/IconSprite.js +281 -0
  68. package/dist/cjs/integration/IconSprite.js.map +1 -0
  69. package/dist/cjs/inventory/InventorySystem.js +930 -0
  70. package/dist/cjs/inventory/InventorySystem.js.map +1 -0
  71. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js.map +1 -1
  72. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js.map +1 -1
  73. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js.map +1 -1
  74. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js.map +1 -1
  75. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js.map +1 -1
  76. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js.map +1 -1
  77. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js.map +1 -1
  78. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js.map +1 -1
  79. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js.map +1 -1
  80. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js.map +1 -1
  81. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js.map +1 -1
  82. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js.map +1 -1
  83. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js.map +1 -1
  84. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js.map +1 -1
  85. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js.map +1 -1
  86. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js.map +1 -1
  87. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js.map +1 -1
  88. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js.map +1 -1
  89. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js.map +1 -1
  90. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js.map +1 -1
  91. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js.map +1 -1
  92. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js.map +1 -1
  93. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js.map +1 -1
  94. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js.map +1 -1
  95. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js.map +1 -1
  96. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js.map +1 -1
  97. package/dist/cjs/quest/QuestSystem.js +924 -0
  98. package/dist/cjs/quest/QuestSystem.js.map +1 -0
  99. package/dist/cjs/rendering/WebGPURenderPipeline.js +658 -0
  100. package/dist/cjs/rendering/WebGPURenderPipeline.js.map +1 -0
  101. package/dist/cjs/scripting/GraphToAST.js +567 -0
  102. package/dist/cjs/scripting/GraphToAST.js.map +1 -0
  103. package/dist/cjs/scripting/LanguageExporter.js +321 -0
  104. package/dist/cjs/scripting/LanguageExporter.js.map +1 -0
  105. package/dist/cjs/scripting/ScriptAST.js +67 -0
  106. package/dist/cjs/scripting/ScriptAST.js.map +1 -0
  107. package/dist/cjs/scripting/VisualScripting2.js +1140 -0
  108. package/dist/cjs/scripting/VisualScripting2.js.map +1 -0
  109. package/dist/cjs/scripting/exporters/CSharpExporter.js +503 -0
  110. package/dist/cjs/scripting/exporters/CSharpExporter.js.map +1 -0
  111. package/dist/cjs/scripting/exporters/GDScriptExporter.js +452 -0
  112. package/dist/cjs/scripting/exporters/GDScriptExporter.js.map +1 -0
  113. package/dist/cjs/scripting/exporters/LuaExporter.js +457 -0
  114. package/dist/cjs/scripting/exporters/LuaExporter.js.map +1 -0
  115. package/dist/cjs/scripting/exporters/PythonExporter.js +565 -0
  116. package/dist/cjs/scripting/exporters/PythonExporter.js.map +1 -0
  117. package/dist/cjs/scripting/exporters/RustExporter.js +525 -0
  118. package/dist/cjs/scripting/exporters/RustExporter.js.map +1 -0
  119. package/dist/cjs/scripting/exporters/TypeScriptExporter.js +570 -0
  120. package/dist/cjs/scripting/exporters/TypeScriptExporter.js.map +1 -0
  121. package/dist/cjs/systems/ParticleSystem2.js +1478 -0
  122. package/dist/cjs/systems/ParticleSystem2.js.map +1 -0
  123. package/dist/cjs/xr/ARVR.js.map +1 -1
  124. package/dist/esm/ai/BehaviorTree.js +1186 -0
  125. package/dist/esm/ai/BehaviorTree.js.map +1 -0
  126. package/dist/esm/ai/StateMachine.js +767 -0
  127. package/dist/esm/ai/StateMachine.js.map +1 -0
  128. package/dist/esm/audio/AudioBridge.js +446 -0
  129. package/dist/esm/audio/AudioBridge.js.map +1 -0
  130. package/dist/esm/devtools/GameplayAnalytics.js +639 -0
  131. package/dist/esm/devtools/GameplayAnalytics.js.map +1 -0
  132. package/dist/esm/dialogue/DialogueSystem.js +1008 -0
  133. package/dist/esm/dialogue/DialogueSystem.js.map +1 -0
  134. package/dist/esm/editor/NiceGameEditor.js +556 -58
  135. package/dist/esm/editor/NiceGameEditor.js.map +1 -1
  136. package/dist/esm/editor/ShaderGraph.js +1606 -0
  137. package/dist/esm/editor/ShaderGraph.js.map +1 -0
  138. package/dist/esm/editor/TimelineEditor.js +800 -0
  139. package/dist/esm/editor/TimelineEditor.js.map +1 -0
  140. package/dist/esm/engine/SaveSystemV2.js +487 -0
  141. package/dist/esm/engine/SaveSystemV2.js.map +1 -0
  142. package/dist/esm/export/GodotExporter.js +1100 -0
  143. package/dist/esm/export/GodotExporter.js.map +1 -0
  144. package/dist/esm/export/PlatformExporter.js +230 -0
  145. package/dist/esm/export/PlatformExporter.js.map +1 -0
  146. package/dist/esm/export/ThreeJSExporter.js +1114 -0
  147. package/dist/esm/export/ThreeJSExporter.js.map +1 -0
  148. package/dist/esm/export/UnityExporter.js +1191 -0
  149. package/dist/esm/export/UnityExporter.js.map +1 -0
  150. package/dist/esm/export/WebExporter.js +1033 -0
  151. package/dist/esm/export/WebExporter.js.map +1 -0
  152. package/dist/esm/export/index.js +44 -0
  153. package/dist/esm/export/index.js.map +1 -0
  154. package/dist/esm/import/AsepriteImporter.js +759 -0
  155. package/dist/esm/import/AsepriteImporter.js.map +1 -0
  156. package/dist/esm/import/DragonBonesImporter.js +496 -0
  157. package/dist/esm/import/DragonBonesImporter.js.map +1 -0
  158. package/dist/esm/import/GameMakerImporter.js +556 -0
  159. package/dist/esm/import/GameMakerImporter.js.map +1 -0
  160. package/dist/esm/import/GodotSceneImporter.js +822 -0
  161. package/dist/esm/import/GodotSceneImporter.js.map +1 -0
  162. package/dist/esm/import/LDtkImporter.js +479 -0
  163. package/dist/esm/import/LDtkImporter.js.map +1 -0
  164. package/dist/esm/import/Live2DImporter.js +550 -0
  165. package/dist/esm/import/Live2DImporter.js.map +1 -0
  166. package/dist/esm/import/NdgFormat.js +490 -0
  167. package/dist/esm/import/NdgFormat.js.map +1 -0
  168. package/dist/esm/import/OgmoImporter.js +526 -0
  169. package/dist/esm/import/OgmoImporter.js.map +1 -0
  170. package/dist/esm/import/RPGMakerImporter.js +517 -0
  171. package/dist/esm/import/RPGMakerImporter.js.map +1 -0
  172. package/dist/esm/import/SceneImporter.js +441 -0
  173. package/dist/esm/import/SceneImporter.js.map +1 -0
  174. package/dist/esm/import/SpineImporter.js +580 -0
  175. package/dist/esm/import/SpineImporter.js.map +1 -0
  176. package/dist/esm/import/SpriterImporter.js +649 -0
  177. package/dist/esm/import/SpriterImporter.js.map +1 -0
  178. package/dist/esm/import/TiledMapImporter.js +857 -0
  179. package/dist/esm/import/TiledMapImporter.js.map +1 -0
  180. package/dist/esm/import/UnitySceneImporter.js +730 -0
  181. package/dist/esm/import/UnitySceneImporter.js.map +1 -0
  182. package/dist/esm/import/index.js +279 -0
  183. package/dist/esm/import/index.js.map +1 -0
  184. package/dist/esm/index.js +47 -3
  185. package/dist/esm/index.js.map +1 -1
  186. package/dist/esm/integration/IconSprite.js +266 -0
  187. package/dist/esm/integration/IconSprite.js.map +1 -0
  188. package/dist/esm/inventory/InventorySystem.js +924 -0
  189. package/dist/esm/inventory/InventorySystem.js.map +1 -0
  190. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js.map +1 -1
  191. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js.map +1 -1
  192. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js.map +1 -1
  193. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js.map +1 -1
  194. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js.map +1 -1
  195. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js.map +1 -1
  196. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js.map +1 -1
  197. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js.map +1 -1
  198. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js.map +1 -1
  199. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js.map +1 -1
  200. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js.map +1 -1
  201. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js.map +1 -1
  202. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js.map +1 -1
  203. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js.map +1 -1
  204. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js.map +1 -1
  205. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js.map +1 -1
  206. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js.map +1 -1
  207. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js.map +1 -1
  208. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js.map +1 -1
  209. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js.map +1 -1
  210. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js.map +1 -1
  211. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js.map +1 -1
  212. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js.map +1 -1
  213. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js.map +1 -1
  214. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js.map +1 -1
  215. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js.map +1 -1
  216. package/dist/esm/quest/QuestSystem.js +916 -0
  217. package/dist/esm/quest/QuestSystem.js.map +1 -0
  218. package/dist/esm/rendering/WebGPURenderPipeline.js +642 -0
  219. package/dist/esm/rendering/WebGPURenderPipeline.js.map +1 -0
  220. package/dist/esm/scripting/GraphToAST.js +564 -0
  221. package/dist/esm/scripting/GraphToAST.js.map +1 -0
  222. package/dist/esm/scripting/LanguageExporter.js +311 -0
  223. package/dist/esm/scripting/LanguageExporter.js.map +1 -0
  224. package/dist/esm/scripting/ScriptAST.js +52 -0
  225. package/dist/esm/scripting/ScriptAST.js.map +1 -0
  226. package/dist/esm/scripting/VisualScripting2.js +1130 -0
  227. package/dist/esm/scripting/VisualScripting2.js.map +1 -0
  228. package/dist/esm/scripting/exporters/CSharpExporter.js +501 -0
  229. package/dist/esm/scripting/exporters/CSharpExporter.js.map +1 -0
  230. package/dist/esm/scripting/exporters/GDScriptExporter.js +450 -0
  231. package/dist/esm/scripting/exporters/GDScriptExporter.js.map +1 -0
  232. package/dist/esm/scripting/exporters/LuaExporter.js +455 -0
  233. package/dist/esm/scripting/exporters/LuaExporter.js.map +1 -0
  234. package/dist/esm/scripting/exporters/PythonExporter.js +563 -0
  235. package/dist/esm/scripting/exporters/PythonExporter.js.map +1 -0
  236. package/dist/esm/scripting/exporters/RustExporter.js +523 -0
  237. package/dist/esm/scripting/exporters/RustExporter.js.map +1 -0
  238. package/dist/esm/scripting/exporters/TypeScriptExporter.js +568 -0
  239. package/dist/esm/scripting/exporters/TypeScriptExporter.js.map +1 -0
  240. package/dist/esm/systems/ParticleSystem2.js +1471 -0
  241. package/dist/esm/systems/ParticleSystem2.js.map +1 -0
  242. package/dist/esm/xr/ARVR.js.map +1 -1
  243. package/dist/types/__tests__/setup.d.ts +1 -1
  244. package/dist/types/ai/BehaviorTree.d.ts +375 -0
  245. package/dist/types/ai/StateMachine.d.ts +296 -0
  246. package/dist/types/audio/AudioBridge.d.ts +199 -0
  247. package/dist/types/devtools/GameplayAnalytics.d.ts +279 -0
  248. package/dist/types/dialogue/DialogueSystem.d.ts +326 -0
  249. package/dist/types/dialogue/index.d.ts +2 -0
  250. package/dist/types/editor/NiceGameEditor.d.ts +12 -1
  251. package/dist/types/editor/ShaderGraph.d.ts +207 -0
  252. package/dist/types/editor/TimelineEditor.d.ts +393 -0
  253. package/dist/types/engine/SaveSystemV2.d.ts +155 -0
  254. package/dist/types/export/GodotExporter.d.ts +56 -0
  255. package/dist/types/export/PlatformExporter.d.ts +201 -0
  256. package/dist/types/export/ThreeJSExporter.d.ts +40 -0
  257. package/dist/types/export/UnityExporter.d.ts +69 -0
  258. package/dist/types/export/WebExporter.d.ts +58 -0
  259. package/dist/types/export/index.d.ts +19 -0
  260. package/dist/types/import/AsepriteImporter.d.ts +46 -0
  261. package/dist/types/import/DragonBonesImporter.d.ts +331 -0
  262. package/dist/types/import/GameMakerImporter.d.ts +375 -0
  263. package/dist/types/import/GodotSceneImporter.d.ts +34 -0
  264. package/dist/types/import/LDtkImporter.d.ts +177 -0
  265. package/dist/types/import/Live2DImporter.d.ts +237 -0
  266. package/dist/types/import/NdgFormat.d.ts +387 -0
  267. package/dist/types/import/OgmoImporter.d.ts +237 -0
  268. package/dist/types/import/RPGMakerImporter.d.ts +186 -0
  269. package/dist/types/import/SceneImporter.d.ts +276 -0
  270. package/dist/types/import/SpineImporter.d.ts +372 -0
  271. package/dist/types/import/SpriterImporter.d.ts +230 -0
  272. package/dist/types/import/TiledMapImporter.d.ts +57 -0
  273. package/dist/types/import/UnitySceneImporter.d.ts +87 -0
  274. package/dist/types/import/index.d.ts +59 -0
  275. package/dist/types/index.d.ts +46 -18
  276. package/dist/types/integration/IconSprite.d.ts +196 -0
  277. package/dist/types/inventory/InventorySystem.d.ts +336 -0
  278. package/dist/types/performance/WebGPUCompute.d.ts +0 -10
  279. package/dist/types/quest/QuestSystem.d.ts +287 -0
  280. package/dist/types/rendering/WebGPURenderPipeline.d.ts +255 -0
  281. package/dist/types/scripting/GraphToAST.d.ts +55 -0
  282. package/dist/types/scripting/LanguageExporter.d.ts +136 -0
  283. package/dist/types/scripting/ScriptAST.d.ts +312 -0
  284. package/dist/types/scripting/VisualScripting2.d.ts +353 -0
  285. package/dist/types/scripting/exporters/CSharpExporter.d.ts +44 -0
  286. package/dist/types/scripting/exporters/GDScriptExporter.d.ts +46 -0
  287. package/dist/types/scripting/exporters/LuaExporter.d.ts +46 -0
  288. package/dist/types/scripting/exporters/PythonExporter.d.ts +49 -0
  289. package/dist/types/scripting/exporters/RustExporter.d.ts +46 -0
  290. package/dist/types/scripting/exporters/TypeScriptExporter.d.ts +48 -0
  291. package/dist/types/scripting/exporters/index.d.ts +8 -0
  292. package/dist/types/scripting/index.d.ts +11 -0
  293. package/dist/types/systems/ParticleSystem2.d.ts +646 -0
  294. package/package.json +7 -1
@@ -0,0 +1,800 @@
1
+ /**
2
+ * @file TimelineEditor.ts
3
+ * @description Timeline System for Cutscenes, Cinematics, and Sequencing
4
+ * PRO-1.4: Professional Editor Features
5
+ *
6
+ * Features:
7
+ * - Multi-track timeline
8
+ * - Track types: animation, audio, event, property, activation
9
+ * - Keyframe animation with curves
10
+ * - Clips with blending
11
+ * - Markers and events
12
+ * - Playback control
13
+ * - Recording mode
14
+ * - Debugger integration
15
+ */
16
+ // ============================================================
17
+ // Easing Implementation
18
+ // ============================================================
19
+ const easingFunctions = {
20
+ linear: (t) => t,
21
+ easeIn: (t) => t * t,
22
+ easeOut: (t) => t * (2 - t),
23
+ easeInOut: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
24
+ easeInQuad: (t) => t * t,
25
+ easeOutQuad: (t) => t * (2 - t),
26
+ easeInOutQuad: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
27
+ easeInCubic: (t) => t * t * t,
28
+ easeOutCubic: (t) => --t * t * t + 1,
29
+ easeInOutCubic: (t) => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1),
30
+ easeInQuart: (t) => t * t * t * t,
31
+ easeOutQuart: (t) => 1 - --t * t * t * t,
32
+ easeInOutQuart: (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t),
33
+ easeInQuint: (t) => t * t * t * t * t,
34
+ easeOutQuint: (t) => 1 + --t * t * t * t * t,
35
+ easeInOutQuint: (t) => (t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t),
36
+ easeInSine: (t) => 1 - Math.cos((t * Math.PI) / 2),
37
+ easeOutSine: (t) => Math.sin((t * Math.PI) / 2),
38
+ easeInOutSine: (t) => -(Math.cos(Math.PI * t) - 1) / 2,
39
+ easeInExpo: (t) => (t === 0 ? 0 : Math.pow(2, 10 * t - 10)),
40
+ easeOutExpo: (t) => (t === 1 ? 1 : 1 - Math.pow(2, -10 * t)),
41
+ easeInOutExpo: (t) => {
42
+ if (t === 0)
43
+ return 0;
44
+ if (t === 1)
45
+ return 1;
46
+ if (t < 0.5)
47
+ return Math.pow(2, 20 * t - 10) / 2;
48
+ return (2 - Math.pow(2, -20 * t + 10)) / 2;
49
+ },
50
+ easeInCirc: (t) => 1 - Math.sqrt(1 - t * t),
51
+ easeOutCirc: (t) => Math.sqrt(1 - --t * t),
52
+ easeInOutCirc: (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t * t)) / 2 : (Math.sqrt(1 - Math.pow(-2 * t + 2, 2)) + 1) / 2,
53
+ easeInBack: (t) => {
54
+ const c1 = 1.70158;
55
+ const c3 = c1 + 1;
56
+ return c3 * t * t * t - c1 * t * t;
57
+ },
58
+ easeOutBack: (t) => {
59
+ const c1 = 1.70158;
60
+ const c3 = c1 + 1;
61
+ return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
62
+ },
63
+ easeInOutBack: (t) => {
64
+ const c1 = 1.70158;
65
+ const c2 = c1 * 1.525;
66
+ return t < 0.5
67
+ ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
68
+ : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
69
+ },
70
+ easeInElastic: (t) => {
71
+ if (t === 0)
72
+ return 0;
73
+ if (t === 1)
74
+ return 1;
75
+ const c4 = (2 * Math.PI) / 3;
76
+ return -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);
77
+ },
78
+ easeOutElastic: (t) => {
79
+ if (t === 0)
80
+ return 0;
81
+ if (t === 1)
82
+ return 1;
83
+ const c4 = (2 * Math.PI) / 3;
84
+ return Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
85
+ },
86
+ easeInOutElastic: (t) => {
87
+ if (t === 0)
88
+ return 0;
89
+ if (t === 1)
90
+ return 1;
91
+ const c5 = (2 * Math.PI) / 4.5;
92
+ return t < 0.5
93
+ ? -(Math.pow(2, 20 * t - 10) * Math.sin((20 * t - 11.125) * c5)) / 2
94
+ : (Math.pow(2, -20 * t + 10) * Math.sin((20 * t - 11.125) * c5)) / 2 + 1;
95
+ },
96
+ easeInBounce: (t) => 1 - easingFunctions.easeOutBounce(1 - t),
97
+ easeOutBounce: (t) => {
98
+ const n1 = 7.5625;
99
+ const d1 = 2.75;
100
+ if (t < 1 / d1) {
101
+ return n1 * t * t;
102
+ }
103
+ else if (t < 2 / d1) {
104
+ return n1 * (t -= 1.5 / d1) * t + 0.75;
105
+ }
106
+ else if (t < 2.5 / d1) {
107
+ return n1 * (t -= 2.25 / d1) * t + 0.9375;
108
+ }
109
+ else {
110
+ return n1 * (t -= 2.625 / d1) * t + 0.984375;
111
+ }
112
+ },
113
+ easeInOutBounce: (t) => t < 0.5
114
+ ? (1 - easingFunctions.easeOutBounce(1 - 2 * t)) / 2
115
+ : (1 + easingFunctions.easeOutBounce(2 * t - 1)) / 2,
116
+ };
117
+ function applyEasing(t, easing = 'linear') {
118
+ return easingFunctions[easing](t);
119
+ }
120
+ // ============================================================
121
+ // Curve Evaluation
122
+ // ============================================================
123
+ function evaluateCurve(curve, time) {
124
+ const keyframes = curve.keyframes;
125
+ if (keyframes.length === 0)
126
+ return 0;
127
+ if (keyframes.length === 1)
128
+ return keyframes[0].value;
129
+ // Handle pre/post infinity
130
+ const firstKey = keyframes[0];
131
+ const lastKey = keyframes[keyframes.length - 1];
132
+ if (time <= firstKey.time) {
133
+ return firstKey.value;
134
+ }
135
+ if (time >= lastKey.time) {
136
+ return lastKey.value;
137
+ }
138
+ // Find surrounding keyframes
139
+ let prevKey = firstKey;
140
+ let nextKey = lastKey;
141
+ for (let i = 0; i < keyframes.length - 1; i++) {
142
+ if (time >= keyframes[i].time && time <= keyframes[i + 1].time) {
143
+ prevKey = keyframes[i];
144
+ nextKey = keyframes[i + 1];
145
+ break;
146
+ }
147
+ }
148
+ // Calculate local t
149
+ const duration = nextKey.time - prevKey.time;
150
+ const localT = duration > 0 ? (time - prevKey.time) / duration : 0;
151
+ // Apply easing
152
+ const easedT = applyEasing(localT, prevKey.easing || 'linear');
153
+ // Interpolate
154
+ if (prevKey.tangentMode === 'constant') {
155
+ return prevKey.value;
156
+ }
157
+ // Bezier interpolation if tangents are specified
158
+ if (prevKey.outTangent && nextKey.inTangent) {
159
+ return bezierInterpolate(prevKey.value, prevKey.value + prevKey.outTangent.y * duration, nextKey.value + nextKey.inTangent.y * duration, nextKey.value, easedT);
160
+ }
161
+ // Linear interpolation
162
+ return prevKey.value + (nextKey.value - prevKey.value) * easedT;
163
+ }
164
+ function bezierInterpolate(p0, p1, p2, p3, t) {
165
+ const mt = 1 - t;
166
+ return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3;
167
+ }
168
+ // ============================================================
169
+ // Timeline Player
170
+ // ============================================================
171
+ class TimelinePlayer {
172
+ constructor(definition) {
173
+ this.state = 'stopped';
174
+ this.currentTime = 0;
175
+ this.speed = 1;
176
+ this.direction = 1; // 1 = forward, -1 = backward
177
+ /** Active clips per track */
178
+ this.activeClips = new Map();
179
+ /** Previous time for detecting clip transitions */
180
+ this.previousTime = 0;
181
+ /** Event listeners */
182
+ this.listeners = new Map();
183
+ /** Property bindings */
184
+ this.propertyBindings = new Map();
185
+ this.audioNodes = new Map();
186
+ /** Debug mode */
187
+ this.debugMode = false;
188
+ this.history = [];
189
+ this.definition = definition;
190
+ }
191
+ // ─── Playback Control ────────────────────────────
192
+ play() {
193
+ if (this.state === 'playing')
194
+ return;
195
+ this.state = 'playing';
196
+ this.emit('play');
197
+ }
198
+ pause() {
199
+ if (this.state !== 'playing')
200
+ return;
201
+ this.state = 'paused';
202
+ this.emit('pause');
203
+ }
204
+ stop() {
205
+ this.state = 'stopped';
206
+ this.currentTime = 0;
207
+ this.previousTime = 0;
208
+ this.activeClips.clear();
209
+ this.stopAllAudio();
210
+ this.emit('stop');
211
+ }
212
+ seek(time) {
213
+ this.previousTime = this.currentTime;
214
+ this.currentTime = Math.max(0, Math.min(time, this.definition.duration));
215
+ this.emit('seek', { time: this.currentTime });
216
+ }
217
+ seekToMarker(markerName) {
218
+ const marker = this.definition.markers.find((m) => m.name === markerName);
219
+ if (marker) {
220
+ this.seek(marker.time);
221
+ return true;
222
+ }
223
+ return false;
224
+ }
225
+ setSpeed(speed) {
226
+ this.speed = speed;
227
+ this.direction = speed >= 0 ? 1 : -1;
228
+ }
229
+ getSpeed() {
230
+ return this.speed;
231
+ }
232
+ // ─── Update ──────────────────────────────────────
233
+ update(dt) {
234
+ if (this.state !== 'playing')
235
+ return;
236
+ this.previousTime = this.currentTime;
237
+ this.currentTime += dt * this.speed;
238
+ // Handle wrap modes
239
+ if (this.currentTime >= this.definition.duration) {
240
+ switch (this.definition.wrapMode) {
241
+ case 'once':
242
+ this.currentTime = this.definition.duration;
243
+ this.state = 'stopped';
244
+ this.emit('complete');
245
+ break;
246
+ case 'loop':
247
+ this.currentTime = this.currentTime % this.definition.duration;
248
+ this.emit('loop');
249
+ this.activeClips.clear();
250
+ break;
251
+ case 'pingPong':
252
+ this.direction *= -1;
253
+ this.currentTime =
254
+ this.definition.duration - (this.currentTime - this.definition.duration);
255
+ this.emit('loop');
256
+ break;
257
+ case 'clampForever':
258
+ this.currentTime = this.definition.duration;
259
+ break;
260
+ }
261
+ }
262
+ else if (this.currentTime < 0) {
263
+ switch (this.definition.wrapMode) {
264
+ case 'once':
265
+ this.currentTime = 0;
266
+ this.state = 'stopped';
267
+ this.emit('complete');
268
+ break;
269
+ case 'loop':
270
+ this.currentTime = this.definition.duration + this.currentTime;
271
+ this.emit('loop');
272
+ this.activeClips.clear();
273
+ break;
274
+ case 'pingPong':
275
+ this.direction *= -1;
276
+ this.currentTime = -this.currentTime;
277
+ this.emit('loop');
278
+ break;
279
+ case 'clampForever':
280
+ this.currentTime = 0;
281
+ break;
282
+ }
283
+ }
284
+ // Process tracks
285
+ this.processTracks();
286
+ // Check markers
287
+ this.processMarkers();
288
+ }
289
+ processTracks() {
290
+ for (const track of this.definition.tracks) {
291
+ if (track.muted)
292
+ continue;
293
+ this.processTrack(track);
294
+ }
295
+ }
296
+ processTrack(track) {
297
+ let activeSet = this.activeClips.get(track.id);
298
+ if (!activeSet) {
299
+ activeSet = new Set();
300
+ this.activeClips.set(track.id, activeSet);
301
+ }
302
+ for (const clip of track.clips) {
303
+ if (clip.muted)
304
+ continue;
305
+ const clipEnd = clip.startTime + clip.duration;
306
+ const wasActive = activeSet.has(clip.id);
307
+ const isActive = this.currentTime >= clip.startTime && this.currentTime < clipEnd;
308
+ // Clip enter
309
+ if (isActive && !wasActive) {
310
+ activeSet.add(clip.id);
311
+ this.onClipEnter(track, clip);
312
+ }
313
+ // Clip exit
314
+ if (!isActive && wasActive) {
315
+ activeSet.delete(clip.id);
316
+ this.onClipExit(track, clip);
317
+ }
318
+ // Clip update
319
+ if (isActive) {
320
+ const localTime = (this.currentTime - clip.startTime) * (clip.speed || 1);
321
+ this.updateClip(track, clip, localTime);
322
+ }
323
+ }
324
+ }
325
+ onClipEnter(track, clip) {
326
+ this.emit('clip-enter', { track, clip });
327
+ // Handle audio clips
328
+ if (clip.type === 'audio') {
329
+ this.playAudioClip(clip);
330
+ }
331
+ }
332
+ onClipExit(track, clip) {
333
+ this.emit('clip-exit', { track, clip });
334
+ // Handle event clips with on-exit fire mode
335
+ if (clip.type === 'event' && clip.fireMode === 'on-exit') {
336
+ this.fireEventClip(clip);
337
+ }
338
+ // Stop audio
339
+ if (clip.type === 'audio') {
340
+ this.stopAudioClip(clip.id);
341
+ }
342
+ }
343
+ updateClip(track, clip, localTime) {
344
+ switch (clip.type) {
345
+ case 'animation':
346
+ this.updateAnimationClip(clip, localTime);
347
+ break;
348
+ case 'property':
349
+ this.updatePropertyClip(clip, localTime);
350
+ break;
351
+ case 'event':
352
+ this.updateEventClip(clip, localTime);
353
+ break;
354
+ case 'transform':
355
+ this.updateTransformClip(clip, localTime);
356
+ break;
357
+ case 'camera':
358
+ this.updateCameraClip(clip, localTime);
359
+ break;
360
+ case 'audio':
361
+ this.updateAudioClip(clip, localTime);
362
+ break;
363
+ }
364
+ }
365
+ updateAnimationClip(clip, localTime) {
366
+ for (const curve of clip.curves) {
367
+ const value = evaluateCurve(curve, localTime);
368
+ this.applyProperty(curve.property, value);
369
+ }
370
+ }
371
+ updatePropertyClip(clip, localTime) {
372
+ for (const curve of clip.curves) {
373
+ const value = evaluateCurve(curve, localTime);
374
+ this.applyProperty(clip.propertyPath + '.' + curve.property, value);
375
+ }
376
+ }
377
+ updateEventClip(clip, localTime) {
378
+ if (clip.fireMode === 'every-frame') {
379
+ this.fireEventClip(clip);
380
+ }
381
+ else if (clip.fireMode === 'once' && localTime < 0.016) {
382
+ // Fire once at the start (within one frame)
383
+ this.fireEventClip(clip);
384
+ }
385
+ }
386
+ updateTransformClip(clip, localTime) {
387
+ if (clip.positionCurve) {
388
+ const x = evaluateCurve(clip.positionCurve.x, localTime);
389
+ const y = evaluateCurve(clip.positionCurve.y, localTime);
390
+ const z = evaluateCurve(clip.positionCurve.z, localTime);
391
+ this.applyProperty(`${clip.trackId}.position`, { x, y, z });
392
+ }
393
+ if (clip.rotationCurve) {
394
+ const x = evaluateCurve(clip.rotationCurve.x, localTime);
395
+ const y = evaluateCurve(clip.rotationCurve.y, localTime);
396
+ const z = evaluateCurve(clip.rotationCurve.z, localTime);
397
+ this.applyProperty(`${clip.trackId}.rotation`, { x, y, z });
398
+ }
399
+ if (clip.scaleCurve) {
400
+ const x = evaluateCurve(clip.scaleCurve.x, localTime);
401
+ const y = evaluateCurve(clip.scaleCurve.y, localTime);
402
+ const z = evaluateCurve(clip.scaleCurve.z, localTime);
403
+ this.applyProperty(`${clip.trackId}.scale`, { x, y, z });
404
+ }
405
+ }
406
+ updateCameraClip(clip, localTime) {
407
+ if (clip.fieldOfView) {
408
+ const fov = evaluateCurve(clip.fieldOfView, localTime);
409
+ this.applyProperty(`${clip.trackId}.fov`, fov);
410
+ }
411
+ if (clip.dof) {
412
+ const focusDistance = evaluateCurve(clip.dof.focusDistance, localTime);
413
+ const aperture = evaluateCurve(clip.dof.aperture, localTime);
414
+ const focalLength = evaluateCurve(clip.dof.focalLength, localTime);
415
+ this.applyProperty(`${clip.trackId}.dof`, { focusDistance, aperture, focalLength });
416
+ }
417
+ if (clip.shake) {
418
+ const amplitude = evaluateCurve(clip.shake.amplitude, localTime);
419
+ const frequency = evaluateCurve(clip.shake.frequency, localTime);
420
+ this.applyProperty(`${clip.trackId}.shake`, { amplitude, frequency });
421
+ }
422
+ }
423
+ updateAudioClip(clip, localTime) {
424
+ if (clip.volumeCurve) {
425
+ evaluateCurve(clip.volumeCurve, localTime);
426
+ // Apply volume to audio node
427
+ this.audioNodes.get(clip.id);
428
+ // Volume adjustment would go here
429
+ }
430
+ }
431
+ fireEventClip(clip) {
432
+ this.emit('event', {
433
+ eventName: clip.eventName,
434
+ payload: clip.payload,
435
+ });
436
+ }
437
+ // ─── Audio ───────────────────────────────────────
438
+ playAudioClip(clip) {
439
+ // Audio playback would be implemented with Web Audio API
440
+ // This is a placeholder for the interface
441
+ }
442
+ stopAudioClip(clipId) {
443
+ const node = this.audioNodes.get(clipId);
444
+ if (node) {
445
+ node.stop();
446
+ this.audioNodes.delete(clipId);
447
+ }
448
+ }
449
+ stopAllAudio() {
450
+ for (const node of this.audioNodes.values()) {
451
+ node.stop();
452
+ }
453
+ this.audioNodes.clear();
454
+ }
455
+ // ─── Markers ─────────────────────────────────────
456
+ processMarkers() {
457
+ for (const marker of this.definition.markers) {
458
+ // Check if we crossed the marker
459
+ const crossedForward = this.previousTime < marker.time && this.currentTime >= marker.time;
460
+ const crossedBackward = this.previousTime > marker.time && this.currentTime <= marker.time;
461
+ if (crossedForward || crossedBackward) {
462
+ this.emit('marker', { marker });
463
+ if (marker.type === 'signal' && marker.signalName) {
464
+ this.emit('signal', {
465
+ signalName: marker.signalName,
466
+ payload: marker.signalPayload,
467
+ });
468
+ }
469
+ if (marker.type === 'jump' && marker.jumpTarget) {
470
+ const targetMarker = this.definition.markers.find((m) => m.name === marker.jumpTarget);
471
+ if (targetMarker) {
472
+ // Check condition if present
473
+ if (!marker.jumpCondition || this.evaluateCondition(marker.jumpCondition)) {
474
+ this.seek(targetMarker.time);
475
+ }
476
+ }
477
+ }
478
+ }
479
+ }
480
+ }
481
+ evaluateCondition(condition) {
482
+ // Simple condition evaluation - could be extended
483
+ return true;
484
+ }
485
+ // ─── Property Binding ────────────────────────────
486
+ bindProperty(path, setter) {
487
+ this.propertyBindings.set(path, setter);
488
+ }
489
+ unbindProperty(path) {
490
+ this.propertyBindings.delete(path);
491
+ }
492
+ applyProperty(path, value) {
493
+ const binding = this.propertyBindings.get(path);
494
+ if (binding) {
495
+ binding(value);
496
+ }
497
+ }
498
+ // ─── Events ──────────────────────────────────────
499
+ on(event, listener) {
500
+ let listeners = this.listeners.get(event);
501
+ if (!listeners) {
502
+ listeners = [];
503
+ this.listeners.set(event, listeners);
504
+ }
505
+ listeners.push(listener);
506
+ }
507
+ off(event, listener) {
508
+ const listeners = this.listeners.get(event);
509
+ if (listeners) {
510
+ const idx = listeners.indexOf(listener);
511
+ if (idx >= 0) {
512
+ listeners.splice(idx, 1);
513
+ }
514
+ }
515
+ }
516
+ emit(type, data) {
517
+ const event = {
518
+ type,
519
+ time: this.currentTime,
520
+ data,
521
+ };
522
+ if (this.debugMode) {
523
+ this.history.push(event);
524
+ if (this.history.length > 100) {
525
+ this.history.shift();
526
+ }
527
+ }
528
+ const listeners = this.listeners.get(type);
529
+ if (listeners) {
530
+ for (const listener of listeners) {
531
+ listener(event);
532
+ }
533
+ }
534
+ }
535
+ // ─── State Queries ───────────────────────────────
536
+ getState() {
537
+ return this.state;
538
+ }
539
+ getCurrentTime() {
540
+ return this.currentTime;
541
+ }
542
+ getDuration() {
543
+ return this.definition.duration;
544
+ }
545
+ getProgress() {
546
+ return this.definition.duration > 0 ? this.currentTime / this.definition.duration : 0;
547
+ }
548
+ isPlaying() {
549
+ return this.state === 'playing';
550
+ }
551
+ isPaused() {
552
+ return this.state === 'paused';
553
+ }
554
+ isStopped() {
555
+ return this.state === 'stopped';
556
+ }
557
+ getDefinition() {
558
+ return this.definition;
559
+ }
560
+ // ─── Debugging ───────────────────────────────────
561
+ getHistory() {
562
+ return [...this.history];
563
+ }
564
+ clearHistory() {
565
+ this.history = [];
566
+ }
567
+ getDebugInfo() {
568
+ let activeClipCount = 0;
569
+ for (const set of this.activeClips.values()) {
570
+ activeClipCount += set.size;
571
+ }
572
+ return {
573
+ state: this.state,
574
+ time: this.currentTime,
575
+ duration: this.definition.duration,
576
+ progress: this.getProgress(),
577
+ speed: this.speed,
578
+ activeClipCount,
579
+ };
580
+ }
581
+ }
582
+ class TimelineRecorder {
583
+ constructor(player, options) {
584
+ this.recording = false;
585
+ this.recordedKeyframes = new Map();
586
+ this.lastSampleTime = 0;
587
+ this.player = player;
588
+ this.options = options;
589
+ }
590
+ startRecording() {
591
+ this.recording = true;
592
+ this.recordedKeyframes.clear();
593
+ this.lastSampleTime = 0;
594
+ }
595
+ stopRecording() {
596
+ this.recording = false;
597
+ return new Map(this.recordedKeyframes);
598
+ }
599
+ isRecording() {
600
+ return this.recording;
601
+ }
602
+ recordValue(property, value) {
603
+ if (!this.recording)
604
+ return;
605
+ const time = this.player.getCurrentTime();
606
+ const sampleRate = this.options.sampleRate || 30;
607
+ const minInterval = 1 / sampleRate;
608
+ // Check if enough time has passed
609
+ if (time - this.lastSampleTime < minInterval)
610
+ return;
611
+ let keyframes = this.recordedKeyframes.get(property);
612
+ if (!keyframes) {
613
+ keyframes = [];
614
+ this.recordedKeyframes.set(property, keyframes);
615
+ }
616
+ keyframes.push({
617
+ id: `key_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
618
+ time,
619
+ value,
620
+ easing: 'linear',
621
+ });
622
+ this.lastSampleTime = time;
623
+ }
624
+ getRecordedKeyframes() {
625
+ return new Map(this.recordedKeyframes);
626
+ }
627
+ }
628
+ // ============================================================
629
+ // Factory Functions
630
+ // ============================================================
631
+ function createTimelineDefinition(name, duration = 10) {
632
+ return {
633
+ id: `timeline_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
634
+ name,
635
+ description: '',
636
+ duration,
637
+ fps: 60,
638
+ wrapMode: 'once',
639
+ tracks: [],
640
+ markers: [],
641
+ };
642
+ }
643
+ function createTimelinePlayer(definition) {
644
+ return new TimelinePlayer(definition);
645
+ }
646
+ function createTimelineRecorder(player, options) {
647
+ return new TimelineRecorder(player, options);
648
+ }
649
+ function createTrack(name, type) {
650
+ const baseTrack = {
651
+ id: `track_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
652
+ name,
653
+ type,
654
+ muted: false,
655
+ locked: false,
656
+ collapsed: false,
657
+ clips: [],
658
+ };
659
+ switch (type) {
660
+ case 'animation':
661
+ return { ...baseTrack, type: 'animation' };
662
+ case 'audio':
663
+ return { ...baseTrack, type: 'audio', volume: 1 };
664
+ case 'event':
665
+ return { ...baseTrack, type: 'event' };
666
+ case 'property':
667
+ return {
668
+ ...baseTrack,
669
+ type: 'property',
670
+ targetEntity: '',
671
+ propertyPath: '',
672
+ };
673
+ case 'activation':
674
+ return {
675
+ ...baseTrack,
676
+ type: 'activation',
677
+ targetEntity: '',
678
+ };
679
+ case 'transform':
680
+ return {
681
+ ...baseTrack,
682
+ type: 'transform',
683
+ targetEntity: '',
684
+ space: 'local',
685
+ };
686
+ case 'camera':
687
+ return {
688
+ ...baseTrack,
689
+ type: 'camera',
690
+ cameraEntity: '',
691
+ };
692
+ case 'group':
693
+ return { ...baseTrack, type: 'group', children: [] };
694
+ default:
695
+ return baseTrack;
696
+ }
697
+ }
698
+ function createAnimationClip(trackId, startTime, duration) {
699
+ return {
700
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
701
+ name: 'Animation Clip',
702
+ type: 'animation',
703
+ trackId,
704
+ startTime,
705
+ duration,
706
+ curves: [],
707
+ };
708
+ }
709
+ function createAudioClip(trackId, startTime, duration, audioSource) {
710
+ return {
711
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
712
+ name: 'Audio Clip',
713
+ type: 'audio',
714
+ trackId,
715
+ startTime,
716
+ duration,
717
+ audioSource,
718
+ volume: 1,
719
+ };
720
+ }
721
+ function createEventClip(trackId, time, eventName) {
722
+ return {
723
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
724
+ name: eventName,
725
+ type: 'event',
726
+ trackId,
727
+ startTime: time,
728
+ duration: 0.01, // Instant
729
+ eventName,
730
+ fireMode: 'once',
731
+ };
732
+ }
733
+ function createPropertyClip(trackId, startTime, duration, propertyPath) {
734
+ return {
735
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
736
+ name: 'Property Clip',
737
+ type: 'property',
738
+ trackId,
739
+ startTime,
740
+ duration,
741
+ propertyPath,
742
+ curves: [],
743
+ };
744
+ }
745
+ function createTransformClip(trackId, startTime, duration) {
746
+ return {
747
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
748
+ name: 'Transform Clip',
749
+ type: 'transform',
750
+ trackId,
751
+ startTime,
752
+ duration,
753
+ };
754
+ }
755
+ function createCameraClip(trackId, startTime, duration) {
756
+ return {
757
+ id: `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
758
+ name: 'Camera Clip',
759
+ type: 'camera',
760
+ trackId,
761
+ startTime,
762
+ duration,
763
+ };
764
+ }
765
+ function createAnimationCurve(property) {
766
+ return {
767
+ id: `curve_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
768
+ property,
769
+ keyframes: [],
770
+ };
771
+ }
772
+ function createKeyframe(time, value, easing = 'linear') {
773
+ return {
774
+ id: `key_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
775
+ time,
776
+ value,
777
+ easing,
778
+ };
779
+ }
780
+ function createMarker(name, time) {
781
+ return {
782
+ id: `marker_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
783
+ name,
784
+ time,
785
+ type: 'marker',
786
+ };
787
+ }
788
+ function createSignalMarker(name, time, signalName, payload) {
789
+ return {
790
+ id: `marker_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
791
+ name,
792
+ time,
793
+ type: 'signal',
794
+ signalName,
795
+ signalPayload: payload,
796
+ };
797
+ }
798
+
799
+ export { TimelinePlayer, TimelineRecorder, applyEasing, createAnimationClip, createAnimationCurve, createAudioClip, createCameraClip, createEventClip, createKeyframe, createMarker, createPropertyClip, createSignalMarker, createTimelineDefinition, createTimelinePlayer, createTimelineRecorder, createTrack, createTransformClip, evaluateCurve };
800
+ //# sourceMappingURL=TimelineEditor.js.map