ccb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +31 -0
- data/bin/ccb +4 -0
- data/lib/ccb/builder/project_builder.rb +14 -0
- data/lib/ccb/builder/scene_builder.rb +9 -0
- data/lib/ccb/builder/templates/project/GameConfig.js.tt +21 -0
- data/lib/ccb/builder/templates/project/_cocos-project.json +4 -0
- data/lib/ccb/builder/templates/project/folder/CMakeLists.txt +295 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/Base64Images.js +32 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/CCBoot.js +2271 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/CCDebugger.js +336 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCAction.js +694 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionCamera.js +293 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionCatmullRom.js +605 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionEase.js +3681 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionInstant.js +757 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionInterval.js +3554 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionTween.js +166 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionGrid.js +372 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionGrid3D.js +1257 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionPageTurn3D.js +113 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionTiledGrid.js +1289 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/audio/CCAudio.js +1024 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNode.js +224 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNodeCanvasRenderCmd.js +227 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNodeWebGLRenderCmd.js +226 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/ZipUtils.js +82 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/base64.js +95 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/gzip.js +731 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/zlib.min.js +55 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCActionManager.js +378 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCCamera.js +290 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCConfiguration.js +294 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDirector.js +1019 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDirectorWebGL.js +329 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDrawingPrimitivesCanvas.js +438 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDrawingPrimitivesWebGL.js +464 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCScheduler.js +744 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/BaseNodesPropertyDefine.js +127 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNode.js +294 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNodeCanvasRenderCmd.js +138 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNodeWebGLRenderCmd.js +145 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNode.js +2386 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNodeCanvasRenderCmd.js +504 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNodeWebGLRenderCmd.js +254 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/cocoa/CCAffineTransform.js +259 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/cocoa/CCGeometry.js +327 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEvent.js +449 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventExtension.js +126 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventListener.js +519 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventManager.js +1025 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCTouch.js +175 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTF.js +829 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js +420 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js +101 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/LabelTTFPropertyDefine.js +88 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayer.js +642 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayerCanvasRenderCmd.js +434 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayerWebGLRenderCmd.js +248 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCClass.js +333 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCCommon.js +303 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCConfig.js +303 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCEGLView.js +1245 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCInputExtension.js +135 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCInputManager.js +616 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCLoaders.js +142 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCMacro.js +830 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCSAXParser.js +160 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCScreen.js +155 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypes.js +374 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypesPropertyDefine.js +165 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypesWebGL.js +689 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCVisibleRect.js +100 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/miniFramework.js +264 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/renderer/RendererCanvas.js +274 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/renderer/RendererWebGL.js +137 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/scenes/CCLoaderScene.js +149 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/scenes/CCScene.js +62 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCAnimation.js +477 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCAnimationCache.js +213 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCBakeSprite.js +71 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSprite.js +1014 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNode.js +676 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js +101 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js +243 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js +518 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteFrame.js +420 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteFrameCache.js +341 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js +493 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/SpritesPropertyDefine.js +67 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/CCPointExtension.js +515 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/CCVertex.js +170 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/TransformUtils.js +62 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTexture2D.js +455 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTextureAtlas.js +653 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTextureCache.js +371 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/TexturesPropertyDefine.js +221 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/TexturesWebGL.js +899 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/utils/BinaryLoader.js +151 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/effects/CCGrabber.js +110 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/effects/CCGrid.js +737 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/aabb.js +68 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/gl/mat4stack.js +59 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/gl/matrix.js +169 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/mat3.js +329 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/mat4.js +810 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/plane.js +184 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/quaternion.js +497 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/ray2.js +163 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/utility.js +76 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec2.js +107 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec3.js +205 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec4.js +158 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlas.js +239 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js +95 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlasWebGLRenderCmd.js +132 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFont.js +958 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFontCanvasRenderCmd.js +142 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFontWebGLRenderCmd.js +87 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/menus/CCMenu.js +600 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/menus/CCMenuItem.js +1422 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/motion-streak/CCMotionStreak.js +517 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/motion-streak/CCMotionStreakWebGLRenderCmd.js +66 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/node-grid/CCNodeGrid.js +129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/node-grid/CCNodeGridWebGLRenderCmd.js +98 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/parallax/CCParallaxNode.js +252 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/parallax/CCParallaxNodeRenderCmd.js +69 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCPNGReader.js +330 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNode.js +527 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNodeCanvasRenderCmd.js +38 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNodeWebGLRenderCmd.js +74 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleExamples.js +1006 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystem.js +2294 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystemCanvasRenderCmd.js +217 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystemWebGLRenderCmd.js +402 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCTIFFReader.js +692 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNode.js +212 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNodeCanvasRenderCmd.js +52 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNodeWebGLRenderCmd.js +53 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSprite.js +447 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSpriteCanvasRenderCmd.js +93 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSpriteWebGLRenderCmd.js +87 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCActionProgressTimer.js +227 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimer.js +345 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimerCanvasRenderCmd.js +270 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimerWebGLRenderCmd.js +486 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTexture.js +395 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTextureCanvasRenderCmd.js +105 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js +367 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCGLProgram.js +767 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCGLStateCache.js +340 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCShaderCache.js +301 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCShaders.js +280 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNode.js +940 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNodeCanvasRenderCmd.js +129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNodeWebGLRenderCmd.js +41 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/text-input/CCIMEDispatcher.js +526 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/text-input/CCTextFieldTTF.js +472 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTGAlib.js +437 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayer.js +914 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayerCanvasRenderCmd.js +232 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayerWebGLRenderCmd.js +67 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXObjectGroup.js +146 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXTiledMap.js +479 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXXMLParser.js +950 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransition.js +1971 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransitionPageTurn.js +152 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransitionProgress.js +458 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBAnimationManager.js +770 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBKeyframe.js +60 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBReader.js +1129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBReaderUtil.js +61 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBRelativePositioning.js +90 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBSequence.js +114 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBValue.js +81 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCControlLoader.js +318 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCNodeLoader.js +905 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCNodeLoaderLibrary.js +101 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCSpriteLoader.js +544 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccpool/CCPool.js +146 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNode.js +305 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNodeCanvasRenderCmd.js +246 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNodeWebGLRenderCmd.js +159 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9Sprite.js +1105 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9SpriteCanvasRenderCmd.js +142 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9SpriteWebGLRenderCmd.js +129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIWidget.js +2059 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIWidgetRenderCmd.js +100 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIHBox.js +80 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayout.js +1558 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutCanvasRenderCmd.js +179 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutComponent.js +585 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutManager.js +457 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutParameter.js +576 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutWebGLRenderCmd.js +240 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIRelativeBox.js +79 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIVBox.js +79 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/system/CocosGUI.js +62 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/system/UIHelper.js +164 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIButton.js +987 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UICheckBox.js +737 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIImageView.js +337 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UILoadingBar.js +432 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIRichText.js +579 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UISlider.js +762 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIText.js +512 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextAtlas.js +229 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextBMFont.js +216 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextField.js +915 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIListView.js +602 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIPageView.js +657 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIScrollView.js +1884 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/CocoStudio.js +68 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionFrame.js +528 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionManager.js +112 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionNode.js +417 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionObject.js +263 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmature.js +579 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js +190 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmatureWebGLRenderCmd.js +167 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCBone.js +711 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCArmatureAnimation.js +669 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCProcessBase.js +365 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCTween.js +448 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/datas/CCDatas.js +807 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDecorativeDisplay.js +118 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDisplayFactory.js +220 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDisplayManager.js +465 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkin.js +215 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkinCanvasRenderCmd.js +58 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkinWebGLRenderCmd.js +146 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/physics/CCColliderDetector.js +397 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCArmatureDataManager.js +325 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCArmatureDefine.js +45 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCDataReaderHelper.js +1223 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCSpriteFrameCacheHelper.js +68 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCTransformHelp.js +183 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCTweenFunction.js +501 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCUtilMath.js +69 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComAttribute.js +210 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComAudio.js +285 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComController.js +76 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComRender.js +91 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComponent.js +136 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComponentContainer.js +159 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/load.js +221 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/action-1.x.js +238 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/action-2.x.js +266 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/compatible.js +251 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/scene-1.x.js +262 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/timelineParser-1.x.js +292 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/timelineParser-2.x.js +1288 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/uiParser-1.x.js +680 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/ActionTimeline.js +448 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/Frame.js +1268 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/Timeline.js +321 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/ObjectFactory.js +99 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerBase.js +49 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerMng.js +301 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerObj.js +263 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/editbox/CCEditBox.js +716 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/editbox/CCdomNode.js +657 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControl.js +381 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlButton.js +688 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlColourPicker.js +187 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlHuePicker.js +218 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlPotentiometer.js +300 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSaturationBrightnessPicker.js +257 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSlider.js +308 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlStepper.js +390 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSwitch.js +425 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlUtils.js +177 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCInvocation.js +65 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCMenuPassive.js +415 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9Sprite.js +1099 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9SpriteCanvasRenderCmd.js +142 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9SpriteWebGLRenderCmd.js +129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollView.js +827 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollViewCanvasRenderCmd.js +79 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollViewWebGLRenderCmd.js +108 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCSorting.js +239 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCTableView.js +718 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeleton.js +357 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonAnimation.js +340 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonCanvasRenderCmd.js +165 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonWebGLRenderCmd.js +165 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/Spine.js +2239 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/box2d/box2d.js +10882 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/chipmunk/chipmunk.js +6196 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/Plugin.js +254 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/platform/facebook.js +557 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/platform/facebook_sdk.js +151 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/socketio/socket.io.min.js +2 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/jsb_apis.js +618 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/moduleConfig.json +453 -0
- data/lib/ccb/builder/templates/project/folder/project.json +42 -0
- data/lib/ccb/builder/templates/project/folder/res/CloseNormal.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/CloseSelected.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/HelloWorld.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/favicon.ico +0 -0
- data/lib/ccb/builder/templates/project/folder/res/gameOver/cocos2d-html5.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/gameOver/gameOver.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/mainMenu/bg.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/mainMenu/menu.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/setting/menuTitle.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/shared/arial-14.fnt +182 -0
- data/lib/ccb/builder/templates/project/folder/res/shared/arial-14.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/sound/music/bgMusic.mp3 +0 -0
- data/lib/ccb/builder/templates/project/folder/src/about/layer/ABBackgroundLayer.js +23 -0
- data/lib/ccb/builder/templates/project/folder/src/about/layer/ABTouchLayer.js +51 -0
- data/lib/ccb/builder/templates/project/folder/src/about/scene/About.js +36 -0
- data/lib/ccb/builder/templates/project/folder/src/config/Level.js +7 -0
- data/lib/ccb/builder/templates/project/folder/src/gameOver/layer/GOBackgroundLayer.js +50 -0
- data/lib/ccb/builder/templates/project/folder/src/gameOver/layer/GOTouchLayer.js +51 -0
- data/lib/ccb/builder/templates/project/folder/src/gameOver/scene/GameOver.js +38 -0
- data/lib/ccb/builder/templates/project/folder/src/gamePlay/classes/LevelManager.js +21 -0
- data/lib/ccb/builder/templates/project/folder/src/gamePlay/layer/GPBackgroundLayer.js +25 -0
- data/lib/ccb/builder/templates/project/folder/src/gamePlay/layer/GPTouchLayer.js +51 -0
- data/lib/ccb/builder/templates/project/folder/src/gamePlay/scene/GamePlay.js +44 -0
- data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMBackgroundLayer.js +43 -0
- data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMMainMenuLayer.js +38 -0
- data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMTouchLayer.js +96 -0
- data/lib/ccb/builder/templates/project/folder/src/mainMenu/scene/MainMenu.js +45 -0
- data/lib/ccb/builder/templates/project/folder/src/resource.js +29 -0
- data/lib/ccb/builder/templates/project/folder/src/setting/layer/STBackgroundLayer.js +25 -0
- data/lib/ccb/builder/templates/project/folder/src/setting/layer/STTouchLayer.js +89 -0
- data/lib/ccb/builder/templates/project/folder/src/setting/scene/Setting.js +40 -0
- data/lib/ccb/builder/templates/project/index.html.tt +27 -0
- data/lib/ccb/builder/templates/project/main.js.tt +62 -0
- data/lib/ccb/cli.rb +32 -0
- data/lib/ccb/ext/method_hooker.rb +68 -0
- data/lib/ccb/ext/string_extention.rb +7 -0
- data/lib/ccb.rb +1 -0
- metadata +449 -0
@@ -0,0 +1,1257 @@
|
|
1
|
+
/****************************************************************************
|
2
|
+
Copyright (c) 2008-2010 Ricardo Quesada
|
3
|
+
Copyright (c) 2011-2012 cocos2d-x.org
|
4
|
+
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
5
|
+
|
6
|
+
http://www.cocos2d-x.org
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
10
|
+
in the Software without restriction, including without limitation the rights
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
13
|
+
furnished to do so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
16
|
+
all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
THE SOFTWARE.
|
25
|
+
****************************************************************************/
|
26
|
+
|
27
|
+
/**
|
28
|
+
* cc.Waves3D action. <br />
|
29
|
+
* Reference the test cases (Effects Advanced Test)
|
30
|
+
* @class
|
31
|
+
* @extends cc.Grid3DAction
|
32
|
+
* @param {Number} duration
|
33
|
+
* @param {cc.Size} gridSize
|
34
|
+
* @param {Number} waves
|
35
|
+
* @param {Number} amplitude
|
36
|
+
*/
|
37
|
+
cc.Waves3D = cc.Grid3DAction.extend(/** @lends cc.Waves3D# */{
|
38
|
+
_waves: 0,
|
39
|
+
_amplitude: 0,
|
40
|
+
_amplitudeRate: 0,
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
44
|
+
* Create a wave 3d action with duration, grid size, waves and amplitude.
|
45
|
+
* @param {Number} duration
|
46
|
+
* @param {cc.Size} gridSize
|
47
|
+
* @param {Number} waves
|
48
|
+
* @param {Number} amplitude
|
49
|
+
*/
|
50
|
+
ctor:function (duration, gridSize, waves, amplitude) {
|
51
|
+
cc.GridAction.prototype.ctor.call(this);
|
52
|
+
amplitude !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude);
|
53
|
+
},
|
54
|
+
|
55
|
+
/**
|
56
|
+
* get Amplitude
|
57
|
+
* @return {Number}
|
58
|
+
*/
|
59
|
+
getAmplitude:function () {
|
60
|
+
return this._amplitude;
|
61
|
+
},
|
62
|
+
|
63
|
+
/**
|
64
|
+
* set Amplitude
|
65
|
+
* @param {Number} amplitude
|
66
|
+
*/
|
67
|
+
setAmplitude:function (amplitude) {
|
68
|
+
this._amplitude = amplitude;
|
69
|
+
},
|
70
|
+
|
71
|
+
/**
|
72
|
+
* get Amplitude Rate
|
73
|
+
* @return {Number}
|
74
|
+
*/
|
75
|
+
getAmplitudeRate:function () {
|
76
|
+
return this._amplitudeRate;
|
77
|
+
},
|
78
|
+
|
79
|
+
/**
|
80
|
+
* set Amplitude Rate
|
81
|
+
* @param {Number} amplitudeRate
|
82
|
+
*/
|
83
|
+
setAmplitudeRate:function (amplitudeRate) {
|
84
|
+
this._amplitudeRate = amplitudeRate;
|
85
|
+
},
|
86
|
+
|
87
|
+
/**
|
88
|
+
* initializes an action with duration, grid size, waves and amplitude
|
89
|
+
* @param {Number} duration
|
90
|
+
* @param {cc.Size} gridSize
|
91
|
+
* @param {Number} waves
|
92
|
+
* @param {Number} amplitude
|
93
|
+
* @return {Boolean}
|
94
|
+
*/
|
95
|
+
initWithDuration:function (duration, gridSize, waves, amplitude) {
|
96
|
+
if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
|
97
|
+
this._waves = waves;
|
98
|
+
this._amplitude = amplitude;
|
99
|
+
this._amplitudeRate = 1.0;
|
100
|
+
return true;
|
101
|
+
}
|
102
|
+
return false;
|
103
|
+
},
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
107
|
+
*
|
108
|
+
* @param {Number} dt
|
109
|
+
*/
|
110
|
+
update:function (dt) {
|
111
|
+
var locGridSize = this._gridSize;
|
112
|
+
var locAmplitude = this._amplitude, locPos = cc.p(0, 0);
|
113
|
+
var locAmplitudeRate = this._amplitudeRate, locWaves = this._waves;
|
114
|
+
for (var i = 0; i < locGridSize.width + 1; ++i) {
|
115
|
+
for (var j = 0; j < locGridSize.height + 1; ++j) {
|
116
|
+
locPos.x = i;
|
117
|
+
locPos.y = j;
|
118
|
+
var v = this.originalVertex(locPos);
|
119
|
+
v.z += (Math.sin(Math.PI * dt * locWaves * 2 + (v.y + v.x) * 0.01) * locAmplitude * locAmplitudeRate);
|
120
|
+
//cc.log("v.z offset is" + (Math.sin(Math.PI * dt * this._waves * 2 + (v.y + v.x) * 0.01) * this._amplitude * this._amplitudeRate));
|
121
|
+
this.setVertex(locPos, v);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
});
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Create a wave 3d action with duration, grid size, waves and amplitude.
|
129
|
+
* @function
|
130
|
+
* @param {Number} duration
|
131
|
+
* @param {cc.Size} gridSize
|
132
|
+
* @param {Number} waves
|
133
|
+
* @param {Number} amplitude
|
134
|
+
*/
|
135
|
+
cc.waves3D = function (duration, gridSize, waves, amplitude) {
|
136
|
+
return new cc.Waves3D(duration, gridSize, waves, amplitude);
|
137
|
+
};
|
138
|
+
/**
|
139
|
+
* Please use cc.waves3D instead. <br />
|
140
|
+
* Create a wave 3d action with duration, grid size, waves and amplitude.
|
141
|
+
* @param {Number} duration
|
142
|
+
* @param {cc.Size} gridSize
|
143
|
+
* @param {Number} waves
|
144
|
+
* @param {Number} amplitude
|
145
|
+
* @static
|
146
|
+
* @deprecated since v3.0 <br /> Please use cc.waves3D instead.
|
147
|
+
*/
|
148
|
+
cc.Waves3D.create = cc.waves3D;
|
149
|
+
|
150
|
+
/**
|
151
|
+
* cc.FlipX3D action. <br />
|
152
|
+
* Flip around. <br />
|
153
|
+
* Reference the test cases (Effects Test)
|
154
|
+
* @class
|
155
|
+
* @extends cc.Grid3DAction
|
156
|
+
* @param {Number} duration
|
157
|
+
*/
|
158
|
+
cc.FlipX3D = cc.Grid3DAction.extend(/** @lends cc.FlipX3D# */{
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
162
|
+
* Create a Flip X 3D action with duration.
|
163
|
+
* @param {Number} duration
|
164
|
+
*/
|
165
|
+
ctor: function(duration) {
|
166
|
+
if (duration !== undefined)
|
167
|
+
cc.GridAction.prototype.ctor.call(this, duration, cc.size(1, 1));
|
168
|
+
else cc.GridAction.prototype.ctor.call(this);
|
169
|
+
},
|
170
|
+
|
171
|
+
/**
|
172
|
+
* initializes the action with duration
|
173
|
+
* @param {Number} duration
|
174
|
+
* @return {Boolean}
|
175
|
+
*/
|
176
|
+
initWithDuration:function (duration) {
|
177
|
+
return cc.Grid3DAction.prototype.initWithDuration.call(this, duration, cc.size(1, 1));
|
178
|
+
},
|
179
|
+
|
180
|
+
/**
|
181
|
+
* initializes the action with gridSize and duration
|
182
|
+
* @param {cc.Size} gridSize
|
183
|
+
* @param {Number} duration
|
184
|
+
* @return {Boolean}
|
185
|
+
*/
|
186
|
+
initWithSize:function (gridSize, duration) {
|
187
|
+
if (gridSize.width != 1 || gridSize.height != 1) {
|
188
|
+
// Grid size must be (1,1)
|
189
|
+
cc.log("Grid size must be (1,1)");
|
190
|
+
return false;
|
191
|
+
}
|
192
|
+
return cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize);
|
193
|
+
},
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
197
|
+
*
|
198
|
+
* @param {Number} dt
|
199
|
+
*/
|
200
|
+
update:function (dt) {
|
201
|
+
var angle = Math.PI * dt; // 180 degrees
|
202
|
+
var mz = Math.sin(angle);
|
203
|
+
angle = angle / 2.0; // x calculates degrees from 0 to 90
|
204
|
+
var mx = Math.cos(angle);
|
205
|
+
|
206
|
+
var diff = new cc.Vertex3F();
|
207
|
+
var tempVer = cc.p(0, 0);
|
208
|
+
tempVer.x = tempVer.y = 1;
|
209
|
+
var v0 = this.originalVertex(tempVer);
|
210
|
+
tempVer.x = tempVer.y = 0;
|
211
|
+
var v1 = this.originalVertex(tempVer);
|
212
|
+
|
213
|
+
var x0 = v0.x;
|
214
|
+
var x1 = v1.x;
|
215
|
+
var x;
|
216
|
+
var a, b, c, d;
|
217
|
+
|
218
|
+
if (x0 > x1) {
|
219
|
+
// Normal Grid
|
220
|
+
a = cc.p(0, 0);
|
221
|
+
b = cc.p(0, 1);
|
222
|
+
c = cc.p(1, 0);
|
223
|
+
d = cc.p(1, 1);
|
224
|
+
x = x0;
|
225
|
+
} else {
|
226
|
+
// Reversed Grid
|
227
|
+
c = cc.p(0, 0);
|
228
|
+
d = cc.p(0, 1);
|
229
|
+
a = cc.p(1, 0);
|
230
|
+
b = cc.p(1, 1);
|
231
|
+
x = x1;
|
232
|
+
}
|
233
|
+
|
234
|
+
diff.x = ( x - x * mx );
|
235
|
+
diff.z = Math.abs(parseFloat((x * mz) / 4.0));
|
236
|
+
|
237
|
+
// bottom-left
|
238
|
+
var v = this.originalVertex(a);
|
239
|
+
v.x = diff.x;
|
240
|
+
v.z += diff.z;
|
241
|
+
this.setVertex(a, v);
|
242
|
+
|
243
|
+
// upper-left
|
244
|
+
v = this.originalVertex(b);
|
245
|
+
v.x = diff.x;
|
246
|
+
v.z += diff.z;
|
247
|
+
this.setVertex(b, v);
|
248
|
+
|
249
|
+
// bottom-right
|
250
|
+
v = this.originalVertex(c);
|
251
|
+
v.x -= diff.x;
|
252
|
+
v.z -= diff.z;
|
253
|
+
this.setVertex(c, v);
|
254
|
+
|
255
|
+
// upper-right
|
256
|
+
v = this.originalVertex(d);
|
257
|
+
v.x -= diff.x;
|
258
|
+
v.z -= diff.z;
|
259
|
+
this.setVertex(d, v);
|
260
|
+
}
|
261
|
+
});
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Create a Flip X 3D action with duration. <br />
|
265
|
+
* Flip around.
|
266
|
+
* @function
|
267
|
+
* @param {Number} duration
|
268
|
+
* @return {cc.FlipX3D}
|
269
|
+
*/
|
270
|
+
cc.flipX3D = function (duration) {
|
271
|
+
return new cc.FlipX3D(duration);
|
272
|
+
};
|
273
|
+
|
274
|
+
/**
|
275
|
+
* Please use cc.flipX3D instead. <br />
|
276
|
+
* Create a Flip X 3D action with duration. <br />
|
277
|
+
* Flip around.
|
278
|
+
* @param {Number} duration
|
279
|
+
* @return {cc.FlipX3D}
|
280
|
+
* @static
|
281
|
+
* @deprecated since v3.0 <br /> Please use cc.flipX3D instead.
|
282
|
+
*/
|
283
|
+
cc.FlipX3D.create = cc.flipX3D;
|
284
|
+
|
285
|
+
/**
|
286
|
+
* cc.FlipY3D action. <br />
|
287
|
+
* Upside down. <br />
|
288
|
+
* Reference the test cases (Effects Test)
|
289
|
+
* @class
|
290
|
+
* @extends cc.FlipX3D
|
291
|
+
* @param {Number} duration
|
292
|
+
*/
|
293
|
+
cc.FlipY3D = cc.FlipX3D.extend(/** @lends cc.FlipY3D# */{
|
294
|
+
|
295
|
+
/**
|
296
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
297
|
+
* Create a flip Y 3d action with duration.
|
298
|
+
* @param {Number} duration
|
299
|
+
*/
|
300
|
+
ctor: function(duration) {
|
301
|
+
if (duration !== undefined)
|
302
|
+
cc.GridAction.prototype.ctor.call(this, duration, cc.size(1, 1));
|
303
|
+
else cc.GridAction.prototype.ctor.call(this);
|
304
|
+
},
|
305
|
+
|
306
|
+
/**
|
307
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
308
|
+
*
|
309
|
+
* @param {Number} dt
|
310
|
+
*/
|
311
|
+
update:function (dt) {
|
312
|
+
var angle = Math.PI * dt; // 180 degrees
|
313
|
+
var mz = Math.sin(angle);
|
314
|
+
angle = angle / 2.0; // x calculates degrees from 0 to 90
|
315
|
+
var my = Math.cos(angle);
|
316
|
+
|
317
|
+
var diff = new cc.Vertex3F();
|
318
|
+
|
319
|
+
var tempP = cc.p(0, 0);
|
320
|
+
tempP.x = tempP.y = 1;
|
321
|
+
var v0 = this.originalVertex(tempP);
|
322
|
+
tempP.x = tempP.y = 0;
|
323
|
+
var v1 = this.originalVertex(tempP);
|
324
|
+
|
325
|
+
var y0 = v0.y;
|
326
|
+
var y1 = v1.y;
|
327
|
+
var y;
|
328
|
+
var a, b, c, d;
|
329
|
+
|
330
|
+
if (y0 > y1) {
|
331
|
+
// Normal Grid
|
332
|
+
a = cc.p(0, 0);
|
333
|
+
b = cc.p(0, 1);
|
334
|
+
c = cc.p(1, 0);
|
335
|
+
d = cc.p(1, 1);
|
336
|
+
y = y0;
|
337
|
+
} else {
|
338
|
+
// Reversed Grid
|
339
|
+
b = cc.p(0, 0);
|
340
|
+
a = cc.p(0, 1);
|
341
|
+
d = cc.p(1, 0);
|
342
|
+
c = cc.p(1, 1);
|
343
|
+
y = y1;
|
344
|
+
}
|
345
|
+
|
346
|
+
diff.y = y - y * my;
|
347
|
+
diff.z = Math.abs(parseFloat(y * mz) / 4.0);
|
348
|
+
|
349
|
+
// bottom-left
|
350
|
+
var v = this.originalVertex(a);
|
351
|
+
v.y = diff.y;
|
352
|
+
v.z += diff.z;
|
353
|
+
this.setVertex(a, v);
|
354
|
+
|
355
|
+
// upper-left
|
356
|
+
v = this.originalVertex(b);
|
357
|
+
v.y -= diff.y;
|
358
|
+
v.z -= diff.z;
|
359
|
+
this.setVertex(b, v);
|
360
|
+
|
361
|
+
// bottom-right
|
362
|
+
v = this.originalVertex(c);
|
363
|
+
v.y = diff.y;
|
364
|
+
v.z += diff.z;
|
365
|
+
this.setVertex(c, v);
|
366
|
+
|
367
|
+
// upper-right
|
368
|
+
v = this.originalVertex(d);
|
369
|
+
v.y -= diff.y;
|
370
|
+
v.z -= diff.z;
|
371
|
+
this.setVertex(d, v);
|
372
|
+
}
|
373
|
+
});
|
374
|
+
|
375
|
+
/**
|
376
|
+
* Create a flip Y 3d action with duration. <br />
|
377
|
+
* Upside down.
|
378
|
+
* @function
|
379
|
+
* @param {Number} duration
|
380
|
+
* @return {cc.FlipY3D}
|
381
|
+
*/
|
382
|
+
cc.flipY3D = function (duration) {
|
383
|
+
return new cc.FlipY3D(duration);
|
384
|
+
};
|
385
|
+
|
386
|
+
/**
|
387
|
+
* Please use cc.flipY3D instead. <br />
|
388
|
+
* Create a flip Y 3d action with duration.
|
389
|
+
* @param {Number} duration
|
390
|
+
* @return {cc.FlipY3D}
|
391
|
+
* @static
|
392
|
+
* @deprecated since v3.0 <br /> Please use cc.flipY3D instead.
|
393
|
+
*/
|
394
|
+
cc.FlipY3D.create = cc.flipY3D;
|
395
|
+
|
396
|
+
/**
|
397
|
+
* cc.Lens3D action. <br />
|
398
|
+
* Upside down. <br />
|
399
|
+
* Reference the test cases (Effects Test)
|
400
|
+
* @class
|
401
|
+
* @extends cc.Grid3DAction
|
402
|
+
* @param {Number} duration
|
403
|
+
* @param {cc.Size} gridSize
|
404
|
+
* @param {cc.Point} position
|
405
|
+
* @param {Number} radius
|
406
|
+
*/
|
407
|
+
cc.Lens3D = cc.Grid3DAction.extend(/** @lends cc.Lens3D# */{
|
408
|
+
//lens center position
|
409
|
+
_position:null,
|
410
|
+
_radius:0,
|
411
|
+
//lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect
|
412
|
+
_lensEffect:0,
|
413
|
+
//lens is concave. (true = concave, false = convex) default is convex i.e. false
|
414
|
+
_concave:false,
|
415
|
+
_dirty:false,
|
416
|
+
|
417
|
+
/**
|
418
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
419
|
+
* creates a lens 3d action with center position, radius.
|
420
|
+
* @param {Number} duration
|
421
|
+
* @param {cc.Size} gridSize
|
422
|
+
* @param {cc.Point} position
|
423
|
+
* @param {Number} radius
|
424
|
+
*/
|
425
|
+
ctor:function (duration, gridSize, position, radius) {
|
426
|
+
cc.GridAction.prototype.ctor.call(this);
|
427
|
+
|
428
|
+
this._position = cc.p(0, 0);
|
429
|
+
radius !== undefined && this.initWithDuration(duration, gridSize, position, radius);
|
430
|
+
},
|
431
|
+
|
432
|
+
/**
|
433
|
+
* Get lens center position
|
434
|
+
* @return {Number}
|
435
|
+
*/
|
436
|
+
getLensEffect:function () {
|
437
|
+
return this._lensEffect;
|
438
|
+
},
|
439
|
+
|
440
|
+
/**
|
441
|
+
* Set lens center position
|
442
|
+
* @param {Number} lensEffect
|
443
|
+
*/
|
444
|
+
setLensEffect:function (lensEffect) {
|
445
|
+
this._lensEffect = lensEffect;
|
446
|
+
},
|
447
|
+
|
448
|
+
/**
|
449
|
+
* Set whether lens is concave
|
450
|
+
* @param {Boolean} concave
|
451
|
+
*/
|
452
|
+
setConcave:function (concave) {
|
453
|
+
this._concave = concave;
|
454
|
+
},
|
455
|
+
|
456
|
+
/**
|
457
|
+
* get Position
|
458
|
+
* @return {cc.Point}
|
459
|
+
*/
|
460
|
+
getPosition:function () {
|
461
|
+
return this._position;
|
462
|
+
},
|
463
|
+
|
464
|
+
/**
|
465
|
+
* set Position
|
466
|
+
* @param {cc.Point} position
|
467
|
+
*/
|
468
|
+
setPosition:function (position) {
|
469
|
+
if (!cc.pointEqualToPoint(position, this._position)) {
|
470
|
+
this._position.x = position.x;
|
471
|
+
this._position.y = position.y;
|
472
|
+
this._dirty = true;
|
473
|
+
}
|
474
|
+
},
|
475
|
+
|
476
|
+
/**
|
477
|
+
* initializes the action with center position, radius, a grid size and duration
|
478
|
+
* @param {Number} duration
|
479
|
+
* @param {cc.Size} gridSize
|
480
|
+
* @param {cc.Point} position
|
481
|
+
* @param {Number} radius
|
482
|
+
* @return {Boolean}
|
483
|
+
*/
|
484
|
+
initWithDuration:function (duration, gridSize, position, radius) {
|
485
|
+
if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
|
486
|
+
this.setPosition(position);
|
487
|
+
this._radius = radius;
|
488
|
+
this._lensEffect = 0.7;
|
489
|
+
this._dirty = true;
|
490
|
+
return true;
|
491
|
+
}
|
492
|
+
return false;
|
493
|
+
},
|
494
|
+
|
495
|
+
/**
|
496
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
497
|
+
*
|
498
|
+
* @param {Number} dt
|
499
|
+
*/
|
500
|
+
update:function (dt) {
|
501
|
+
if (this._dirty) {
|
502
|
+
var locGridSizeWidth = this._gridSize.width, locGridSizeHeight = this._gridSize.height;
|
503
|
+
var locRadius = this._radius, locLensEffect = this._lensEffect;
|
504
|
+
var locPos = cc.p(0, 0);
|
505
|
+
var vect = cc.p(0, 0);
|
506
|
+
var v, r, l, new_r, pre_log;
|
507
|
+
for (var i = 0; i < locGridSizeWidth + 1; ++i) {
|
508
|
+
for (var j = 0; j < locGridSizeHeight + 1; ++j) {
|
509
|
+
locPos.x = i;
|
510
|
+
locPos.y = j;
|
511
|
+
v = this.originalVertex(locPos);
|
512
|
+
vect.x = this._position.x - v.x;
|
513
|
+
vect.y = this._position.y - v.y;
|
514
|
+
r = cc.pLength(vect);
|
515
|
+
|
516
|
+
if (r < locRadius) {
|
517
|
+
r = locRadius - r;
|
518
|
+
pre_log = r / locRadius;
|
519
|
+
if (pre_log == 0)
|
520
|
+
pre_log = 0.001;
|
521
|
+
|
522
|
+
l = Math.log(pre_log) * locLensEffect;
|
523
|
+
new_r = Math.exp(l) * locRadius;
|
524
|
+
|
525
|
+
r = cc.pLength(vect);
|
526
|
+
if (r > 0) {
|
527
|
+
vect.x = vect.x / r;
|
528
|
+
vect.y = vect.y / r;
|
529
|
+
|
530
|
+
vect.x = vect.x * new_r;
|
531
|
+
vect.y = vect.y * new_r;
|
532
|
+
v.z += cc.pLength(vect) * locLensEffect;
|
533
|
+
}
|
534
|
+
}
|
535
|
+
this.setVertex(locPos, v);
|
536
|
+
}
|
537
|
+
}
|
538
|
+
this._dirty = false;
|
539
|
+
}
|
540
|
+
}
|
541
|
+
});
|
542
|
+
|
543
|
+
/**
|
544
|
+
* creates a lens 3d action with center position, radius
|
545
|
+
* @function
|
546
|
+
* @param {Number} duration
|
547
|
+
* @param {cc.Size} gridSize
|
548
|
+
* @param {cc.Point} position
|
549
|
+
* @param {Number} radius
|
550
|
+
* @return {cc.Lens3D}
|
551
|
+
*/
|
552
|
+
cc.lens3D = function (duration, gridSize, position, radius) {
|
553
|
+
return new cc.Lens3D(duration, gridSize, position, radius);
|
554
|
+
};
|
555
|
+
|
556
|
+
/**
|
557
|
+
* Please use cc.lens3D instead
|
558
|
+
* creates a lens 3d action with center position, radius
|
559
|
+
* @param {Number} duration
|
560
|
+
* @param {cc.Size} gridSize
|
561
|
+
* @param {cc.Point} position
|
562
|
+
* @param {Number} radius
|
563
|
+
* @return {cc.Lens3D}
|
564
|
+
* @static
|
565
|
+
* @deprecated since v3.0 <br /> Please use cc.lens3D instead.
|
566
|
+
*/
|
567
|
+
cc.Lens3D.create = cc.lens3D;
|
568
|
+
|
569
|
+
/**
|
570
|
+
* cc.Ripple3D action. <br />
|
571
|
+
* Reference the test cases (Effects Test)
|
572
|
+
* @class
|
573
|
+
* @extends cc.Grid3DAction
|
574
|
+
* @param {Number} duration
|
575
|
+
* @param {cc.Size} gridSize
|
576
|
+
* @param {cc.Point} position
|
577
|
+
* @param {Number} radius
|
578
|
+
* @param {Number} waves
|
579
|
+
* @param {Number} amplitude
|
580
|
+
*/
|
581
|
+
cc.Ripple3D = cc.Grid3DAction.extend(/** @lends cc.Ripple3D# */{
|
582
|
+
/* center position */
|
583
|
+
_position: null,
|
584
|
+
_radius: 0,
|
585
|
+
_waves: 0,
|
586
|
+
_amplitude: 0,
|
587
|
+
_amplitudeRate: 0,
|
588
|
+
|
589
|
+
/**
|
590
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
591
|
+
* creates a ripple 3d action with radius, number of waves, amplitude.
|
592
|
+
* @param {Number} duration
|
593
|
+
* @param {cc.Size} gridSize
|
594
|
+
* @param {cc.Point} position
|
595
|
+
* @param {Number} radius
|
596
|
+
* @param {Number} waves
|
597
|
+
* @param {Number} amplitude
|
598
|
+
*/
|
599
|
+
ctor:function (duration, gridSize, position, radius, waves, amplitude) {
|
600
|
+
cc.GridAction.prototype.ctor.call(this);
|
601
|
+
|
602
|
+
this._position = cc.p(0, 0);
|
603
|
+
amplitude !== undefined && this.initWithDuration(duration, gridSize, position, radius, waves, amplitude);
|
604
|
+
},
|
605
|
+
|
606
|
+
/**
|
607
|
+
* get center position
|
608
|
+
* @return {cc.Point}
|
609
|
+
*/
|
610
|
+
getPosition:function () {
|
611
|
+
return this._position;
|
612
|
+
},
|
613
|
+
|
614
|
+
/**
|
615
|
+
* set center position
|
616
|
+
* @param {cc.Point} position
|
617
|
+
*/
|
618
|
+
setPosition:function (position) {
|
619
|
+
this._position.x = position.x;
|
620
|
+
this._position.y = position.y;
|
621
|
+
},
|
622
|
+
|
623
|
+
/**
|
624
|
+
* get Amplitude
|
625
|
+
* @return {Number}
|
626
|
+
*/
|
627
|
+
getAmplitude:function () {
|
628
|
+
return this._amplitude;
|
629
|
+
},
|
630
|
+
|
631
|
+
/**
|
632
|
+
* set Amplitude
|
633
|
+
* @param {Number} amplitude
|
634
|
+
*/
|
635
|
+
setAmplitude:function (amplitude) {
|
636
|
+
this._amplitude = amplitude;
|
637
|
+
},
|
638
|
+
|
639
|
+
/**
|
640
|
+
* get Amplitude rate
|
641
|
+
* @return {*}
|
642
|
+
*/
|
643
|
+
getAmplitudeRate:function () {
|
644
|
+
return this._amplitudeRate;
|
645
|
+
},
|
646
|
+
|
647
|
+
/**
|
648
|
+
* get amplitude rate
|
649
|
+
* @param {Number} amplitudeRate
|
650
|
+
*/
|
651
|
+
setAmplitudeRate:function (amplitudeRate) {
|
652
|
+
this._amplitudeRate = amplitudeRate;
|
653
|
+
},
|
654
|
+
|
655
|
+
/**
|
656
|
+
* initializes the action with radius, number of waves, amplitude, a grid size and duration
|
657
|
+
* @param {Number} duration
|
658
|
+
* @param {cc.Size} gridSize
|
659
|
+
* @param {cc.Point} position
|
660
|
+
* @param {Number} radius
|
661
|
+
* @param {Number} waves
|
662
|
+
* @param {Number} amplitude
|
663
|
+
* @return {Boolean}
|
664
|
+
*/
|
665
|
+
initWithDuration:function (duration, gridSize, position, radius, waves, amplitude) {
|
666
|
+
if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
|
667
|
+
this.setPosition(position);
|
668
|
+
this._radius = radius;
|
669
|
+
this._waves = waves;
|
670
|
+
this._amplitude = amplitude;
|
671
|
+
this._amplitudeRate = 1.0;
|
672
|
+
return true;
|
673
|
+
}
|
674
|
+
return false;
|
675
|
+
},
|
676
|
+
|
677
|
+
/**
|
678
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
679
|
+
*
|
680
|
+
* @param {Number} dt
|
681
|
+
*/
|
682
|
+
update:function (dt) {
|
683
|
+
var locGridSizeWidth = this._gridSize.width, locGridSizeHeight = this._gridSize.height;
|
684
|
+
var locPos = cc.p(0, 0), locRadius = this._radius;
|
685
|
+
var locWaves = this._waves, locAmplitude = this._amplitude, locAmplitudeRate = this._amplitudeRate;
|
686
|
+
var v, r, tempPos = cc.p(0, 0);
|
687
|
+
for (var i = 0; i < (locGridSizeWidth + 1); ++i) {
|
688
|
+
for (var j = 0; j < (locGridSizeHeight + 1); ++j) {
|
689
|
+
locPos.x = i;
|
690
|
+
locPos.y = j;
|
691
|
+
v = this.originalVertex(locPos);
|
692
|
+
|
693
|
+
tempPos.x = this._position.x - v.x;
|
694
|
+
tempPos.y = this._position.y - v.y;
|
695
|
+
r = cc.pLength(tempPos);
|
696
|
+
|
697
|
+
if (r < locRadius) {
|
698
|
+
r = locRadius - r;
|
699
|
+
var rate = Math.pow(r / locRadius, 2);
|
700
|
+
v.z += (Math.sin(dt * Math.PI * locWaves * 2 + r * 0.1) * locAmplitude * locAmplitudeRate * rate);
|
701
|
+
}
|
702
|
+
this.setVertex(locPos, v);
|
703
|
+
}
|
704
|
+
}
|
705
|
+
}
|
706
|
+
});
|
707
|
+
|
708
|
+
/**
|
709
|
+
* creates a ripple 3d action with radius, number of waves, amplitude
|
710
|
+
* @function
|
711
|
+
* @param {Number} duration
|
712
|
+
* @param {cc.Size} gridSize
|
713
|
+
* @param {cc.Point} position
|
714
|
+
* @param {Number} radius
|
715
|
+
* @param {Number} waves
|
716
|
+
* @param {Number} amplitude
|
717
|
+
* @return {cc.Ripple3D}
|
718
|
+
*/
|
719
|
+
cc.ripple3D = function (duration, gridSize, position, radius, waves, amplitude) {
|
720
|
+
return new cc.Ripple3D(duration, gridSize, position, radius, waves, amplitude);
|
721
|
+
};
|
722
|
+
|
723
|
+
/**
|
724
|
+
* Please use cc.ripple3D instead
|
725
|
+
* creates a ripple 3d action with radius, number of waves, amplitude
|
726
|
+
* @param {Number} duration
|
727
|
+
* @param {cc.Size} gridSize
|
728
|
+
* @param {cc.Point} position
|
729
|
+
* @param {Number} radius
|
730
|
+
* @param {Number} waves
|
731
|
+
* @param {Number} amplitude
|
732
|
+
* @return {cc.Ripple3D}
|
733
|
+
* @static
|
734
|
+
* @deprecated since v3.0 <br /> Please use cc.ripple3D instead.
|
735
|
+
*/
|
736
|
+
cc.Ripple3D.create = cc.ripple3D;
|
737
|
+
|
738
|
+
/**
|
739
|
+
* cc.Shaky3D action. <br />
|
740
|
+
* Reference the test cases (Effects Test)
|
741
|
+
* @class
|
742
|
+
* @extends cc.Grid3DAction
|
743
|
+
* @param {Number} duration
|
744
|
+
* @param {cc.Size} gridSize
|
745
|
+
* @param {Number} range
|
746
|
+
* @param {Boolean} shakeZ
|
747
|
+
*/
|
748
|
+
cc.Shaky3D = cc.Grid3DAction.extend(/** @lends cc.Shaky3D# */{
|
749
|
+
_randRange: 0,
|
750
|
+
_shakeZ: false,
|
751
|
+
|
752
|
+
/**
|
753
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
754
|
+
* Create a shaky3d action with a range, shake Z vertices.
|
755
|
+
* @param {Number} duration
|
756
|
+
* @param {cc.Size} gridSize
|
757
|
+
* @param {Number} range
|
758
|
+
* @param {Boolean} shakeZ
|
759
|
+
*/
|
760
|
+
ctor:function (duration, gridSize, range, shakeZ) {
|
761
|
+
cc.GridAction.prototype.ctor.call(this);
|
762
|
+
shakeZ !== undefined && this.initWithDuration(duration, gridSize, range, shakeZ);
|
763
|
+
},
|
764
|
+
|
765
|
+
/**
|
766
|
+
* initializes the action with a range, shake Z vertices, a grid and duration
|
767
|
+
* @param {Number} duration
|
768
|
+
* @param {cc.Size} gridSize
|
769
|
+
* @param {Number} range
|
770
|
+
* @param {Boolean} shakeZ
|
771
|
+
* @return {Boolean}
|
772
|
+
*/
|
773
|
+
initWithDuration:function (duration, gridSize, range, shakeZ) {
|
774
|
+
if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
|
775
|
+
this._randRange = range;
|
776
|
+
this._shakeZ = shakeZ;
|
777
|
+
return true;
|
778
|
+
}
|
779
|
+
return false;
|
780
|
+
},
|
781
|
+
|
782
|
+
/**
|
783
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
784
|
+
*
|
785
|
+
* @param {Number} dt
|
786
|
+
*/
|
787
|
+
update:function (dt) {
|
788
|
+
var locGridSizeWidth = this._gridSize.width, locGridSizeHeight = this._gridSize.height;
|
789
|
+
var locRandRange = this._randRange, locShakeZ = this._shakeZ, locP = cc.p(0, 0);
|
790
|
+
var v;
|
791
|
+
for (var i = 0; i < (locGridSizeWidth + 1); ++i) {
|
792
|
+
for (var j = 0; j < (locGridSizeHeight + 1); ++j) {
|
793
|
+
locP.x = i;
|
794
|
+
locP.y = j;
|
795
|
+
v = this.originalVertex(locP);
|
796
|
+
v.x += (cc.rand() % (locRandRange * 2)) - locRandRange;
|
797
|
+
v.y += (cc.rand() % (locRandRange * 2)) - locRandRange;
|
798
|
+
if (locShakeZ)
|
799
|
+
v.z += (cc.rand() % (locRandRange * 2)) - locRandRange;
|
800
|
+
this.setVertex(locP, v);
|
801
|
+
}
|
802
|
+
}
|
803
|
+
}
|
804
|
+
});
|
805
|
+
|
806
|
+
/**
|
807
|
+
* creates the action with a range, shake Z vertices, a grid and duration
|
808
|
+
* @function
|
809
|
+
* @param {Number} duration
|
810
|
+
* @param {cc.Size} gridSize
|
811
|
+
* @param {Number} range
|
812
|
+
* @param {Boolean} shakeZ
|
813
|
+
* @return {cc.Shaky3D}
|
814
|
+
*/
|
815
|
+
cc.shaky3D = function (duration, gridSize, range, shakeZ) {
|
816
|
+
return new cc.Shaky3D(duration, gridSize, range, shakeZ);
|
817
|
+
};
|
818
|
+
|
819
|
+
/**
|
820
|
+
* Please use cc.shaky3D instead
|
821
|
+
* creates the action with a range, shake Z vertices, a grid and duration
|
822
|
+
* @param {Number} duration
|
823
|
+
* @param {cc.Size} gridSize
|
824
|
+
* @param {Number} range
|
825
|
+
* @param {Boolean} shakeZ
|
826
|
+
* @return {cc.Shaky3D}
|
827
|
+
* @static
|
828
|
+
* @deprecated since v3.0 <br /> Please use cc.shaky3D instead.
|
829
|
+
*/
|
830
|
+
cc.Shaky3D.create = cc.shaky3D;
|
831
|
+
|
832
|
+
/**
|
833
|
+
* cc.Liquid action. <br />
|
834
|
+
* Reference the test cases (Effects Test)
|
835
|
+
* @class
|
836
|
+
* @extends cc.Grid3DAction
|
837
|
+
* @param {Number} duration
|
838
|
+
* @param {cc.Size} gridSize
|
839
|
+
* @param {Number} waves
|
840
|
+
* @param {Number} amplitude
|
841
|
+
*/
|
842
|
+
cc.Liquid = cc.Grid3DAction.extend(/** @lends cc.Liquid# */{
|
843
|
+
_waves: 0,
|
844
|
+
_amplitude: 0,
|
845
|
+
_amplitudeRate: 0,
|
846
|
+
|
847
|
+
/**
|
848
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
849
|
+
* Create a liquid action with amplitude, a grid and duration.
|
850
|
+
* @param {Number} duration
|
851
|
+
* @param {cc.Size} gridSize
|
852
|
+
* @param {Number} waves
|
853
|
+
* @param {Number} amplitude
|
854
|
+
*/
|
855
|
+
ctor: function (duration, gridSize, waves, amplitude) {
|
856
|
+
cc.GridAction.prototype.ctor.call(this);
|
857
|
+
amplitude !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude);
|
858
|
+
},
|
859
|
+
|
860
|
+
/**
|
861
|
+
* get amplitude
|
862
|
+
* @return {Number}
|
863
|
+
*/
|
864
|
+
getAmplitude:function () {
|
865
|
+
return this._amplitude;
|
866
|
+
},
|
867
|
+
|
868
|
+
/**
|
869
|
+
* set amplitude
|
870
|
+
* @param {Number} amplitude
|
871
|
+
*/
|
872
|
+
setAmplitude:function (amplitude) {
|
873
|
+
this._amplitude = amplitude;
|
874
|
+
},
|
875
|
+
|
876
|
+
/**
|
877
|
+
* get amplitude rate
|
878
|
+
* @return {Number}
|
879
|
+
*/
|
880
|
+
getAmplitudeRate:function () {
|
881
|
+
return this._amplitudeRate;
|
882
|
+
},
|
883
|
+
|
884
|
+
/**
|
885
|
+
* set amplitude rate
|
886
|
+
* @param {Number} amplitudeRate
|
887
|
+
*/
|
888
|
+
setAmplitudeRate:function (amplitudeRate) {
|
889
|
+
this._amplitudeRate = amplitudeRate;
|
890
|
+
},
|
891
|
+
|
892
|
+
/**
|
893
|
+
* initializes the action with amplitude, a grid and duration
|
894
|
+
* @param {Number} duration
|
895
|
+
* @param {cc.Size} gridSize
|
896
|
+
* @param {Number} waves
|
897
|
+
* @param {Number} amplitude
|
898
|
+
* @return {Boolean}
|
899
|
+
*/
|
900
|
+
initWithDuration:function (duration, gridSize, waves, amplitude) {
|
901
|
+
if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
|
902
|
+
this._waves = waves;
|
903
|
+
this._amplitude = amplitude;
|
904
|
+
this._amplitudeRate = 1.0;
|
905
|
+
return true;
|
906
|
+
}
|
907
|
+
return false;
|
908
|
+
},
|
909
|
+
|
910
|
+
/**
|
911
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
912
|
+
*
|
913
|
+
* @param {Number} dt
|
914
|
+
*/
|
915
|
+
update:function (dt) {
|
916
|
+
var locSizeWidth = this._gridSize.width, locSizeHeight = this._gridSize.height, locPos = cc.p(0, 0);
|
917
|
+
var locWaves = this._waves, locAmplitude = this._amplitude, locAmplitudeRate = this._amplitudeRate;
|
918
|
+
var v;
|
919
|
+
for (var i = 1; i < locSizeWidth; ++i) {
|
920
|
+
for (var j = 1; j < locSizeHeight; ++j) {
|
921
|
+
locPos.x = i;
|
922
|
+
locPos.y = j;
|
923
|
+
v = this.originalVertex(locPos);
|
924
|
+
v.x = (v.x + (Math.sin(dt * Math.PI * locWaves * 2 + v.x * .01) * locAmplitude * locAmplitudeRate));
|
925
|
+
v.y = (v.y + (Math.sin(dt * Math.PI * locWaves * 2 + v.y * .01) * locAmplitude * locAmplitudeRate));
|
926
|
+
this.setVertex(locPos, v);
|
927
|
+
}
|
928
|
+
}
|
929
|
+
}
|
930
|
+
});
|
931
|
+
|
932
|
+
/**
|
933
|
+
* creates the action with amplitude, a grid and duration
|
934
|
+
* @function
|
935
|
+
* @param {Number} duration
|
936
|
+
* @param {cc.Size} gridSize
|
937
|
+
* @param {Number} waves
|
938
|
+
* @param {Number} amplitude
|
939
|
+
* @return {cc.Liquid}
|
940
|
+
*/
|
941
|
+
cc.liquid = function (duration, gridSize, waves, amplitude) {
|
942
|
+
return new cc.Liquid(duration, gridSize, waves, amplitude);
|
943
|
+
};
|
944
|
+
|
945
|
+
/**
|
946
|
+
* Please use cc.liquid instead
|
947
|
+
* creates the action with amplitude, a grid and duration
|
948
|
+
* @param {Number} duration
|
949
|
+
* @param {cc.Size} gridSize
|
950
|
+
* @param {Number} waves
|
951
|
+
* @param {Number} amplitude
|
952
|
+
* @return {cc.Liquid}
|
953
|
+
* @static
|
954
|
+
* @deprecated since v3.0 <br /> Please use cc.liquid instead.
|
955
|
+
*/
|
956
|
+
cc.Liquid.create = cc.liquid;
|
957
|
+
|
958
|
+
/**
|
959
|
+
* cc.Waves action. <br />
|
960
|
+
* Reference the test cases (Effects Test)
|
961
|
+
* @class
|
962
|
+
* @extends cc.Grid3DAction
|
963
|
+
* @param {Number} duration
|
964
|
+
* @param {cc.Size} gridSize
|
965
|
+
* @param {Number} waves
|
966
|
+
* @param {Number} amplitude
|
967
|
+
* @param {Boolean} horizontal
|
968
|
+
* @param {Boolean} vertical
|
969
|
+
*/
|
970
|
+
cc.Waves = cc.Grid3DAction.extend(/** @lends cc.Waves# */{
|
971
|
+
_waves: 0,
|
972
|
+
_amplitude: 0,
|
973
|
+
_amplitudeRate: 0,
|
974
|
+
_vertical: false,
|
975
|
+
_horizontal: false,
|
976
|
+
|
977
|
+
/**
|
978
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
979
|
+
* Create a wave action with amplitude, horizontal sin, vertical sin, a grid and duration.
|
980
|
+
* @param {Number} duration
|
981
|
+
* @param {cc.Size} gridSize
|
982
|
+
* @param {Number} waves
|
983
|
+
* @param {Number} amplitude
|
984
|
+
* @param {Boolean} horizontal
|
985
|
+
* @param {Boolean} vertical
|
986
|
+
*/
|
987
|
+
ctor: function (duration, gridSize, waves, amplitude, horizontal, vertical) {
|
988
|
+
cc.GridAction.prototype.ctor.call(this);
|
989
|
+
vertical !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude, horizontal, vertical);
|
990
|
+
},
|
991
|
+
|
992
|
+
/**
|
993
|
+
* get amplitude
|
994
|
+
* @return {Number}
|
995
|
+
*/
|
996
|
+
getAmplitude:function () {
|
997
|
+
return this._amplitude;
|
998
|
+
},
|
999
|
+
|
1000
|
+
/**
|
1001
|
+
* set amplitude
|
1002
|
+
* @param {Number} amplitude
|
1003
|
+
*/
|
1004
|
+
setAmplitude:function (amplitude) {
|
1005
|
+
this._amplitude = amplitude;
|
1006
|
+
},
|
1007
|
+
|
1008
|
+
/**
|
1009
|
+
* get amplitude rate
|
1010
|
+
* @return {Number}
|
1011
|
+
*/
|
1012
|
+
getAmplitudeRate:function () {
|
1013
|
+
return this._amplitudeRate;
|
1014
|
+
},
|
1015
|
+
|
1016
|
+
/**
|
1017
|
+
* set amplitude rate
|
1018
|
+
* @param {Number} amplitudeRate
|
1019
|
+
*/
|
1020
|
+
setAmplitudeRate:function (amplitudeRate) {
|
1021
|
+
this._amplitudeRate = amplitudeRate;
|
1022
|
+
},
|
1023
|
+
|
1024
|
+
/**
|
1025
|
+
* initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration
|
1026
|
+
* @param {Number} duration
|
1027
|
+
* @param {cc.Size} gridSize
|
1028
|
+
* @param {Number} waves
|
1029
|
+
* @param {Number} amplitude
|
1030
|
+
* @param {Boolean} horizontal
|
1031
|
+
* @param {Boolean} vertical
|
1032
|
+
* @return {Boolean}
|
1033
|
+
*/
|
1034
|
+
initWithDuration:function (duration, gridSize, waves, amplitude, horizontal, vertical) {
|
1035
|
+
if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
|
1036
|
+
this._waves = waves;
|
1037
|
+
this._amplitude = amplitude;
|
1038
|
+
this._amplitudeRate = 1.0;
|
1039
|
+
this._horizontal = horizontal;
|
1040
|
+
this._vertical = vertical;
|
1041
|
+
return true;
|
1042
|
+
}
|
1043
|
+
return false;
|
1044
|
+
},
|
1045
|
+
|
1046
|
+
/**
|
1047
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
1048
|
+
*
|
1049
|
+
* @param {Number} dt
|
1050
|
+
*/
|
1051
|
+
update:function (dt) {
|
1052
|
+
var locSizeWidth = this._gridSize.width, locSizeHeight = this._gridSize.height, locPos = cc.p(0, 0);
|
1053
|
+
var locVertical = this._vertical, locHorizontal = this._horizontal;
|
1054
|
+
var locWaves = this._waves, locAmplitude = this._amplitude, locAmplitudeRate = this._amplitudeRate;
|
1055
|
+
var v;
|
1056
|
+
for (var i = 0; i < locSizeWidth + 1; ++i) {
|
1057
|
+
for (var j = 0; j < locSizeHeight + 1; ++j) {
|
1058
|
+
locPos.x = i;
|
1059
|
+
locPos.y = j;
|
1060
|
+
v = this.originalVertex(locPos);
|
1061
|
+
if (locVertical)
|
1062
|
+
v.x = (v.x + (Math.sin(dt * Math.PI * locWaves * 2 + v.y * .01) * locAmplitude * locAmplitudeRate));
|
1063
|
+
if (locHorizontal)
|
1064
|
+
v.y = (v.y + (Math.sin(dt * Math.PI * locWaves * 2 + v.x * .01) * locAmplitude * locAmplitudeRate));
|
1065
|
+
this.setVertex(locPos, v);
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
}
|
1069
|
+
});
|
1070
|
+
|
1071
|
+
/**
|
1072
|
+
* initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration
|
1073
|
+
* @function
|
1074
|
+
* @param {Number} duration
|
1075
|
+
* @param {cc.Size} gridSize
|
1076
|
+
* @param {Number} waves
|
1077
|
+
* @param {Number} amplitude
|
1078
|
+
* @param {Boolean} horizontal
|
1079
|
+
* @param {Boolean} vertical
|
1080
|
+
* @return {cc.Waves}
|
1081
|
+
*/
|
1082
|
+
cc.waves = function (duration, gridSize, waves, amplitude, horizontal, vertical) {
|
1083
|
+
return new cc.Waves(duration, gridSize, waves, amplitude, horizontal, vertical);
|
1084
|
+
};
|
1085
|
+
|
1086
|
+
/**
|
1087
|
+
* Please use cc.waves instead
|
1088
|
+
* initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration
|
1089
|
+
* @param {Number} duration
|
1090
|
+
* @param {cc.Size} gridSize
|
1091
|
+
* @param {Number} waves
|
1092
|
+
* @param {Number} amplitude
|
1093
|
+
* @param {Boolean} horizontal
|
1094
|
+
* @param {Boolean} vertical
|
1095
|
+
* @return {cc.Waves}
|
1096
|
+
* @static
|
1097
|
+
* @deprecated since v3.0 <br /> Please use cc.waves instead.
|
1098
|
+
*/
|
1099
|
+
cc.Waves.create = cc.waves;
|
1100
|
+
|
1101
|
+
/** @brief */
|
1102
|
+
/**
|
1103
|
+
* cc.Twirl action. <br />
|
1104
|
+
* Reference the test cases (Effects Test)
|
1105
|
+
* @class
|
1106
|
+
* @extends cc.Grid3DAction
|
1107
|
+
* @param {Number} duration
|
1108
|
+
* @param {cc.Size} gridSize
|
1109
|
+
* @param {cc.Point} position
|
1110
|
+
* @param {Number} twirls
|
1111
|
+
* @param {Number} amplitude
|
1112
|
+
*/
|
1113
|
+
cc.Twirl = cc.Grid3DAction.extend(/** @lends cc.Twirl# */{
|
1114
|
+
/* twirl center */
|
1115
|
+
_position: null,
|
1116
|
+
_twirls: 0,
|
1117
|
+
_amplitude: 0,
|
1118
|
+
_amplitudeRate: 0,
|
1119
|
+
|
1120
|
+
/**
|
1121
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
|
1122
|
+
* Create a grid 3d action with center position, number of twirls, amplitude, a grid size and duration.
|
1123
|
+
* @param {Number} duration
|
1124
|
+
* @param {cc.Size} gridSize
|
1125
|
+
* @param {cc.Point} position
|
1126
|
+
* @param {Number} twirls
|
1127
|
+
* @param {Number} amplitude
|
1128
|
+
*/
|
1129
|
+
ctor:function (duration, gridSize, position, twirls, amplitude) {
|
1130
|
+
cc.GridAction.prototype.ctor.call(this);
|
1131
|
+
|
1132
|
+
this._position = cc.p(0, 0);
|
1133
|
+
amplitude !== undefined && this.initWithDuration(duration, gridSize, position, twirls, amplitude);
|
1134
|
+
},
|
1135
|
+
|
1136
|
+
/**
|
1137
|
+
* get twirl center
|
1138
|
+
* @return {cc.Point}
|
1139
|
+
*/
|
1140
|
+
getPosition:function () {
|
1141
|
+
return this._position;
|
1142
|
+
},
|
1143
|
+
|
1144
|
+
/**
|
1145
|
+
* set twirl center
|
1146
|
+
* @param {cc.Point} position
|
1147
|
+
*/
|
1148
|
+
setPosition:function (position) {
|
1149
|
+
this._position.x = position.x;
|
1150
|
+
this._position.y = position.y;
|
1151
|
+
},
|
1152
|
+
|
1153
|
+
/**
|
1154
|
+
* get amplitude
|
1155
|
+
* @return {Number}
|
1156
|
+
*/
|
1157
|
+
getAmplitude:function () {
|
1158
|
+
return this._amplitude;
|
1159
|
+
},
|
1160
|
+
|
1161
|
+
/**
|
1162
|
+
* set amplitude
|
1163
|
+
* @param {Number} amplitude
|
1164
|
+
*/
|
1165
|
+
setAmplitude:function (amplitude) {
|
1166
|
+
this._amplitude = amplitude;
|
1167
|
+
},
|
1168
|
+
|
1169
|
+
/**
|
1170
|
+
* get amplitude rate
|
1171
|
+
* @return {Number}
|
1172
|
+
*/
|
1173
|
+
getAmplitudeRate:function () {
|
1174
|
+
return this._amplitudeRate;
|
1175
|
+
},
|
1176
|
+
|
1177
|
+
/**
|
1178
|
+
* set amplitude rate
|
1179
|
+
* @param {Number} amplitudeRate
|
1180
|
+
*/
|
1181
|
+
setAmplitudeRate:function (amplitudeRate) {
|
1182
|
+
this._amplitudeRate = amplitudeRate;
|
1183
|
+
},
|
1184
|
+
|
1185
|
+
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
1186
|
+
initWithDuration:function (duration, gridSize, position, twirls, amplitude) {
|
1187
|
+
if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
|
1188
|
+
this.setPosition(position);
|
1189
|
+
this._twirls = twirls;
|
1190
|
+
this._amplitude = amplitude;
|
1191
|
+
this._amplitudeRate = 1.0;
|
1192
|
+
return true;
|
1193
|
+
}
|
1194
|
+
return false;
|
1195
|
+
},
|
1196
|
+
|
1197
|
+
/**
|
1198
|
+
* Called once per frame. Time is the number of seconds of a frame interval.
|
1199
|
+
*
|
1200
|
+
* @param {Number} dt
|
1201
|
+
*/
|
1202
|
+
update:function (dt) {
|
1203
|
+
var c = this._position;
|
1204
|
+
var locSizeWidth = this._gridSize.width, locSizeHeight = this._gridSize.height, locPos = cc.p(0, 0);
|
1205
|
+
var amp = 0.1 * this._amplitude * this._amplitudeRate;
|
1206
|
+
var locTwirls = this._twirls;
|
1207
|
+
var v, a, dX, dY, avg = cc.p(0, 0);
|
1208
|
+
for (var i = 0; i < (locSizeWidth + 1); ++i) {
|
1209
|
+
for (var j = 0; j < (locSizeHeight + 1); ++j) {
|
1210
|
+
locPos.x = i;
|
1211
|
+
locPos.y = j;
|
1212
|
+
v = this.originalVertex(locPos);
|
1213
|
+
|
1214
|
+
avg.x = i - (locSizeWidth / 2.0);
|
1215
|
+
avg.y = j - (locSizeHeight / 2.0);
|
1216
|
+
|
1217
|
+
a = cc.pLength(avg) * Math.cos(Math.PI / 2.0 + dt * Math.PI * locTwirls * 2) * amp;
|
1218
|
+
|
1219
|
+
dX = Math.sin(a) * (v.y - c.y) + Math.cos(a) * (v.x - c.x);
|
1220
|
+
dY = Math.cos(a) * (v.y - c.y) - Math.sin(a) * (v.x - c.x);
|
1221
|
+
|
1222
|
+
v.x = c.x + dX;
|
1223
|
+
v.y = c.y + dY;
|
1224
|
+
|
1225
|
+
this.setVertex(locPos, v);
|
1226
|
+
}
|
1227
|
+
}
|
1228
|
+
}
|
1229
|
+
});
|
1230
|
+
|
1231
|
+
/**
|
1232
|
+
* creates the action with center position, number of twirls, amplitude, a grid size and duration
|
1233
|
+
* @function
|
1234
|
+
* @param {Number} duration
|
1235
|
+
* @param {cc.Size} gridSize
|
1236
|
+
* @param {cc.Point} position
|
1237
|
+
* @param {Number} twirls
|
1238
|
+
* @param {Number} amplitude
|
1239
|
+
* @return {cc.Twirl}
|
1240
|
+
*/
|
1241
|
+
cc.twirl = function (duration, gridSize, position, twirls, amplitude) {
|
1242
|
+
return new cc.Twirl(duration, gridSize, position, twirls, amplitude);
|
1243
|
+
};
|
1244
|
+
|
1245
|
+
/**
|
1246
|
+
* Please use cc.twirl instead
|
1247
|
+
* creates the action with center position, number of twirls, amplitude, a grid size and duration
|
1248
|
+
* @param {Number} duration
|
1249
|
+
* @param {cc.Size} gridSize
|
1250
|
+
* @param {cc.Point} position
|
1251
|
+
* @param {Number} twirls
|
1252
|
+
* @param {Number} amplitude
|
1253
|
+
* @return {cc.Twirl}
|
1254
|
+
* @static
|
1255
|
+
* @deprecated since v3.0 <br /> Please use cc.twirl instead.
|
1256
|
+
*/
|
1257
|
+
cc.Twirl.create = cc.twirl;
|