safex-webgl 1.0.0

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 (910) hide show
  1. package/.prettierrc +6 -0
  2. package/@types/index.d.ts +36 -0
  3. package/README.md +152 -0
  4. package/bun.lock +353 -0
  5. package/dist/actions/Action.d.ts +27 -0
  6. package/dist/actions/Action.d.ts.map +1 -0
  7. package/dist/actions/Action.js +62 -0
  8. package/dist/actions/Action.js.map +1 -0
  9. package/dist/actions/ActionBezier.d.ts +121 -0
  10. package/dist/actions/ActionBezier.d.ts.map +1 -0
  11. package/dist/actions/ActionBezier.js +221 -0
  12. package/dist/actions/ActionBezier.js.map +1 -0
  13. package/dist/actions/ActionBlink.d.ts +62 -0
  14. package/dist/actions/ActionBlink.d.ts.map +1 -0
  15. package/dist/actions/ActionBlink.js +96 -0
  16. package/dist/actions/ActionBlink.js.map +1 -0
  17. package/dist/actions/ActionCatmullRom.d.ts +242 -0
  18. package/dist/actions/ActionCatmullRom.d.ts.map +1 -0
  19. package/dist/actions/ActionCatmullRom.js +436 -0
  20. package/dist/actions/ActionCatmullRom.js.map +1 -0
  21. package/dist/actions/ActionFade.d.ts +126 -0
  22. package/dist/actions/ActionFade.d.ts.map +1 -0
  23. package/dist/actions/ActionFade.js +190 -0
  24. package/dist/actions/ActionFade.js.map +1 -0
  25. package/dist/actions/ActionInstant.d.ts +237 -0
  26. package/dist/actions/ActionInstant.d.ts.map +1 -0
  27. package/dist/actions/ActionInstant.js +386 -0
  28. package/dist/actions/ActionInstant.js.map +1 -0
  29. package/dist/actions/ActionInterval.d.ts +132 -0
  30. package/dist/actions/ActionInterval.d.ts.map +1 -0
  31. package/dist/actions/ActionInterval.js +254 -0
  32. package/dist/actions/ActionInterval.js.map +1 -0
  33. package/dist/actions/ActionJump.d.ts +146 -0
  34. package/dist/actions/ActionJump.d.ts.map +1 -0
  35. package/dist/actions/ActionJump.js +239 -0
  36. package/dist/actions/ActionJump.js.map +1 -0
  37. package/dist/actions/ActionMove.d.ts +73 -0
  38. package/dist/actions/ActionMove.d.ts.map +1 -0
  39. package/dist/actions/ActionMove.js +164 -0
  40. package/dist/actions/ActionMove.js.map +1 -0
  41. package/dist/actions/ActionRotate.d.ts +137 -0
  42. package/dist/actions/ActionRotate.d.ts.map +1 -0
  43. package/dist/actions/ActionRotate.js +214 -0
  44. package/dist/actions/ActionRotate.js.map +1 -0
  45. package/dist/actions/ActionScale.d.ts +110 -0
  46. package/dist/actions/ActionScale.d.ts.map +1 -0
  47. package/dist/actions/ActionScale.js +157 -0
  48. package/dist/actions/ActionScale.js.map +1 -0
  49. package/dist/actions/ActionSkew.d.ts +120 -0
  50. package/dist/actions/ActionSkew.d.ts.map +1 -0
  51. package/dist/actions/ActionSkew.js +185 -0
  52. package/dist/actions/ActionSkew.js.map +1 -0
  53. package/dist/actions/ActionTint.d.ts +132 -0
  54. package/dist/actions/ActionTint.d.ts.map +1 -0
  55. package/dist/actions/ActionTint.js +193 -0
  56. package/dist/actions/ActionTint.js.map +1 -0
  57. package/dist/actions/Animate.d.ts +77 -0
  58. package/dist/actions/Animate.d.ts.map +1 -0
  59. package/dist/actions/Animate.js +177 -0
  60. package/dist/actions/Animate.js.map +1 -0
  61. package/dist/actions/DelayTime.d.ts +95 -0
  62. package/dist/actions/DelayTime.d.ts.map +1 -0
  63. package/dist/actions/DelayTime.js +145 -0
  64. package/dist/actions/DelayTime.js.map +1 -0
  65. package/dist/actions/FiniteTimeAction.d.ts +11 -0
  66. package/dist/actions/FiniteTimeAction.d.ts.map +1 -0
  67. package/dist/actions/FiniteTimeAction.js +24 -0
  68. package/dist/actions/FiniteTimeAction.js.map +1 -0
  69. package/dist/actions/Follow.d.ts +23 -0
  70. package/dist/actions/Follow.d.ts.map +1 -0
  71. package/dist/actions/Follow.js +98 -0
  72. package/dist/actions/Follow.js.map +1 -0
  73. package/dist/actions/Repeat.d.ts +151 -0
  74. package/dist/actions/Repeat.d.ts.map +1 -0
  75. package/dist/actions/Repeat.js +276 -0
  76. package/dist/actions/Repeat.js.map +1 -0
  77. package/dist/actions/Sequence.d.ts +77 -0
  78. package/dist/actions/Sequence.d.ts.map +1 -0
  79. package/dist/actions/Sequence.js +190 -0
  80. package/dist/actions/Sequence.js.map +1 -0
  81. package/dist/actions/Spawn.d.ts +63 -0
  82. package/dist/actions/Spawn.d.ts.map +1 -0
  83. package/dist/actions/Spawn.js +146 -0
  84. package/dist/actions/Spawn.js.map +1 -0
  85. package/dist/actions/Speed.d.ts +19 -0
  86. package/dist/actions/Speed.d.ts.map +1 -0
  87. package/dist/actions/Speed.js +57 -0
  88. package/dist/actions/Speed.js.map +1 -0
  89. package/dist/actions/TargetedAction.d.ts +67 -0
  90. package/dist/actions/TargetedAction.d.ts.map +1 -0
  91. package/dist/actions/TargetedAction.js +99 -0
  92. package/dist/actions/TargetedAction.js.map +1 -0
  93. package/dist/actions/easing/ActionEase.d.ts +133 -0
  94. package/dist/actions/easing/ActionEase.d.ts.map +1 -0
  95. package/dist/actions/easing/ActionEase.js +184 -0
  96. package/dist/actions/easing/ActionEase.js.map +1 -0
  97. package/dist/actions/easing/Back.d.ts +174 -0
  98. package/dist/actions/easing/Back.d.ts.map +1 -0
  99. package/dist/actions/easing/Back.js +227 -0
  100. package/dist/actions/easing/Back.js.map +1 -0
  101. package/dist/actions/easing/Bezier.d.ts +94 -0
  102. package/dist/actions/easing/Bezier.d.ts.map +1 -0
  103. package/dist/actions/easing/Bezier.js +124 -0
  104. package/dist/actions/easing/Bezier.js.map +1 -0
  105. package/dist/actions/easing/Bounce.d.ts +203 -0
  106. package/dist/actions/easing/Bounce.d.ts.map +1 -0
  107. package/dist/actions/easing/Bounce.js +288 -0
  108. package/dist/actions/easing/Bounce.js.map +1 -0
  109. package/dist/actions/easing/Circle.d.ts +177 -0
  110. package/dist/actions/easing/Circle.d.ts.map +1 -0
  111. package/dist/actions/easing/Circle.js +220 -0
  112. package/dist/actions/easing/Circle.js.map +1 -0
  113. package/dist/actions/easing/Cubic.d.ts +165 -0
  114. package/dist/actions/easing/Cubic.d.ts.map +1 -0
  115. package/dist/actions/easing/Cubic.js +209 -0
  116. package/dist/actions/easing/Cubic.js.map +1 -0
  117. package/dist/actions/easing/Elastic.d.ts +269 -0
  118. package/dist/actions/easing/Elastic.d.ts.map +1 -0
  119. package/dist/actions/easing/Elastic.js +358 -0
  120. package/dist/actions/easing/Elastic.js.map +1 -0
  121. package/dist/actions/easing/Exponential.d.ts +181 -0
  122. package/dist/actions/easing/Exponential.d.ts.map +1 -0
  123. package/dist/actions/easing/Exponential.js +214 -0
  124. package/dist/actions/easing/Exponential.js.map +1 -0
  125. package/dist/actions/easing/InOut.d.ts +191 -0
  126. package/dist/actions/easing/InOut.d.ts.map +1 -0
  127. package/dist/actions/easing/InOut.js +254 -0
  128. package/dist/actions/easing/InOut.js.map +1 -0
  129. package/dist/actions/easing/Quartic.d.ts +232 -0
  130. package/dist/actions/easing/Quartic.d.ts.map +1 -0
  131. package/dist/actions/easing/Quartic.js +313 -0
  132. package/dist/actions/easing/Quartic.js.map +1 -0
  133. package/dist/actions/easing/Quintic.d.ts +168 -0
  134. package/dist/actions/easing/Quintic.d.ts.map +1 -0
  135. package/dist/actions/easing/Quintic.js +212 -0
  136. package/dist/actions/easing/Quintic.js.map +1 -0
  137. package/dist/actions/easing/Sine.d.ts +176 -0
  138. package/dist/actions/easing/Sine.d.ts.map +1 -0
  139. package/dist/actions/easing/Sine.js +206 -0
  140. package/dist/actions/easing/Sine.js.map +1 -0
  141. package/dist/actions/index.d.ts +16 -0
  142. package/dist/actions/index.d.ts.map +1 -0
  143. package/dist/actions/index.js +16 -0
  144. package/dist/actions/index.js.map +1 -0
  145. package/dist/audio/Audio.d.ts +47 -0
  146. package/dist/audio/Audio.d.ts.map +1 -0
  147. package/dist/audio/Audio.js +255 -0
  148. package/dist/audio/Audio.js.map +1 -0
  149. package/dist/audio/engine.d.ts +171 -0
  150. package/dist/audio/engine.d.ts.map +1 -0
  151. package/dist/audio/engine.js +556 -0
  152. package/dist/audio/engine.js.map +1 -0
  153. package/dist/audio/index.d.ts +3 -0
  154. package/dist/audio/index.d.ts.map +1 -0
  155. package/dist/audio/index.js +3 -0
  156. package/dist/audio/index.js.map +1 -0
  157. package/dist/boot.d.ts +80 -0
  158. package/dist/boot.d.ts.map +1 -0
  159. package/dist/boot.js +468 -0
  160. package/dist/boot.js.map +1 -0
  161. package/dist/clipping-nodes/ClippingNode.d.ts +114 -0
  162. package/dist/clipping-nodes/ClippingNode.d.ts.map +1 -0
  163. package/dist/clipping-nodes/ClippingNode.js +177 -0
  164. package/dist/clipping-nodes/ClippingNode.js.map +1 -0
  165. package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.d.ts +25 -0
  166. package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.d.ts.map +1 -0
  167. package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.js +157 -0
  168. package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.js.map +1 -0
  169. package/dist/core/ActionManager.d.ts +56 -0
  170. package/dist/core/ActionManager.d.ts.map +1 -0
  171. package/dist/core/ActionManager.js +253 -0
  172. package/dist/core/ActionManager.js.map +1 -0
  173. package/dist/core/Configuration.d.ts +108 -0
  174. package/dist/core/Configuration.d.ts.map +1 -0
  175. package/dist/core/Configuration.js +232 -0
  176. package/dist/core/Configuration.js.map +1 -0
  177. package/dist/core/Director.d.ts +130 -0
  178. package/dist/core/Director.d.ts.map +1 -0
  179. package/dist/core/Director.js +580 -0
  180. package/dist/core/Director.js.map +1 -0
  181. package/dist/core/DrawingPrimitivesWebGL.d.ts +32 -0
  182. package/dist/core/DrawingPrimitivesWebGL.d.ts.map +1 -0
  183. package/dist/core/DrawingPrimitivesWebGL.js +273 -0
  184. package/dist/core/DrawingPrimitivesWebGL.js.map +1 -0
  185. package/dist/core/Scheduler.d.ts +110 -0
  186. package/dist/core/Scheduler.d.ts.map +1 -0
  187. package/dist/core/Scheduler.js +687 -0
  188. package/dist/core/Scheduler.js.map +1 -0
  189. package/dist/core/base-nodes/BaseNodesPropertyDefine.d.ts +2 -0
  190. package/dist/core/base-nodes/BaseNodesPropertyDefine.d.ts.map +1 -0
  191. package/dist/core/base-nodes/BaseNodesPropertyDefine.js +37 -0
  192. package/dist/core/base-nodes/BaseNodesPropertyDefine.js.map +1 -0
  193. package/dist/core/base-nodes/CustomRenderCmd.d.ts +9 -0
  194. package/dist/core/base-nodes/CustomRenderCmd.d.ts.map +1 -0
  195. package/dist/core/base-nodes/CustomRenderCmd.js +16 -0
  196. package/dist/core/base-nodes/CustomRenderCmd.js.map +1 -0
  197. package/dist/core/base-nodes/Node.d.ts +285 -0
  198. package/dist/core/base-nodes/Node.d.ts.map +1 -0
  199. package/dist/core/base-nodes/Node.js +1112 -0
  200. package/dist/core/base-nodes/Node.js.map +1 -0
  201. package/dist/core/base-nodes/NodeRenderCmd.d.ts +65 -0
  202. package/dist/core/base-nodes/NodeRenderCmd.d.ts.map +1 -0
  203. package/dist/core/base-nodes/NodeRenderCmd.js +460 -0
  204. package/dist/core/base-nodes/NodeRenderCmd.js.map +1 -0
  205. package/dist/core/base-nodes/NodeWebGLRenderCmd.d.ts +17 -0
  206. package/dist/core/base-nodes/NodeWebGLRenderCmd.d.ts.map +1 -0
  207. package/dist/core/base-nodes/NodeWebGLRenderCmd.js +29 -0
  208. package/dist/core/base-nodes/NodeWebGLRenderCmd.js.map +1 -0
  209. package/dist/core/cocoa/AffineTransform.d.ts +201 -0
  210. package/dist/core/cocoa/AffineTransform.d.ts.map +1 -0
  211. package/dist/core/cocoa/AffineTransform.js +260 -0
  212. package/dist/core/cocoa/AffineTransform.js.map +1 -0
  213. package/dist/core/cocoa/Geometry.d.ts +176 -0
  214. package/dist/core/cocoa/Geometry.d.ts.map +1 -0
  215. package/dist/core/cocoa/Geometry.js +237 -0
  216. package/dist/core/cocoa/Geometry.js.map +1 -0
  217. package/dist/core/event-manager/Event.d.ts +57 -0
  218. package/dist/core/event-manager/Event.d.ts.map +1 -0
  219. package/dist/core/event-manager/Event.js +69 -0
  220. package/dist/core/event-manager/Event.js.map +1 -0
  221. package/dist/core/event-manager/EventCustom.d.ts +22 -0
  222. package/dist/core/event-manager/EventCustom.d.ts.map +1 -0
  223. package/dist/core/event-manager/EventCustom.js +31 -0
  224. package/dist/core/event-manager/EventCustom.js.map +1 -0
  225. package/dist/core/event-manager/EventExtension.d.ts +33 -0
  226. package/dist/core/event-manager/EventExtension.d.ts.map +1 -0
  227. package/dist/core/event-manager/EventExtension.js +80 -0
  228. package/dist/core/event-manager/EventExtension.js.map +1 -0
  229. package/dist/core/event-manager/EventFocus.d.ts +17 -0
  230. package/dist/core/event-manager/EventFocus.d.ts.map +1 -0
  231. package/dist/core/event-manager/EventFocus.js +21 -0
  232. package/dist/core/event-manager/EventFocus.js.map +1 -0
  233. package/dist/core/event-manager/EventHelper.d.ts +8 -0
  234. package/dist/core/event-manager/EventHelper.d.ts.map +1 -0
  235. package/dist/core/event-manager/EventHelper.js +92 -0
  236. package/dist/core/event-manager/EventHelper.js.map +1 -0
  237. package/dist/core/event-manager/EventListener.d.ts +53 -0
  238. package/dist/core/event-manager/EventListener.d.ts.map +1 -0
  239. package/dist/core/event-manager/EventListener.js +95 -0
  240. package/dist/core/event-manager/EventListener.js.map +1 -0
  241. package/dist/core/event-manager/EventListenerCustom.d.ts +11 -0
  242. package/dist/core/event-manager/EventListenerCustom.d.ts.map +1 -0
  243. package/dist/core/event-manager/EventListenerCustom.js +37 -0
  244. package/dist/core/event-manager/EventListenerCustom.js.map +1 -0
  245. package/dist/core/event-manager/EventListenerFocus.d.ts +10 -0
  246. package/dist/core/event-manager/EventListenerFocus.d.ts.map +1 -0
  247. package/dist/core/event-manager/EventListenerFocus.js +28 -0
  248. package/dist/core/event-manager/EventListenerFocus.js.map +1 -0
  249. package/dist/core/event-manager/EventListenerMouse.d.ts +13 -0
  250. package/dist/core/event-manager/EventListenerMouse.d.ts.map +1 -0
  251. package/dist/core/event-manager/EventListenerMouse.js +49 -0
  252. package/dist/core/event-manager/EventListenerMouse.js.map +1 -0
  253. package/dist/core/event-manager/EventListenerTouchAllAtOnce.d.ts +12 -0
  254. package/dist/core/event-manager/EventListenerTouchAllAtOnce.d.ts.map +1 -0
  255. package/dist/core/event-manager/EventListenerTouchAllAtOnce.js +28 -0
  256. package/dist/core/event-manager/EventListenerTouchAllAtOnce.js.map +1 -0
  257. package/dist/core/event-manager/EventListenerTouchOneByOne.d.ts +16 -0
  258. package/dist/core/event-manager/EventListenerTouchOneByOne.d.ts.map +1 -0
  259. package/dist/core/event-manager/EventListenerTouchOneByOne.js +38 -0
  260. package/dist/core/event-manager/EventListenerTouchOneByOne.js.map +1 -0
  261. package/dist/core/event-manager/EventListenerVector.d.ts +15 -0
  262. package/dist/core/event-manager/EventListenerVector.d.ts.map +1 -0
  263. package/dist/core/event-manager/EventListenerVector.js +38 -0
  264. package/dist/core/event-manager/EventListenerVector.js.map +1 -0
  265. package/dist/core/event-manager/EventManager.d.ts +140 -0
  266. package/dist/core/event-manager/EventManager.d.ts.map +1 -0
  267. package/dist/core/event-manager/EventManager.js +907 -0
  268. package/dist/core/event-manager/EventManager.js.map +1 -0
  269. package/dist/core/event-manager/EventMouse.d.ts +173 -0
  270. package/dist/core/event-manager/EventMouse.d.ts.map +1 -0
  271. package/dist/core/event-manager/EventMouse.js +200 -0
  272. package/dist/core/event-manager/EventMouse.js.map +1 -0
  273. package/dist/core/event-manager/EventTouch.d.ts +24 -0
  274. package/dist/core/event-manager/EventTouch.d.ts.map +1 -0
  275. package/dist/core/event-manager/EventTouch.js +33 -0
  276. package/dist/core/event-manager/EventTouch.js.map +1 -0
  277. package/dist/core/event-manager/Touch.d.ts +60 -0
  278. package/dist/core/event-manager/Touch.d.ts.map +1 -0
  279. package/dist/core/event-manager/Touch.js +94 -0
  280. package/dist/core/event-manager/Touch.js.map +1 -0
  281. package/dist/core/event-manager/index.d.ts +6 -0
  282. package/dist/core/event-manager/index.d.ts.map +1 -0
  283. package/dist/core/event-manager/index.js +6 -0
  284. package/dist/core/event-manager/index.js.map +1 -0
  285. package/dist/core/index.d.ts +16 -0
  286. package/dist/core/index.d.ts.map +1 -0
  287. package/dist/core/index.js +16 -0
  288. package/dist/core/index.js.map +1 -0
  289. package/dist/core/kazmath/gl/mat4stack.d.ts +5 -0
  290. package/dist/core/kazmath/gl/mat4stack.d.ts.map +1 -0
  291. package/dist/core/kazmath/gl/mat4stack.js +53 -0
  292. package/dist/core/kazmath/gl/mat4stack.js.map +1 -0
  293. package/dist/core/kazmath/gl/matrix.d.ts +21 -0
  294. package/dist/core/kazmath/gl/matrix.d.ts.map +1 -0
  295. package/dist/core/kazmath/gl/matrix.js +121 -0
  296. package/dist/core/kazmath/gl/matrix.js.map +1 -0
  297. package/dist/core/kazmath/index.d.ts +7 -0
  298. package/dist/core/kazmath/index.d.ts.map +1 -0
  299. package/dist/core/kazmath/index.js +7 -0
  300. package/dist/core/kazmath/index.js.map +1 -0
  301. package/dist/core/kazmath/mat3.d.ts +45 -0
  302. package/dist/core/kazmath/mat3.d.ts.map +1 -0
  303. package/dist/core/kazmath/mat3.js +297 -0
  304. package/dist/core/kazmath/mat3.js.map +1 -0
  305. package/dist/core/kazmath/mat4.d.ts +175 -0
  306. package/dist/core/kazmath/mat4.d.ts.map +1 -0
  307. package/dist/core/kazmath/mat4.func.d.ts +44 -0
  308. package/dist/core/kazmath/mat4.func.d.ts.map +1 -0
  309. package/dist/core/kazmath/mat4.func.js +210 -0
  310. package/dist/core/kazmath/mat4.func.js.map +1 -0
  311. package/dist/core/kazmath/mat4.js +671 -0
  312. package/dist/core/kazmath/mat4.js.map +1 -0
  313. package/dist/core/kazmath/plane.d.ts +24 -0
  314. package/dist/core/kazmath/plane.d.ts.map +1 -0
  315. package/dist/core/kazmath/plane.js +96 -0
  316. package/dist/core/kazmath/plane.js.map +1 -0
  317. package/dist/core/kazmath/quaternion.d.ts +135 -0
  318. package/dist/core/kazmath/quaternion.d.ts.map +1 -0
  319. package/dist/core/kazmath/quaternion.js +407 -0
  320. package/dist/core/kazmath/quaternion.js.map +1 -0
  321. package/dist/core/kazmath/utility.d.ts +8 -0
  322. package/dist/core/kazmath/utility.d.ts.map +1 -0
  323. package/dist/core/kazmath/utility.js +14 -0
  324. package/dist/core/kazmath/utility.js.map +1 -0
  325. package/dist/core/kazmath/vec3.d.ts +26 -0
  326. package/dist/core/kazmath/vec3.d.ts.map +1 -0
  327. package/dist/core/kazmath/vec3.js +170 -0
  328. package/dist/core/kazmath/vec3.js.map +1 -0
  329. package/dist/core/kazmath/vec4.d.ts +22 -0
  330. package/dist/core/kazmath/vec4.d.ts.map +1 -0
  331. package/dist/core/kazmath/vec4.js +136 -0
  332. package/dist/core/kazmath/vec4.js.map +1 -0
  333. package/dist/core/labelttf/LabelTTF.d.ts +310 -0
  334. package/dist/core/labelttf/LabelTTF.d.ts.map +1 -0
  335. package/dist/core/labelttf/LabelTTF.js +818 -0
  336. package/dist/core/labelttf/LabelTTF.js.map +1 -0
  337. package/dist/core/labelttf/LabelTTFPropertyDefine.d.ts +2 -0
  338. package/dist/core/labelttf/LabelTTFPropertyDefine.d.ts.map +1 -0
  339. package/dist/core/labelttf/LabelTTFPropertyDefine.js +27 -0
  340. package/dist/core/labelttf/LabelTTFPropertyDefine.js.map +1 -0
  341. package/dist/core/labelttf/LabelTTFWebGLRenderCmd.d.ts +37 -0
  342. package/dist/core/labelttf/LabelTTFWebGLRenderCmd.d.ts.map +1 -0
  343. package/dist/core/labelttf/LabelTTFWebGLRenderCmd.js +367 -0
  344. package/dist/core/labelttf/LabelTTFWebGLRenderCmd.js.map +1 -0
  345. package/dist/core/layers/Layer.d.ts +35 -0
  346. package/dist/core/layers/Layer.d.ts.map +1 -0
  347. package/dist/core/layers/Layer.js +93 -0
  348. package/dist/core/layers/Layer.js.map +1 -0
  349. package/dist/core/layers/LayerColor.d.ts +61 -0
  350. package/dist/core/layers/LayerColor.d.ts.map +1 -0
  351. package/dist/core/layers/LayerColor.js +144 -0
  352. package/dist/core/layers/LayerColor.js.map +1 -0
  353. package/dist/core/layers/LayerGradient.d.ts +196 -0
  354. package/dist/core/layers/LayerGradient.d.ts.map +1 -0
  355. package/dist/core/layers/LayerGradient.js +482 -0
  356. package/dist/core/layers/LayerGradient.js.map +1 -0
  357. package/dist/core/layers/LayerMultiplex.d.ts +47 -0
  358. package/dist/core/layers/LayerMultiplex.d.ts.map +1 -0
  359. package/dist/core/layers/LayerMultiplex.js +87 -0
  360. package/dist/core/layers/LayerMultiplex.js.map +1 -0
  361. package/dist/core/layers/LayerWebGLRenderCmd.d.ts +26 -0
  362. package/dist/core/layers/LayerWebGLRenderCmd.d.ts.map +1 -0
  363. package/dist/core/layers/LayerWebGLRenderCmd.js +100 -0
  364. package/dist/core/layers/LayerWebGLRenderCmd.js.map +1 -0
  365. package/dist/core/layers/index.d.ts +5 -0
  366. package/dist/core/layers/index.d.ts.map +1 -0
  367. package/dist/core/layers/index.js +5 -0
  368. package/dist/core/layers/index.js.map +1 -0
  369. package/dist/core/platform/BlendFunc.d.ts +30 -0
  370. package/dist/core/platform/BlendFunc.d.ts.map +1 -0
  371. package/dist/core/platform/BlendFunc.js +50 -0
  372. package/dist/core/platform/BlendFunc.js.map +1 -0
  373. package/dist/core/platform/Color.d.ts +31 -0
  374. package/dist/core/platform/Color.d.ts.map +1 -0
  375. package/dist/core/platform/Color.js +71 -0
  376. package/dist/core/platform/Color.js.map +1 -0
  377. package/dist/core/platform/Common.d.ts +157 -0
  378. package/dist/core/platform/Common.d.ts.map +1 -0
  379. package/dist/core/platform/Common.js +180 -0
  380. package/dist/core/platform/Common.js.map +1 -0
  381. package/dist/core/platform/Config.d.ts +230 -0
  382. package/dist/core/platform/Config.d.ts.map +1 -0
  383. package/dist/core/platform/Config.js +231 -0
  384. package/dist/core/platform/Config.js.map +1 -0
  385. package/dist/core/platform/Dictionary.d.ts +16 -0
  386. package/dist/core/platform/Dictionary.d.ts.map +1 -0
  387. package/dist/core/platform/Dictionary.js +65 -0
  388. package/dist/core/platform/Dictionary.js.map +1 -0
  389. package/dist/core/platform/EGLView/ContainerStrategy.d.ts +30 -0
  390. package/dist/core/platform/EGLView/ContainerStrategy.d.ts.map +1 -0
  391. package/dist/core/platform/EGLView/ContainerStrategy.js +121 -0
  392. package/dist/core/platform/EGLView/ContainerStrategy.js.map +1 -0
  393. package/dist/core/platform/EGLView/ContentStrategy.d.ts +56 -0
  394. package/dist/core/platform/EGLView/ContentStrategy.d.ts.map +1 -0
  395. package/dist/core/platform/EGLView/ContentStrategy.js +117 -0
  396. package/dist/core/platform/EGLView/ContentStrategy.js.map +1 -0
  397. package/dist/core/platform/EGLView/EGLInstance.d.ts +8 -0
  398. package/dist/core/platform/EGLView/EGLInstance.d.ts.map +1 -0
  399. package/dist/core/platform/EGLView/EGLInstance.js +16 -0
  400. package/dist/core/platform/EGLView/EGLInstance.js.map +1 -0
  401. package/dist/core/platform/EGLView/ResolutionPolicy.d.ts +99 -0
  402. package/dist/core/platform/EGLView/ResolutionPolicy.d.ts.map +1 -0
  403. package/dist/core/platform/EGLView/ResolutionPolicy.js +116 -0
  404. package/dist/core/platform/EGLView/ResolutionPolicy.js.map +1 -0
  405. package/dist/core/platform/EGLView.d.ts +204 -0
  406. package/dist/core/platform/EGLView.d.ts.map +1 -0
  407. package/dist/core/platform/EGLView.js +669 -0
  408. package/dist/core/platform/EGLView.js.map +1 -0
  409. package/dist/core/platform/FontDefinition.d.ts +47 -0
  410. package/dist/core/platform/FontDefinition.d.ts.map +1 -0
  411. package/dist/core/platform/FontDefinition.js +59 -0
  412. package/dist/core/platform/FontDefinition.js.map +1 -0
  413. package/dist/core/platform/InputManager.d.ts +149 -0
  414. package/dist/core/platform/InputManager.d.ts.map +1 -0
  415. package/dist/core/platform/InputManager.js +558 -0
  416. package/dist/core/platform/InputManager.js.map +1 -0
  417. package/dist/core/platform/Loaders.d.ts +4 -0
  418. package/dist/core/platform/Loaders.d.ts.map +1 -0
  419. package/dist/core/platform/Loaders.js +141 -0
  420. package/dist/core/platform/Loaders.js.map +1 -0
  421. package/dist/core/platform/Macro.d.ts +634 -0
  422. package/dist/core/platform/Macro.d.ts.map +1 -0
  423. package/dist/core/platform/Macro.js +763 -0
  424. package/dist/core/platform/Macro.js.map +1 -0
  425. package/dist/core/platform/SAXParser.d.ts +44 -0
  426. package/dist/core/platform/SAXParser.d.ts.map +1 -0
  427. package/dist/core/platform/SAXParser.js +122 -0
  428. package/dist/core/platform/SAXParser.js.map +1 -0
  429. package/dist/core/platform/Types.d.ts +188 -0
  430. package/dist/core/platform/Types.d.ts.map +1 -0
  431. package/dist/core/platform/Types.js +425 -0
  432. package/dist/core/platform/Types.js.map +1 -0
  433. package/dist/core/platform/VisibleRect.d.ts +38 -0
  434. package/dist/core/platform/VisibleRect.d.ts.map +1 -0
  435. package/dist/core/platform/VisibleRect.js +66 -0
  436. package/dist/core/platform/VisibleRect.js.map +1 -0
  437. package/dist/core/platform/index.d.ts +7 -0
  438. package/dist/core/platform/index.d.ts.map +1 -0
  439. package/dist/core/platform/index.js +7 -0
  440. package/dist/core/platform/index.js.map +1 -0
  441. package/dist/core/platform/miniFramework.d.ts +28 -0
  442. package/dist/core/platform/miniFramework.d.ts.map +1 -0
  443. package/dist/core/platform/miniFramework.js +245 -0
  444. package/dist/core/platform/miniFramework.js.map +1 -0
  445. package/dist/core/platform/types/Quad2.d.ts +30 -0
  446. package/dist/core/platform/types/Quad2.d.ts.map +1 -0
  447. package/dist/core/platform/types/Quad2.js +62 -0
  448. package/dist/core/platform/types/Quad2.js.map +1 -0
  449. package/dist/core/platform/types/Quad3.d.ts +18 -0
  450. package/dist/core/platform/types/Quad3.d.ts.map +1 -0
  451. package/dist/core/platform/types/Quad3.js +30 -0
  452. package/dist/core/platform/types/Quad3.js.map +1 -0
  453. package/dist/core/platform/types/Tex2F.d.ts +20 -0
  454. package/dist/core/platform/types/Tex2F.d.ts.map +1 -0
  455. package/dist/core/platform/types/Tex2F.js +33 -0
  456. package/dist/core/platform/types/Tex2F.js.map +1 -0
  457. package/dist/core/platform/types/Vertex2F.d.ts +12 -0
  458. package/dist/core/platform/types/Vertex2F.d.ts.map +1 -0
  459. package/dist/core/platform/types/Vertex2F.js +25 -0
  460. package/dist/core/platform/types/Vertex2F.js.map +1 -0
  461. package/dist/core/platform/types/Vertex3F.d.ts +14 -0
  462. package/dist/core/platform/types/Vertex3F.d.ts.map +1 -0
  463. package/dist/core/platform/types/Vertex3F.js +31 -0
  464. package/dist/core/platform/types/Vertex3F.js.map +1 -0
  465. package/dist/core/platform/types/WebGLColor.d.ts +17 -0
  466. package/dist/core/platform/types/WebGLColor.d.ts.map +1 -0
  467. package/dist/core/platform/types/WebGLColor.js +40 -0
  468. package/dist/core/platform/types/WebGLColor.js.map +1 -0
  469. package/dist/core/renderer/GlobalVertexBuffer.d.ts +19 -0
  470. package/dist/core/renderer/GlobalVertexBuffer.d.ts.map +1 -0
  471. package/dist/core/renderer/GlobalVertexBuffer.js +99 -0
  472. package/dist/core/renderer/GlobalVertexBuffer.js.map +1 -0
  473. package/dist/core/renderer/RendererWebGL.d.ts +47 -0
  474. package/dist/core/renderer/RendererWebGL.d.ts.map +1 -0
  475. package/dist/core/renderer/RendererWebGL.js +389 -0
  476. package/dist/core/renderer/RendererWebGL.js.map +1 -0
  477. package/dist/core/scenes/Scene.d.ts +6 -0
  478. package/dist/core/scenes/Scene.d.ts.map +1 -0
  479. package/dist/core/scenes/Scene.js +12 -0
  480. package/dist/core/scenes/Scene.js.map +1 -0
  481. package/dist/core/sprites/Animation.d.ts +147 -0
  482. package/dist/core/sprites/Animation.d.ts.map +1 -0
  483. package/dist/core/sprites/Animation.js +277 -0
  484. package/dist/core/sprites/Animation.js.map +1 -0
  485. package/dist/core/sprites/AnimationCache.d.ts +37 -0
  486. package/dist/core/sprites/AnimationCache.d.ts.map +1 -0
  487. package/dist/core/sprites/AnimationCache.js +159 -0
  488. package/dist/core/sprites/AnimationCache.js.map +1 -0
  489. package/dist/core/sprites/Sprite.d.ts +104 -0
  490. package/dist/core/sprites/Sprite.d.ts.map +1 -0
  491. package/dist/core/sprites/Sprite.js +388 -0
  492. package/dist/core/sprites/Sprite.js.map +1 -0
  493. package/dist/core/sprites/SpriteBatchNode.d.ts +194 -0
  494. package/dist/core/sprites/SpriteBatchNode.d.ts.map +1 -0
  495. package/dist/core/sprites/SpriteBatchNode.js +332 -0
  496. package/dist/core/sprites/SpriteBatchNode.js.map +1 -0
  497. package/dist/core/sprites/SpriteFrame.d.ts +47 -0
  498. package/dist/core/sprites/SpriteFrame.d.ts.map +1 -0
  499. package/dist/core/sprites/SpriteFrame.js +223 -0
  500. package/dist/core/sprites/SpriteFrame.js.map +1 -0
  501. package/dist/core/sprites/SpriteFrameCache.d.ts +102 -0
  502. package/dist/core/sprites/SpriteFrameCache.d.ts.map +1 -0
  503. package/dist/core/sprites/SpriteFrameCache.js +333 -0
  504. package/dist/core/sprites/SpriteFrameCache.js.map +1 -0
  505. package/dist/core/sprites/SpriteLoadManager.d.ts +8 -0
  506. package/dist/core/sprites/SpriteLoadManager.d.ts.map +1 -0
  507. package/dist/core/sprites/SpriteLoadManager.js +37 -0
  508. package/dist/core/sprites/SpriteLoadManager.js.map +1 -0
  509. package/dist/core/sprites/SpriteWebGLRenderCmd.d.ts +35 -0
  510. package/dist/core/sprites/SpriteWebGLRenderCmd.d.ts.map +1 -0
  511. package/dist/core/sprites/SpriteWebGLRenderCmd.js +286 -0
  512. package/dist/core/sprites/SpriteWebGLRenderCmd.js.map +1 -0
  513. package/dist/core/sprites/SpritesPropertyDefine.d.ts +2 -0
  514. package/dist/core/sprites/SpritesPropertyDefine.d.ts.map +1 -0
  515. package/dist/core/sprites/SpritesPropertyDefine.js +19 -0
  516. package/dist/core/sprites/SpritesPropertyDefine.js.map +1 -0
  517. package/dist/core/support/PointExtension.d.ts +296 -0
  518. package/dist/core/support/PointExtension.d.ts.map +1 -0
  519. package/dist/core/support/PointExtension.js +443 -0
  520. package/dist/core/support/PointExtension.js.map +1 -0
  521. package/dist/core/support/Vertex.d.ts +24 -0
  522. package/dist/core/support/Vertex.d.ts.map +1 -0
  523. package/dist/core/support/Vertex.js +120 -0
  524. package/dist/core/support/Vertex.js.map +1 -0
  525. package/dist/core/utils/BinaryLoader.d.ts +9 -0
  526. package/dist/core/utils/BinaryLoader.d.ts.map +1 -0
  527. package/dist/core/utils/BinaryLoader.js +116 -0
  528. package/dist/core/utils/BinaryLoader.js.map +1 -0
  529. package/dist/core/utils/Profiler.d.ts +13 -0
  530. package/dist/core/utils/Profiler.d.ts.map +1 -0
  531. package/dist/core/utils/Profiler.js +140 -0
  532. package/dist/core/utils/Profiler.js.map +1 -0
  533. package/dist/helper/AsyncPool.d.ts +22 -0
  534. package/dist/helper/AsyncPool.d.ts.map +1 -0
  535. package/dist/helper/AsyncPool.js +101 -0
  536. package/dist/helper/AsyncPool.js.map +1 -0
  537. package/dist/helper/Base64.d.ts +29 -0
  538. package/dist/helper/Base64.d.ts.map +1 -0
  539. package/dist/helper/Base64.js +71 -0
  540. package/dist/helper/Base64.js.map +1 -0
  541. package/dist/helper/Debugger.d.ts +179 -0
  542. package/dist/helper/Debugger.d.ts.map +1 -0
  543. package/dist/helper/Debugger.js +250 -0
  544. package/dist/helper/Debugger.js.map +1 -0
  545. package/dist/helper/ZipUtils.d.ts +2 -0
  546. package/dist/helper/ZipUtils.d.ts.map +1 -0
  547. package/dist/helper/ZipUtils.js +20 -0
  548. package/dist/helper/ZipUtils.js.map +1 -0
  549. package/dist/helper/async.d.ts +49 -0
  550. package/dist/helper/async.d.ts.map +1 -0
  551. package/dist/helper/async.js +95 -0
  552. package/dist/helper/async.js.map +1 -0
  553. package/dist/helper/checkType.d.ts +8 -0
  554. package/dist/helper/checkType.d.ts.map +1 -0
  555. package/dist/helper/checkType.js +31 -0
  556. package/dist/helper/checkType.js.map +1 -0
  557. package/dist/helper/engine.d.ts +6 -0
  558. package/dist/helper/engine.d.ts.map +1 -0
  559. package/dist/helper/engine.js +115 -0
  560. package/dist/helper/engine.js.map +1 -0
  561. package/dist/helper/getset.d.ts +2 -0
  562. package/dist/helper/getset.d.ts.map +1 -0
  563. package/dist/helper/getset.js +51 -0
  564. package/dist/helper/getset.js.map +1 -0
  565. package/dist/helper/global.d.ts +6 -0
  566. package/dist/helper/global.d.ts.map +1 -0
  567. package/dist/helper/global.js +6 -0
  568. package/dist/helper/global.js.map +1 -0
  569. package/dist/helper/index.d.ts +3 -0
  570. package/dist/helper/index.d.ts.map +1 -0
  571. package/dist/helper/index.js +3 -0
  572. package/dist/helper/index.js.map +1 -0
  573. package/dist/helper/loader.d.ts +102 -0
  574. package/dist/helper/loader.d.ts.map +1 -0
  575. package/dist/helper/loader.js +447 -0
  576. package/dist/helper/loader.js.map +1 -0
  577. package/dist/helper/path.d.ts +12 -0
  578. package/dist/helper/path.d.ts.map +1 -0
  579. package/dist/helper/path.js +75 -0
  580. package/dist/helper/path.js.map +1 -0
  581. package/dist/helper/string.d.ts +2 -0
  582. package/dist/helper/string.d.ts.map +1 -0
  583. package/dist/helper/string.js +32 -0
  584. package/dist/helper/string.js.map +1 -0
  585. package/dist/helper/sys.d.ts +446 -0
  586. package/dist/helper/sys.d.ts.map +1 -0
  587. package/dist/helper/sys.js +691 -0
  588. package/dist/helper/sys.js.map +1 -0
  589. package/dist/index.d.ts +11 -0
  590. package/dist/index.d.ts.map +1 -0
  591. package/dist/index.js +11 -0
  592. package/dist/index.js.map +1 -0
  593. package/dist/motion-streak/MotionStreak.d.ts +56 -0
  594. package/dist/motion-streak/MotionStreak.d.ts.map +1 -0
  595. package/dist/motion-streak/MotionStreak.js +301 -0
  596. package/dist/motion-streak/MotionStreak.js.map +1 -0
  597. package/dist/motion-streak/MotionStreakWebGLRenderCmd.d.ts +9 -0
  598. package/dist/motion-streak/MotionStreakWebGLRenderCmd.d.ts.map +1 -0
  599. package/dist/motion-streak/MotionStreakWebGLRenderCmd.js +52 -0
  600. package/dist/motion-streak/MotionStreakWebGLRenderCmd.js.map +1 -0
  601. package/dist/motion-streak/index.d.ts +2 -0
  602. package/dist/motion-streak/index.d.ts.map +1 -0
  603. package/dist/motion-streak/index.js +2 -0
  604. package/dist/motion-streak/index.js.map +1 -0
  605. package/dist/particle/PNGReader.d.ts +30 -0
  606. package/dist/particle/PNGReader.d.ts.map +1 -0
  607. package/dist/particle/PNGReader.js +304 -0
  608. package/dist/particle/PNGReader.js.map +1 -0
  609. package/dist/particle/Particle.d.ts +27 -0
  610. package/dist/particle/Particle.d.ts.map +1 -0
  611. package/dist/particle/Particle.js +50 -0
  612. package/dist/particle/Particle.js.map +1 -0
  613. package/dist/particle/ParticleBatchNode.d.ts +163 -0
  614. package/dist/particle/ParticleBatchNode.d.ts.map +1 -0
  615. package/dist/particle/ParticleBatchNode.js +447 -0
  616. package/dist/particle/ParticleBatchNode.js.map +1 -0
  617. package/dist/particle/ParticleBatchNodeWebGLRenderCmd.d.ts +8 -0
  618. package/dist/particle/ParticleBatchNodeWebGLRenderCmd.d.ts.map +1 -0
  619. package/dist/particle/ParticleBatchNodeWebGLRenderCmd.js +33 -0
  620. package/dist/particle/ParticleBatchNodeWebGLRenderCmd.js.map +1 -0
  621. package/dist/particle/ParticleSystem.d.ts +941 -0
  622. package/dist/particle/ParticleSystem.d.ts.map +1 -0
  623. package/dist/particle/ParticleSystem.js +2017 -0
  624. package/dist/particle/ParticleSystem.js.map +1 -0
  625. package/dist/particle/ParticleSystemWebGLRenderCmd.d.ts +29 -0
  626. package/dist/particle/ParticleSystemWebGLRenderCmd.d.ts.map +1 -0
  627. package/dist/particle/ParticleSystemWebGLRenderCmd.js +346 -0
  628. package/dist/particle/ParticleSystemWebGLRenderCmd.js.map +1 -0
  629. package/dist/particle/TIFFReader.d.ts +138 -0
  630. package/dist/particle/TIFFReader.d.ts.map +1 -0
  631. package/dist/particle/TIFFReader.js +596 -0
  632. package/dist/particle/TIFFReader.js.map +1 -0
  633. package/dist/particle/examples/ParticleFire.d.ts +60 -0
  634. package/dist/particle/examples/ParticleFire.d.ts.map +1 -0
  635. package/dist/particle/examples/ParticleFire.js +188 -0
  636. package/dist/particle/examples/ParticleFire.js.map +1 -0
  637. package/dist/particle/examples/ParticleGalaxy.d.ts +60 -0
  638. package/dist/particle/examples/ParticleGalaxy.d.ts.map +1 -0
  639. package/dist/particle/examples/ParticleGalaxy.js +199 -0
  640. package/dist/particle/examples/ParticleGalaxy.js.map +1 -0
  641. package/dist/particle/examples/ParticleSmoke.d.ts +60 -0
  642. package/dist/particle/examples/ParticleSmoke.d.ts.map +1 -0
  643. package/dist/particle/examples/ParticleSmoke.js +195 -0
  644. package/dist/particle/examples/ParticleSmoke.js.map +1 -0
  645. package/dist/particle/examples/ParticleSpiral.d.ts +38 -0
  646. package/dist/particle/examples/ParticleSpiral.d.ts.map +1 -0
  647. package/dist/particle/examples/ParticleSpiral.js +130 -0
  648. package/dist/particle/examples/ParticleSpiral.js.map +1 -0
  649. package/dist/particle/examples/index.d.ts +5 -0
  650. package/dist/particle/examples/index.d.ts.map +1 -0
  651. package/dist/particle/examples/index.js +5 -0
  652. package/dist/particle/examples/index.js.map +1 -0
  653. package/dist/particle/index.d.ts +2 -0
  654. package/dist/particle/index.d.ts.map +1 -0
  655. package/dist/particle/index.js +2 -0
  656. package/dist/particle/index.js.map +1 -0
  657. package/dist/polyfills.d.ts +34 -0
  658. package/dist/polyfills.d.ts.map +1 -0
  659. package/dist/polyfills.js +102 -0
  660. package/dist/polyfills.js.map +1 -0
  661. package/dist/progress-timer/ActionProgressTimer.d.ts +118 -0
  662. package/dist/progress-timer/ActionProgressTimer.d.ts.map +1 -0
  663. package/dist/progress-timer/ActionProgressTimer.js +173 -0
  664. package/dist/progress-timer/ActionProgressTimer.js.map +1 -0
  665. package/dist/progress-timer/ProgressTimer.d.ts +143 -0
  666. package/dist/progress-timer/ProgressTimer.d.ts.map +1 -0
  667. package/dist/progress-timer/ProgressTimer.js +228 -0
  668. package/dist/progress-timer/ProgressTimer.js.map +1 -0
  669. package/dist/progress-timer/ProgressTimerWebGLRenderCmd.d.ts +56 -0
  670. package/dist/progress-timer/ProgressTimerWebGLRenderCmd.d.ts.map +1 -0
  671. package/dist/progress-timer/ProgressTimerWebGLRenderCmd.js +445 -0
  672. package/dist/progress-timer/ProgressTimerWebGLRenderCmd.js.map +1 -0
  673. package/dist/progress-timer/index.d.ts +3 -0
  674. package/dist/progress-timer/index.d.ts.map +1 -0
  675. package/dist/progress-timer/index.js +3 -0
  676. package/dist/progress-timer/index.js.map +1 -0
  677. package/dist/render-texture/RenderTexture.d.ts +226 -0
  678. package/dist/render-texture/RenderTexture.d.ts.map +1 -0
  679. package/dist/render-texture/RenderTexture.js +332 -0
  680. package/dist/render-texture/RenderTexture.js.map +1 -0
  681. package/dist/render-texture/RenderTextureWebGLRenderCmd.d.ts +28 -0
  682. package/dist/render-texture/RenderTextureWebGLRenderCmd.d.ts.map +1 -0
  683. package/dist/render-texture/RenderTextureWebGLRenderCmd.js +276 -0
  684. package/dist/render-texture/RenderTextureWebGLRenderCmd.js.map +1 -0
  685. package/dist/render-texture/index.d.ts +2 -0
  686. package/dist/render-texture/index.d.ts.map +1 -0
  687. package/dist/render-texture/index.js +2 -0
  688. package/dist/render-texture/index.js.map +1 -0
  689. package/dist/shaders/GLProgram.d.ts +288 -0
  690. package/dist/shaders/GLProgram.d.ts.map +1 -0
  691. package/dist/shaders/GLProgram.js +794 -0
  692. package/dist/shaders/GLProgram.js.map +1 -0
  693. package/dist/shaders/GLProgramState.d.ts +58 -0
  694. package/dist/shaders/GLProgramState.d.ts.map +1 -0
  695. package/dist/shaders/GLProgramState.js +255 -0
  696. package/dist/shaders/GLProgramState.js.map +1 -0
  697. package/dist/shaders/GLStateCache.d.ts +97 -0
  698. package/dist/shaders/GLStateCache.d.ts.map +1 -0
  699. package/dist/shaders/GLStateCache.js +255 -0
  700. package/dist/shaders/GLStateCache.js.map +1 -0
  701. package/dist/shaders/ShaderCache.d.ts +111 -0
  702. package/dist/shaders/ShaderCache.d.ts.map +1 -0
  703. package/dist/shaders/ShaderCache.js +273 -0
  704. package/dist/shaders/ShaderCache.js.map +1 -0
  705. package/dist/shaders/Shaders.d.ts +84 -0
  706. package/dist/shaders/Shaders.d.ts.map +1 -0
  707. package/dist/shaders/Shaders.js +250 -0
  708. package/dist/shaders/Shaders.js.map +1 -0
  709. package/dist/shaders/index.d.ts +5 -0
  710. package/dist/shaders/index.d.ts.map +1 -0
  711. package/dist/shaders/index.js +5 -0
  712. package/dist/shaders/index.js.map +1 -0
  713. package/dist/shape-nodes/DrawNode.d.ts +61 -0
  714. package/dist/shape-nodes/DrawNode.d.ts.map +1 -0
  715. package/dist/shape-nodes/DrawNode.js +597 -0
  716. package/dist/shape-nodes/DrawNode.js.map +1 -0
  717. package/dist/shape-nodes/DrawNodeWebGLRenderCmd.d.ts +11 -0
  718. package/dist/shape-nodes/DrawNodeWebGLRenderCmd.d.ts.map +1 -0
  719. package/dist/shape-nodes/DrawNodeWebGLRenderCmd.js +27 -0
  720. package/dist/shape-nodes/DrawNodeWebGLRenderCmd.js.map +1 -0
  721. package/dist/text-input/IMEDispatcher.d.ts +180 -0
  722. package/dist/text-input/IMEDispatcher.d.ts.map +1 -0
  723. package/dist/text-input/IMEDispatcher.js +454 -0
  724. package/dist/text-input/IMEDispatcher.js.map +1 -0
  725. package/dist/text-input/TextFieldTTF.d.ts +219 -0
  726. package/dist/text-input/TextFieldTTF.d.ts.map +1 -0
  727. package/dist/text-input/TextFieldTTF.js +381 -0
  728. package/dist/text-input/TextFieldTTF.js.map +1 -0
  729. package/dist/textures/Texture2D.d.ts +10 -0
  730. package/dist/textures/Texture2D.d.ts.map +1 -0
  731. package/dist/textures/Texture2D.js +10 -0
  732. package/dist/textures/Texture2D.js.map +1 -0
  733. package/dist/textures/TextureAtlas.d.ts +204 -0
  734. package/dist/textures/TextureAtlas.d.ts.map +1 -0
  735. package/dist/textures/TextureAtlas.js +602 -0
  736. package/dist/textures/TextureAtlas.js.map +1 -0
  737. package/dist/textures/TextureCache.d.ts +147 -0
  738. package/dist/textures/TextureCache.d.ts.map +1 -0
  739. package/dist/textures/TextureCache.js +327 -0
  740. package/dist/textures/TextureCache.js.map +1 -0
  741. package/dist/textures/TexturesPropertyDefine.d.ts +2 -0
  742. package/dist/textures/TexturesPropertyDefine.d.ts.map +1 -0
  743. package/dist/textures/TexturesPropertyDefine.js +39 -0
  744. package/dist/textures/TexturesPropertyDefine.js.map +1 -0
  745. package/dist/textures/TexturesWebGL.d.ts +349 -0
  746. package/dist/textures/TexturesWebGL.d.ts.map +1 -0
  747. package/dist/textures/TexturesWebGL.js +765 -0
  748. package/dist/textures/TexturesWebGL.js.map +1 -0
  749. package/dist/textures/WebGLTextureCache.d.ts +2 -0
  750. package/dist/textures/WebGLTextureCache.d.ts.map +1 -0
  751. package/dist/textures/WebGLTextureCache.js +79 -0
  752. package/dist/textures/WebGLTextureCache.js.map +1 -0
  753. package/dist/textures/index.d.ts +3 -0
  754. package/dist/textures/index.d.ts.map +1 -0
  755. package/dist/textures/index.js +3 -0
  756. package/dist/textures/index.js.map +1 -0
  757. package/dist/tilemap/TGAlib.d.ts +103 -0
  758. package/dist/tilemap/TGAlib.d.ts.map +1 -0
  759. package/dist/tilemap/TGAlib.js +338 -0
  760. package/dist/tilemap/TGAlib.js.map +1 -0
  761. package/dist/tilemap/TMXLayer.d.ts +225 -0
  762. package/dist/tilemap/TMXLayer.d.ts.map +1 -0
  763. package/dist/tilemap/TMXLayer.js +694 -0
  764. package/dist/tilemap/TMXLayer.js.map +1 -0
  765. package/dist/tilemap/TMXLayerInfo.d.ts +42 -0
  766. package/dist/tilemap/TMXLayerInfo.d.ts.map +1 -0
  767. package/dist/tilemap/TMXLayerInfo.js +57 -0
  768. package/dist/tilemap/TMXLayerInfo.js.map +1 -0
  769. package/dist/tilemap/TMXLayerWebGLRenderCmd.d.ts +17 -0
  770. package/dist/tilemap/TMXLayerWebGLRenderCmd.d.ts.map +1 -0
  771. package/dist/tilemap/TMXLayerWebGLRenderCmd.js +209 -0
  772. package/dist/tilemap/TMXLayerWebGLRenderCmd.js.map +1 -0
  773. package/dist/tilemap/TMXMapInfo.d.ts +210 -0
  774. package/dist/tilemap/TMXMapInfo.d.ts.map +1 -0
  775. package/dist/tilemap/TMXMapInfo.js +614 -0
  776. package/dist/tilemap/TMXMapInfo.js.map +1 -0
  777. package/dist/tilemap/TMXObjectGroup.d.ts +70 -0
  778. package/dist/tilemap/TMXObjectGroup.d.ts.map +1 -0
  779. package/dist/tilemap/TMXObjectGroup.js +106 -0
  780. package/dist/tilemap/TMXObjectGroup.js.map +1 -0
  781. package/dist/tilemap/TMXTiledMap.d.ts +163 -0
  782. package/dist/tilemap/TMXTiledMap.d.ts.map +1 -0
  783. package/dist/tilemap/TMXTiledMap.js +347 -0
  784. package/dist/tilemap/TMXTiledMap.js.map +1 -0
  785. package/dist/tilemap/TMXTilesetInfo.d.ts +38 -0
  786. package/dist/tilemap/TMXTilesetInfo.d.ts.map +1 -0
  787. package/dist/tilemap/TMXTilesetInfo.js +59 -0
  788. package/dist/tilemap/TMXTilesetInfo.js.map +1 -0
  789. package/dist/tilemap/TMXXMLParser.d.ts +52 -0
  790. package/dist/tilemap/TMXXMLParser.d.ts.map +1 -0
  791. package/dist/tilemap/TMXXMLParser.js +52 -0
  792. package/dist/tilemap/TMXXMLParser.js.map +1 -0
  793. package/dist/tilemap/index.d.ts +4 -0
  794. package/dist/tilemap/index.d.ts.map +1 -0
  795. package/dist/tilemap/index.js +4 -0
  796. package/dist/tilemap/index.js.map +1 -0
  797. package/dist/ui/base/FocusNavigationController.d.ts +12 -0
  798. package/dist/ui/base/FocusNavigationController.d.ts.map +1 -0
  799. package/dist/ui/base/FocusNavigationController.js +54 -0
  800. package/dist/ui/base/FocusNavigationController.js.map +1 -0
  801. package/dist/ui/base/ProtectedNode.d.ts +66 -0
  802. package/dist/ui/base/ProtectedNode.d.ts.map +1 -0
  803. package/dist/ui/base/ProtectedNode.js +248 -0
  804. package/dist/ui/base/ProtectedNode.js.map +1 -0
  805. package/dist/ui/base/ProtectedNodeWebGLRenderCmd.d.ts +13 -0
  806. package/dist/ui/base/ProtectedNodeWebGLRenderCmd.d.ts.map +1 -0
  807. package/dist/ui/base/ProtectedNodeWebGLRenderCmd.js +136 -0
  808. package/dist/ui/base/ProtectedNodeWebGLRenderCmd.js.map +1 -0
  809. package/dist/ui/base/UIHelper.d.ts +48 -0
  810. package/dist/ui/base/UIHelper.d.ts.map +1 -0
  811. package/dist/ui/base/UIHelper.js +128 -0
  812. package/dist/ui/base/UIHelper.js.map +1 -0
  813. package/dist/ui/base/UIScale9Sprite.d.ts +224 -0
  814. package/dist/ui/base/UIScale9Sprite.d.ts.map +1 -0
  815. package/dist/ui/base/UIScale9Sprite.js +825 -0
  816. package/dist/ui/base/UIScale9Sprite.js.map +1 -0
  817. package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.d.ts +15 -0
  818. package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.d.ts.map +1 -0
  819. package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.js +119 -0
  820. package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.js.map +1 -0
  821. package/dist/ui/base/UIWidget.d.ts +794 -0
  822. package/dist/ui/base/UIWidget.d.ts.map +1 -0
  823. package/dist/ui/base/UIWidget.js +1634 -0
  824. package/dist/ui/base/UIWidget.js.map +1 -0
  825. package/dist/ui/base/UIWidgetRenderCmd.d.ts +9 -0
  826. package/dist/ui/base/UIWidgetRenderCmd.d.ts.map +1 -0
  827. package/dist/ui/base/UIWidgetRenderCmd.js +41 -0
  828. package/dist/ui/base/UIWidgetRenderCmd.js.map +1 -0
  829. package/dist/ui/index.d.ts +9 -0
  830. package/dist/ui/index.d.ts.map +1 -0
  831. package/dist/ui/index.js +9 -0
  832. package/dist/ui/index.js.map +1 -0
  833. package/dist/ui/layout/UILayout.d.ts +486 -0
  834. package/dist/ui/layout/UILayout.d.ts.map +1 -0
  835. package/dist/ui/layout/UILayout.js +1430 -0
  836. package/dist/ui/layout/UILayout.js.map +1 -0
  837. package/dist/ui/layout/UILayoutParameter.d.ts +344 -0
  838. package/dist/ui/layout/UILayoutParameter.d.ts.map +1 -0
  839. package/dist/ui/layout/UILayoutParameter.js +444 -0
  840. package/dist/ui/layout/UILayoutParameter.js.map +1 -0
  841. package/dist/ui/layout/UILayoutWebGLRenderCmd.d.ts +30 -0
  842. package/dist/ui/layout/UILayoutWebGLRenderCmd.d.ts.map +1 -0
  843. package/dist/ui/layout/UILayoutWebGLRenderCmd.js +136 -0
  844. package/dist/ui/layout/UILayoutWebGLRenderCmd.js.map +1 -0
  845. package/dist/ui/layout/constant.d.ts +30 -0
  846. package/dist/ui/layout/constant.d.ts.map +1 -0
  847. package/dist/ui/layout/constant.js +31 -0
  848. package/dist/ui/layout/constant.js.map +1 -0
  849. package/dist/ui/widget/UIButton.d.ts +248 -0
  850. package/dist/ui/widget/UIButton.d.ts.map +1 -0
  851. package/dist/ui/widget/UIButton.js +727 -0
  852. package/dist/ui/widget/UIButton.js.map +1 -0
  853. package/dist/ui/widget/UIRichText.d.ts +216 -0
  854. package/dist/ui/widget/UIRichText.d.ts.map +1 -0
  855. package/dist/ui/widget/UIRichText.js +549 -0
  856. package/dist/ui/widget/UIRichText.js.map +1 -0
  857. package/dist/ui/widget/UIScrollView.d.ts +547 -0
  858. package/dist/ui/widget/UIScrollView.d.ts.map +1 -0
  859. package/dist/ui/widget/UIScrollView.js +1544 -0
  860. package/dist/ui/widget/UIScrollView.js.map +1 -0
  861. package/dist/ui/widget/UIScrollViewBar.d.ts +101 -0
  862. package/dist/ui/widget/UIScrollViewBar.d.ts.map +1 -0
  863. package/dist/ui/widget/UIScrollViewBar.js +277 -0
  864. package/dist/ui/widget/UIScrollViewBar.js.map +1 -0
  865. package/dist/ui/widget/UIScrollViewWebGLRenderCmd.d.ts +10 -0
  866. package/dist/ui/widget/UIScrollViewWebGLRenderCmd.d.ts.map +1 -0
  867. package/dist/ui/widget/UIScrollViewWebGLRenderCmd.js +42 -0
  868. package/dist/ui/widget/UIScrollViewWebGLRenderCmd.js.map +1 -0
  869. package/dist/ui/widget/UISlider.d.ts +229 -0
  870. package/dist/ui/widget/UISlider.d.ts.map +1 -0
  871. package/dist/ui/widget/UISlider.js +667 -0
  872. package/dist/ui/widget/UISlider.js.map +1 -0
  873. package/dist/ui/widget/UIText.d.ts +90 -0
  874. package/dist/ui/widget/UIText.d.ts.map +1 -0
  875. package/dist/ui/widget/UIText.js +325 -0
  876. package/dist/ui/widget/UIText.js.map +1 -0
  877. package/dist/ui/widget/UITextField.d.ts +282 -0
  878. package/dist/ui/widget/UITextField.d.ts.map +1 -0
  879. package/dist/ui/widget/UITextField.js +549 -0
  880. package/dist/ui/widget/UITextField.js.map +1 -0
  881. package/dist/ui/widget/UITextFieldRenderer.d.ts +41 -0
  882. package/dist/ui/widget/UITextFieldRenderer.d.ts.map +1 -0
  883. package/dist/ui/widget/UITextFieldRenderer.js +150 -0
  884. package/dist/ui/widget/UITextFieldRenderer.js.map +1 -0
  885. package/eslint.config.ts +59 -0
  886. package/index.html +22 -0
  887. package/package.json +38 -0
  888. package/res/Button.mp3 +0 -0
  889. package/res/SmallSun.plist +108 -0
  890. package/res/Spiral.plist +102 -0
  891. package/res/base.png +0 -0
  892. package/res/button.png +0 -0
  893. package/res/button_plus.png +0 -0
  894. package/res/ortho-test1.png +0 -0
  895. package/res/orthogonal-test1.tmx +9 -0
  896. package/res/orthogonal-test1.tsx +4 -0
  897. package/res/particle.png +0 -0
  898. package/res/sliderThumb.png +0 -0
  899. package/res/sliderTrack.png +0 -0
  900. package/res/streak.png +0 -0
  901. package/res/ui.plist +578 -0
  902. package/res/ui.png +0 -0
  903. package/res/vite.svg +1 -0
  904. package/test/ActionScene.ts +15 -0
  905. package/test/DemoScene.ts +108 -0
  906. package/test/GraphicsTest.ts +17 -0
  907. package/test/ParticleScene.ts +24 -0
  908. package/test/TiledMapScene.ts +14 -0
  909. package/test/index.ts +28 -0
  910. package/vite.config.ts +13 -0
@@ -0,0 +1,2017 @@
1
+ import { game } from '..';
2
+ import { BLEND_DST, BLEND_SRC, BlendFunc, clampf, Color, color, degreesToRadians, Node, ONE, ONE_MINUS_SRC_ALPHA, p, pAddIn, pIn, pMultIn, pNormalizeIn, Point, pSubIn, pToAngle, pZeroIn, radiansToDegrees, randomMinus1To1, Rect, SRC_ALPHA, } from '../core';
3
+ import { FMT_PNG, getImageFormatByData } from '../core/platform/Common';
4
+ import { path } from '../helper';
5
+ import { isNumber, isObject, isString } from '../helper/checkType';
6
+ import { log } from '../helper/Debugger';
7
+ import { loader } from '../helper/loader';
8
+ import { unzipBase64AsArray } from '../helper/ZipUtils';
9
+ import { Texture2D, textureCache } from '../textures';
10
+ import { Particle } from './Particle';
11
+ import { ParticleSystemWebGLRenderCmd } from './ParticleSystemWebGLRenderCmd';
12
+ import { PNGReader } from './PNGReader';
13
+ /**
14
+ * <p>
15
+ * Particle System base class. <br/>
16
+ * Attributes of a Particle System:<br/>
17
+ * - emission rate of the particles<br/>
18
+ * - Gravity Mode (Mode A): <br/>
19
+ * - gravity <br/>
20
+ * - direction <br/>
21
+ * - speed +- variance <br/>
22
+ * - tangential acceleration +- variance<br/>
23
+ * - radial acceleration +- variance<br/>
24
+ * - Radius Mode (Mode B): <br/>
25
+ * - startRadius +- variance <br/>
26
+ * - endRadius +- variance <br/>
27
+ * - rotate +- variance <br/>
28
+ * - Properties common to all modes: <br/>
29
+ * - life +- life variance <br/>
30
+ * - start spin +- variance <br/>
31
+ * - end spin +- variance <br/>
32
+ * - start size +- variance <br/>
33
+ * - end size +- variance <br/>
34
+ * - start color +- variance <br/>
35
+ * - end color +- variance <br/>
36
+ * - life +- variance <br/>
37
+ * - blending function <br/>
38
+ * - texture <br/>
39
+ * <br/>
40
+ * cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).<br/>
41
+ * 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d, <br/>
42
+ * cocos2d uses a another approach, but the results are almost identical.<br/>
43
+ * cocos2d supports all the variables used by Particle Designer plus a bit more: <br/>
44
+ * - spinning particles (supported when using ParticleSystem) <br/>
45
+ * - tangential acceleration (Gravity mode) <br/>
46
+ * - radial acceleration (Gravity mode) <br/>
47
+ * - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only) <br/>
48
+ * It is possible to customize any of the above mentioned properties in runtime. Example: <br/>
49
+ * </p>
50
+ * @class
51
+ * @extends Node
52
+ *
53
+ * @property {Boolean} opacityModifyRGB - Indicate whether the alpha value modify color.
54
+ * @property {SpriteBatchNode} batchNode - Weak reference to the sprite batch node.
55
+ * @property {Boolean} active - <@readonly> Indicate whether the particle system is activated.
56
+ * @property {Number} shapeType - ShapeType of ParticleSystem : ParticleSystem.BALL_SHAPE | ParticleSystem.STAR_SHAPE.
57
+ * @property {Number} atlasIndex - Index of system in batch node array.
58
+ * @property {Number} particleCount - Current quantity of particles that are being simulated.
59
+ * @property {Number} duration - How many seconds the emitter wil run. -1 means 'forever'
60
+ * @property {Point} sourcePos - Source position of the emitter.
61
+ * @property {Point} posVar - Variation of source position.
62
+ * @property {Number} life - Life of each particle setter.
63
+ * @property {Number} lifeVar - Variation of life.
64
+ * @property {Number} angle - Angle of each particle setter.
65
+ * @property {Number} angleVar - Variation of angle of each particle setter.
66
+ * @property {Number} startSize - Start size in pixels of each particle.
67
+ * @property {Number} startSizeVar - Variation of start size in pixels.
68
+ * @property {Number} endSize - End size in pixels of each particle.
69
+ * @property {Number} endSizeVar - Variation of end size in pixels.
70
+ * @property {Number} startSpin - Start angle of each particle.
71
+ * @property {Number} startSpinVar - Variation of start angle.
72
+ * @property {Number} endSpin - End angle of each particle.
73
+ * @property {Number} endSpinVar - Variation of end angle.
74
+ * @property {Point} gravity - Gravity of the emitter.
75
+ * @property {Point} speed - Speed of the emitter.
76
+ * @property {Point} speedVar - Variation of the speed.
77
+ * @property {Number} tangentialAccel - Tangential acceleration of each particle. Only available in 'Gravity' mode.
78
+ * @property {Number} tangentialAccelVar - Variation of the tangential acceleration.
79
+ * @property {Number} tangentialAccel - Radial acceleration of each particle. Only available in 'Gravity' mode.
80
+ * @property {Number} tangentialAccelVar - Variation of the radial acceleration.
81
+ * @property {Boolean} rotationIsDir - Indicate whether the rotation of each particle equals to its direction. Only available in 'Gravity' mode.
82
+ * @property {Number} startRadius - Starting radius of the particles. Only available in 'Radius' mode.
83
+ * @property {Number} startRadiusVar - Variation of the starting radius.
84
+ * @property {Number} endRadius - Ending radius of the particles. Only available in 'Radius' mode.
85
+ * @property {Number} endRadiusVar - Variation of the ending radius.
86
+ * @property {Number} rotatePerS - Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
87
+ * @property {Number} rotatePerSVar - Variation of the degress to rotate a particle around the source pos per second.
88
+ * @property {Color} startColor - Start color of each particle.
89
+ * @property {Color} startColorVar - Variation of the start color.
90
+ * @property {Color} endColor - Ending color of each particle.
91
+ * @property {Color} endColorVar - Variation of the end color.
92
+ * @property {Number} emissionRate - Emission rate of the particles.
93
+ * @property {Number} emitterMode - Emitter modes: CCParticleSystem.MODE_GRAVITY: uses gravity, speed, radial and tangential acceleration; CCParticleSystem.MODE_RADIUS: uses radius movement + rotation.
94
+ * @property {Number} positionType - Particles movement type: ParticleSystem.TYPE_FREE | ParticleSystem.TYPE_GROUPED.
95
+ * @property {Number} totalParticles - Maximum particles of the system.
96
+ * @property {Boolean} autoRemoveOnFinish - Indicate whether the node will be auto-removed when it has no particles left.
97
+ * @property {Texture2D|HTMLImageElement|HTMLCanvasElement} texture - Texture of Particle System.
98
+ *
99
+ * @example
100
+ * emitter.radialAccel = 15;
101
+ * emitter.startSpin = 0;
102
+ */
103
+ export class ParticleSystemModeA {
104
+ gravity;
105
+ speed;
106
+ speedVar;
107
+ tangentialAccel;
108
+ tangentialAccelVar;
109
+ radialAccel;
110
+ radialAccelVar;
111
+ rotationIsDir;
112
+ constructor(gravity, speed, speedVar, tangentialAccel, tangentialAccelVar, radialAccel, radialAccelVar, rotationIsDir) {
113
+ /** Gravity value. Only available in 'Gravity' mode. */ this.gravity = gravity ? gravity : p(0, 0);
114
+ /** speed of each particle. Only available in 'Gravity' mode. */ this.speed = speed || 0;
115
+ /** speed variance of each particle. Only available in 'Gravity' mode. */ this.speedVar = speedVar || 0;
116
+ /** tangential acceleration of each particle. Only available in 'Gravity' mode. */ this.tangentialAccel = tangentialAccel || 0;
117
+ /** tangential acceleration variance of each particle. Only available in 'Gravity' mode. */ this.tangentialAccelVar =
118
+ tangentialAccelVar || 0;
119
+ /** radial acceleration of each particle. Only available in 'Gravity' mode. */ this.radialAccel = radialAccel || 0;
120
+ /** radial acceleration variance of each particle. Only available in 'Gravity' mode. */ this.radialAccelVar = radialAccelVar || 0;
121
+ /** set the rotation of each particle to its direction Only available in 'Gravity' mode. */ this.rotationIsDir = rotationIsDir || false;
122
+ }
123
+ }
124
+ export class ParticleSystemModeB {
125
+ startRadius;
126
+ startRadiusVar;
127
+ endRadius;
128
+ endRadiusVar;
129
+ rotatePerSecond;
130
+ rotatePerSecondVar;
131
+ constructor(startRadius, startRadiusVar, endRadius, endRadiusVar, rotatePerSecond, rotatePerSecondVar) {
132
+ /** The starting radius of the particles. Only available in 'Radius' mode. */
133
+ this.startRadius = startRadius || 0;
134
+ /** The starting radius variance of the particles. Only available in 'Radius' mode. */
135
+ this.startRadiusVar = startRadiusVar || 0;
136
+ /** The ending radius of the particles. Only available in 'Radius' mode. */
137
+ this.endRadius = endRadius || 0;
138
+ /** The ending radius variance of the particles. Only available in 'Radius' mode. */
139
+ this.endRadiusVar = endRadiusVar || 0;
140
+ /** Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode. */
141
+ this.rotatePerSecond = rotatePerSecond || 0;
142
+ /** Variance in degrees for rotatePerSecond. Only available in 'Radius' mode. */
143
+ this.rotatePerSecondVar = rotatePerSecondVar || 0;
144
+ }
145
+ }
146
+ export class ParticleSystem extends Node {
147
+ _className = 'ParticleSystem';
148
+ //***********variables*************
149
+ _plistFile = '';
150
+ //! time elapsed since the start of the system (in seconds)
151
+ _elapsed = 0;
152
+ _dontTint = false;
153
+ // Different modes
154
+ //! Mode A:Gravity + Tangential Accel + Radial Accel
155
+ modeA;
156
+ //! Mode B: circular movement (gravity, radial accel and tangential accel don't are not used in this mode)
157
+ modeB;
158
+ //private POINTZERO for ParticleSystem
159
+ _pointZeroForParticle = p(0, 0);
160
+ //! Array of particles
161
+ _particles;
162
+ // color modulate
163
+ // BOOL colorModulate;
164
+ //! How many particles can be emitted per second
165
+ _emitCounter = 0;
166
+ //! particle idx
167
+ _particleIdx = 0;
168
+ // _batchNode: any
169
+ atlasIndex = 0;
170
+ //true if scaled or rotated
171
+ _transformSystemDirty = false;
172
+ _allocatedParticles = 0;
173
+ _isActive = false;
174
+ particleCount = 0;
175
+ duration = 0;
176
+ _sourcePosition;
177
+ _posVar;
178
+ life = 0;
179
+ lifeVar = 0;
180
+ angle = 0;
181
+ angleVar = 0;
182
+ startSize = 0;
183
+ startSizeVar = 0;
184
+ endSize = 0;
185
+ endSizeVar = 0;
186
+ _startColor;
187
+ _startColorVar;
188
+ _endColor;
189
+ _endColorVar;
190
+ startSpin = 0;
191
+ startSpinVar = 0;
192
+ endSpin = 0;
193
+ endSpinVar = 0;
194
+ emissionRate = 0;
195
+ _totalParticles = 0;
196
+ _texture;
197
+ _blendFunc;
198
+ _opacityModifyRGB = false;
199
+ positionType;
200
+ autoRemoveOnFinish = false;
201
+ emitterMode = 0;
202
+ /**
203
+ * <p> return the string found by key in dict. <br/>
204
+ * This plist files can be create manually or with Particle Designer:<br/>
205
+ * http://particledesigner.71squared.com/<br/>
206
+ * </p>
207
+ * Constructor of ParticleSystem
208
+ * @param {String|Number} plistFile
209
+ */
210
+ constructor(plistFile) {
211
+ super();
212
+ this.emitterMode = ParticleSystem.MODE_GRAVITY;
213
+ this.modeA = new ParticleSystemModeA();
214
+ this.modeB = new ParticleSystemModeB();
215
+ this._blendFunc = { src: BLEND_SRC, dst: BLEND_DST };
216
+ this._particles = [];
217
+ this._sourcePosition = p(0, 0);
218
+ this._posVar = p(0, 0);
219
+ this._startColor = color(255, 255, 255, 255);
220
+ this._startColorVar = color(255, 255, 255, 255);
221
+ this._endColor = color(255, 255, 255, 255);
222
+ this._endColorVar = color(255, 255, 255, 255);
223
+ this._plistFile = '';
224
+ this._elapsed = 0;
225
+ this._dontTint = false;
226
+ this._pointZeroForParticle = p(0, 0);
227
+ this._emitCounter = 0;
228
+ this._particleIdx = 0;
229
+ this._batchNode = null;
230
+ this.atlasIndex = 0;
231
+ this._transformSystemDirty = false;
232
+ this._allocatedParticles = 0;
233
+ this._isActive = false;
234
+ this.particleCount = 0;
235
+ this.duration = 0;
236
+ this.life = 0;
237
+ this.lifeVar = 0;
238
+ this.angle = 0;
239
+ this.angleVar = 0;
240
+ this.startSize = 0;
241
+ this.startSizeVar = 0;
242
+ this.endSize = 0;
243
+ this.endSizeVar = 0;
244
+ this.startSpin = 0;
245
+ this.startSpinVar = 0;
246
+ this.endSpin = 0;
247
+ this.endSpinVar = 0;
248
+ this.emissionRate = 0;
249
+ this._totalParticles = 0;
250
+ // this._texture = null
251
+ this._opacityModifyRGB = false;
252
+ this.positionType = ParticleSystem.TYPE_FREE;
253
+ this.autoRemoveOnFinish = false;
254
+ this._textureLoaded = true;
255
+ if (!plistFile || isNumber(plistFile)) {
256
+ const ton = plistFile || 100;
257
+ this.setDrawMode(ParticleSystem.TEXTURE_MODE);
258
+ this.initWithTotalParticles(ton);
259
+ }
260
+ else if (isString(plistFile)) {
261
+ this.initWithFile(plistFile);
262
+ }
263
+ else if (isObject(plistFile)) {
264
+ this.initWithDictionary(plistFile, '');
265
+ }
266
+ }
267
+ _createRenderCmd() {
268
+ return new ParticleSystemWebGLRenderCmd(this);
269
+ }
270
+ /**
271
+ * This is a hack function for performance, it's only available on Canvas mode. <br/>
272
+ * It's very expensive to change color on Canvas mode, so if set it to true, particle system will ignore the changing color operation.
273
+ * @param {boolean} ignore
274
+ */
275
+ ignoreColor(ignore) {
276
+ this._dontTint = ignore;
277
+ }
278
+ /**
279
+ * <p> initializes the texture with a rectangle measured Points<br/>
280
+ * pointRect should be in Texture coordinates, not pixel coordinates
281
+ * </p>
282
+ * @param {Rect} pointRect
283
+ */
284
+ initTexCoordsWithRect(pointRect) {
285
+ this._renderCmd.initTexCoordsWithRect(pointRect);
286
+ }
287
+ /**
288
+ * return weak reference to the SpriteBatchNode that renders the Sprite
289
+ * @return {ParticleBatchNode}
290
+ */
291
+ getBatchNode() {
292
+ return this._batchNode;
293
+ }
294
+ /**
295
+ * set weak reference to the SpriteBatchNode that renders the Sprite
296
+ * @param {ParticleBatchNode} batchNode
297
+ */
298
+ setBatchNode(batchNode) {
299
+ this._renderCmd.setBatchNode(batchNode);
300
+ }
301
+ /**
302
+ * return index of system in batch node array
303
+ * @return {Number}
304
+ */
305
+ getAtlasIndex() {
306
+ return this.atlasIndex;
307
+ }
308
+ /**
309
+ * set index of system in batch node array
310
+ * @param {Number} atlasIndex
311
+ */
312
+ setAtlasIndex(atlasIndex) {
313
+ this.atlasIndex = atlasIndex;
314
+ }
315
+ /**
316
+ * Return DrawMode of ParticleSystem (Canvas Mode only)
317
+ * @return {Number}
318
+ */
319
+ getDrawMode() {
320
+ return this._renderCmd.getDrawMode();
321
+ }
322
+ /**
323
+ * DrawMode of ParticleSystem setter (Canvas Mode only)
324
+ * @param {Number} drawMode
325
+ */
326
+ setDrawMode(drawMode) {
327
+ this._renderCmd.setDrawMode(drawMode);
328
+ }
329
+ /**
330
+ * Return ShapeType of ParticleSystem (Canvas Mode only)
331
+ * @return {Number}
332
+ */
333
+ getShapeType() {
334
+ return this._renderCmd.getShapeType();
335
+ }
336
+ /**
337
+ * ShapeType of ParticleSystem setter (Canvas Mode only)
338
+ * @param {Number} shapeType
339
+ */
340
+ setShapeType(shapeType) {
341
+ this._renderCmd.setShapeType(shapeType);
342
+ }
343
+ /**
344
+ * Return ParticleSystem is active
345
+ * @return {Boolean}
346
+ */
347
+ isActive() {
348
+ return this._isActive;
349
+ }
350
+ /**
351
+ * Quantity of particles that are being simulated at the moment
352
+ * @return {Number}
353
+ */
354
+ getParticleCount() {
355
+ return this.particleCount;
356
+ }
357
+ /**
358
+ * Quantity of particles setter
359
+ * @param {Number} particleCount
360
+ */
361
+ setParticleCount(particleCount) {
362
+ this.particleCount = particleCount;
363
+ }
364
+ /**
365
+ * How many seconds the emitter wil run. -1 means 'forever'
366
+ * @return {Number}
367
+ */
368
+ getDuration() {
369
+ return this.duration;
370
+ }
371
+ /**
372
+ * set run seconds of the emitter
373
+ * @param {Number} duration
374
+ */
375
+ setDuration(duration) {
376
+ this.duration = duration;
377
+ }
378
+ /**
379
+ * Return sourcePosition of the emitter
380
+ * @return {Point | Object}
381
+ */
382
+ getSourcePosition() {
383
+ return { x: this._sourcePosition.x, y: this._sourcePosition.y };
384
+ }
385
+ /**
386
+ * sourcePosition of the emitter setter
387
+ * @param sourcePosition
388
+ */
389
+ setSourcePosition(sourcePosition) {
390
+ this._sourcePosition.x = sourcePosition.x;
391
+ this._sourcePosition.y = sourcePosition.y;
392
+ }
393
+ /**
394
+ * Return Position variance of the emitter
395
+ * @return {Point | Object}
396
+ */
397
+ getPosVar() {
398
+ return { x: this._posVar.x, y: this._posVar.y };
399
+ }
400
+ /**
401
+ * Position variance of the emitter setter
402
+ * @param {Point} posVar
403
+ */
404
+ setPosVar(posVar) {
405
+ this._posVar.x = posVar.x;
406
+ this._posVar.y = posVar.y;
407
+ }
408
+ /**
409
+ * Return life of each particle
410
+ * @return {Number}
411
+ */
412
+ getLife() {
413
+ return this.life;
414
+ }
415
+ /**
416
+ * life of each particle setter
417
+ * @param {Number} life
418
+ */
419
+ setLife(life) {
420
+ this.life = life;
421
+ }
422
+ /**
423
+ * Return life variance of each particle
424
+ * @return {Number}
425
+ */
426
+ getLifeVar() {
427
+ return this.lifeVar;
428
+ }
429
+ /**
430
+ * life variance of each particle setter
431
+ * @param {Number} lifeVar
432
+ */
433
+ setLifeVar(lifeVar) {
434
+ this.lifeVar = lifeVar;
435
+ }
436
+ /**
437
+ * Return angle of each particle
438
+ * @return {Number}
439
+ */
440
+ getAngle() {
441
+ return this.angle;
442
+ }
443
+ /**
444
+ * angle of each particle setter
445
+ * @param {Number} angle
446
+ */
447
+ setAngle(angle) {
448
+ this.angle = angle;
449
+ }
450
+ /**
451
+ * Return angle variance of each particle
452
+ * @return {Number}
453
+ */
454
+ getAngleVar() {
455
+ return this.angleVar;
456
+ }
457
+ /**
458
+ * angle variance of each particle setter
459
+ * @param angleVar
460
+ */
461
+ setAngleVar(angleVar) {
462
+ this.angleVar = angleVar;
463
+ }
464
+ // mode A
465
+ /**
466
+ * Return Gravity of emitter
467
+ * @return {Point}
468
+ */
469
+ getGravity() {
470
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
471
+ log('ParticleBatchNode.getGravity() : Particle Mode should be Gravity');
472
+ const locGravity = this.modeA.gravity;
473
+ return p(locGravity.x, locGravity.y);
474
+ }
475
+ /**
476
+ * Gravity of emitter setter
477
+ * @param {Point} gravity
478
+ */
479
+ setGravity(gravity) {
480
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
481
+ log('ParticleBatchNode.setGravity() : Particle Mode should be Gravity');
482
+ this.modeA.gravity = gravity;
483
+ }
484
+ /**
485
+ * Return Speed of each particle
486
+ * @return {Number}
487
+ */
488
+ getSpeed() {
489
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
490
+ log('ParticleBatchNode.getSpeed() : Particle Mode should be Gravity');
491
+ return this.modeA.speed;
492
+ }
493
+ /**
494
+ * Speed of each particle setter
495
+ * @param {Number} speed
496
+ */
497
+ setSpeed(speed) {
498
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
499
+ log('ParticleBatchNode.setSpeed() : Particle Mode should be Gravity');
500
+ this.modeA.speed = speed;
501
+ }
502
+ /**
503
+ * return speed variance of each particle. Only available in 'Gravity' mode.
504
+ * @return {Number}
505
+ */
506
+ getSpeedVar() {
507
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
508
+ log('ParticleBatchNode.getSpeedVar() : Particle Mode should be Gravity');
509
+ return this.modeA.speedVar;
510
+ }
511
+ /**
512
+ * speed variance of each particle setter. Only available in 'Gravity' mode.
513
+ * @param {Number} speedVar
514
+ */
515
+ setSpeedVar(speedVar) {
516
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
517
+ log('ParticleBatchNode.setSpeedVar() : Particle Mode should be Gravity');
518
+ this.modeA.speedVar = speedVar;
519
+ }
520
+ /**
521
+ * Return tangential acceleration of each particle. Only available in 'Gravity' mode.
522
+ * @return {Number}
523
+ */
524
+ getTangentialAccel() {
525
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
526
+ log('ParticleBatchNode.getTangentialAccel() : Particle Mode should be Gravity');
527
+ return this.modeA.tangentialAccel;
528
+ }
529
+ /**
530
+ * Tangential acceleration of each particle setter. Only available in 'Gravity' mode.
531
+ * @param {Number} tangentialAccel
532
+ */
533
+ setTangentialAccel(tangentialAccel) {
534
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
535
+ log('ParticleBatchNode.setTangentialAccel() : Particle Mode should be Gravity');
536
+ this.modeA.tangentialAccel = tangentialAccel;
537
+ }
538
+ /**
539
+ * Return tangential acceleration variance of each particle. Only available in 'Gravity' mode.
540
+ * @return {Number}
541
+ */
542
+ getTangentialAccelVar() {
543
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
544
+ log('ParticleBatchNode.getTangentialAccelVar() : Particle Mode should be Gravity');
545
+ return this.modeA.tangentialAccelVar;
546
+ }
547
+ /**
548
+ * tangential acceleration variance of each particle setter. Only available in 'Gravity' mode.
549
+ * @param {Number} tangentialAccelVar
550
+ */
551
+ setTangentialAccelVar(tangentialAccelVar) {
552
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
553
+ log('ParticleBatchNode.setTangentialAccelVar() : Particle Mode should be Gravity');
554
+ this.modeA.tangentialAccelVar = tangentialAccelVar;
555
+ }
556
+ /**
557
+ * Return radial acceleration of each particle. Only available in 'Gravity' mode.
558
+ * @return {Number}
559
+ */
560
+ getRadialAccel() {
561
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
562
+ log('ParticleBatchNode.getRadialAccel() : Particle Mode should be Gravity');
563
+ return this.modeA.radialAccel;
564
+ }
565
+ /**
566
+ * radial acceleration of each particle setter. Only available in 'Gravity' mode.
567
+ * @param {Number} radialAccel
568
+ */
569
+ setRadialAccel(radialAccel) {
570
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
571
+ log('ParticleBatchNode.setRadialAccel() : Particle Mode should be Gravity');
572
+ this.modeA.radialAccel = radialAccel;
573
+ }
574
+ /**
575
+ * Return radial acceleration variance of each particle. Only available in 'Gravity' mode.
576
+ * @return {Number}
577
+ */
578
+ getRadialAccelVar() {
579
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
580
+ log('ParticleBatchNode.getRadialAccelVar() : Particle Mode should be Gravity');
581
+ return this.modeA.radialAccelVar;
582
+ }
583
+ /**
584
+ * radial acceleration variance of each particle setter. Only available in 'Gravity' mode.
585
+ * @param {Number} radialAccelVar
586
+ */
587
+ setRadialAccelVar(radialAccelVar) {
588
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
589
+ log('ParticleBatchNode.setRadialAccelVar() : Particle Mode should be Gravity');
590
+ this.modeA.radialAccelVar = radialAccelVar;
591
+ }
592
+ /**
593
+ * get the rotation of each particle to its direction Only available in 'Gravity' mode.
594
+ * @returns {boolean}
595
+ */
596
+ getRotationIsDir() {
597
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
598
+ log('ParticleBatchNode.getRotationIsDir() : Particle Mode should be Gravity');
599
+ return this.modeA.rotationIsDir;
600
+ }
601
+ /**
602
+ * set the rotation of each particle to its direction Only available in 'Gravity' mode.
603
+ * @param {boolean} t
604
+ */
605
+ setRotationIsDir(t) {
606
+ if (this.emitterMode !== ParticleSystem.MODE_GRAVITY)
607
+ log('ParticleBatchNode.setRotationIsDir() : Particle Mode should be Gravity');
608
+ this.modeA.rotationIsDir = t;
609
+ }
610
+ // mode B
611
+ /**
612
+ * Return starting radius of the particles. Only available in 'Radius' mode.
613
+ * @return {Number}
614
+ */
615
+ getStartRadius() {
616
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
617
+ log('ParticleBatchNode.getStartRadius() : Particle Mode should be Radius');
618
+ return this.modeB.startRadius;
619
+ }
620
+ /**
621
+ * starting radius of the particles setter. Only available in 'Radius' mode.
622
+ * @param {Number} startRadius
623
+ */
624
+ setStartRadius(startRadius) {
625
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
626
+ log('ParticleBatchNode.setStartRadius() : Particle Mode should be Radius');
627
+ this.modeB.startRadius = startRadius;
628
+ }
629
+ /**
630
+ * Return starting radius variance of the particles. Only available in 'Radius' mode.
631
+ * @return {Number}
632
+ */
633
+ getStartRadiusVar() {
634
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
635
+ log('ParticleBatchNode.getStartRadiusVar() : Particle Mode should be Radius');
636
+ return this.modeB.startRadiusVar;
637
+ }
638
+ /**
639
+ * starting radius variance of the particles setter. Only available in 'Radius' mode.
640
+ * @param {Number} startRadiusVar
641
+ */
642
+ setStartRadiusVar(startRadiusVar) {
643
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
644
+ log('ParticleBatchNode.setStartRadiusVar() : Particle Mode should be Radius');
645
+ this.modeB.startRadiusVar = startRadiusVar;
646
+ }
647
+ /**
648
+ * Return ending radius of the particles. Only available in 'Radius' mode.
649
+ * @return {Number}
650
+ */
651
+ getEndRadius() {
652
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
653
+ log('ParticleBatchNode.getEndRadius() : Particle Mode should be Radius');
654
+ return this.modeB.endRadius;
655
+ }
656
+ /**
657
+ * ending radius of the particles setter. Only available in 'Radius' mode.
658
+ * @param {Number} endRadius
659
+ */
660
+ setEndRadius(endRadius) {
661
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
662
+ log('ParticleBatchNode.setEndRadius() : Particle Mode should be Radius');
663
+ this.modeB.endRadius = endRadius;
664
+ }
665
+ /**
666
+ * Return ending radius variance of the particles. Only available in 'Radius' mode.
667
+ * @return {Number}
668
+ */
669
+ getEndRadiusVar() {
670
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
671
+ log('ParticleBatchNode.getEndRadiusVar() : Particle Mode should be Radius');
672
+ return this.modeB.endRadiusVar;
673
+ }
674
+ /**
675
+ * ending radius variance of the particles setter. Only available in 'Radius' mode.
676
+ * @param endRadiusVar
677
+ */
678
+ setEndRadiusVar(endRadiusVar) {
679
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
680
+ log('ParticleBatchNode.setEndRadiusVar() : Particle Mode should be Radius');
681
+ this.modeB.endRadiusVar = endRadiusVar;
682
+ }
683
+ /**
684
+ * get Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
685
+ * @return {Number}
686
+ */
687
+ getRotatePerSecond() {
688
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
689
+ log('ParticleBatchNode.getRotatePerSecond() : Particle Mode should be Radius');
690
+ return this.modeB.rotatePerSecond;
691
+ }
692
+ /**
693
+ * set Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
694
+ * @param {Number} degrees
695
+ */
696
+ setRotatePerSecond(degrees) {
697
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
698
+ log('ParticleBatchNode.setRotatePerSecond() : Particle Mode should be Radius');
699
+ this.modeB.rotatePerSecond = degrees;
700
+ }
701
+ /**
702
+ * Return Variance in degrees for rotatePerSecond. Only available in 'Radius' mode.
703
+ * @return {Number}
704
+ */
705
+ getRotatePerSecondVar() {
706
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
707
+ log('ParticleBatchNode.getRotatePerSecondVar() : Particle Mode should be Radius');
708
+ return this.modeB.rotatePerSecondVar;
709
+ }
710
+ /**
711
+ * Variance in degrees for rotatePerSecond setter. Only available in 'Radius' mode.
712
+ * @param degrees
713
+ */
714
+ setRotatePerSecondVar(degrees) {
715
+ if (this.emitterMode !== ParticleSystem.MODE_RADIUS)
716
+ log('ParticleBatchNode.setRotatePerSecondVar() : Particle Mode should be Radius');
717
+ this.modeB.rotatePerSecondVar = degrees;
718
+ }
719
+ //////////////////////////////////////////////////////////////////////////
720
+ //don't use a transform matrix, this is faster
721
+ setScale(scale, scaleY) {
722
+ this._transformSystemDirty = true;
723
+ Node.prototype.setScale.call(this, scale, scaleY);
724
+ }
725
+ setRotation(newRotation) {
726
+ this._transformSystemDirty = true;
727
+ Node.prototype.setRotation.call(this, newRotation);
728
+ }
729
+ setScaleX(newScaleX) {
730
+ this._transformSystemDirty = true;
731
+ Node.prototype.setScaleX.call(this, newScaleX);
732
+ }
733
+ setScaleY(newScaleY) {
734
+ this._transformSystemDirty = true;
735
+ Node.prototype.setScaleY.call(this, newScaleY);
736
+ }
737
+ /**
738
+ * get start size in pixels of each particle
739
+ * @return {Number}
740
+ */
741
+ getStartSize() {
742
+ return this.startSize;
743
+ }
744
+ /**
745
+ * set start size in pixels of each particle
746
+ * @param {Number} startSize
747
+ */
748
+ setStartSize(startSize) {
749
+ this.startSize = startSize;
750
+ }
751
+ /**
752
+ * get size variance in pixels of each particle
753
+ * @return {Number}
754
+ */
755
+ getStartSizeVar() {
756
+ return this.startSizeVar;
757
+ }
758
+ /**
759
+ * set size variance in pixels of each particle
760
+ * @param {Number} startSizeVar
761
+ */
762
+ setStartSizeVar(startSizeVar) {
763
+ this.startSizeVar = startSizeVar;
764
+ }
765
+ /**
766
+ * get end size in pixels of each particle
767
+ * @return {Number}
768
+ */
769
+ getEndSize() {
770
+ return this.endSize;
771
+ }
772
+ /**
773
+ * set end size in pixels of each particle
774
+ * @param endSize
775
+ */
776
+ setEndSize(endSize) {
777
+ this.endSize = endSize;
778
+ }
779
+ /**
780
+ * get end size variance in pixels of each particle
781
+ * @return {Number}
782
+ */
783
+ getEndSizeVar() {
784
+ return this.endSizeVar;
785
+ }
786
+ /**
787
+ * set end size variance in pixels of each particle
788
+ * @param {Number} endSizeVar
789
+ */
790
+ setEndSizeVar(endSizeVar) {
791
+ this.endSizeVar = endSizeVar;
792
+ }
793
+ /**
794
+ * set start color of each particle
795
+ * @return {Color}
796
+ */
797
+ getStartColor() {
798
+ return color(this._startColor.r, this._startColor.g, this._startColor.b, this._startColor.a);
799
+ }
800
+ /**
801
+ * get start color of each particle
802
+ * @param {Color} startColor
803
+ */
804
+ setStartColor(startColor) {
805
+ this._startColor.r = startColor.r;
806
+ this._startColor.g = startColor.g;
807
+ this._startColor.b = startColor.b;
808
+ this._startColor.a = startColor.a;
809
+ }
810
+ /**
811
+ * get start color variance of each particle
812
+ * @return {Color}
813
+ */
814
+ getStartColorVar() {
815
+ return color(this._startColorVar.r, this._startColorVar.g, this._startColorVar.b, this._startColorVar.a);
816
+ }
817
+ /**
818
+ * set start color variance of each particle
819
+ * @param {Color} startColorVar
820
+ */
821
+ setStartColorVar(startColorVar) {
822
+ this._startColorVar.r = startColorVar.r;
823
+ this._startColorVar.g = startColorVar.g;
824
+ this._startColorVar.b = startColorVar.b;
825
+ this._startColorVar.a = startColorVar.a;
826
+ }
827
+ /**
828
+ * get end color and end color variation of each particle
829
+ * @return {Color}
830
+ */
831
+ getEndColor() {
832
+ return color(this._endColor.r, this._endColor.g, this._endColor.b, this._endColor.a);
833
+ }
834
+ /**
835
+ * set end color and end color variation of each particle
836
+ * @param {Color} endColor
837
+ */
838
+ setEndColor(endColor) {
839
+ this._endColor.r = endColor.r;
840
+ this._endColor.g = endColor.g;
841
+ this._endColor.b = endColor.b;
842
+ this._endColor.a = endColor.a;
843
+ }
844
+ /**
845
+ * get end color variance of each particle
846
+ * @return {Color}
847
+ */
848
+ getEndColorVar() {
849
+ return color(this._endColorVar.r, this._endColorVar.g, this._endColorVar.b, this._endColorVar.a);
850
+ }
851
+ /**
852
+ * set end color variance of each particle
853
+ * @param {Color} endColorVar
854
+ */
855
+ setEndColorVar(endColorVar) {
856
+ this._endColorVar.r = endColorVar.r;
857
+ this._endColorVar.g = endColorVar.g;
858
+ this._endColorVar.b = endColorVar.b;
859
+ this._endColorVar.a = endColorVar.a;
860
+ }
861
+ /**
862
+ * get initial angle of each particle
863
+ * @return {Number}
864
+ */
865
+ getStartSpin() {
866
+ return this.startSpin;
867
+ }
868
+ /**
869
+ * set initial angle of each particle
870
+ * @param {Number} startSpin
871
+ */
872
+ setStartSpin(startSpin) {
873
+ this.startSpin = startSpin;
874
+ }
875
+ /**
876
+ * get initial angle variance of each particle
877
+ * @return {Number}
878
+ */
879
+ getStartSpinVar() {
880
+ return this.startSpinVar;
881
+ }
882
+ /**
883
+ * set initial angle variance of each particle
884
+ * @param {Number} startSpinVar
885
+ */
886
+ setStartSpinVar(startSpinVar) {
887
+ this.startSpinVar = startSpinVar;
888
+ }
889
+ /**
890
+ * get end angle of each particle
891
+ * @return {Number}
892
+ */
893
+ getEndSpin() {
894
+ return this.endSpin;
895
+ }
896
+ /**
897
+ * set end angle of each particle
898
+ * @param {Number} endSpin
899
+ */
900
+ setEndSpin(endSpin) {
901
+ this.endSpin = endSpin;
902
+ }
903
+ /**
904
+ * get end angle variance of each particle
905
+ * @return {Number}
906
+ */
907
+ getEndSpinVar() {
908
+ return this.endSpinVar;
909
+ }
910
+ /**
911
+ * set end angle variance of each particle
912
+ * @param {Number} endSpinVar
913
+ */
914
+ setEndSpinVar(endSpinVar) {
915
+ this.endSpinVar = endSpinVar;
916
+ }
917
+ /**
918
+ * get emission rate of the particles
919
+ * @return {Number}
920
+ */
921
+ getEmissionRate() {
922
+ return this.emissionRate;
923
+ }
924
+ /**
925
+ * set emission rate of the particles
926
+ * @param {Number} emissionRate
927
+ */
928
+ setEmissionRate(emissionRate) {
929
+ this.emissionRate = emissionRate;
930
+ }
931
+ /**
932
+ * get maximum particles of the system
933
+ * @return {Number}
934
+ */
935
+ getTotalParticles() {
936
+ return this._totalParticles;
937
+ }
938
+ /**
939
+ * set maximum particles of the system
940
+ * @param {Number} tp totalParticles
941
+ */
942
+ setTotalParticles(tp) {
943
+ this._renderCmd.setTotalParticles(tp);
944
+ }
945
+ /**
946
+ * get Texture of Particle System
947
+ * @return {Texture2D}
948
+ */
949
+ getTexture() {
950
+ return this._texture;
951
+ }
952
+ /**
953
+ * set Texture of Particle System
954
+ * @param {Texture2D } texture
955
+ */
956
+ setTexture(texture) {
957
+ if (!texture)
958
+ return;
959
+ if (texture.isLoaded()) {
960
+ this.setTextureWithRect(texture, Rect(0, 0, texture._getWidth(), texture._getHeight()));
961
+ }
962
+ else {
963
+ this._textureLoaded = false;
964
+ texture.addEventListener('load', function (sender) {
965
+ this._textureLoaded = true;
966
+ this.setTextureWithRect(sender, Rect(0, 0, sender.width, sender.height));
967
+ }, this);
968
+ }
969
+ }
970
+ /** conforms to CocosNodeTexture protocol */
971
+ /**
972
+ * get BlendFunc of Particle System
973
+ * @return {BlendFunc}
974
+ */
975
+ getBlendFunc() {
976
+ return this._blendFunc;
977
+ }
978
+ /**
979
+ * set BlendFunc of Particle System
980
+ * @param {Number} src
981
+ * @param {Number} dst
982
+ */
983
+ setBlendFunc(src, dst) {
984
+ if (dst === undefined) {
985
+ if (this._blendFunc !== src) {
986
+ this._blendFunc = src;
987
+ this._updateBlendFunc();
988
+ }
989
+ }
990
+ else {
991
+ if (this._blendFunc.src !== src || this._blendFunc.dst !== dst) {
992
+ this._blendFunc = { src: src, dst: dst };
993
+ this._updateBlendFunc();
994
+ }
995
+ }
996
+ }
997
+ /**
998
+ * does the alpha value modify color getter
999
+ * @return {Boolean}
1000
+ */
1001
+ isOpacityModifyRGB() {
1002
+ return this._opacityModifyRGB;
1003
+ }
1004
+ /**
1005
+ * does the alpha value modify color setter
1006
+ * @param newValue
1007
+ */
1008
+ setOpacityModifyRGB(newValue) {
1009
+ this._opacityModifyRGB = newValue;
1010
+ }
1011
+ /**
1012
+ * <p>whether or not the particles are using blend additive.<br/>
1013
+ * If enabled, the following blending function will be used.<br/>
1014
+ * </p>
1015
+ * @return {Boolean}
1016
+ * @example
1017
+ * source blend function = GL_SRC_ALPHA;
1018
+ * dest blend function = GL_ONE;
1019
+ */
1020
+ isBlendAdditive() {
1021
+ return ((this._blendFunc.src === SRC_ALPHA && this._blendFunc.dst === ONE) || (this._blendFunc.src === ONE && this._blendFunc.dst === ONE));
1022
+ }
1023
+ /**
1024
+ * <p>whether or not the particles are using blend additive.<br/>
1025
+ * If enabled, the following blending function will be used.<br/>
1026
+ * </p>
1027
+ * @param {Boolean} isBlendAdditive
1028
+ */
1029
+ setBlendAdditive(isBlendAdditive) {
1030
+ const locBlendFunc = this._blendFunc;
1031
+ if (isBlendAdditive) {
1032
+ locBlendFunc.src = SRC_ALPHA;
1033
+ locBlendFunc.dst = ONE;
1034
+ }
1035
+ else {
1036
+ this._renderCmd._setBlendAdditive();
1037
+ }
1038
+ }
1039
+ /**
1040
+ * get particles movement type: Free or Grouped
1041
+ * @return {Number}
1042
+ */
1043
+ getPositionType() {
1044
+ return this.positionType;
1045
+ }
1046
+ /**
1047
+ * set particles movement type: Free or Grouped
1048
+ * @param {Number} positionType
1049
+ */
1050
+ setPositionType(positionType) {
1051
+ this.positionType = positionType;
1052
+ }
1053
+ /**
1054
+ * <p> return whether or not the node will be auto-removed when it has no particles left.<br/>
1055
+ * By default it is false.<br/>
1056
+ * </p>
1057
+ * @return {Boolean}
1058
+ */
1059
+ isAutoRemoveOnFinish() {
1060
+ return this.autoRemoveOnFinish;
1061
+ }
1062
+ /**
1063
+ * <p> set whether or not the node will be auto-removed when it has no particles left.<br/>
1064
+ * By default it is false.<br/>
1065
+ * </p>
1066
+ * @param {Boolean} isAutoRemoveOnFinish
1067
+ */
1068
+ setAutoRemoveOnFinish(isAutoRemoveOnFinish) {
1069
+ this.autoRemoveOnFinish = isAutoRemoveOnFinish;
1070
+ }
1071
+ /**
1072
+ * return kind of emitter modes
1073
+ * @return {Number}
1074
+ */
1075
+ getEmitterMode() {
1076
+ return this.emitterMode;
1077
+ }
1078
+ /**
1079
+ * <p>Switch between different kind of emitter modes:<br/>
1080
+ * - CCParticleSystem.MODE_GRAVITY: uses gravity, speed, radial and tangential acceleration<br/>
1081
+ * - CCParticleSystem.MODE_RADIUS: uses radius movement + rotation <br/>
1082
+ * </p>
1083
+ * @param {Number} emitterMode
1084
+ */
1085
+ setEmitterMode(emitterMode) {
1086
+ this.emitterMode = emitterMode;
1087
+ }
1088
+ /**
1089
+ * initializes a ParticleSystem
1090
+ */
1091
+ init() {
1092
+ return this.initWithTotalParticles(150);
1093
+ }
1094
+ /**
1095
+ * <p>
1096
+ * initializes a CCParticleSystem from a plist file. <br/>
1097
+ * This plist files can be creted manually or with Particle Designer:<br/>
1098
+ * http://particledesigner.71squared.com/
1099
+ * </p>
1100
+ * @param {String} plistFile
1101
+ * @return {boolean}
1102
+ */
1103
+ initWithFile(plistFile) {
1104
+ this._plistFile = plistFile;
1105
+ const dict = loader.getRes(plistFile);
1106
+ if (!dict) {
1107
+ log('ParticleSystem.initWithFile(): Particles: file not found');
1108
+ return false;
1109
+ }
1110
+ // XXX compute path from a path, should define a function somewhere to do it
1111
+ return this.initWithDictionary(dict, '');
1112
+ }
1113
+ /**
1114
+ * return bounding box of particle system in world space
1115
+ * @return {Rect}
1116
+ */
1117
+ getBoundingBoxToWorld() {
1118
+ return Rect(0, 0, game.canvas.width, game.canvas.height);
1119
+ }
1120
+ /**
1121
+ * initializes a particle system from a NSDictionary and the path from where to load the png
1122
+ * @param {object} dictionary
1123
+ * @param {String} dirname
1124
+ * @return {Boolean}
1125
+ */
1126
+ initWithDictionary(dictionary, dirname) {
1127
+ let ret = false;
1128
+ let buffer;
1129
+ const locValueForKey = this._valueForKey;
1130
+ const maxParticles = parseInt(locValueForKey('maxParticles', dictionary));
1131
+ // self, not super
1132
+ if (this.initWithTotalParticles(maxParticles)) {
1133
+ // angle
1134
+ this.angle = parseFloat(locValueForKey('angle', dictionary));
1135
+ this.angleVar = parseFloat(locValueForKey('angleVariance', dictionary));
1136
+ // duration
1137
+ this.duration = parseFloat(locValueForKey('duration', dictionary));
1138
+ // blend function
1139
+ this._blendFunc.src = parseInt(locValueForKey('blendFuncSource', dictionary));
1140
+ this._blendFunc.dst = parseInt(locValueForKey('blendFuncDestination', dictionary));
1141
+ // color
1142
+ const locStartColor = this._startColor;
1143
+ locStartColor.r = parseFloat(locValueForKey('startColorRed', dictionary)) * 255;
1144
+ locStartColor.g = parseFloat(locValueForKey('startColorGreen', dictionary)) * 255;
1145
+ locStartColor.b = parseFloat(locValueForKey('startColorBlue', dictionary)) * 255;
1146
+ locStartColor.a = parseFloat(locValueForKey('startColorAlpha', dictionary)) * 255;
1147
+ const locStartColorVar = this._startColorVar;
1148
+ locStartColorVar.r = parseFloat(locValueForKey('startColorVarianceRed', dictionary)) * 255;
1149
+ locStartColorVar.g = parseFloat(locValueForKey('startColorVarianceGreen', dictionary)) * 255;
1150
+ locStartColorVar.b = parseFloat(locValueForKey('startColorVarianceBlue', dictionary)) * 255;
1151
+ locStartColorVar.a = parseFloat(locValueForKey('startColorVarianceAlpha', dictionary)) * 255;
1152
+ const locEndColor = this._endColor;
1153
+ locEndColor.r = parseFloat(locValueForKey('finishColorRed', dictionary)) * 255;
1154
+ locEndColor.g = parseFloat(locValueForKey('finishColorGreen', dictionary)) * 255;
1155
+ locEndColor.b = parseFloat(locValueForKey('finishColorBlue', dictionary)) * 255;
1156
+ locEndColor.a = parseFloat(locValueForKey('finishColorAlpha', dictionary)) * 255;
1157
+ const locEndColorVar = this._endColorVar;
1158
+ locEndColorVar.r = parseFloat(locValueForKey('finishColorVarianceRed', dictionary)) * 255;
1159
+ locEndColorVar.g = parseFloat(locValueForKey('finishColorVarianceGreen', dictionary)) * 255;
1160
+ locEndColorVar.b = parseFloat(locValueForKey('finishColorVarianceBlue', dictionary)) * 255;
1161
+ locEndColorVar.a = parseFloat(locValueForKey('finishColorVarianceAlpha', dictionary)) * 255;
1162
+ // particle size
1163
+ this.startSize = parseFloat(locValueForKey('startParticleSize', dictionary));
1164
+ this.startSizeVar = parseFloat(locValueForKey('startParticleSizeVariance', dictionary));
1165
+ this.endSize = parseFloat(locValueForKey('finishParticleSize', dictionary));
1166
+ this.endSizeVar = parseFloat(locValueForKey('finishParticleSizeVariance', dictionary));
1167
+ // position
1168
+ this.setPosition(parseFloat(locValueForKey('sourcePositionx', dictionary)), parseFloat(locValueForKey('sourcePositiony', dictionary)));
1169
+ this._posVar.x = parseFloat(locValueForKey('sourcePositionVariancex', dictionary));
1170
+ this._posVar.y = parseFloat(locValueForKey('sourcePositionVariancey', dictionary));
1171
+ // Spinning
1172
+ this.startSpin = parseFloat(locValueForKey('rotationStart', dictionary));
1173
+ this.startSpinVar = parseFloat(locValueForKey('rotationStartVariance', dictionary));
1174
+ this.endSpin = parseFloat(locValueForKey('rotationEnd', dictionary));
1175
+ this.endSpinVar = parseFloat(locValueForKey('rotationEndVariance', dictionary));
1176
+ this.emitterMode = parseInt(locValueForKey('emitterType', dictionary));
1177
+ // Mode A: Gravity + tangential accel + radial accel
1178
+ if (this.emitterMode === ParticleSystem.MODE_GRAVITY) {
1179
+ const locModeA = this.modeA;
1180
+ // gravity
1181
+ locModeA.gravity.x = parseFloat(locValueForKey('gravityx', dictionary));
1182
+ locModeA.gravity.y = parseFloat(locValueForKey('gravityy', dictionary));
1183
+ // speed
1184
+ locModeA.speed = parseFloat(locValueForKey('speed', dictionary));
1185
+ locModeA.speedVar = parseFloat(locValueForKey('speedVariance', dictionary));
1186
+ // radial acceleration
1187
+ let pszTmp = locValueForKey('radialAcceleration', dictionary);
1188
+ locModeA.radialAccel = pszTmp ? parseFloat(pszTmp) : 0;
1189
+ pszTmp = locValueForKey('radialAccelVariance', dictionary);
1190
+ locModeA.radialAccelVar = pszTmp ? parseFloat(pszTmp) : 0;
1191
+ // tangential acceleration
1192
+ pszTmp = locValueForKey('tangentialAcceleration', dictionary);
1193
+ locModeA.tangentialAccel = pszTmp ? parseFloat(pszTmp) : 0;
1194
+ pszTmp = locValueForKey('tangentialAccelVariance', dictionary);
1195
+ locModeA.tangentialAccelVar = pszTmp ? parseFloat(pszTmp) : 0;
1196
+ // rotation is dir
1197
+ let locRotationIsDir = locValueForKey('rotationIsDir', dictionary);
1198
+ if (locRotationIsDir !== null) {
1199
+ locRotationIsDir = locRotationIsDir.toString().toLowerCase();
1200
+ locModeA.rotationIsDir = locRotationIsDir === 'true' || locRotationIsDir === '1';
1201
+ }
1202
+ else {
1203
+ locModeA.rotationIsDir = false;
1204
+ }
1205
+ }
1206
+ else if (this.emitterMode === ParticleSystem.MODE_RADIUS) {
1207
+ // or Mode B: radius movement
1208
+ const locModeB = this.modeB;
1209
+ locModeB.startRadius = parseFloat(locValueForKey('maxRadius', dictionary));
1210
+ locModeB.startRadiusVar = parseFloat(locValueForKey('maxRadiusVariance', dictionary));
1211
+ locModeB.endRadius = parseFloat(locValueForKey('minRadius', dictionary));
1212
+ locModeB.endRadiusVar = 0;
1213
+ locModeB.rotatePerSecond = parseFloat(locValueForKey('rotatePerSecond', dictionary));
1214
+ locModeB.rotatePerSecondVar = parseFloat(locValueForKey('rotatePerSecondVariance', dictionary));
1215
+ }
1216
+ else {
1217
+ log('ParticleSystem.initWithDictionary(): Invalid emitterType in config file');
1218
+ return false;
1219
+ }
1220
+ // life span
1221
+ this.life = parseFloat(locValueForKey('particleLifespan', dictionary));
1222
+ this.lifeVar = parseFloat(locValueForKey('particleLifespanVariance', dictionary));
1223
+ // emission Rate
1224
+ this.emissionRate = this._totalParticles / this.life;
1225
+ //don't get the internal texture if a batchNode is used
1226
+ if (!this._batchNode) {
1227
+ // Set a compatible default for the alpha transfer
1228
+ this._opacityModifyRGB = false;
1229
+ // texture
1230
+ // Try to get the texture from the cache
1231
+ const textureName = locValueForKey('textureFileName', dictionary);
1232
+ const imgPath = path.changeBasename(this._plistFile, textureName);
1233
+ let tex = textureCache.getTextureForKey(imgPath);
1234
+ if (tex) {
1235
+ this.setTexture(tex);
1236
+ }
1237
+ else {
1238
+ const textureData = locValueForKey('textureImageData', dictionary);
1239
+ if (!textureData || textureData.length === 0) {
1240
+ tex = textureCache.addImage(imgPath);
1241
+ if (!tex)
1242
+ return false;
1243
+ this.setTexture(tex);
1244
+ }
1245
+ else {
1246
+ buffer = unzipBase64AsArray(textureData, 1);
1247
+ if (!buffer) {
1248
+ log('ParticleSystem: error decoding or ungzipping textureImageData');
1249
+ return false;
1250
+ }
1251
+ const imageFormat = getImageFormatByData(buffer);
1252
+ if (imageFormat !== FMT_PNG) {
1253
+ log('ParticleSystem: unknown image format with Data');
1254
+ return false;
1255
+ }
1256
+ const canvasObj = document.createElement('canvas');
1257
+ if (imageFormat === FMT_PNG) {
1258
+ const myPngObj = new PNGReader(buffer);
1259
+ myPngObj.render(canvasObj);
1260
+ // } else {
1261
+ // const myTIFFObj = tiffReader
1262
+ // myTIFFObj.parseTIFF(buffer, canvasObj)
1263
+ }
1264
+ textureCache.cacheImage(imgPath, canvasObj);
1265
+ const addTexture = textureCache.getTextureForKey(imgPath);
1266
+ if (!addTexture)
1267
+ log('ParticleSystem.initWithDictionary() : error loading the texture');
1268
+ this.setTexture(addTexture);
1269
+ }
1270
+ }
1271
+ }
1272
+ ret = true;
1273
+ }
1274
+ return ret;
1275
+ }
1276
+ /**
1277
+ * Initializes a system with a fixed number of particles
1278
+ * @param {Number} numberOfParticles
1279
+ * @return {Boolean}
1280
+ */
1281
+ initWithTotalParticles(numberOfParticles) {
1282
+ this._totalParticles = numberOfParticles;
1283
+ let i;
1284
+ const locParticles = this._particles;
1285
+ locParticles.length = 0;
1286
+ for (i = 0; i < numberOfParticles; i++) {
1287
+ locParticles[i] = new Particle();
1288
+ }
1289
+ if (!locParticles) {
1290
+ log('Particle system: not enough memory');
1291
+ return false;
1292
+ }
1293
+ this._allocatedParticles = numberOfParticles;
1294
+ if (this._batchNode)
1295
+ for (i = 0; i < this._totalParticles; i++)
1296
+ locParticles[i].atlasIndex = i;
1297
+ // default, active
1298
+ this._isActive = true;
1299
+ // default blend function
1300
+ this._blendFunc.src = BLEND_SRC;
1301
+ this._blendFunc.dst = BLEND_DST;
1302
+ // default movement type;
1303
+ this.positionType = ParticleSystem.TYPE_FREE;
1304
+ // by default be in mode A:
1305
+ this.emitterMode = ParticleSystem.MODE_GRAVITY;
1306
+ // default: modulate
1307
+ // XXX: not used
1308
+ // colorModulate = YES;
1309
+ this.autoRemoveOnFinish = false;
1310
+ //for batchNode
1311
+ this._transformSystemDirty = false;
1312
+ // udpate after action in run!
1313
+ this.scheduleUpdateWithPriority(1);
1314
+ this._renderCmd._initWithTotalParticles(numberOfParticles);
1315
+ return true;
1316
+ }
1317
+ /**
1318
+ * Unschedules the "update" method.
1319
+ * @function
1320
+ * @see scheduleUpdate();
1321
+ */
1322
+ destroyParticleSystem() {
1323
+ this.unscheduleUpdate();
1324
+ }
1325
+ /**
1326
+ * Add a particle to the emitter
1327
+ * @return {Boolean}
1328
+ */
1329
+ addParticle() {
1330
+ if (this.isFull())
1331
+ return false;
1332
+ const particle = this._renderCmd.addParticle();
1333
+ this.initParticle(particle);
1334
+ ++this.particleCount;
1335
+ return true;
1336
+ }
1337
+ /**
1338
+ * Initializes a particle
1339
+ * @param {Particle} particle
1340
+ */
1341
+ initParticle(particle) {
1342
+ const locRandomMinus11 = randomMinus1To1;
1343
+ // timeToLive
1344
+ // no negative life. prevent division by 0
1345
+ particle.timeToLive = this.life + this.lifeVar * locRandomMinus11();
1346
+ particle.timeToLive = Math.max(0, particle.timeToLive);
1347
+ // position
1348
+ particle.pos.x = this._sourcePosition.x + this._posVar.x * locRandomMinus11();
1349
+ particle.pos.y = this._sourcePosition.y + this._posVar.y * locRandomMinus11();
1350
+ // Color
1351
+ const locStartColor = this._startColor, locStartColorVar = this._startColorVar;
1352
+ const locEndColor = this._endColor, locEndColorVar = this._endColorVar;
1353
+ const start = {
1354
+ r: clampf(locStartColor.r + locStartColorVar.r * locRandomMinus11(), 0, 255),
1355
+ g: clampf(locStartColor.g + locStartColorVar.g * locRandomMinus11(), 0, 255),
1356
+ b: clampf(locStartColor.b + locStartColorVar.b * locRandomMinus11(), 0, 255),
1357
+ a: clampf(locStartColor.a + locStartColorVar.a * locRandomMinus11(), 0, 255),
1358
+ };
1359
+ const end = {
1360
+ r: clampf(locEndColor.r + locEndColorVar.r * locRandomMinus11(), 0, 255),
1361
+ g: clampf(locEndColor.g + locEndColorVar.g * locRandomMinus11(), 0, 255),
1362
+ b: clampf(locEndColor.b + locEndColorVar.b * locRandomMinus11(), 0, 255),
1363
+ a: clampf(locEndColor.a + locEndColorVar.a * locRandomMinus11(), 0, 255),
1364
+ };
1365
+ particle.color = start;
1366
+ const locParticleDeltaColor = particle.deltaColor, locParticleTimeToLive = particle.timeToLive;
1367
+ locParticleDeltaColor.r = (end.r - start.r) / locParticleTimeToLive;
1368
+ locParticleDeltaColor.g = (end.g - start.g) / locParticleTimeToLive;
1369
+ locParticleDeltaColor.b = (end.b - start.b) / locParticleTimeToLive;
1370
+ locParticleDeltaColor.a = (end.a - start.a) / locParticleTimeToLive;
1371
+ // size
1372
+ let startS = this.startSize + this.startSizeVar * locRandomMinus11();
1373
+ startS = Math.max(0, startS); // No negative value
1374
+ particle.size = startS;
1375
+ if (this.endSize === ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE) {
1376
+ particle.deltaSize = 0;
1377
+ }
1378
+ else {
1379
+ let endS = this.endSize + this.endSizeVar * locRandomMinus11();
1380
+ endS = Math.max(0, endS); // No negative values
1381
+ particle.deltaSize = (endS - startS) / locParticleTimeToLive;
1382
+ }
1383
+ // rotation
1384
+ const startA = this.startSpin + this.startSpinVar * locRandomMinus11();
1385
+ const endA = this.endSpin + this.endSpinVar * locRandomMinus11();
1386
+ particle.rotation = startA;
1387
+ particle.deltaRotation = (endA - startA) / locParticleTimeToLive;
1388
+ // position
1389
+ if (this.positionType === ParticleSystem.TYPE_FREE)
1390
+ particle.startPos = this.convertToWorldSpace(this._pointZeroForParticle);
1391
+ else if (this.positionType === ParticleSystem.TYPE_RELATIVE) {
1392
+ particle.startPos.x = this._position.x;
1393
+ particle.startPos.y = this._position.y;
1394
+ }
1395
+ // direction
1396
+ const a = degreesToRadians(this.angle + this.angleVar * locRandomMinus11());
1397
+ // Mode Gravity: A
1398
+ if (this.emitterMode === ParticleSystem.MODE_GRAVITY) {
1399
+ const locModeA = this.modeA, locParticleModeA = particle.modeA;
1400
+ const s = locModeA.speed + locModeA.speedVar * locRandomMinus11();
1401
+ // direction
1402
+ locParticleModeA.dir.x = Math.cos(a);
1403
+ locParticleModeA.dir.y = Math.sin(a);
1404
+ pMultIn(locParticleModeA.dir, s);
1405
+ // radial accel
1406
+ locParticleModeA.radialAccel = locModeA.radialAccel + locModeA.radialAccelVar * locRandomMinus11();
1407
+ // tangential accel
1408
+ locParticleModeA.tangentialAccel = locModeA.tangentialAccel + locModeA.tangentialAccelVar * locRandomMinus11();
1409
+ // rotation is dir
1410
+ if (locModeA.rotationIsDir)
1411
+ particle.rotation = -radiansToDegrees(pToAngle(locParticleModeA.dir));
1412
+ }
1413
+ else {
1414
+ // Mode Radius: B
1415
+ const locModeB = this.modeB, locParitlceModeB = particle.modeB;
1416
+ // Set the default diameter of the particle from the source position
1417
+ const startRadius = locModeB.startRadius + locModeB.startRadiusVar * locRandomMinus11();
1418
+ const endRadius = locModeB.endRadius + locModeB.endRadiusVar * locRandomMinus11();
1419
+ locParitlceModeB.radius = startRadius;
1420
+ locParitlceModeB.deltaRadius =
1421
+ locModeB.endRadius === ParticleSystem.START_RADIUS_EQUAL_TO_END_RADIUS ? 0 : (endRadius - startRadius) / locParticleTimeToLive;
1422
+ locParitlceModeB.angle = a;
1423
+ locParitlceModeB.degreesPerSecond = degreesToRadians(locModeB.rotatePerSecond + locModeB.rotatePerSecondVar * locRandomMinus11());
1424
+ }
1425
+ }
1426
+ /**
1427
+ * stop emitting particles. Running particles will continue to run until they die
1428
+ */
1429
+ stopSystem() {
1430
+ this._isActive = false;
1431
+ this._elapsed = this.duration;
1432
+ this._emitCounter = 0;
1433
+ }
1434
+ /**
1435
+ * Kill all living particles.
1436
+ */
1437
+ resetSystem() {
1438
+ this._isActive = true;
1439
+ this._elapsed = 0;
1440
+ const locParticles = this._particles;
1441
+ for (this._particleIdx = 0; this._particleIdx < this.particleCount; ++this._particleIdx)
1442
+ locParticles[this._particleIdx].timeToLive = 0;
1443
+ }
1444
+ /**
1445
+ * whether or not the system is full
1446
+ * @return {Boolean}
1447
+ */
1448
+ isFull() {
1449
+ return this.particleCount >= this._totalParticles;
1450
+ }
1451
+ /**
1452
+ * should be overridden by subclasses
1453
+ * @param {Particle} particle
1454
+ * @param {Point} newPosition
1455
+ */
1456
+ updateQuadWithParticle(particle, newPosition) {
1457
+ this._renderCmd.updateQuadWithParticle(particle, newPosition);
1458
+ }
1459
+ /**
1460
+ * should be overridden by subclasses
1461
+ */
1462
+ postStep() {
1463
+ this._renderCmd.postStep();
1464
+ }
1465
+ /**
1466
+ * update emitter's status
1467
+ * @override
1468
+ * @param {Number} dt delta time
1469
+ */
1470
+ update(dt) {
1471
+ if (this._isActive && this.emissionRate) {
1472
+ const rate = 1.0 / this.emissionRate;
1473
+ //issue #1201, prevent bursts of particles, due to too high emitCounter
1474
+ if (this.particleCount < this._totalParticles)
1475
+ this._emitCounter += dt;
1476
+ while (this.particleCount < this._totalParticles && this._emitCounter > rate) {
1477
+ this.addParticle();
1478
+ this._emitCounter -= rate;
1479
+ }
1480
+ this._elapsed += dt;
1481
+ if (this.duration !== -1 && this.duration < this._elapsed)
1482
+ this.stopSystem();
1483
+ }
1484
+ this._particleIdx = 0;
1485
+ const currentPosition = Particle.TemporaryPoints[0];
1486
+ if (this.positionType === ParticleSystem.TYPE_FREE) {
1487
+ pIn(currentPosition, this.convertToWorldSpace(this._pointZeroForParticle));
1488
+ }
1489
+ else if (this.positionType === ParticleSystem.TYPE_RELATIVE) {
1490
+ currentPosition.x = this._position.x;
1491
+ currentPosition.y = this._position.y;
1492
+ }
1493
+ if (this._visible) {
1494
+ // Used to reduce memory allocation / creation within the loop
1495
+ const tpa = Particle.TemporaryPoints[1], tpb = Particle.TemporaryPoints[2], tpc = Particle.TemporaryPoints[3];
1496
+ const locParticles = this._particles;
1497
+ while (this._particleIdx < this.particleCount) {
1498
+ // Reset the working particles
1499
+ pZeroIn(tpa);
1500
+ pZeroIn(tpb);
1501
+ pZeroIn(tpc);
1502
+ const selParticle = locParticles[this._particleIdx];
1503
+ // life
1504
+ selParticle.timeToLive -= dt;
1505
+ if (selParticle.timeToLive > 0) {
1506
+ // Mode A: gravity, direction, tangential accel & radial accel
1507
+ if (this.emitterMode === ParticleSystem.MODE_GRAVITY) {
1508
+ const tmp = tpc, radial = tpa, tangential = tpb;
1509
+ // radial acceleration
1510
+ if (selParticle.pos.x || selParticle.pos.y) {
1511
+ pIn(radial, selParticle.pos);
1512
+ pNormalizeIn(radial);
1513
+ }
1514
+ else {
1515
+ pZeroIn(radial);
1516
+ }
1517
+ pIn(tangential, radial);
1518
+ pMultIn(radial, selParticle.modeA.radialAccel);
1519
+ // tangential acceleration
1520
+ const newy = tangential.x;
1521
+ tangential.x = -tangential.y;
1522
+ tangential.y = newy;
1523
+ pMultIn(tangential, selParticle.modeA.tangentialAccel);
1524
+ pIn(tmp, radial);
1525
+ pAddIn(tmp, tangential);
1526
+ pAddIn(tmp, this.modeA.gravity);
1527
+ pMultIn(tmp, dt);
1528
+ pAddIn(selParticle.modeA.dir, tmp);
1529
+ pIn(tmp, selParticle.modeA.dir);
1530
+ pMultIn(tmp, dt);
1531
+ pAddIn(selParticle.pos, tmp);
1532
+ }
1533
+ else {
1534
+ // Mode B: radius movement
1535
+ const selModeB = selParticle.modeB;
1536
+ // Update the angle and radius of the particle.
1537
+ selModeB.angle += selModeB.degreesPerSecond * dt;
1538
+ selModeB.radius += selModeB.deltaRadius * dt;
1539
+ selParticle.pos.x = -Math.cos(selModeB.angle) * selModeB.radius;
1540
+ selParticle.pos.y = -Math.sin(selModeB.angle) * selModeB.radius;
1541
+ }
1542
+ // color
1543
+ this._renderCmd._updateDeltaColor(selParticle, dt);
1544
+ // size
1545
+ selParticle.size += selParticle.deltaSize * dt;
1546
+ selParticle.size = Math.max(0, selParticle.size);
1547
+ // angle
1548
+ selParticle.rotation += selParticle.deltaRotation * dt;
1549
+ //
1550
+ // update values in quad
1551
+ //
1552
+ const newPos = tpa;
1553
+ if (this.positionType === ParticleSystem.TYPE_FREE || this.positionType === ParticleSystem.TYPE_RELATIVE) {
1554
+ const diff = tpb;
1555
+ pIn(diff, currentPosition);
1556
+ pSubIn(diff, selParticle.startPos);
1557
+ pIn(newPos, selParticle.pos);
1558
+ pSubIn(newPos, diff);
1559
+ }
1560
+ else {
1561
+ pIn(newPos, selParticle.pos);
1562
+ }
1563
+ // translate newPos to correct position, since matrix transform isn't performed in batchnode
1564
+ // don't update the particle with the new position information, it will interfere with the radius and tangential calculations
1565
+ if (this._batchNode) {
1566
+ newPos.x += this._position.x;
1567
+ newPos.y += this._position.y;
1568
+ }
1569
+ this._renderCmd.updateParticlePosition(selParticle, newPos);
1570
+ // update particle counter
1571
+ ++this._particleIdx;
1572
+ }
1573
+ else {
1574
+ // life < 0
1575
+ const currentIndex = selParticle.atlasIndex;
1576
+ if (this._particleIdx !== this.particleCount - 1) {
1577
+ const deadParticle = locParticles[this._particleIdx];
1578
+ locParticles[this._particleIdx] = locParticles[this.particleCount - 1];
1579
+ locParticles[this.particleCount - 1] = deadParticle;
1580
+ }
1581
+ if (this._batchNode) {
1582
+ //disable the switched particle
1583
+ this._batchNode.disableParticle(this.atlasIndex + currentIndex);
1584
+ //switch indexes
1585
+ locParticles[this.particleCount - 1].atlasIndex = currentIndex;
1586
+ }
1587
+ --this.particleCount;
1588
+ if (this.particleCount === 0 && this.autoRemoveOnFinish) {
1589
+ this.unscheduleUpdate();
1590
+ this._parent.removeChild(this, true);
1591
+ return;
1592
+ }
1593
+ }
1594
+ }
1595
+ this._transformSystemDirty = false;
1596
+ }
1597
+ if (!this._batchNode)
1598
+ this.postStep();
1599
+ }
1600
+ /**
1601
+ * update emitter's status (dt = 0)
1602
+ */
1603
+ updateWithNoTime() {
1604
+ this.update(0);
1605
+ }
1606
+ //
1607
+ // return the string found by key in dict.
1608
+ // @param {string} key
1609
+ // @param {object} dict
1610
+ // @return {String} "" if not found; return the string if found.
1611
+ // @private
1612
+ //
1613
+ _valueForKey(key, dict) {
1614
+ if (dict) {
1615
+ const pString = dict[key];
1616
+ return pString != null ? pString : '';
1617
+ }
1618
+ return '';
1619
+ }
1620
+ _updateBlendFunc() {
1621
+ if (this._batchNode) {
1622
+ log('Cannot change blending functions when the particle is being batched');
1623
+ return;
1624
+ }
1625
+ const locTexture = this._texture;
1626
+ if (locTexture && locTexture instanceof Texture2D) {
1627
+ this._opacityModifyRGB = false;
1628
+ const locBlendFunc = this._blendFunc;
1629
+ if (locBlendFunc.src === BLEND_SRC && locBlendFunc.dst === BLEND_DST) {
1630
+ if (locTexture.hasPremultipliedAlpha()) {
1631
+ this._opacityModifyRGB = true;
1632
+ }
1633
+ else {
1634
+ locBlendFunc.src = SRC_ALPHA;
1635
+ locBlendFunc.dst = ONE_MINUS_SRC_ALPHA;
1636
+ }
1637
+ }
1638
+ }
1639
+ }
1640
+ /**
1641
+ * to copy object with deep copy.
1642
+ * returns a clone of action.
1643
+ *
1644
+ * @return {ParticleSystem}
1645
+ */
1646
+ clone() {
1647
+ const retParticle = new ParticleSystem();
1648
+ // self, not super
1649
+ if (retParticle.initWithTotalParticles(this.getTotalParticles())) {
1650
+ // angle
1651
+ retParticle.setAngle(this.getAngle());
1652
+ retParticle.setAngleVar(this.getAngleVar());
1653
+ // duration
1654
+ retParticle.setDuration(this.getDuration());
1655
+ // blend function
1656
+ const blend = this.getBlendFunc();
1657
+ retParticle.setBlendFunc(blend.src, blend.dst);
1658
+ // color
1659
+ retParticle.setStartColor(this.getStartColor());
1660
+ retParticle.setStartColorVar(this.getStartColorVar());
1661
+ retParticle.setEndColor(this.getEndColor());
1662
+ retParticle.setEndColorVar(this.getEndColorVar());
1663
+ // this size
1664
+ retParticle.setStartSize(this.getStartSize());
1665
+ retParticle.setStartSizeVar(this.getStartSizeVar());
1666
+ retParticle.setEndSize(this.getEndSize());
1667
+ retParticle.setEndSizeVar(this.getEndSizeVar());
1668
+ // position
1669
+ retParticle.setPosition(p(this.getPositionX(), this.getPositionY()));
1670
+ retParticle.setPosVar(p(this.getPosVar().x, this.getPosVar().y));
1671
+ retParticle.setPositionType(this.getPositionType());
1672
+ // Spinning
1673
+ retParticle.setStartSpin(this.getStartSpin() || 0);
1674
+ retParticle.setStartSpinVar(this.getStartSpinVar() || 0);
1675
+ retParticle.setEndSpin(this.getEndSpin() || 0);
1676
+ retParticle.setEndSpinVar(this.getEndSpinVar() || 0);
1677
+ retParticle.setEmitterMode(this.getEmitterMode());
1678
+ // Mode A: Gravity + tangential accel + radial accel
1679
+ if (this.getEmitterMode() === ParticleSystem.MODE_GRAVITY) {
1680
+ // gravity
1681
+ const gra = this.getGravity();
1682
+ retParticle.setGravity(p(gra.x, gra.y));
1683
+ // speed
1684
+ retParticle.setSpeed(this.getSpeed());
1685
+ retParticle.setSpeedVar(this.getSpeedVar());
1686
+ // radial acceleration
1687
+ retParticle.setRadialAccel(this.getRadialAccel());
1688
+ retParticle.setRadialAccelVar(this.getRadialAccelVar());
1689
+ // tangential acceleration
1690
+ retParticle.setTangentialAccel(this.getTangentialAccel());
1691
+ retParticle.setTangentialAccelVar(this.getTangentialAccelVar());
1692
+ }
1693
+ else if (this.getEmitterMode() === ParticleSystem.MODE_RADIUS) {
1694
+ // or Mode B: radius movement
1695
+ retParticle.setStartRadius(this.getStartRadius());
1696
+ retParticle.setStartRadiusVar(this.getStartRadiusVar());
1697
+ retParticle.setEndRadius(this.getEndRadius());
1698
+ retParticle.setEndRadiusVar(this.getEndRadiusVar());
1699
+ retParticle.setRotatePerSecond(this.getRotatePerSecond());
1700
+ retParticle.setRotatePerSecondVar(this.getRotatePerSecondVar());
1701
+ }
1702
+ // life span
1703
+ retParticle.setLife(this.getLife());
1704
+ retParticle.setLifeVar(this.getLifeVar());
1705
+ // emission Rate
1706
+ retParticle.setEmissionRate(this.getEmissionRate());
1707
+ //don't get the internal texture if a batchNode is used
1708
+ if (!this.getBatchNode()) {
1709
+ // Set a compatible default for the alpha transfer
1710
+ retParticle.setOpacityModifyRGB(this.isOpacityModifyRGB());
1711
+ // texture
1712
+ const texture = this.getTexture();
1713
+ if (texture) {
1714
+ const size = texture.getContentSize();
1715
+ retParticle.setTextureWithRect(texture, Rect(0, 0, size.width, size.height));
1716
+ }
1717
+ }
1718
+ }
1719
+ return retParticle;
1720
+ }
1721
+ /**
1722
+ * <p> Sets a new CCSpriteFrame as particle.</br>
1723
+ * WARNING: this method is experimental. Use setTextureWithRect instead.
1724
+ * </p>
1725
+ * @param {SpriteFrame} spriteFrame
1726
+ */
1727
+ setDisplayFrame(spriteFrame) {
1728
+ if (!spriteFrame)
1729
+ return;
1730
+ const locOffset = spriteFrame.getOffsetInPixels();
1731
+ if (locOffset.x !== 0 || locOffset.y !== 0)
1732
+ log('ParticleSystem.setDisplayFrame(): QuadParticle only supports SpriteFrames with no offsets');
1733
+ // update texture before updating texture rect
1734
+ const texture = spriteFrame.getTexture(), locTexture = this._texture;
1735
+ if (locTexture !== texture)
1736
+ this.setTexture(texture);
1737
+ }
1738
+ /**
1739
+ * Sets a new texture with a rect. The rect is in Points.
1740
+ * @param {Texture2D} texture
1741
+ * @param {Rect} rect
1742
+ */
1743
+ setTextureWithRect(texture, rect) {
1744
+ const locTexture = this._texture;
1745
+ if (locTexture !== texture) {
1746
+ this._texture = texture;
1747
+ this._updateBlendFunc();
1748
+ }
1749
+ this.initTexCoordsWithRect(rect);
1750
+ }
1751
+ /**
1752
+ * listen the event that coming to foreground on Android (An empty function for native)
1753
+ * @param {Class} obj
1754
+ */
1755
+ listenBackToForeground(obj) {
1756
+ //do nothing
1757
+ }
1758
+ get opacityModifyRGB() {
1759
+ return this.isOpacityModifyRGB();
1760
+ }
1761
+ set opacityModifyRGB(value) {
1762
+ this.setOpacityModifyRGB(value);
1763
+ }
1764
+ get batchNode() {
1765
+ return this.getBatchNode();
1766
+ }
1767
+ set batchNode(value) {
1768
+ this.setBatchNode(value);
1769
+ }
1770
+ get drawMode() {
1771
+ return this.getDrawMode();
1772
+ }
1773
+ set drawMode(value) {
1774
+ this.setDrawMode(value);
1775
+ }
1776
+ get shapeType() {
1777
+ return this.getShapeType();
1778
+ }
1779
+ set shapeType(value) {
1780
+ this.setShapeType(value);
1781
+ }
1782
+ get active() {
1783
+ return this.isActive();
1784
+ }
1785
+ get sourcePos() {
1786
+ return this.getSourcePosition();
1787
+ }
1788
+ set sourcePos(value) {
1789
+ this.setSourcePosition(value);
1790
+ }
1791
+ get posVar() {
1792
+ return this.getPosVar();
1793
+ }
1794
+ set posVar(value) {
1795
+ this.setPosVar(value);
1796
+ }
1797
+ get gravity() {
1798
+ return this.getGravity();
1799
+ }
1800
+ set gravity(value) {
1801
+ this.setGravity(value);
1802
+ }
1803
+ get speed() {
1804
+ return this.getSpeed();
1805
+ }
1806
+ set speed(value) {
1807
+ this.setSpeed(value);
1808
+ }
1809
+ get speedVar() {
1810
+ return this.getSpeedVar();
1811
+ }
1812
+ set speedVar(value) {
1813
+ this.setSpeedVar(value);
1814
+ }
1815
+ get tangentialAccel() {
1816
+ return this.getTangentialAccel();
1817
+ }
1818
+ set tangentialAccel(value) {
1819
+ this.setTangentialAccel(value);
1820
+ }
1821
+ get tangentialAccelVar() {
1822
+ return this.getTangentialAccelVar();
1823
+ }
1824
+ set tangentialAccelVar(value) {
1825
+ this.setTangentialAccelVar(value);
1826
+ }
1827
+ get radialAccel() {
1828
+ return this.getRadialAccel();
1829
+ }
1830
+ set radialAccel(value) {
1831
+ this.setRadialAccel(value);
1832
+ }
1833
+ get radialAccelVar() {
1834
+ return this.getRadialAccelVar();
1835
+ }
1836
+ set radialAccelVar(value) {
1837
+ this.setRadialAccelVar(value);
1838
+ }
1839
+ get rotationIsDir() {
1840
+ return this.getRotationIsDir();
1841
+ }
1842
+ set rotationIsDir(value) {
1843
+ this.setRotationIsDir(value);
1844
+ }
1845
+ get startRadius() {
1846
+ return this.getStartRadius();
1847
+ }
1848
+ set startRadius(value) {
1849
+ this.setStartRadius(value);
1850
+ }
1851
+ get startRadiusVar() {
1852
+ return this.getStartRadiusVar();
1853
+ }
1854
+ set startRadiusVar(value) {
1855
+ this.setStartRadiusVar(value);
1856
+ }
1857
+ get endRadius() {
1858
+ return this.getEndRadius();
1859
+ }
1860
+ set endRadius(value) {
1861
+ this.setEndRadius(value);
1862
+ }
1863
+ get endRadiusVar() {
1864
+ return this.getEndRadiusVar();
1865
+ }
1866
+ set endRadiusVar(value) {
1867
+ this.setEndRadiusVar(value);
1868
+ }
1869
+ get rotatePerS() {
1870
+ return this.getRotatePerSecond();
1871
+ }
1872
+ set rotatePerS(value) {
1873
+ this.setRotatePerSecond(value);
1874
+ }
1875
+ get rotatePerSVar() {
1876
+ return this.getRotatePerSecondVar();
1877
+ }
1878
+ set rotatePerSVar(value) {
1879
+ this.setRotatePerSecondVar(value);
1880
+ }
1881
+ get startColor() {
1882
+ return this.getStartColor();
1883
+ }
1884
+ set startColor(value) {
1885
+ this.setStartColor(value);
1886
+ }
1887
+ get startColorVar() {
1888
+ return this.getStartColorVar();
1889
+ }
1890
+ set startColorVar(value) {
1891
+ this.setStartColorVar(value);
1892
+ }
1893
+ get endColor() {
1894
+ return this.getEndColor();
1895
+ }
1896
+ set endColor(value) {
1897
+ this.setEndColor(value);
1898
+ }
1899
+ get endColorVar() {
1900
+ return this.getEndColorVar();
1901
+ }
1902
+ set endColorVar(value) {
1903
+ this.setEndColorVar(value);
1904
+ }
1905
+ get totalParticles() {
1906
+ return this.getTotalParticles();
1907
+ }
1908
+ set totalParticles(value) {
1909
+ this.setTotalParticles(value);
1910
+ }
1911
+ get texture() {
1912
+ return this.getTexture();
1913
+ }
1914
+ set texture(value) {
1915
+ this.setTexture(value);
1916
+ }
1917
+ /**
1918
+ * Shape Mode of Particle Draw
1919
+ * @constant
1920
+ * @type Number
1921
+ */
1922
+ static SHAPE_MODE = 0;
1923
+ /**
1924
+ * Texture Mode of Particle Draw
1925
+ * @constant
1926
+ * @type Number
1927
+ */
1928
+ static TEXTURE_MODE = 1;
1929
+ /**
1930
+ * Star Shape for ShapeMode of Particle
1931
+ * @constant
1932
+ * @type Number
1933
+ */
1934
+ static STAR_SHAPE = 0;
1935
+ /**
1936
+ * Ball Shape for ShapeMode of Particle
1937
+ * @constant
1938
+ * @type Number
1939
+ */
1940
+ static BALL_SHAPE = 1;
1941
+ /**
1942
+ * The Particle emitter lives forever
1943
+ * @constant
1944
+ * @type Number
1945
+ */
1946
+ static DURATION_INFINITY = -1;
1947
+ /**
1948
+ * The starting size of the particle is equal to the ending size
1949
+ * @constant
1950
+ * @type Number
1951
+ */
1952
+ static START_SIZE_EQUAL_TO_END_SIZE = -1;
1953
+ /**
1954
+ * The starting radius of the particle is equal to the ending radius
1955
+ * @constant
1956
+ * @type Number
1957
+ */
1958
+ static START_RADIUS_EQUAL_TO_END_RADIUS = -1;
1959
+ /**
1960
+ * Gravity mode (A mode)
1961
+ * @constant
1962
+ * @type Number
1963
+ */
1964
+ static MODE_GRAVITY = 0;
1965
+ /**
1966
+ * Radius mode (B mode)
1967
+ * @constant
1968
+ * @type Number
1969
+ */
1970
+ static MODE_RADIUS = 1;
1971
+ /**
1972
+ * Living particles are attached to the world and are unaffected by emitter repositioning.
1973
+ * @constant
1974
+ * @type Number
1975
+ */
1976
+ static TYPE_FREE = 0;
1977
+ /**
1978
+ * Living particles are attached to the world but will follow the emitter repositioning.<br/>
1979
+ * Use case: Attach an emitter to an sprite, and you want that the emitter follows the sprite.
1980
+ * @constant
1981
+ * @type Number
1982
+ */
1983
+ static TYPE_RELATIVE = 1;
1984
+ /**
1985
+ * Living particles are attached to the emitter and are translated along with it.
1986
+ * @constant
1987
+ * @type Number
1988
+ */
1989
+ static TYPE_GROUPED = 2;
1990
+ }
1991
+ // Extended properties
1992
+ // Different modes
1993
+ /**
1994
+ * Mode A:Gravity + Tangential Accel + Radial Accel
1995
+ * @Class
1996
+ * @Construct
1997
+ * @param {Point} [gravity=] Gravity value.
1998
+ * @param {Number} [speed=0] speed of each particle.
1999
+ * @param {Number} [speedVar=0] speed variance of each particle.
2000
+ * @param {Number} [tangentialAccel=0] tangential acceleration of each particle.
2001
+ * @param {Number} [tangentialAccelVar=0] tangential acceleration variance of each particle.
2002
+ * @param {Number} [radialAccel=0] radial acceleration of each particle.
2003
+ * @param {Number} [radialAccelVar=0] radial acceleration variance of each particle.
2004
+ * @param {boolean} [rotationIsDir=false]
2005
+ */
2006
+ /**
2007
+ * Mode B: circular movement (gravity, radial accel and tangential accel don't are not used in this mode)
2008
+ * @Class
2009
+ * @Construct
2010
+ * @param {Number} [startRadius=0] The starting radius of the particles.
2011
+ * @param {Number} [startRadiusVar=0] The starting radius variance of the particles.
2012
+ * @param {Number} [endRadius=0] The ending radius of the particles.
2013
+ * @param {Number} [endRadiusVar=0] The ending radius variance of the particles.
2014
+ * @param {Number} [rotatePerSecond=0] Number of degrees to rotate a particle around the source pos per second.
2015
+ * @param {Number} [rotatePerSecondVar=0] Variance in degrees for rotatePerSecond.
2016
+ */
2017
+ //# sourceMappingURL=ParticleSystem.js.map