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.
- package/.prettierrc +6 -0
- package/@types/index.d.ts +36 -0
- package/README.md +152 -0
- package/bun.lock +353 -0
- package/dist/actions/Action.d.ts +27 -0
- package/dist/actions/Action.d.ts.map +1 -0
- package/dist/actions/Action.js +62 -0
- package/dist/actions/Action.js.map +1 -0
- package/dist/actions/ActionBezier.d.ts +121 -0
- package/dist/actions/ActionBezier.d.ts.map +1 -0
- package/dist/actions/ActionBezier.js +221 -0
- package/dist/actions/ActionBezier.js.map +1 -0
- package/dist/actions/ActionBlink.d.ts +62 -0
- package/dist/actions/ActionBlink.d.ts.map +1 -0
- package/dist/actions/ActionBlink.js +96 -0
- package/dist/actions/ActionBlink.js.map +1 -0
- package/dist/actions/ActionCatmullRom.d.ts +242 -0
- package/dist/actions/ActionCatmullRom.d.ts.map +1 -0
- package/dist/actions/ActionCatmullRom.js +436 -0
- package/dist/actions/ActionCatmullRom.js.map +1 -0
- package/dist/actions/ActionFade.d.ts +126 -0
- package/dist/actions/ActionFade.d.ts.map +1 -0
- package/dist/actions/ActionFade.js +190 -0
- package/dist/actions/ActionFade.js.map +1 -0
- package/dist/actions/ActionInstant.d.ts +237 -0
- package/dist/actions/ActionInstant.d.ts.map +1 -0
- package/dist/actions/ActionInstant.js +386 -0
- package/dist/actions/ActionInstant.js.map +1 -0
- package/dist/actions/ActionInterval.d.ts +132 -0
- package/dist/actions/ActionInterval.d.ts.map +1 -0
- package/dist/actions/ActionInterval.js +254 -0
- package/dist/actions/ActionInterval.js.map +1 -0
- package/dist/actions/ActionJump.d.ts +146 -0
- package/dist/actions/ActionJump.d.ts.map +1 -0
- package/dist/actions/ActionJump.js +239 -0
- package/dist/actions/ActionJump.js.map +1 -0
- package/dist/actions/ActionMove.d.ts +73 -0
- package/dist/actions/ActionMove.d.ts.map +1 -0
- package/dist/actions/ActionMove.js +164 -0
- package/dist/actions/ActionMove.js.map +1 -0
- package/dist/actions/ActionRotate.d.ts +137 -0
- package/dist/actions/ActionRotate.d.ts.map +1 -0
- package/dist/actions/ActionRotate.js +214 -0
- package/dist/actions/ActionRotate.js.map +1 -0
- package/dist/actions/ActionScale.d.ts +110 -0
- package/dist/actions/ActionScale.d.ts.map +1 -0
- package/dist/actions/ActionScale.js +157 -0
- package/dist/actions/ActionScale.js.map +1 -0
- package/dist/actions/ActionSkew.d.ts +120 -0
- package/dist/actions/ActionSkew.d.ts.map +1 -0
- package/dist/actions/ActionSkew.js +185 -0
- package/dist/actions/ActionSkew.js.map +1 -0
- package/dist/actions/ActionTint.d.ts +132 -0
- package/dist/actions/ActionTint.d.ts.map +1 -0
- package/dist/actions/ActionTint.js +193 -0
- package/dist/actions/ActionTint.js.map +1 -0
- package/dist/actions/Animate.d.ts +77 -0
- package/dist/actions/Animate.d.ts.map +1 -0
- package/dist/actions/Animate.js +177 -0
- package/dist/actions/Animate.js.map +1 -0
- package/dist/actions/DelayTime.d.ts +95 -0
- package/dist/actions/DelayTime.d.ts.map +1 -0
- package/dist/actions/DelayTime.js +145 -0
- package/dist/actions/DelayTime.js.map +1 -0
- package/dist/actions/FiniteTimeAction.d.ts +11 -0
- package/dist/actions/FiniteTimeAction.d.ts.map +1 -0
- package/dist/actions/FiniteTimeAction.js +24 -0
- package/dist/actions/FiniteTimeAction.js.map +1 -0
- package/dist/actions/Follow.d.ts +23 -0
- package/dist/actions/Follow.d.ts.map +1 -0
- package/dist/actions/Follow.js +98 -0
- package/dist/actions/Follow.js.map +1 -0
- package/dist/actions/Repeat.d.ts +151 -0
- package/dist/actions/Repeat.d.ts.map +1 -0
- package/dist/actions/Repeat.js +276 -0
- package/dist/actions/Repeat.js.map +1 -0
- package/dist/actions/Sequence.d.ts +77 -0
- package/dist/actions/Sequence.d.ts.map +1 -0
- package/dist/actions/Sequence.js +190 -0
- package/dist/actions/Sequence.js.map +1 -0
- package/dist/actions/Spawn.d.ts +63 -0
- package/dist/actions/Spawn.d.ts.map +1 -0
- package/dist/actions/Spawn.js +146 -0
- package/dist/actions/Spawn.js.map +1 -0
- package/dist/actions/Speed.d.ts +19 -0
- package/dist/actions/Speed.d.ts.map +1 -0
- package/dist/actions/Speed.js +57 -0
- package/dist/actions/Speed.js.map +1 -0
- package/dist/actions/TargetedAction.d.ts +67 -0
- package/dist/actions/TargetedAction.d.ts.map +1 -0
- package/dist/actions/TargetedAction.js +99 -0
- package/dist/actions/TargetedAction.js.map +1 -0
- package/dist/actions/easing/ActionEase.d.ts +133 -0
- package/dist/actions/easing/ActionEase.d.ts.map +1 -0
- package/dist/actions/easing/ActionEase.js +184 -0
- package/dist/actions/easing/ActionEase.js.map +1 -0
- package/dist/actions/easing/Back.d.ts +174 -0
- package/dist/actions/easing/Back.d.ts.map +1 -0
- package/dist/actions/easing/Back.js +227 -0
- package/dist/actions/easing/Back.js.map +1 -0
- package/dist/actions/easing/Bezier.d.ts +94 -0
- package/dist/actions/easing/Bezier.d.ts.map +1 -0
- package/dist/actions/easing/Bezier.js +124 -0
- package/dist/actions/easing/Bezier.js.map +1 -0
- package/dist/actions/easing/Bounce.d.ts +203 -0
- package/dist/actions/easing/Bounce.d.ts.map +1 -0
- package/dist/actions/easing/Bounce.js +288 -0
- package/dist/actions/easing/Bounce.js.map +1 -0
- package/dist/actions/easing/Circle.d.ts +177 -0
- package/dist/actions/easing/Circle.d.ts.map +1 -0
- package/dist/actions/easing/Circle.js +220 -0
- package/dist/actions/easing/Circle.js.map +1 -0
- package/dist/actions/easing/Cubic.d.ts +165 -0
- package/dist/actions/easing/Cubic.d.ts.map +1 -0
- package/dist/actions/easing/Cubic.js +209 -0
- package/dist/actions/easing/Cubic.js.map +1 -0
- package/dist/actions/easing/Elastic.d.ts +269 -0
- package/dist/actions/easing/Elastic.d.ts.map +1 -0
- package/dist/actions/easing/Elastic.js +358 -0
- package/dist/actions/easing/Elastic.js.map +1 -0
- package/dist/actions/easing/Exponential.d.ts +181 -0
- package/dist/actions/easing/Exponential.d.ts.map +1 -0
- package/dist/actions/easing/Exponential.js +214 -0
- package/dist/actions/easing/Exponential.js.map +1 -0
- package/dist/actions/easing/InOut.d.ts +191 -0
- package/dist/actions/easing/InOut.d.ts.map +1 -0
- package/dist/actions/easing/InOut.js +254 -0
- package/dist/actions/easing/InOut.js.map +1 -0
- package/dist/actions/easing/Quartic.d.ts +232 -0
- package/dist/actions/easing/Quartic.d.ts.map +1 -0
- package/dist/actions/easing/Quartic.js +313 -0
- package/dist/actions/easing/Quartic.js.map +1 -0
- package/dist/actions/easing/Quintic.d.ts +168 -0
- package/dist/actions/easing/Quintic.d.ts.map +1 -0
- package/dist/actions/easing/Quintic.js +212 -0
- package/dist/actions/easing/Quintic.js.map +1 -0
- package/dist/actions/easing/Sine.d.ts +176 -0
- package/dist/actions/easing/Sine.d.ts.map +1 -0
- package/dist/actions/easing/Sine.js +206 -0
- package/dist/actions/easing/Sine.js.map +1 -0
- package/dist/actions/index.d.ts +16 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +16 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/audio/Audio.d.ts +47 -0
- package/dist/audio/Audio.d.ts.map +1 -0
- package/dist/audio/Audio.js +255 -0
- package/dist/audio/Audio.js.map +1 -0
- package/dist/audio/engine.d.ts +171 -0
- package/dist/audio/engine.d.ts.map +1 -0
- package/dist/audio/engine.js +556 -0
- package/dist/audio/engine.js.map +1 -0
- package/dist/audio/index.d.ts +3 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +3 -0
- package/dist/audio/index.js.map +1 -0
- package/dist/boot.d.ts +80 -0
- package/dist/boot.d.ts.map +1 -0
- package/dist/boot.js +468 -0
- package/dist/boot.js.map +1 -0
- package/dist/clipping-nodes/ClippingNode.d.ts +114 -0
- package/dist/clipping-nodes/ClippingNode.d.ts.map +1 -0
- package/dist/clipping-nodes/ClippingNode.js +177 -0
- package/dist/clipping-nodes/ClippingNode.js.map +1 -0
- package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.d.ts +25 -0
- package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.js +157 -0
- package/dist/clipping-nodes/ClippingNodeWebGLRenderCmd.js.map +1 -0
- package/dist/core/ActionManager.d.ts +56 -0
- package/dist/core/ActionManager.d.ts.map +1 -0
- package/dist/core/ActionManager.js +253 -0
- package/dist/core/ActionManager.js.map +1 -0
- package/dist/core/Configuration.d.ts +108 -0
- package/dist/core/Configuration.d.ts.map +1 -0
- package/dist/core/Configuration.js +232 -0
- package/dist/core/Configuration.js.map +1 -0
- package/dist/core/Director.d.ts +130 -0
- package/dist/core/Director.d.ts.map +1 -0
- package/dist/core/Director.js +580 -0
- package/dist/core/Director.js.map +1 -0
- package/dist/core/DrawingPrimitivesWebGL.d.ts +32 -0
- package/dist/core/DrawingPrimitivesWebGL.d.ts.map +1 -0
- package/dist/core/DrawingPrimitivesWebGL.js +273 -0
- package/dist/core/DrawingPrimitivesWebGL.js.map +1 -0
- package/dist/core/Scheduler.d.ts +110 -0
- package/dist/core/Scheduler.d.ts.map +1 -0
- package/dist/core/Scheduler.js +687 -0
- package/dist/core/Scheduler.js.map +1 -0
- package/dist/core/base-nodes/BaseNodesPropertyDefine.d.ts +2 -0
- package/dist/core/base-nodes/BaseNodesPropertyDefine.d.ts.map +1 -0
- package/dist/core/base-nodes/BaseNodesPropertyDefine.js +37 -0
- package/dist/core/base-nodes/BaseNodesPropertyDefine.js.map +1 -0
- package/dist/core/base-nodes/CustomRenderCmd.d.ts +9 -0
- package/dist/core/base-nodes/CustomRenderCmd.d.ts.map +1 -0
- package/dist/core/base-nodes/CustomRenderCmd.js +16 -0
- package/dist/core/base-nodes/CustomRenderCmd.js.map +1 -0
- package/dist/core/base-nodes/Node.d.ts +285 -0
- package/dist/core/base-nodes/Node.d.ts.map +1 -0
- package/dist/core/base-nodes/Node.js +1112 -0
- package/dist/core/base-nodes/Node.js.map +1 -0
- package/dist/core/base-nodes/NodeRenderCmd.d.ts +65 -0
- package/dist/core/base-nodes/NodeRenderCmd.d.ts.map +1 -0
- package/dist/core/base-nodes/NodeRenderCmd.js +460 -0
- package/dist/core/base-nodes/NodeRenderCmd.js.map +1 -0
- package/dist/core/base-nodes/NodeWebGLRenderCmd.d.ts +17 -0
- package/dist/core/base-nodes/NodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/core/base-nodes/NodeWebGLRenderCmd.js +29 -0
- package/dist/core/base-nodes/NodeWebGLRenderCmd.js.map +1 -0
- package/dist/core/cocoa/AffineTransform.d.ts +201 -0
- package/dist/core/cocoa/AffineTransform.d.ts.map +1 -0
- package/dist/core/cocoa/AffineTransform.js +260 -0
- package/dist/core/cocoa/AffineTransform.js.map +1 -0
- package/dist/core/cocoa/Geometry.d.ts +176 -0
- package/dist/core/cocoa/Geometry.d.ts.map +1 -0
- package/dist/core/cocoa/Geometry.js +237 -0
- package/dist/core/cocoa/Geometry.js.map +1 -0
- package/dist/core/event-manager/Event.d.ts +57 -0
- package/dist/core/event-manager/Event.d.ts.map +1 -0
- package/dist/core/event-manager/Event.js +69 -0
- package/dist/core/event-manager/Event.js.map +1 -0
- package/dist/core/event-manager/EventCustom.d.ts +22 -0
- package/dist/core/event-manager/EventCustom.d.ts.map +1 -0
- package/dist/core/event-manager/EventCustom.js +31 -0
- package/dist/core/event-manager/EventCustom.js.map +1 -0
- package/dist/core/event-manager/EventExtension.d.ts +33 -0
- package/dist/core/event-manager/EventExtension.d.ts.map +1 -0
- package/dist/core/event-manager/EventExtension.js +80 -0
- package/dist/core/event-manager/EventExtension.js.map +1 -0
- package/dist/core/event-manager/EventFocus.d.ts +17 -0
- package/dist/core/event-manager/EventFocus.d.ts.map +1 -0
- package/dist/core/event-manager/EventFocus.js +21 -0
- package/dist/core/event-manager/EventFocus.js.map +1 -0
- package/dist/core/event-manager/EventHelper.d.ts +8 -0
- package/dist/core/event-manager/EventHelper.d.ts.map +1 -0
- package/dist/core/event-manager/EventHelper.js +92 -0
- package/dist/core/event-manager/EventHelper.js.map +1 -0
- package/dist/core/event-manager/EventListener.d.ts +53 -0
- package/dist/core/event-manager/EventListener.d.ts.map +1 -0
- package/dist/core/event-manager/EventListener.js +95 -0
- package/dist/core/event-manager/EventListener.js.map +1 -0
- package/dist/core/event-manager/EventListenerCustom.d.ts +11 -0
- package/dist/core/event-manager/EventListenerCustom.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerCustom.js +37 -0
- package/dist/core/event-manager/EventListenerCustom.js.map +1 -0
- package/dist/core/event-manager/EventListenerFocus.d.ts +10 -0
- package/dist/core/event-manager/EventListenerFocus.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerFocus.js +28 -0
- package/dist/core/event-manager/EventListenerFocus.js.map +1 -0
- package/dist/core/event-manager/EventListenerMouse.d.ts +13 -0
- package/dist/core/event-manager/EventListenerMouse.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerMouse.js +49 -0
- package/dist/core/event-manager/EventListenerMouse.js.map +1 -0
- package/dist/core/event-manager/EventListenerTouchAllAtOnce.d.ts +12 -0
- package/dist/core/event-manager/EventListenerTouchAllAtOnce.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerTouchAllAtOnce.js +28 -0
- package/dist/core/event-manager/EventListenerTouchAllAtOnce.js.map +1 -0
- package/dist/core/event-manager/EventListenerTouchOneByOne.d.ts +16 -0
- package/dist/core/event-manager/EventListenerTouchOneByOne.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerTouchOneByOne.js +38 -0
- package/dist/core/event-manager/EventListenerTouchOneByOne.js.map +1 -0
- package/dist/core/event-manager/EventListenerVector.d.ts +15 -0
- package/dist/core/event-manager/EventListenerVector.d.ts.map +1 -0
- package/dist/core/event-manager/EventListenerVector.js +38 -0
- package/dist/core/event-manager/EventListenerVector.js.map +1 -0
- package/dist/core/event-manager/EventManager.d.ts +140 -0
- package/dist/core/event-manager/EventManager.d.ts.map +1 -0
- package/dist/core/event-manager/EventManager.js +907 -0
- package/dist/core/event-manager/EventManager.js.map +1 -0
- package/dist/core/event-manager/EventMouse.d.ts +173 -0
- package/dist/core/event-manager/EventMouse.d.ts.map +1 -0
- package/dist/core/event-manager/EventMouse.js +200 -0
- package/dist/core/event-manager/EventMouse.js.map +1 -0
- package/dist/core/event-manager/EventTouch.d.ts +24 -0
- package/dist/core/event-manager/EventTouch.d.ts.map +1 -0
- package/dist/core/event-manager/EventTouch.js +33 -0
- package/dist/core/event-manager/EventTouch.js.map +1 -0
- package/dist/core/event-manager/Touch.d.ts +60 -0
- package/dist/core/event-manager/Touch.d.ts.map +1 -0
- package/dist/core/event-manager/Touch.js +94 -0
- package/dist/core/event-manager/Touch.js.map +1 -0
- package/dist/core/event-manager/index.d.ts +6 -0
- package/dist/core/event-manager/index.d.ts.map +1 -0
- package/dist/core/event-manager/index.js +6 -0
- package/dist/core/event-manager/index.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/kazmath/gl/mat4stack.d.ts +5 -0
- package/dist/core/kazmath/gl/mat4stack.d.ts.map +1 -0
- package/dist/core/kazmath/gl/mat4stack.js +53 -0
- package/dist/core/kazmath/gl/mat4stack.js.map +1 -0
- package/dist/core/kazmath/gl/matrix.d.ts +21 -0
- package/dist/core/kazmath/gl/matrix.d.ts.map +1 -0
- package/dist/core/kazmath/gl/matrix.js +121 -0
- package/dist/core/kazmath/gl/matrix.js.map +1 -0
- package/dist/core/kazmath/index.d.ts +7 -0
- package/dist/core/kazmath/index.d.ts.map +1 -0
- package/dist/core/kazmath/index.js +7 -0
- package/dist/core/kazmath/index.js.map +1 -0
- package/dist/core/kazmath/mat3.d.ts +45 -0
- package/dist/core/kazmath/mat3.d.ts.map +1 -0
- package/dist/core/kazmath/mat3.js +297 -0
- package/dist/core/kazmath/mat3.js.map +1 -0
- package/dist/core/kazmath/mat4.d.ts +175 -0
- package/dist/core/kazmath/mat4.d.ts.map +1 -0
- package/dist/core/kazmath/mat4.func.d.ts +44 -0
- package/dist/core/kazmath/mat4.func.d.ts.map +1 -0
- package/dist/core/kazmath/mat4.func.js +210 -0
- package/dist/core/kazmath/mat4.func.js.map +1 -0
- package/dist/core/kazmath/mat4.js +671 -0
- package/dist/core/kazmath/mat4.js.map +1 -0
- package/dist/core/kazmath/plane.d.ts +24 -0
- package/dist/core/kazmath/plane.d.ts.map +1 -0
- package/dist/core/kazmath/plane.js +96 -0
- package/dist/core/kazmath/plane.js.map +1 -0
- package/dist/core/kazmath/quaternion.d.ts +135 -0
- package/dist/core/kazmath/quaternion.d.ts.map +1 -0
- package/dist/core/kazmath/quaternion.js +407 -0
- package/dist/core/kazmath/quaternion.js.map +1 -0
- package/dist/core/kazmath/utility.d.ts +8 -0
- package/dist/core/kazmath/utility.d.ts.map +1 -0
- package/dist/core/kazmath/utility.js +14 -0
- package/dist/core/kazmath/utility.js.map +1 -0
- package/dist/core/kazmath/vec3.d.ts +26 -0
- package/dist/core/kazmath/vec3.d.ts.map +1 -0
- package/dist/core/kazmath/vec3.js +170 -0
- package/dist/core/kazmath/vec3.js.map +1 -0
- package/dist/core/kazmath/vec4.d.ts +22 -0
- package/dist/core/kazmath/vec4.d.ts.map +1 -0
- package/dist/core/kazmath/vec4.js +136 -0
- package/dist/core/kazmath/vec4.js.map +1 -0
- package/dist/core/labelttf/LabelTTF.d.ts +310 -0
- package/dist/core/labelttf/LabelTTF.d.ts.map +1 -0
- package/dist/core/labelttf/LabelTTF.js +818 -0
- package/dist/core/labelttf/LabelTTF.js.map +1 -0
- package/dist/core/labelttf/LabelTTFPropertyDefine.d.ts +2 -0
- package/dist/core/labelttf/LabelTTFPropertyDefine.d.ts.map +1 -0
- package/dist/core/labelttf/LabelTTFPropertyDefine.js +27 -0
- package/dist/core/labelttf/LabelTTFPropertyDefine.js.map +1 -0
- package/dist/core/labelttf/LabelTTFWebGLRenderCmd.d.ts +37 -0
- package/dist/core/labelttf/LabelTTFWebGLRenderCmd.d.ts.map +1 -0
- package/dist/core/labelttf/LabelTTFWebGLRenderCmd.js +367 -0
- package/dist/core/labelttf/LabelTTFWebGLRenderCmd.js.map +1 -0
- package/dist/core/layers/Layer.d.ts +35 -0
- package/dist/core/layers/Layer.d.ts.map +1 -0
- package/dist/core/layers/Layer.js +93 -0
- package/dist/core/layers/Layer.js.map +1 -0
- package/dist/core/layers/LayerColor.d.ts +61 -0
- package/dist/core/layers/LayerColor.d.ts.map +1 -0
- package/dist/core/layers/LayerColor.js +144 -0
- package/dist/core/layers/LayerColor.js.map +1 -0
- package/dist/core/layers/LayerGradient.d.ts +196 -0
- package/dist/core/layers/LayerGradient.d.ts.map +1 -0
- package/dist/core/layers/LayerGradient.js +482 -0
- package/dist/core/layers/LayerGradient.js.map +1 -0
- package/dist/core/layers/LayerMultiplex.d.ts +47 -0
- package/dist/core/layers/LayerMultiplex.d.ts.map +1 -0
- package/dist/core/layers/LayerMultiplex.js +87 -0
- package/dist/core/layers/LayerMultiplex.js.map +1 -0
- package/dist/core/layers/LayerWebGLRenderCmd.d.ts +26 -0
- package/dist/core/layers/LayerWebGLRenderCmd.d.ts.map +1 -0
- package/dist/core/layers/LayerWebGLRenderCmd.js +100 -0
- package/dist/core/layers/LayerWebGLRenderCmd.js.map +1 -0
- package/dist/core/layers/index.d.ts +5 -0
- package/dist/core/layers/index.d.ts.map +1 -0
- package/dist/core/layers/index.js +5 -0
- package/dist/core/layers/index.js.map +1 -0
- package/dist/core/platform/BlendFunc.d.ts +30 -0
- package/dist/core/platform/BlendFunc.d.ts.map +1 -0
- package/dist/core/platform/BlendFunc.js +50 -0
- package/dist/core/platform/BlendFunc.js.map +1 -0
- package/dist/core/platform/Color.d.ts +31 -0
- package/dist/core/platform/Color.d.ts.map +1 -0
- package/dist/core/platform/Color.js +71 -0
- package/dist/core/platform/Color.js.map +1 -0
- package/dist/core/platform/Common.d.ts +157 -0
- package/dist/core/platform/Common.d.ts.map +1 -0
- package/dist/core/platform/Common.js +180 -0
- package/dist/core/platform/Common.js.map +1 -0
- package/dist/core/platform/Config.d.ts +230 -0
- package/dist/core/platform/Config.d.ts.map +1 -0
- package/dist/core/platform/Config.js +231 -0
- package/dist/core/platform/Config.js.map +1 -0
- package/dist/core/platform/Dictionary.d.ts +16 -0
- package/dist/core/platform/Dictionary.d.ts.map +1 -0
- package/dist/core/platform/Dictionary.js +65 -0
- package/dist/core/platform/Dictionary.js.map +1 -0
- package/dist/core/platform/EGLView/ContainerStrategy.d.ts +30 -0
- package/dist/core/platform/EGLView/ContainerStrategy.d.ts.map +1 -0
- package/dist/core/platform/EGLView/ContainerStrategy.js +121 -0
- package/dist/core/platform/EGLView/ContainerStrategy.js.map +1 -0
- package/dist/core/platform/EGLView/ContentStrategy.d.ts +56 -0
- package/dist/core/platform/EGLView/ContentStrategy.d.ts.map +1 -0
- package/dist/core/platform/EGLView/ContentStrategy.js +117 -0
- package/dist/core/platform/EGLView/ContentStrategy.js.map +1 -0
- package/dist/core/platform/EGLView/EGLInstance.d.ts +8 -0
- package/dist/core/platform/EGLView/EGLInstance.d.ts.map +1 -0
- package/dist/core/platform/EGLView/EGLInstance.js +16 -0
- package/dist/core/platform/EGLView/EGLInstance.js.map +1 -0
- package/dist/core/platform/EGLView/ResolutionPolicy.d.ts +99 -0
- package/dist/core/platform/EGLView/ResolutionPolicy.d.ts.map +1 -0
- package/dist/core/platform/EGLView/ResolutionPolicy.js +116 -0
- package/dist/core/platform/EGLView/ResolutionPolicy.js.map +1 -0
- package/dist/core/platform/EGLView.d.ts +204 -0
- package/dist/core/platform/EGLView.d.ts.map +1 -0
- package/dist/core/platform/EGLView.js +669 -0
- package/dist/core/platform/EGLView.js.map +1 -0
- package/dist/core/platform/FontDefinition.d.ts +47 -0
- package/dist/core/platform/FontDefinition.d.ts.map +1 -0
- package/dist/core/platform/FontDefinition.js +59 -0
- package/dist/core/platform/FontDefinition.js.map +1 -0
- package/dist/core/platform/InputManager.d.ts +149 -0
- package/dist/core/platform/InputManager.d.ts.map +1 -0
- package/dist/core/platform/InputManager.js +558 -0
- package/dist/core/platform/InputManager.js.map +1 -0
- package/dist/core/platform/Loaders.d.ts +4 -0
- package/dist/core/platform/Loaders.d.ts.map +1 -0
- package/dist/core/platform/Loaders.js +141 -0
- package/dist/core/platform/Loaders.js.map +1 -0
- package/dist/core/platform/Macro.d.ts +634 -0
- package/dist/core/platform/Macro.d.ts.map +1 -0
- package/dist/core/platform/Macro.js +763 -0
- package/dist/core/platform/Macro.js.map +1 -0
- package/dist/core/platform/SAXParser.d.ts +44 -0
- package/dist/core/platform/SAXParser.d.ts.map +1 -0
- package/dist/core/platform/SAXParser.js +122 -0
- package/dist/core/platform/SAXParser.js.map +1 -0
- package/dist/core/platform/Types.d.ts +188 -0
- package/dist/core/platform/Types.d.ts.map +1 -0
- package/dist/core/platform/Types.js +425 -0
- package/dist/core/platform/Types.js.map +1 -0
- package/dist/core/platform/VisibleRect.d.ts +38 -0
- package/dist/core/platform/VisibleRect.d.ts.map +1 -0
- package/dist/core/platform/VisibleRect.js +66 -0
- package/dist/core/platform/VisibleRect.js.map +1 -0
- package/dist/core/platform/index.d.ts +7 -0
- package/dist/core/platform/index.d.ts.map +1 -0
- package/dist/core/platform/index.js +7 -0
- package/dist/core/platform/index.js.map +1 -0
- package/dist/core/platform/miniFramework.d.ts +28 -0
- package/dist/core/platform/miniFramework.d.ts.map +1 -0
- package/dist/core/platform/miniFramework.js +245 -0
- package/dist/core/platform/miniFramework.js.map +1 -0
- package/dist/core/platform/types/Quad2.d.ts +30 -0
- package/dist/core/platform/types/Quad2.d.ts.map +1 -0
- package/dist/core/platform/types/Quad2.js +62 -0
- package/dist/core/platform/types/Quad2.js.map +1 -0
- package/dist/core/platform/types/Quad3.d.ts +18 -0
- package/dist/core/platform/types/Quad3.d.ts.map +1 -0
- package/dist/core/platform/types/Quad3.js +30 -0
- package/dist/core/platform/types/Quad3.js.map +1 -0
- package/dist/core/platform/types/Tex2F.d.ts +20 -0
- package/dist/core/platform/types/Tex2F.d.ts.map +1 -0
- package/dist/core/platform/types/Tex2F.js +33 -0
- package/dist/core/platform/types/Tex2F.js.map +1 -0
- package/dist/core/platform/types/Vertex2F.d.ts +12 -0
- package/dist/core/platform/types/Vertex2F.d.ts.map +1 -0
- package/dist/core/platform/types/Vertex2F.js +25 -0
- package/dist/core/platform/types/Vertex2F.js.map +1 -0
- package/dist/core/platform/types/Vertex3F.d.ts +14 -0
- package/dist/core/platform/types/Vertex3F.d.ts.map +1 -0
- package/dist/core/platform/types/Vertex3F.js +31 -0
- package/dist/core/platform/types/Vertex3F.js.map +1 -0
- package/dist/core/platform/types/WebGLColor.d.ts +17 -0
- package/dist/core/platform/types/WebGLColor.d.ts.map +1 -0
- package/dist/core/platform/types/WebGLColor.js +40 -0
- package/dist/core/platform/types/WebGLColor.js.map +1 -0
- package/dist/core/renderer/GlobalVertexBuffer.d.ts +19 -0
- package/dist/core/renderer/GlobalVertexBuffer.d.ts.map +1 -0
- package/dist/core/renderer/GlobalVertexBuffer.js +99 -0
- package/dist/core/renderer/GlobalVertexBuffer.js.map +1 -0
- package/dist/core/renderer/RendererWebGL.d.ts +47 -0
- package/dist/core/renderer/RendererWebGL.d.ts.map +1 -0
- package/dist/core/renderer/RendererWebGL.js +389 -0
- package/dist/core/renderer/RendererWebGL.js.map +1 -0
- package/dist/core/scenes/Scene.d.ts +6 -0
- package/dist/core/scenes/Scene.d.ts.map +1 -0
- package/dist/core/scenes/Scene.js +12 -0
- package/dist/core/scenes/Scene.js.map +1 -0
- package/dist/core/sprites/Animation.d.ts +147 -0
- package/dist/core/sprites/Animation.d.ts.map +1 -0
- package/dist/core/sprites/Animation.js +277 -0
- package/dist/core/sprites/Animation.js.map +1 -0
- package/dist/core/sprites/AnimationCache.d.ts +37 -0
- package/dist/core/sprites/AnimationCache.d.ts.map +1 -0
- package/dist/core/sprites/AnimationCache.js +159 -0
- package/dist/core/sprites/AnimationCache.js.map +1 -0
- package/dist/core/sprites/Sprite.d.ts +104 -0
- package/dist/core/sprites/Sprite.d.ts.map +1 -0
- package/dist/core/sprites/Sprite.js +388 -0
- package/dist/core/sprites/Sprite.js.map +1 -0
- package/dist/core/sprites/SpriteBatchNode.d.ts +194 -0
- package/dist/core/sprites/SpriteBatchNode.d.ts.map +1 -0
- package/dist/core/sprites/SpriteBatchNode.js +332 -0
- package/dist/core/sprites/SpriteBatchNode.js.map +1 -0
- package/dist/core/sprites/SpriteFrame.d.ts +47 -0
- package/dist/core/sprites/SpriteFrame.d.ts.map +1 -0
- package/dist/core/sprites/SpriteFrame.js +223 -0
- package/dist/core/sprites/SpriteFrame.js.map +1 -0
- package/dist/core/sprites/SpriteFrameCache.d.ts +102 -0
- package/dist/core/sprites/SpriteFrameCache.d.ts.map +1 -0
- package/dist/core/sprites/SpriteFrameCache.js +333 -0
- package/dist/core/sprites/SpriteFrameCache.js.map +1 -0
- package/dist/core/sprites/SpriteLoadManager.d.ts +8 -0
- package/dist/core/sprites/SpriteLoadManager.d.ts.map +1 -0
- package/dist/core/sprites/SpriteLoadManager.js +37 -0
- package/dist/core/sprites/SpriteLoadManager.js.map +1 -0
- package/dist/core/sprites/SpriteWebGLRenderCmd.d.ts +35 -0
- package/dist/core/sprites/SpriteWebGLRenderCmd.d.ts.map +1 -0
- package/dist/core/sprites/SpriteWebGLRenderCmd.js +286 -0
- package/dist/core/sprites/SpriteWebGLRenderCmd.js.map +1 -0
- package/dist/core/sprites/SpritesPropertyDefine.d.ts +2 -0
- package/dist/core/sprites/SpritesPropertyDefine.d.ts.map +1 -0
- package/dist/core/sprites/SpritesPropertyDefine.js +19 -0
- package/dist/core/sprites/SpritesPropertyDefine.js.map +1 -0
- package/dist/core/support/PointExtension.d.ts +296 -0
- package/dist/core/support/PointExtension.d.ts.map +1 -0
- package/dist/core/support/PointExtension.js +443 -0
- package/dist/core/support/PointExtension.js.map +1 -0
- package/dist/core/support/Vertex.d.ts +24 -0
- package/dist/core/support/Vertex.d.ts.map +1 -0
- package/dist/core/support/Vertex.js +120 -0
- package/dist/core/support/Vertex.js.map +1 -0
- package/dist/core/utils/BinaryLoader.d.ts +9 -0
- package/dist/core/utils/BinaryLoader.d.ts.map +1 -0
- package/dist/core/utils/BinaryLoader.js +116 -0
- package/dist/core/utils/BinaryLoader.js.map +1 -0
- package/dist/core/utils/Profiler.d.ts +13 -0
- package/dist/core/utils/Profiler.d.ts.map +1 -0
- package/dist/core/utils/Profiler.js +140 -0
- package/dist/core/utils/Profiler.js.map +1 -0
- package/dist/helper/AsyncPool.d.ts +22 -0
- package/dist/helper/AsyncPool.d.ts.map +1 -0
- package/dist/helper/AsyncPool.js +101 -0
- package/dist/helper/AsyncPool.js.map +1 -0
- package/dist/helper/Base64.d.ts +29 -0
- package/dist/helper/Base64.d.ts.map +1 -0
- package/dist/helper/Base64.js +71 -0
- package/dist/helper/Base64.js.map +1 -0
- package/dist/helper/Debugger.d.ts +179 -0
- package/dist/helper/Debugger.d.ts.map +1 -0
- package/dist/helper/Debugger.js +250 -0
- package/dist/helper/Debugger.js.map +1 -0
- package/dist/helper/ZipUtils.d.ts +2 -0
- package/dist/helper/ZipUtils.d.ts.map +1 -0
- package/dist/helper/ZipUtils.js +20 -0
- package/dist/helper/ZipUtils.js.map +1 -0
- package/dist/helper/async.d.ts +49 -0
- package/dist/helper/async.d.ts.map +1 -0
- package/dist/helper/async.js +95 -0
- package/dist/helper/async.js.map +1 -0
- package/dist/helper/checkType.d.ts +8 -0
- package/dist/helper/checkType.d.ts.map +1 -0
- package/dist/helper/checkType.js +31 -0
- package/dist/helper/checkType.js.map +1 -0
- package/dist/helper/engine.d.ts +6 -0
- package/dist/helper/engine.d.ts.map +1 -0
- package/dist/helper/engine.js +115 -0
- package/dist/helper/engine.js.map +1 -0
- package/dist/helper/getset.d.ts +2 -0
- package/dist/helper/getset.d.ts.map +1 -0
- package/dist/helper/getset.js +51 -0
- package/dist/helper/getset.js.map +1 -0
- package/dist/helper/global.d.ts +6 -0
- package/dist/helper/global.d.ts.map +1 -0
- package/dist/helper/global.js +6 -0
- package/dist/helper/global.js.map +1 -0
- package/dist/helper/index.d.ts +3 -0
- package/dist/helper/index.d.ts.map +1 -0
- package/dist/helper/index.js +3 -0
- package/dist/helper/index.js.map +1 -0
- package/dist/helper/loader.d.ts +102 -0
- package/dist/helper/loader.d.ts.map +1 -0
- package/dist/helper/loader.js +447 -0
- package/dist/helper/loader.js.map +1 -0
- package/dist/helper/path.d.ts +12 -0
- package/dist/helper/path.d.ts.map +1 -0
- package/dist/helper/path.js +75 -0
- package/dist/helper/path.js.map +1 -0
- package/dist/helper/string.d.ts +2 -0
- package/dist/helper/string.d.ts.map +1 -0
- package/dist/helper/string.js +32 -0
- package/dist/helper/string.js.map +1 -0
- package/dist/helper/sys.d.ts +446 -0
- package/dist/helper/sys.d.ts.map +1 -0
- package/dist/helper/sys.js +691 -0
- package/dist/helper/sys.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/motion-streak/MotionStreak.d.ts +56 -0
- package/dist/motion-streak/MotionStreak.d.ts.map +1 -0
- package/dist/motion-streak/MotionStreak.js +301 -0
- package/dist/motion-streak/MotionStreak.js.map +1 -0
- package/dist/motion-streak/MotionStreakWebGLRenderCmd.d.ts +9 -0
- package/dist/motion-streak/MotionStreakWebGLRenderCmd.d.ts.map +1 -0
- package/dist/motion-streak/MotionStreakWebGLRenderCmd.js +52 -0
- package/dist/motion-streak/MotionStreakWebGLRenderCmd.js.map +1 -0
- package/dist/motion-streak/index.d.ts +2 -0
- package/dist/motion-streak/index.d.ts.map +1 -0
- package/dist/motion-streak/index.js +2 -0
- package/dist/motion-streak/index.js.map +1 -0
- package/dist/particle/PNGReader.d.ts +30 -0
- package/dist/particle/PNGReader.d.ts.map +1 -0
- package/dist/particle/PNGReader.js +304 -0
- package/dist/particle/PNGReader.js.map +1 -0
- package/dist/particle/Particle.d.ts +27 -0
- package/dist/particle/Particle.d.ts.map +1 -0
- package/dist/particle/Particle.js +50 -0
- package/dist/particle/Particle.js.map +1 -0
- package/dist/particle/ParticleBatchNode.d.ts +163 -0
- package/dist/particle/ParticleBatchNode.d.ts.map +1 -0
- package/dist/particle/ParticleBatchNode.js +447 -0
- package/dist/particle/ParticleBatchNode.js.map +1 -0
- package/dist/particle/ParticleBatchNodeWebGLRenderCmd.d.ts +8 -0
- package/dist/particle/ParticleBatchNodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/particle/ParticleBatchNodeWebGLRenderCmd.js +33 -0
- package/dist/particle/ParticleBatchNodeWebGLRenderCmd.js.map +1 -0
- package/dist/particle/ParticleSystem.d.ts +941 -0
- package/dist/particle/ParticleSystem.d.ts.map +1 -0
- package/dist/particle/ParticleSystem.js +2017 -0
- package/dist/particle/ParticleSystem.js.map +1 -0
- package/dist/particle/ParticleSystemWebGLRenderCmd.d.ts +29 -0
- package/dist/particle/ParticleSystemWebGLRenderCmd.d.ts.map +1 -0
- package/dist/particle/ParticleSystemWebGLRenderCmd.js +346 -0
- package/dist/particle/ParticleSystemWebGLRenderCmd.js.map +1 -0
- package/dist/particle/TIFFReader.d.ts +138 -0
- package/dist/particle/TIFFReader.d.ts.map +1 -0
- package/dist/particle/TIFFReader.js +596 -0
- package/dist/particle/TIFFReader.js.map +1 -0
- package/dist/particle/examples/ParticleFire.d.ts +60 -0
- package/dist/particle/examples/ParticleFire.d.ts.map +1 -0
- package/dist/particle/examples/ParticleFire.js +188 -0
- package/dist/particle/examples/ParticleFire.js.map +1 -0
- package/dist/particle/examples/ParticleGalaxy.d.ts +60 -0
- package/dist/particle/examples/ParticleGalaxy.d.ts.map +1 -0
- package/dist/particle/examples/ParticleGalaxy.js +199 -0
- package/dist/particle/examples/ParticleGalaxy.js.map +1 -0
- package/dist/particle/examples/ParticleSmoke.d.ts +60 -0
- package/dist/particle/examples/ParticleSmoke.d.ts.map +1 -0
- package/dist/particle/examples/ParticleSmoke.js +195 -0
- package/dist/particle/examples/ParticleSmoke.js.map +1 -0
- package/dist/particle/examples/ParticleSpiral.d.ts +38 -0
- package/dist/particle/examples/ParticleSpiral.d.ts.map +1 -0
- package/dist/particle/examples/ParticleSpiral.js +130 -0
- package/dist/particle/examples/ParticleSpiral.js.map +1 -0
- package/dist/particle/examples/index.d.ts +5 -0
- package/dist/particle/examples/index.d.ts.map +1 -0
- package/dist/particle/examples/index.js +5 -0
- package/dist/particle/examples/index.js.map +1 -0
- package/dist/particle/index.d.ts +2 -0
- package/dist/particle/index.d.ts.map +1 -0
- package/dist/particle/index.js +2 -0
- package/dist/particle/index.js.map +1 -0
- package/dist/polyfills.d.ts +34 -0
- package/dist/polyfills.d.ts.map +1 -0
- package/dist/polyfills.js +102 -0
- package/dist/polyfills.js.map +1 -0
- package/dist/progress-timer/ActionProgressTimer.d.ts +118 -0
- package/dist/progress-timer/ActionProgressTimer.d.ts.map +1 -0
- package/dist/progress-timer/ActionProgressTimer.js +173 -0
- package/dist/progress-timer/ActionProgressTimer.js.map +1 -0
- package/dist/progress-timer/ProgressTimer.d.ts +143 -0
- package/dist/progress-timer/ProgressTimer.d.ts.map +1 -0
- package/dist/progress-timer/ProgressTimer.js +228 -0
- package/dist/progress-timer/ProgressTimer.js.map +1 -0
- package/dist/progress-timer/ProgressTimerWebGLRenderCmd.d.ts +56 -0
- package/dist/progress-timer/ProgressTimerWebGLRenderCmd.d.ts.map +1 -0
- package/dist/progress-timer/ProgressTimerWebGLRenderCmd.js +445 -0
- package/dist/progress-timer/ProgressTimerWebGLRenderCmd.js.map +1 -0
- package/dist/progress-timer/index.d.ts +3 -0
- package/dist/progress-timer/index.d.ts.map +1 -0
- package/dist/progress-timer/index.js +3 -0
- package/dist/progress-timer/index.js.map +1 -0
- package/dist/render-texture/RenderTexture.d.ts +226 -0
- package/dist/render-texture/RenderTexture.d.ts.map +1 -0
- package/dist/render-texture/RenderTexture.js +332 -0
- package/dist/render-texture/RenderTexture.js.map +1 -0
- package/dist/render-texture/RenderTextureWebGLRenderCmd.d.ts +28 -0
- package/dist/render-texture/RenderTextureWebGLRenderCmd.d.ts.map +1 -0
- package/dist/render-texture/RenderTextureWebGLRenderCmd.js +276 -0
- package/dist/render-texture/RenderTextureWebGLRenderCmd.js.map +1 -0
- package/dist/render-texture/index.d.ts +2 -0
- package/dist/render-texture/index.d.ts.map +1 -0
- package/dist/render-texture/index.js +2 -0
- package/dist/render-texture/index.js.map +1 -0
- package/dist/shaders/GLProgram.d.ts +288 -0
- package/dist/shaders/GLProgram.d.ts.map +1 -0
- package/dist/shaders/GLProgram.js +794 -0
- package/dist/shaders/GLProgram.js.map +1 -0
- package/dist/shaders/GLProgramState.d.ts +58 -0
- package/dist/shaders/GLProgramState.d.ts.map +1 -0
- package/dist/shaders/GLProgramState.js +255 -0
- package/dist/shaders/GLProgramState.js.map +1 -0
- package/dist/shaders/GLStateCache.d.ts +97 -0
- package/dist/shaders/GLStateCache.d.ts.map +1 -0
- package/dist/shaders/GLStateCache.js +255 -0
- package/dist/shaders/GLStateCache.js.map +1 -0
- package/dist/shaders/ShaderCache.d.ts +111 -0
- package/dist/shaders/ShaderCache.d.ts.map +1 -0
- package/dist/shaders/ShaderCache.js +273 -0
- package/dist/shaders/ShaderCache.js.map +1 -0
- package/dist/shaders/Shaders.d.ts +84 -0
- package/dist/shaders/Shaders.d.ts.map +1 -0
- package/dist/shaders/Shaders.js +250 -0
- package/dist/shaders/Shaders.js.map +1 -0
- package/dist/shaders/index.d.ts +5 -0
- package/dist/shaders/index.d.ts.map +1 -0
- package/dist/shaders/index.js +5 -0
- package/dist/shaders/index.js.map +1 -0
- package/dist/shape-nodes/DrawNode.d.ts +61 -0
- package/dist/shape-nodes/DrawNode.d.ts.map +1 -0
- package/dist/shape-nodes/DrawNode.js +597 -0
- package/dist/shape-nodes/DrawNode.js.map +1 -0
- package/dist/shape-nodes/DrawNodeWebGLRenderCmd.d.ts +11 -0
- package/dist/shape-nodes/DrawNodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/shape-nodes/DrawNodeWebGLRenderCmd.js +27 -0
- package/dist/shape-nodes/DrawNodeWebGLRenderCmd.js.map +1 -0
- package/dist/text-input/IMEDispatcher.d.ts +180 -0
- package/dist/text-input/IMEDispatcher.d.ts.map +1 -0
- package/dist/text-input/IMEDispatcher.js +454 -0
- package/dist/text-input/IMEDispatcher.js.map +1 -0
- package/dist/text-input/TextFieldTTF.d.ts +219 -0
- package/dist/text-input/TextFieldTTF.d.ts.map +1 -0
- package/dist/text-input/TextFieldTTF.js +381 -0
- package/dist/text-input/TextFieldTTF.js.map +1 -0
- package/dist/textures/Texture2D.d.ts +10 -0
- package/dist/textures/Texture2D.d.ts.map +1 -0
- package/dist/textures/Texture2D.js +10 -0
- package/dist/textures/Texture2D.js.map +1 -0
- package/dist/textures/TextureAtlas.d.ts +204 -0
- package/dist/textures/TextureAtlas.d.ts.map +1 -0
- package/dist/textures/TextureAtlas.js +602 -0
- package/dist/textures/TextureAtlas.js.map +1 -0
- package/dist/textures/TextureCache.d.ts +147 -0
- package/dist/textures/TextureCache.d.ts.map +1 -0
- package/dist/textures/TextureCache.js +327 -0
- package/dist/textures/TextureCache.js.map +1 -0
- package/dist/textures/TexturesPropertyDefine.d.ts +2 -0
- package/dist/textures/TexturesPropertyDefine.d.ts.map +1 -0
- package/dist/textures/TexturesPropertyDefine.js +39 -0
- package/dist/textures/TexturesPropertyDefine.js.map +1 -0
- package/dist/textures/TexturesWebGL.d.ts +349 -0
- package/dist/textures/TexturesWebGL.d.ts.map +1 -0
- package/dist/textures/TexturesWebGL.js +765 -0
- package/dist/textures/TexturesWebGL.js.map +1 -0
- package/dist/textures/WebGLTextureCache.d.ts +2 -0
- package/dist/textures/WebGLTextureCache.d.ts.map +1 -0
- package/dist/textures/WebGLTextureCache.js +79 -0
- package/dist/textures/WebGLTextureCache.js.map +1 -0
- package/dist/textures/index.d.ts +3 -0
- package/dist/textures/index.d.ts.map +1 -0
- package/dist/textures/index.js +3 -0
- package/dist/textures/index.js.map +1 -0
- package/dist/tilemap/TGAlib.d.ts +103 -0
- package/dist/tilemap/TGAlib.d.ts.map +1 -0
- package/dist/tilemap/TGAlib.js +338 -0
- package/dist/tilemap/TGAlib.js.map +1 -0
- package/dist/tilemap/TMXLayer.d.ts +225 -0
- package/dist/tilemap/TMXLayer.d.ts.map +1 -0
- package/dist/tilemap/TMXLayer.js +694 -0
- package/dist/tilemap/TMXLayer.js.map +1 -0
- package/dist/tilemap/TMXLayerInfo.d.ts +42 -0
- package/dist/tilemap/TMXLayerInfo.d.ts.map +1 -0
- package/dist/tilemap/TMXLayerInfo.js +57 -0
- package/dist/tilemap/TMXLayerInfo.js.map +1 -0
- package/dist/tilemap/TMXLayerWebGLRenderCmd.d.ts +17 -0
- package/dist/tilemap/TMXLayerWebGLRenderCmd.d.ts.map +1 -0
- package/dist/tilemap/TMXLayerWebGLRenderCmd.js +209 -0
- package/dist/tilemap/TMXLayerWebGLRenderCmd.js.map +1 -0
- package/dist/tilemap/TMXMapInfo.d.ts +210 -0
- package/dist/tilemap/TMXMapInfo.d.ts.map +1 -0
- package/dist/tilemap/TMXMapInfo.js +614 -0
- package/dist/tilemap/TMXMapInfo.js.map +1 -0
- package/dist/tilemap/TMXObjectGroup.d.ts +70 -0
- package/dist/tilemap/TMXObjectGroup.d.ts.map +1 -0
- package/dist/tilemap/TMXObjectGroup.js +106 -0
- package/dist/tilemap/TMXObjectGroup.js.map +1 -0
- package/dist/tilemap/TMXTiledMap.d.ts +163 -0
- package/dist/tilemap/TMXTiledMap.d.ts.map +1 -0
- package/dist/tilemap/TMXTiledMap.js +347 -0
- package/dist/tilemap/TMXTiledMap.js.map +1 -0
- package/dist/tilemap/TMXTilesetInfo.d.ts +38 -0
- package/dist/tilemap/TMXTilesetInfo.d.ts.map +1 -0
- package/dist/tilemap/TMXTilesetInfo.js +59 -0
- package/dist/tilemap/TMXTilesetInfo.js.map +1 -0
- package/dist/tilemap/TMXXMLParser.d.ts +52 -0
- package/dist/tilemap/TMXXMLParser.d.ts.map +1 -0
- package/dist/tilemap/TMXXMLParser.js +52 -0
- package/dist/tilemap/TMXXMLParser.js.map +1 -0
- package/dist/tilemap/index.d.ts +4 -0
- package/dist/tilemap/index.d.ts.map +1 -0
- package/dist/tilemap/index.js +4 -0
- package/dist/tilemap/index.js.map +1 -0
- package/dist/ui/base/FocusNavigationController.d.ts +12 -0
- package/dist/ui/base/FocusNavigationController.d.ts.map +1 -0
- package/dist/ui/base/FocusNavigationController.js +54 -0
- package/dist/ui/base/FocusNavigationController.js.map +1 -0
- package/dist/ui/base/ProtectedNode.d.ts +66 -0
- package/dist/ui/base/ProtectedNode.d.ts.map +1 -0
- package/dist/ui/base/ProtectedNode.js +248 -0
- package/dist/ui/base/ProtectedNode.js.map +1 -0
- package/dist/ui/base/ProtectedNodeWebGLRenderCmd.d.ts +13 -0
- package/dist/ui/base/ProtectedNodeWebGLRenderCmd.d.ts.map +1 -0
- package/dist/ui/base/ProtectedNodeWebGLRenderCmd.js +136 -0
- package/dist/ui/base/ProtectedNodeWebGLRenderCmd.js.map +1 -0
- package/dist/ui/base/UIHelper.d.ts +48 -0
- package/dist/ui/base/UIHelper.d.ts.map +1 -0
- package/dist/ui/base/UIHelper.js +128 -0
- package/dist/ui/base/UIHelper.js.map +1 -0
- package/dist/ui/base/UIScale9Sprite.d.ts +224 -0
- package/dist/ui/base/UIScale9Sprite.d.ts.map +1 -0
- package/dist/ui/base/UIScale9Sprite.js +825 -0
- package/dist/ui/base/UIScale9Sprite.js.map +1 -0
- package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.d.ts +15 -0
- package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.d.ts.map +1 -0
- package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.js +119 -0
- package/dist/ui/base/UIScale9SpriteWebGLRenderCmd.js.map +1 -0
- package/dist/ui/base/UIWidget.d.ts +794 -0
- package/dist/ui/base/UIWidget.d.ts.map +1 -0
- package/dist/ui/base/UIWidget.js +1634 -0
- package/dist/ui/base/UIWidget.js.map +1 -0
- package/dist/ui/base/UIWidgetRenderCmd.d.ts +9 -0
- package/dist/ui/base/UIWidgetRenderCmd.d.ts.map +1 -0
- package/dist/ui/base/UIWidgetRenderCmd.js +41 -0
- package/dist/ui/base/UIWidgetRenderCmd.js.map +1 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/layout/UILayout.d.ts +486 -0
- package/dist/ui/layout/UILayout.d.ts.map +1 -0
- package/dist/ui/layout/UILayout.js +1430 -0
- package/dist/ui/layout/UILayout.js.map +1 -0
- package/dist/ui/layout/UILayoutParameter.d.ts +344 -0
- package/dist/ui/layout/UILayoutParameter.d.ts.map +1 -0
- package/dist/ui/layout/UILayoutParameter.js +444 -0
- package/dist/ui/layout/UILayoutParameter.js.map +1 -0
- package/dist/ui/layout/UILayoutWebGLRenderCmd.d.ts +30 -0
- package/dist/ui/layout/UILayoutWebGLRenderCmd.d.ts.map +1 -0
- package/dist/ui/layout/UILayoutWebGLRenderCmd.js +136 -0
- package/dist/ui/layout/UILayoutWebGLRenderCmd.js.map +1 -0
- package/dist/ui/layout/constant.d.ts +30 -0
- package/dist/ui/layout/constant.d.ts.map +1 -0
- package/dist/ui/layout/constant.js +31 -0
- package/dist/ui/layout/constant.js.map +1 -0
- package/dist/ui/widget/UIButton.d.ts +248 -0
- package/dist/ui/widget/UIButton.d.ts.map +1 -0
- package/dist/ui/widget/UIButton.js +727 -0
- package/dist/ui/widget/UIButton.js.map +1 -0
- package/dist/ui/widget/UIRichText.d.ts +216 -0
- package/dist/ui/widget/UIRichText.d.ts.map +1 -0
- package/dist/ui/widget/UIRichText.js +549 -0
- package/dist/ui/widget/UIRichText.js.map +1 -0
- package/dist/ui/widget/UIScrollView.d.ts +547 -0
- package/dist/ui/widget/UIScrollView.d.ts.map +1 -0
- package/dist/ui/widget/UIScrollView.js +1544 -0
- package/dist/ui/widget/UIScrollView.js.map +1 -0
- package/dist/ui/widget/UIScrollViewBar.d.ts +101 -0
- package/dist/ui/widget/UIScrollViewBar.d.ts.map +1 -0
- package/dist/ui/widget/UIScrollViewBar.js +277 -0
- package/dist/ui/widget/UIScrollViewBar.js.map +1 -0
- package/dist/ui/widget/UIScrollViewWebGLRenderCmd.d.ts +10 -0
- package/dist/ui/widget/UIScrollViewWebGLRenderCmd.d.ts.map +1 -0
- package/dist/ui/widget/UIScrollViewWebGLRenderCmd.js +42 -0
- package/dist/ui/widget/UIScrollViewWebGLRenderCmd.js.map +1 -0
- package/dist/ui/widget/UISlider.d.ts +229 -0
- package/dist/ui/widget/UISlider.d.ts.map +1 -0
- package/dist/ui/widget/UISlider.js +667 -0
- package/dist/ui/widget/UISlider.js.map +1 -0
- package/dist/ui/widget/UIText.d.ts +90 -0
- package/dist/ui/widget/UIText.d.ts.map +1 -0
- package/dist/ui/widget/UIText.js +325 -0
- package/dist/ui/widget/UIText.js.map +1 -0
- package/dist/ui/widget/UITextField.d.ts +282 -0
- package/dist/ui/widget/UITextField.d.ts.map +1 -0
- package/dist/ui/widget/UITextField.js +549 -0
- package/dist/ui/widget/UITextField.js.map +1 -0
- package/dist/ui/widget/UITextFieldRenderer.d.ts +41 -0
- package/dist/ui/widget/UITextFieldRenderer.d.ts.map +1 -0
- package/dist/ui/widget/UITextFieldRenderer.js +150 -0
- package/dist/ui/widget/UITextFieldRenderer.js.map +1 -0
- package/eslint.config.ts +59 -0
- package/index.html +22 -0
- package/package.json +38 -0
- package/res/Button.mp3 +0 -0
- package/res/SmallSun.plist +108 -0
- package/res/Spiral.plist +102 -0
- package/res/base.png +0 -0
- package/res/button.png +0 -0
- package/res/button_plus.png +0 -0
- package/res/ortho-test1.png +0 -0
- package/res/orthogonal-test1.tmx +9 -0
- package/res/orthogonal-test1.tsx +4 -0
- package/res/particle.png +0 -0
- package/res/sliderThumb.png +0 -0
- package/res/sliderTrack.png +0 -0
- package/res/streak.png +0 -0
- package/res/ui.plist +578 -0
- package/res/ui.png +0 -0
- package/res/vite.svg +1 -0
- package/test/ActionScene.ts +15 -0
- package/test/DemoScene.ts +108 -0
- package/test/GraphicsTest.ts +17 -0
- package/test/ParticleScene.ts +24 -0
- package/test/TiledMapScene.ts +14 -0
- package/test/index.ts +28 -0
- 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
|