From c0f59c15987c9aceb104e3a3eabf95e2035770d1 Mon Sep 17 00:00:00 2001
From: Nan Wang
Date: Sat, 5 Dec 2015 12:22:41 +0800
Subject: [PATCH] synchronized to cocos2d-html5#6700f8bb94b2. starting from
fresh history.
---
.gitignore | 12 +
AUTHORS.txt | 288 +
Base64Images.js | 32 +
CCBoot.js | 343 +
CCDebugger.js | 459 +
CHANGELOG.txt | 952 ++
README.mdown | 52 +
bower.json | 36 +
cocos2d/ToMerge/qunit/test-event-system.js | 360 +
cocos2d/ToMerge/qunit/test-ticker.js | 39 +
cocos2d/ToMerge/qunit/test-time.js | 40 +
cocos2d/ToMerge/wrappers/bitmap-font.js | 177 +
cocos2d/ToMerge/wrappers/draw-node.js | 17 +
cocos2d/ToMerge/wrappers/edit-box.js | 250 +
cocos2d/ToMerge/wrappers/index.js | 27 +
cocos2d/ToMerge/wrappers/label-ttf.js | 202 +
cocos2d/ToMerge/wrappers/layer-color.js | 17 +
cocos2d/ToMerge/wrappers/layer.js | 44 +
cocos2d/ToMerge/wrappers/progress-timer.js | 167 +
cocos2d/ToMerge/wrappers/sprite-batch-node.js | 55 +
cocos2d/ToMerge/wrappers/tiled-map.js | 103 +
cocos2d/ToMerge/wrappers/ui/button.js | 182 +
cocos2d/ToMerge/wrappers/ui/check-box.js | 140 +
cocos2d/ToMerge/wrappers/ui/layout.js | 110 +
cocos2d/ToMerge/wrappers/ui/list-view.js | 17 +
cocos2d/ToMerge/wrappers/ui/loading-bar.js | 85 +
cocos2d/ToMerge/wrappers/ui/page-view.js | 44 +
cocos2d/ToMerge/wrappers/ui/scale9-sprite.js | 58 +
cocos2d/ToMerge/wrappers/ui/scale9.js | 171 +
cocos2d/ToMerge/wrappers/ui/scroll-view.js | 99 +
cocos2d/ToMerge/wrappers/ui/slider.js | 139 +
cocos2d/ToMerge/wrappers/ui/text-atlas.js | 79 +
.../ToMerge/wrappers/ui/text-bitmap-font.js | 70 +
cocos2d/ToMerge/wrappers/ui/text-field.js | 214 +
cocos2d/ToMerge/wrappers/ui/text.js | 178 +
cocos2d/ToMerge/wrappers/ui/widget.js | 245 +
cocos2d/ToMerge/wrappers/utils.js | 16 +
cocos2d/actions/CCAction.js | 694 +
cocos2d/actions/CCActionCamera.js | 293 +
cocos2d/actions/CCActionCatmullRom.js | 605 +
cocos2d/actions/CCActionEase.js | 3681 ++++++
cocos2d/actions/CCActionInstant.js | 749 ++
cocos2d/actions/CCActionInterval.js | 3567 +++++
cocos2d/actions/CCActionTween.js | 166 +
cocos2d/actions3d/CCActionGrid.js | 427 +
cocos2d/actions3d/CCActionGrid3D.js | 1257 ++
cocos2d/actions3d/CCActionPageTurn3D.js | 130 +
cocos2d/actions3d/CCActionTiledGrid.js | 1300 ++
cocos2d/animation/animation-animator.js | 315 +
cocos2d/animation/animation-clip.js | 134 +
cocos2d/animation/animation-curves.js | 397 +
cocos2d/animation/animation-manager.js | 51 +
cocos2d/animation/animation-state.js | 71 +
cocos2d/animation/animators.js | 197 +
cocos2d/animation/bezier.js | 196 +
cocos2d/animation/binary-search.js | 28 +
cocos2d/animation/easing.js | 257 +
cocos2d/animation/index.js | 10 +
cocos2d/animation/motion-path-helper.js | 327 +
cocos2d/animation/playable.js | 131 +
cocos2d/animation/types.js | 364 +
cocos2d/audio/CCAudio.js | 1033 ++
cocos2d/clipping-nodes/CCClippingNode.js | 224 +
.../CCClippingNodeCanvasRenderCmd.js | 215 +
.../CCClippingNodeWebGLRenderCmd.js | 238 +
cocos2d/compression/ZipUtils.js | 82 +
cocos2d/compression/base64.js | 95 +
cocos2d/compression/gzip.js | 731 ++
cocos2d/compression/zlib.min.js | 55 +
cocos2d/core/CCActionManager.js | 383 +
cocos2d/core/CCCamera.js | 282 +
cocos2d/core/CCConfiguration.js | 294 +
cocos2d/core/CCDirector.js | 1173 ++
cocos2d/core/CCDirectorCanvas.js | 85 +
cocos2d/core/CCDirectorWebGL.js | 270 +
cocos2d/core/CCDrawingPrimitivesCanvas.js | 438 +
cocos2d/core/CCDrawingPrimitivesWebGL.js | 464 +
cocos2d/core/CCGame.js | 603 +
cocos2d/core/CCNode.js | 546 +
cocos2d/core/CCScene.js | 136 +
cocos2d/core/CCScheduler.js | 1065 ++
cocos2d/core/assets/CCAsset.js | 154 +
cocos2d/core/assets/CCAudioClip.js | 13 +
cocos2d/core/assets/CCBitmapFont.js | 13 +
cocos2d/core/assets/CCPrefab.js | 43 +
cocos2d/core/assets/CCRawAsset.js | 30 +
cocos2d/core/assets/CCSceneAsset.js | 17 +
cocos2d/core/assets/CCScripts.js | 38 +
cocos2d/core/assets/CCSpriteAnimation.js | 86 +
cocos2d/core/assets/CCSpriteAtlas.js | 13 +
cocos2d/core/assets/CCTTFFont.js | 19 +
cocos2d/core/assets/CCTiledMapAsset.js | 45 +
cocos2d/core/assets/index.js | 39 +
.../base-nodes/BaseNodesPropertyDefine.js | 127 +
cocos2d/core/base-nodes/CCAtlasNode.js | 297 +
.../base-nodes/CCAtlasNodeCanvasRenderCmd.js | 91 +
.../base-nodes/CCAtlasNodeWebGLRenderCmd.js | 145 +
cocos2d/core/base-nodes/CCNode.js | 2251 ++++
.../core/base-nodes/CCNodeCanvasRenderCmd.js | 501 +
.../core/base-nodes/CCNodeWebGLRenderCmd.js | 104 +
cocos2d/core/base-ui/CCWidgetManager.js | 141 +
cocos2d/core/cocos2d_externs.js | 66 +
cocos2d/core/components/CCAnimation.js | 433 +
cocos2d/core/components/CCAudioSource.js | 219 +
cocos2d/core/components/CCButton.js | 496 +
cocos2d/core/components/CCCanvas.js | 178 +
cocos2d/core/components/CCComponent.js | 716 +
cocos2d/core/components/CCComponentInSG.js | 86 +
cocos2d/core/components/CCELabel.js | 175 +
cocos2d/core/components/CCSpriteRenderer.js | 531 +
cocos2d/core/components/CCWidget.js | 423 +
cocos2d/core/components/index.js | 12 +
cocos2d/core/event-manager/CCEventListener.js | 598 +
cocos2d/core/event-manager/CCEventManager.js | 965 ++
cocos2d/core/event-manager/CCSystemEvent.js | 428 +
cocos2d/core/event-manager/CCTouch.js | 186 +
cocos2d/core/event/event-listeners.js | 55 +
cocos2d/core/event/event-target.js | 343 +
cocos2d/core/event/event.js | 279 +
cocos2d/core/event/index.js | 3 +
cocos2d/core/index.js | 11 +
cocos2d/core/labelttf/CCLabelTTF.js | 869 ++
.../labelttf/CCLabelTTFCanvasRenderCmd.js | 535 +
.../core/labelttf/CCLabelTTFWebGLRenderCmd.js | 39 +
.../core/labelttf/LabelTTFPropertyDefine.js | 88 +
cocos2d/core/layers/CCLayer.js | 721 +
cocos2d/core/layers/CCLayerCanvasRenderCmd.js | 474 +
cocos2d/core/layers/CCLayerWebGLRenderCmd.js | 311 +
cocos2d/core/platform/CCAssetLibrary.js | 519 +
cocos2d/core/platform/CCClass.js | 1036 ++
cocos2d/core/platform/CCCommon.js | 295 +
cocos2d/core/platform/CCConfig.js | 312 +
cocos2d/core/platform/CCEGLView.js | 1387 ++
cocos2d/core/platform/CCInputExtension.js | 133 +
cocos2d/core/platform/CCInputManager.js | 615 +
cocos2d/core/platform/CCLoader.js | 583 +
cocos2d/core/platform/CCLoaders.js | 156 +
cocos2d/core/platform/CCMacro.js | 742 ++
cocos2d/core/platform/CCObject.js | 362 +
cocos2d/core/platform/CCSAXParser.js | 167 +
cocos2d/core/platform/CCScreen.js | 164 +
cocos2d/core/platform/CCSys.js | 675 +
cocos2d/core/platform/CCVisibleRect.js | 154 +
cocos2d/core/platform/_CCClass.js | 217 +
cocos2d/core/platform/attribute.js | 301 +
cocos2d/core/platform/callbacks-invoker.js | 245 +
cocos2d/core/platform/deserialize.js | 517 +
cocos2d/core/platform/index.js | 43 +
cocos2d/core/platform/instantiate.js | 243 +
cocos2d/core/platform/js.js | 629 +
cocos2d/core/platform/load-manager.js | 206 +
cocos2d/core/platform/miniFramework.js | 260 +
cocos2d/core/platform/prefab-info.js | 28 +
cocos2d/core/platform/preprocess-attrs.js | 179 +
cocos2d/core/platform/requiring-frame.js | 40 +
cocos2d/core/platform/url.js | 32 +
cocos2d/core/platform/utils.js | 77 +
cocos2d/core/renderer/RendererCanvas.js | 289 +
cocos2d/core/renderer/RendererWebGL.js | 154 +
cocos2d/core/scenes/CCLoaderScene.js | 167 +
cocos2d/core/scenes/CCScene.js | 62 +
cocos2d/core/sprites/CCAnimation.js | 477 +
cocos2d/core/sprites/CCAnimationCache.js | 213 +
cocos2d/core/sprites/CCBakeSprite.js | 78 +
cocos2d/core/sprites/CCSprite.js | 1032 ++
cocos2d/core/sprites/CCSpriteBatchNode.js | 676 +
.../CCSpriteBatchNodeCanvasRenderCmd.js | 100 +
.../CCSpriteBatchNodeWebGLRenderCmd.js | 243 +
.../core/sprites/CCSpriteCanvasRenderCmd.js | 313 +
cocos2d/core/sprites/CCSpriteFrame.js | 603 +
cocos2d/core/sprites/CCSpriteFrameCache.js | 361 +
.../core/sprites/CCSpriteWebGLRenderCmd.js | 503 +
cocos2d/core/sprites/SpritesPropertyDefine.js | 67 +
cocos2d/core/support/CCPointExtension.js | 561 +
cocos2d/core/support/CCVertex.js | 170 +
cocos2d/core/support/TransformUtils.js | 62 +
cocos2d/core/textures/CCTexture2D.js | 1158 ++
cocos2d/core/textures/CCTextureAtlas.js | 733 ++
cocos2d/core/textures/CCTextureCache.js | 393 +
cocos2d/core/textures/index.js | 3 +
cocos2d/core/utils/Async.js | 181 +
cocos2d/core/utils/BinaryLoader.js | 159 +
cocos2d/core/utils/CCPath.js | 162 +
cocos2d/core/utils/CCProfiler.js | 160 +
cocos2d/core/utils/base-node.js | 1365 ++
cocos2d/core/utils/find.js | 66 +
cocos2d/core/utils/index.js | 4 +
cocos2d/core/utils/misc.js | 47 +
cocos2d/core/utils/scene-graph-helper.js | 63 +
cocos2d/core/value-types/CCAffineTransform.js | 288 +
cocos2d/core/value-types/CCColor.js | 491 +
cocos2d/core/value-types/CCEnum.js | 132 +
cocos2d/core/value-types/CCRect.js | 416 +
cocos2d/core/value-types/CCSize.js | 104 +
cocos2d/core/value-types/CCTypes.js | 282 +
cocos2d/core/value-types/CCTypesWebGL.js | 662 +
cocos2d/core/value-types/CCValueType.js | 57 +
cocos2d/core/value-types/CCVec2.js | 483 +
cocos2d/core/value-types/index.js | 9 +
cocos2d/deprecated.js | 503 +
cocos2d/effects/CCGrabber.js | 110 +
cocos2d/effects/CCGrid.js | 846 ++
cocos2d/kazmath/SIMDPolyfill.js | 78 +
cocos2d/kazmath/aabb.js | 78 +
cocos2d/kazmath/gl/mat4stack.js | 98 +
cocos2d/kazmath/gl/matrix.js | 167 +
cocos2d/kazmath/mat3.js | 344 +
cocos2d/kazmath/mat4.js | 1014 ++
cocos2d/kazmath/mat4SIMD.js | 428 +
cocos2d/kazmath/plane.js | 137 +
cocos2d/kazmath/quaternion.js | 459 +
cocos2d/kazmath/ray2.js | 140 +
cocos2d/kazmath/simd_benchmark/base.js | 139 +
cocos2d/kazmath/simd_benchmark/index.html | 44 +
.../kazmath/simd_benchmark/kernel-template.js | 64 +
.../kazmath/simd_benchmark/kmMat4AreEqual.js | 77 +
.../kazmath/simd_benchmark/kmMat4Assign.js | 68 +
.../kazmath/simd_benchmark/kmMat4Inverse.js | 116 +
.../simd_benchmark/kmMat4IsIdentity.js | 65 +
.../kazmath/simd_benchmark/kmMat4LookAt.js | 94 +
.../kazmath/simd_benchmark/kmMat4Multiply.js | 74 +
.../kazmath/simd_benchmark/kmMat4Transpose.js | 82 +
.../simd_benchmark/kmVec3TransformCoord.js | 65 +
cocos2d/kazmath/simd_benchmark/run.js | 40 +
cocos2d/kazmath/simd_benchmark/run_browser.js | 80 +
cocos2d/kazmath/utility.js | 54 +
cocos2d/kazmath/vec2.js | 113 +
cocos2d/kazmath/vec3.js | 201 +
cocos2d/kazmath/vec3SIMD.js | 51 +
cocos2d/kazmath/vec4.js | 158 +
cocos2d/labels/CCLabel.js | 251 +
cocos2d/labels/CCLabelAtlas.js | 240 +
cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js | 110 +
cocos2d/labels/CCLabelAtlasWebGLRenderCmd.js | 153 +
cocos2d/labels/CCLabelBMFont.js | 971 ++
.../labels/CCLabelBMFontCanvasRenderCmd.js | 107 +
cocos2d/labels/CCLabelBMFontWebGLRenderCmd.js | 84 +
cocos2d/labels/CCLabelCanvasRenderCmd.js | 338 +
cocos2d/labels/CCLabelWebGLRenderCmd.js | 78 +
cocos2d/menus/CCMenu.js | 600 +
cocos2d/menus/CCMenuItem.js | 1349 ++
cocos2d/motion-streak/CCMotionStreak.js | 533 +
.../CCMotionStreakWebGLRenderCmd.js | 66 +
cocos2d/node-grid/CCNodeGrid.js | 150 +
cocos2d/node-grid/CCNodeGridWebGLRenderCmd.js | 98 +
cocos2d/parallax/CCParallaxNode.js | 252 +
cocos2d/parallax/CCParallaxNodeRenderCmd.js | 69 +
cocos2d/particle/CCEParticleSystem.js | 830 ++
cocos2d/particle/CCPNGReader.js | 330 +
cocos2d/particle/CCParticleAsset.js | 12 +
cocos2d/particle/CCParticleBatchNode.js | 527 +
.../CCParticleBatchNodeCanvasRenderCmd.js | 38 +
.../CCParticleBatchNodeWebGLRenderCmd.js | 74 +
cocos2d/particle/CCParticleExamples.js | 1006 ++
cocos2d/particle/CCParticleSystem.js | 2241 ++++
.../CCParticleSystemCanvasRenderCmd.js | 199 +
.../CCParticleSystemWebGLRenderCmd.js | 401 +
cocos2d/particle/CCTIFFReader.js | 692 +
cocos2d/physics/CCPhysicsDebugNode.js | 212 +
.../CCPhysicsDebugNodeCanvasRenderCmd.js | 52 +
.../CCPhysicsDebugNodeWebGLRenderCmd.js | 53 +
cocos2d/physics/CCPhysicsSprite.js | 447 +
.../physics/CCPhysicsSpriteCanvasRenderCmd.js | 93 +
.../physics/CCPhysicsSpriteWebGLRenderCmd.js | 92 +
.../progress-timer/CCActionProgressTimer.js | 227 +
cocos2d/progress-timer/CCProgressTimer.js | 344 +
.../CCProgressTimerCanvasRenderCmd.js | 270 +
.../CCProgressTimerWebGLRenderCmd.js | 486 +
cocos2d/render-texture/CCRenderTexture.js | 406 +
.../CCRenderTextureCanvasRenderCmd.js | 107 +
.../CCRenderTextureWebGLRenderCmd.js | 387 +
cocos2d/shaders/CCGLProgram.js | 767 ++
cocos2d/shaders/CCGLStateCache.js | 340 +
cocos2d/shaders/CCShaderCache.js | 301 +
cocos2d/shaders/CCShaders.js | 280 +
cocos2d/shape-nodes/CCDrawNode.js | 905 ++
.../shape-nodes/CCDrawNodeCanvasRenderCmd.js | 131 +
.../shape-nodes/CCDrawNodeWebGLRenderCmd.js | 41 +
cocos2d/text-input/CCIMEDispatcher.js | 534 +
cocos2d/text-input/CCTextFieldTTF.js | 500 +
cocos2d/tilemap/CCTGAlib.js | 437 +
cocos2d/tilemap/CCTMXLayer.js | 914 ++
cocos2d/tilemap/CCTMXLayerCanvasRenderCmd.js | 220 +
cocos2d/tilemap/CCTMXLayerWebGLRenderCmd.js | 67 +
cocos2d/tilemap/CCTMXObjectGroup.js | 157 +
cocos2d/tilemap/CCTMXTiledMap.js | 479 +
cocos2d/tilemap/CCTMXXMLParser.js | 950 ++
cocos2d/transitions/CCTransition.js | 1966 +++
cocos2d/transitions/CCTransitionPageTurn.js | 152 +
cocos2d/transitions/CCTransitionProgress.js | 458 +
.../core/CCActionManager/ActionManager.js | 2 +
docs/cocos2d/core/CCScheduler/schedule.js | 3 +
.../CCScheduler/scheduleCallbackForTarget.js | 3 +
.../CCScheduler/scheduleUpdateForTarget.js | 3 +
.../unscheduleCallbackForTarget.js | 3 +
.../CCScheduler/unscheduleUpdateForTarget.js | 3 +
.../initWithSpriteFrameName.js | 3 +
.../event-manager/CCEventListener/create.js | 10 +
.../core/event/_getCapturingTargets.js | 8 +
docs/cocos2d/core/platform/CCCommon/KEY.js | 9 +
docs/cocos2d/core/platform/CCMacro/lerp.js | 4 +
docs/cocos2d/core/platform/attribute/attr.js | 10 +
docs/cocos2d/core/platform/url/raw.js | 3 +
docs/cocos2d/core/sprites/SpriteFrame.js | 9 +
docs/cocos2d/core/sprites/addSpriteFrames.js | 4 +
docs/cocos2d/core/sprites/getSpriteFrame.js | 3 +
docs/cocos2d/core/support/pAdd.js | 4 +
docs/cocos2d/core/support/pCompOp.js | 3 +
docs/cocos2d/core/textures/TextureAtlas.js | 7 +
docs/cocos2d/core/textures/addImage.js | 2 +
docs/cocos2d/core/textures/getKeyByTexture.js | 2 +
.../cocos2d/core/textures/getTextureColors.js | 2 +
.../cocos2d/core/textures/getTextureForKey.js | 2 +
docs/cocos2d/core/textures/initWithFile.js | 3 +
docs/cocos2d/core/textures/initWithTexture.js | 4 +
.../core/textures/removeAllTextures.js | 2 +
docs/cocos2d/core/textures/removeTexture.js | 2 +
.../core/textures/removeTextureForKey.js | 2 +
docs/cocos2d/core/textures/textureForKey.js | 2 +
docs/cocos2d/core/utils/CCPath/basename.js | 6 +
.../core/utils/CCPath/changeBasename.js | 6 +
.../core/utils/CCPath/changeExtname.js | 3 +
docs/cocos2d/core/utils/CCPath/dirname.js | 9 +
docs/cocos2d/core/utils/CCPath/extname.js | 5 +
docs/cocos2d/core/utils/CCPath/join.js | 6 +
.../core/utils/node-wrapper/setPosition.js | 3 +
.../cocos2d/core/value-types/CCColor/color.js | 7 +
docs/cocos2d/core/value-types/CCSize/size.js | 5 +
docs/extensions/ccpool/putInPool.js | 5 +
editor/dashboard/banner.jpg | Bin 0 -> 4915 bytes
editor/dashboard/banner.png | Bin 0 -> 47339 bytes
editor/dashboard/logo.png | Bin 0 -> 9390 bytes
editor/template/new-scene.fire | 49 +
editor/template/new-script.coffee | 16 +
editor/template/new-script.js | 25 +
extends.js | 43 +
extensions/ccb-reader/CCBAnimationManager.js | 768 ++
extensions/ccb-reader/CCBKeyframe.js | 60 +
extensions/ccb-reader/CCBReader.js | 1126 ++
extensions/ccb-reader/CCBReaderUtil.js | 61 +
.../ccb-reader/CCBRelativePositioning.js | 90 +
extensions/ccb-reader/CCBSequence.js | 114 +
extensions/ccb-reader/CCBValue.js | 81 +
extensions/ccb-reader/CCControlLoader.js | 318 +
extensions/ccb-reader/CCNodeLoader.js | 904 ++
extensions/ccb-reader/CCNodeLoaderLibrary.js | 101 +
extensions/ccb-reader/CCSpriteLoader.js | 544 +
extensions/ccpool/CCPool.js | 141 +
.../ccui/base-classes/CCProtectedNode.js | 305 +
.../CCProtectedNodeCanvasRenderCmd.js | 240 +
.../CCProtectedNodeWebGLRenderCmd.js | 135 +
.../ccui/base-classes/UIScale9Sprite.js | 1118 ++
.../UIScale9SpriteCanvasRenderCmd.js | 141 +
.../UIScale9SpriteWebGLRenderCmd.js | 180 +
extensions/ccui/base-classes/UIWidget.js | 2069 +++
.../ccui/base-classes/UIWidgetRenderCmd.js | 97 +
extensions/ccui/layouts/UIHBox.js | 80 +
extensions/ccui/layouts/UILayout.js | 1555 +++
.../ccui/layouts/UILayoutCanvasRenderCmd.js | 179 +
extensions/ccui/layouts/UILayoutComponent.js | 594 +
extensions/ccui/layouts/UILayoutManager.js | 457 +
extensions/ccui/layouts/UILayoutParameter.js | 539 +
.../ccui/layouts/UILayoutWebGLRenderCmd.js | 242 +
extensions/ccui/layouts/UIRelativeBox.js | 79 +
extensions/ccui/layouts/UIVBox.js | 79 +
extensions/ccui/system/CocosGUI.js | 62 +
extensions/ccui/system/UIHelper.js | 164 +
extensions/ccui/uiwidgets/UIButton.js | 973 ++
extensions/ccui/uiwidgets/UICheckBox.js | 740 ++
extensions/ccui/uiwidgets/UIImageView.js | 329 +
extensions/ccui/uiwidgets/UILoadingBar.js | 443 +
extensions/ccui/uiwidgets/UIRichText.js | 742 ++
extensions/ccui/uiwidgets/UISlider.js | 762 ++
extensions/ccui/uiwidgets/UIText.js | 515 +
extensions/ccui/uiwidgets/UITextAtlas.js | 229 +
extensions/ccui/uiwidgets/UITextBMFont.js | 216 +
extensions/ccui/uiwidgets/UITextField.js | 915 ++
extensions/ccui/uiwidgets/UIVideoPlayer.js | 543 +
extensions/ccui/uiwidgets/UIWebView.js | 389 +
.../uiwidgets/scroll-widget/UIListView.js | 606 +
.../uiwidgets/scroll-widget/UIPageView.js | 663 +
.../uiwidgets/scroll-widget/UIScrollView.js | 1921 +++
.../UIScrollViewCanvasRenderCmd.js | 43 +
.../UIScrollViewWebGLRenderCmd.js | 44 +
extensions/cocostudio/CocoStudio.js | 68 +
extensions/cocostudio/action/CCActionFrame.js | 530 +
.../cocostudio/action/CCActionManager.js | 112 +
extensions/cocostudio/action/CCActionNode.js | 421 +
.../cocostudio/action/CCActionObject.js | 263 +
extensions/cocostudio/armature/CCArmature.js | 578 +
.../armature/CCArmatureCanvasRenderCmd.js | 190 +
.../armature/CCArmatureWebGLRenderCmd.js | 167 +
extensions/cocostudio/armature/CCBone.js | 713 +
.../armature/animation/CCArmatureAnimation.js | 669 +
.../armature/animation/CCProcessBase.js | 365 +
.../cocostudio/armature/animation/CCTween.js | 448 +
.../cocostudio/armature/datas/CCDatas.js | 807 ++
.../armature/display/CCBatchNode.js | 114 +
.../armature/display/CCDecorativeDisplay.js | 118 +
.../armature/display/CCDisplayFactory.js | 217 +
.../armature/display/CCDisplayManager.js | 465 +
.../cocostudio/armature/display/CCSkin.js | 215 +
.../armature/display/CCSkinCanvasRenderCmd.js | 58 +
.../armature/display/CCSkinWebGLRenderCmd.js | 146 +
.../armature/physics/CCColliderDetector.js | 397 +
.../armature/utils/CCArmatureDataManager.js | 325 +
.../armature/utils/CCArmatureDefine.js | 45 +
.../armature/utils/CCDataReaderHelper.js | 1223 ++
.../utils/CCSpriteFrameCacheHelper.js | 68 +
.../armature/utils/CCTransformHelp.js | 183 +
.../armature/utils/CCTweenFunction.js | 501 +
.../cocostudio/armature/utils/CCUtilMath.js | 69 +
.../cocostudio/components/CCComAttribute.js | 210 +
.../cocostudio/components/CCComAudio.js | 285 +
.../cocostudio/components/CCComController.js | 76 +
.../cocostudio/components/CCComRender.js | 91 +
.../cocostudio/components/CCComponent.js | 136 +
.../components/CCComponentContainer.js | 159 +
extensions/cocostudio/loader/load.js | 274 +
.../cocostudio/loader/parsers/action-1.x.js | 232 +
.../cocostudio/loader/parsers/action-2.x.js | 309 +
.../cocostudio/loader/parsers/compatible.js | 251 +
.../cocostudio/loader/parsers/scene-1.x.js | 262 +
.../loader/parsers/timelineParser-1.x.js | 292 +
.../loader/parsers/timelineParser-2.x.js | 1401 ++
.../cocostudio/loader/parsers/uiParser-1.x.js | 698 +
.../cocostudio/timeline/ActionTimeline.js | 541 +
extensions/cocostudio/timeline/CCBoneNode.js | 589 +
.../cocostudio/timeline/CCSkeletonNode.js | 262 +
extensions/cocostudio/timeline/CCSkinNode.js | 14 +
extensions/cocostudio/timeline/Frame.js | 1427 ++
extensions/cocostudio/timeline/Timeline.js | 336 +
.../cocostudio/trigger/ObjectFactory.js | 99 +
extensions/cocostudio/trigger/TriggerBase.js | 49 +
extensions/cocostudio/trigger/TriggerMng.js | 301 +
extensions/cocostudio/trigger/TriggerObj.js | 263 +
extensions/editbox/CCEditBox.js | 688 +
extensions/editbox/CCdomNode.js | 657 +
extensions/gui/control-extension/CCControl.js | 381 +
.../gui/control-extension/CCControlButton.js | 688 +
.../CCControlColourPicker.js | 187 +
.../control-extension/CCControlHuePicker.js | 218 +
.../CCControlPotentiometer.js | 300 +
.../CCControlSaturationBrightnessPicker.js | 257 +
.../gui/control-extension/CCControlSlider.js | 308 +
.../gui/control-extension/CCControlStepper.js | 390 +
.../gui/control-extension/CCControlSwitch.js | 425 +
.../gui/control-extension/CCControlUtils.js | 177 +
.../gui/control-extension/CCInvocation.js | 65 +
.../gui/control-extension/CCMenuPassive.js | 415 +
extensions/gui/scrollview/CCScrollView.js | 826 ++
.../scrollview/CCScrollViewCanvasRenderCmd.js | 81 +
.../scrollview/CCScrollViewWebGLRenderCmd.js | 109 +
extensions/gui/scrollview/CCSorting.js | 239 +
extensions/gui/scrollview/CCTableView.js | 720 +
extensions/runtime/CCLoaderLayer.js | 974 ++
extensions/spine/CCSkeleton.js | 407 +
extensions/spine/CCSkeletonAnimation.js | 348 +
extensions/spine/CCSkeletonCanvasRenderCmd.js | 213 +
extensions/spine/CCSkeletonWebGLRenderCmd.js | 260 +
extensions/spine/Spine.js | 2636 ++++
external/box2d/box2d.js | 10882 ++++++++++++++++
external/chipmunk/chipmunk.js | 6196 +++++++++
external/gaf/GAFBoot.js | 24 +
external/gaf/GAFMacros.js | 33 +
external/gaf/Library/GAFAsset.js | 428 +
external/gaf/Library/GAFAssetPreload.js | 270 +
external/gaf/Library/GAFAtlasLoader.js | 50 +
external/gaf/Library/GAFDataReader.js | 229 +
external/gaf/Library/GAFLoader.js | 75 +
external/gaf/Library/GAFMask.js | 36 +
external/gaf/Library/GAFMaskProto.js | 16 +
external/gaf/Library/GAFObject.js | 426 +
external/gaf/Library/GAFShaderManager.js | 63 +
external/gaf/Library/GAFShaders.js | 58 +
external/gaf/Library/GAFSprite.js | 100 +
.../gaf/Library/GAFSpriteCanvasRenderCmd.js | 233 +
external/gaf/Library/GAFSpriteProto.js | 36 +
.../gaf/Library/GAFSpriteWebGLRenderCmd.js | 132 +
external/gaf/Library/GAFTags.js | 378 +
external/gaf/Library/GAFTextField.js | 6 +
external/gaf/Library/GAFTimeLine.js | 547 +
external/gaf/Library/GAFTimeLineProto.js | 32 +
external/gaf/gaf_viewer.css | 42 +
external/gaf/gaf_viewer.html | 21 +
external/gaf/gaf_viewer.js | 219 +
external/pluginx/Plugin.js | 254 +
external/pluginx/platform/facebook.js | 557 +
external/pluginx/platform/facebook_sdk.js | 151 +
external/socketio/socket.io.js | 7000 ++++++++++
external/socketio/socket.io.min.js | 3 +
gulp/tasks/build-cocos2d.js | 318 +
gulp/tasks/build.js | 210 +
gulp/tasks/clean.js | 8 +
gulp/tasks/test.js | 36 +
gulp/util/handleErrors.js | 27 +
gulpfile.js | 43 +
index.js | 76 +
jsb_apis.js | 618 +
jsb_predefine.js | 41 +
licenses/LICENSE_cocos2d-html5.txt | 23 +
licenses/LICENSE_cocos2d-x.txt | 23 +
licenses/LICENSE_zlib.js.txt | 28 +
moduleConfig.json | 478 +
package.json | 36 +
polyfill/bind.js | 29 +
polyfill/index.js | 2 +
polyfill/string.js | 17 +
predefine.js | 69 +
test/core.js | 26 +
test/fixtures/assets/atlas.plist | 92 +
test/fixtures/assets/atlas.png | Bin 0 -> 11766 bytes
test/fixtures/assets/bitmap-font.fnt | 206 +
test/fixtures/assets/bitmap-font.png | Bin 0 -> 178317 bytes
test/fixtures/assets/button.png | Bin 0 -> 11604 bytes
test/fixtures/assets/particle.plist | 110 +
test/fixtures/assets/sprite.jpg | Bin 0 -> 4915 bytes
test/fixtures/library/22/223456/1.ttf | Bin 0 -> 29948 bytes
test/fixtures/library/22/223459.json | 5 +
test/index.js | 12 +
test/lib/init.js | 30 +
test/lib/runner.html | 39 +
test/lib/spawn-runner.js | 69 +
test/page.html | 32 +
test/page.js | 31 +
test/page/asset.js | 32 +
test/page/bitmap-font.js | 120 +
test/page/button.js | 103 +
test/page/engine.js | 104 +
test/page/index.js | 75 +
test/page/label-ttf.js | 93 +
test/page/node.js | 322 +
test/page/particle.js | 287 +
test/page/scale9-sprite.js | 62 +
test/page/scene.js | 128 +
test/page/sprite.js | 98 +
test/qunit/assets/background.mp3 | Bin 0 -> 128313 bytes
test/qunit/assets/button.png | Bin 0 -> 11604 bytes
test/qunit/assets/library/12/123200.json | 16 +
test/qunit/assets/library/12/1232218.json | 16 +
test/qunit/assets/library/19/19851210.json | 71 +
test/qunit/assets/library/65/65341123490 | 16 +
test/qunit/assets/library/65/6545543 | 6 +
test/qunit/assets/library/65/6545543.png | Bin 0 -> 265815 bytes
test/qunit/assets/library/74/748321.json | 6 +
test/qunit/assets/library/74/748321.json.host | Bin 0 -> 1521 bytes
.../library/deferred-loading/12/1232218.json | 17 +
.../library/deferred-loading/74/748321.json | 7 +
test/qunit/lib/assert-deep-close.js | 28 +
test/qunit/lib/qunit-assert-callback.js | 170 +
test/qunit/lib/qunit-assert-close.js | 106 +
test/qunit/lib/qunit-large-module.js | 8 +
test/qunit/lib/qunit-runner.html | 46 +
test/qunit/lib/qunit.css | 244 +
test/qunit/lib/qunit.js | 2212 ++++
test/qunit/run-helper.sh | 3 +
test/qunit/run.sh | 6 +
test/qunit/server.js | 39 +
test/qunit/unit/_callback-tester.js | 147 +
test/qunit/unit/_init.js | 231 +
test/qunit/unit/_polyfill-for-phantom.js | 18 +
test/qunit/unit/test-animation.js | 890 ++
test/qunit/unit/test-asset-library.js | 84 +
test/qunit/unit/test-attribute.js | 78 +
test/qunit/unit/test-audioSource.js | 25 +
test/qunit/unit/test-callbacks-invoker.js | 170 +
test/qunit/unit/test-class.js | 485 +
test/qunit/unit/test-color.js | 20 +
test/qunit/unit/test-component.js | 174 +
test/qunit/unit/test-deserialize.js | 320 +
test/qunit/unit/test-instantiate.js | 244 +
test/qunit/unit/test-js.js | 36 +
test/qunit/unit/test-load-manager.js | 68 +
test/qunit/unit/test-load-scene.js | 49 +
test/qunit/unit/test-node-serialization.js | 145 +
test/qunit/unit/test-node.js | 394 +
test/qunit/unit/test-object.js | 167 +
test/qunit/unit/test-prefab.js | 183 +
test/qunit/unit/test-record-object.js | 17 +
.../unit/test-serialize-missing-script.js | 51 +
test/qunit/unit/test-serialize.js | 458 +
test/qunit/unit/test-spriteRenderer.js | 29 +
test/qunit/unit/test-utils.js | 42 +
test/qunit/unit/test-vec2.js | 36 +
test/test-env-page.js | 13 +
test/test-env.js | 17 +
test/visual-tests/.cocos-project.json | 58 +
test/visual-tests/index.html | 22 +
test/visual-tests/main.js | 215 +
test/visual-tests/res/.gitignore | 2 +
test/visual-tests/res/Hello.png | Bin 0 -> 138777 bytes
.../visual-tests/res/Images/BoilingFoam.plist | 96 +
test/visual-tests/res/Images/Comet.png | Bin 0 -> 2248 bytes
test/visual-tests/res/Images/CyanSquare.png | Bin 0 -> 6576 bytes
test/visual-tests/res/Images/CyanTriangle.png | Bin 0 -> 7250 bytes
test/visual-tests/res/Images/ETC1.pkm | Bin 0 -> 32784 bytes
test/visual-tests/res/Images/Fog.png | Bin 0 -> 48840 bytes
test/visual-tests/res/Images/HelloWorld.png | Bin 0 -> 137663 bytes
test/visual-tests/res/Images/Icon.png | Bin 0 -> 6259 bytes
.../visual-tests/res/Images/MagentaSquare.png | Bin 0 -> 6714 bytes
test/visual-tests/res/Images/Pea.png | Bin 0 -> 3062 bytes
.../res/Images/SendScoreButton.png | Bin 0 -> 3876 bytes
.../res/Images/SendScoreButtonPressed.png | Bin 0 -> 4460 bytes
test/visual-tests/res/Images/SpinningPeas.png | Bin 0 -> 2495 bytes
test/visual-tests/res/Images/SpookyPeas.png | Bin 0 -> 2495 bytes
test/visual-tests/res/Images/YellowSquare.png | Bin 0 -> 4104 bytes
.../res/Images/YellowTriangle.png | Bin 0 -> 6222 bytes
test/visual-tests/res/Images/arrows-hd.png | Bin 0 -> 3319 bytes
test/visual-tests/res/Images/arrows.png | Bin 0 -> 315 bytes
test/visual-tests/res/Images/arrowsBar-hd.png | Bin 0 -> 2844 bytes
test/visual-tests/res/Images/arrowsBar.png | Bin 0 -> 121 bytes
.../res/Images/assetMgrBackground1.jpg | Bin 0 -> 33193 bytes
.../res/Images/assetMgrBackground2.png | Bin 0 -> 18080 bytes
.../res/Images/assetMgrBackground3.png | Bin 0 -> 796 bytes
test/visual-tests/res/Images/atlastest.png | Bin 0 -> 168995 bytes
test/visual-tests/res/Images/b1.png | Bin 0 -> 3845 bytes
test/visual-tests/res/Images/b2.png | Bin 0 -> 4038 bytes
test/visual-tests/res/Images/background.png | Bin 0 -> 18080 bytes
test/visual-tests/res/Images/background1.jpg | Bin 0 -> 33193 bytes
test/visual-tests/res/Images/background1.png | Bin 0 -> 125988 bytes
test/visual-tests/res/Images/background2.jpg | Bin 0 -> 113801 bytes
test/visual-tests/res/Images/background2.png | Bin 0 -> 125210 bytes
test/visual-tests/res/Images/background3.jpg | Bin 0 -> 7582 bytes
test/visual-tests/res/Images/background3.png | Bin 0 -> 796 bytes
test/visual-tests/res/Images/ball.png | Bin 0 -> 776 bytes
.../res/Images/bitmapFontTest3.fnt | 102 +
.../res/Images/bitmapFontTest3.png | Bin 0 -> 66059 bytes
test/visual-tests/res/Images/blocks.png | Bin 0 -> 891 bytes
test/visual-tests/res/Images/blocks9.png | Bin 0 -> 470 bytes
test/visual-tests/res/Images/blocks9r.png | Bin 0 -> 518 bytes
test/visual-tests/res/Images/blocks9ss.plist | 113 +
test/visual-tests/res/Images/blocks9ss.png | Bin 0 -> 2188 bytes
test/visual-tests/res/Images/blocks9ss.tps | Bin 0 -> 2269 bytes
.../res/Images/btn-about-normal-vertical.png | Bin 0 -> 3091 bytes
.../res/Images/btn-about-normal.png | Bin 0 -> 3069 bytes
.../res/Images/btn-about-selected.png | Bin 0 -> 2982 bytes
.../res/Images/btn-highscores-normal.png | Bin 0 -> 4228 bytes
.../res/Images/btn-highscores-selected.png | Bin 0 -> 4162 bytes
.../res/Images/btn-play-normal.png | Bin 0 -> 2703 bytes
.../res/Images/btn-play-selected.png | Bin 0 -> 2653 bytes
.../res/Images/bug12847_sprite.png | Bin 0 -> 4282 bytes
.../res/Images/bug12847_spriteframe.plist | 35 +
.../res/Images/bug12847_spriteframe.png | Bin 0 -> 4305 bytes
.../res/Images/bugs/RetinaDisplay.jpg | Bin 0 -> 63922 bytes
test/visual-tests/res/Images/bugs/bug886.jpg | Bin 0 -> 31737 bytes
test/visual-tests/res/Images/bugs/bug886.png | Bin 0 -> 220924 bytes
.../visual-tests/res/Images/bugs/circle.plist | 31 +
test/visual-tests/res/Images/bugs/circle.png | Bin 0 -> 1398 bytes
test/visual-tests/res/Images/bugs/corner.png | Bin 0 -> 462 bytes
test/visual-tests/res/Images/bugs/edge.png | Bin 0 -> 108 bytes
test/visual-tests/res/Images/bugs/fill.png | Bin 0 -> 97 bytes
test/visual-tests/res/Images/bugs/picture.png | Bin 0 -> 2137 bytes
test/visual-tests/res/Images/close.png | Bin 0 -> 2676 bytes
test/visual-tests/res/Images/cocos-html5.png | Bin 0 -> 54970 bytes
.../visual-tests/res/Images/cocos2dbanner.png | Bin 0 -> 19837 bytes
test/visual-tests/res/Images/dot.png | Bin 0 -> 2276 bytes
.../res/Images/elephant1_Diffuse.png | Bin 0 -> 2278 bytes
.../res/Images/elephant1_Normal.png | Bin 0 -> 19736 bytes
.../res/Images/encryptedAtlas.plist | 35 +
.../res/Images/encryptedAtlas.pvr.ccz | Bin 0 -> 40197 bytes
.../res/Images/encryptedAtlas.tps | 162 +
test/visual-tests/res/Images/f1.png | Bin 0 -> 3891 bytes
test/visual-tests/res/Images/f2.png | Bin 0 -> 4050 bytes
test/visual-tests/res/Images/favicon.ico | Bin 0 -> 1029 bytes
.../res/Images/fire-grayscale.png | Bin 0 -> 800 bytes
test/visual-tests/res/Images/fire.png | Bin 0 -> 622 bytes
.../visual-tests/res/Images/fire_rgba8888.pvr | Bin 0 -> 4148 bytes
test/visual-tests/res/Images/fps_images.png | Bin 0 -> 6203 bytes
test/visual-tests/res/Images/grossini.png | Bin 0 -> 758 bytes
.../res/Images/grossini_128x256_mipmap.pvr | Bin 0 -> 87434 bytes
.../res/Images/grossini_dance_01.png | Bin 0 -> 463 bytes
.../res/Images/grossini_dance_02.png | Bin 0 -> 490 bytes
.../res/Images/grossini_dance_03.png | Bin 0 -> 500 bytes
.../res/Images/grossini_dance_04.png | Bin 0 -> 510 bytes
.../res/Images/grossini_dance_05.png | Bin 0 -> 777 bytes
.../res/Images/grossini_dance_06.png | Bin 0 -> 766 bytes
.../res/Images/grossini_dance_07.png | Bin 0 -> 786 bytes
.../res/Images/grossini_dance_08.png | Bin 0 -> 758 bytes
.../res/Images/grossini_dance_09.png | Bin 0 -> 777 bytes
.../res/Images/grossini_dance_10.png | Bin 0 -> 762 bytes
.../res/Images/grossini_dance_11.png | Bin 0 -> 480 bytes
.../res/Images/grossini_dance_12.png | Bin 0 -> 749 bytes
.../res/Images/grossini_dance_13.png | Bin 0 -> 750 bytes
.../res/Images/grossini_dance_14.png | Bin 0 -> 751 bytes
.../res/Images/grossini_dance_atlas-mono.png | Bin 0 -> 166948 bytes
.../res/Images/grossini_dance_atlas.png | Bin 0 -> 4676 bytes
.../Images/grossini_dance_atlas_nomipmap.png | Bin 0 -> 4676 bytes
.../res/Images/grossini_pvr_rgba4444.pvr | Bin 0 -> 20622 bytes
.../res/Images/grossini_pvr_rgba8888.pvr | Bin 0 -> 41192 bytes
.../Images/grossinis_sister1-testalpha.png | Bin 0 -> 2688 bytes
.../Images/grossinis_sister1-testalpha.ppng | Bin 0 -> 3501 bytes
.../grossinis_sister1-testalpha_nopremult.pvr | Bin 0 -> 41652 bytes
.../grossinis_sister1-testalpha_premult.pvr | Bin 0 -> 41652 bytes
.../res/Images/grossinis_sister1.png | Bin 0 -> 1207 bytes
.../res/Images/grossinis_sister2.png | Bin 0 -> 873 bytes
.../res/Images/heightfield64x64.raw | Bin 0 -> 4096 bytes
test/visual-tests/res/Images/hole_effect.png | Bin 0 -> 2605 bytes
test/visual-tests/res/Images/hole_stencil.png | Bin 0 -> 254 bytes
test/visual-tests/res/Images/labelatlas.png | Bin 0 -> 6308 bytes
test/visual-tests/res/Images/logo-mipmap.pvr | Bin 0 -> 43828 bytes
.../visual-tests/res/Images/logo-nomipmap.pvr | Bin 0 -> 32820 bytes
.../res/Images/lookup-desktop.plist | 16 +
.../res/Images/lookup-html5.plist | 16 +
.../res/Images/lookup-mobile.plist | 16 +
.../res/Images/menuitemsprite.png | Bin 0 -> 9662 bytes
test/visual-tests/res/Images/movement.png | Bin 0 -> 13369 bytes
test/visual-tests/res/Images/noise.png | Bin 0 -> 262848 bytes
.../res/Images/nonencryptedAtlas.plist | 35 +
.../res/Images/nonencryptedAtlas.pvr.ccz | Bin 0 -> 7232 bytes
.../res/Images/nonencryptedAtlas.tps | 162 +
test/visual-tests/res/Images/paddle.png | Bin 0 -> 1548 bytes
test/visual-tests/res/Images/particles-hd.png | Bin 0 -> 4527 bytes
test/visual-tests/res/Images/particles.png | Bin 0 -> 3269 bytes
test/visual-tests/res/Images/pattern1.png | Bin 0 -> 9957 bytes
test/visual-tests/res/Images/piece.png | Bin 0 -> 9529 bytes
test/visual-tests/res/Images/powered.png | Bin 0 -> 42732 bytes
test/visual-tests/res/Images/r1.png | Bin 0 -> 1939 bytes
test/visual-tests/res/Images/r2.png | Bin 0 -> 1808 bytes
test/visual-tests/res/Images/shapemode.png | Bin 0 -> 8304 bytes
test/visual-tests/res/Images/snow.png | Bin 0 -> 1534 bytes
.../res/Images/sprites_test/sprite-0-0.png | Bin 0 -> 2131 bytes
.../res/Images/sprites_test/sprite-0-1.png | Bin 0 -> 1771 bytes
.../res/Images/sprites_test/sprite-0-2.png | Bin 0 -> 2640 bytes
.../res/Images/sprites_test/sprite-0-3.png | Bin 0 -> 2698 bytes
.../res/Images/sprites_test/sprite-0-4.png | Bin 0 -> 3048 bytes
.../res/Images/sprites_test/sprite-0-5.png | Bin 0 -> 2707 bytes
.../res/Images/sprites_test/sprite-0-6.png | Bin 0 -> 2967 bytes
.../res/Images/sprites_test/sprite-0-7.png | Bin 0 -> 3019 bytes
.../res/Images/sprites_test/sprite-1-0.png | Bin 0 -> 2240 bytes
.../res/Images/sprites_test/sprite-1-1.png | Bin 0 -> 1823 bytes
.../res/Images/sprites_test/sprite-1-2.png | Bin 0 -> 3243 bytes
.../res/Images/sprites_test/sprite-1-3.png | Bin 0 -> 3252 bytes
.../res/Images/sprites_test/sprite-1-4.png | Bin 0 -> 1976 bytes
.../res/Images/sprites_test/sprite-1-5.png | Bin 0 -> 2866 bytes
.../res/Images/sprites_test/sprite-1-6.png | Bin 0 -> 1984 bytes
.../res/Images/sprites_test/sprite-1-7.png | Bin 0 -> 2705 bytes
.../res/Images/sprites_test/sprite-2-0.png | Bin 0 -> 3379 bytes
.../res/Images/sprites_test/sprite-2-1.png | Bin 0 -> 3325 bytes
.../res/Images/sprites_test/sprite-2-2.png | Bin 0 -> 2476 bytes
.../res/Images/sprites_test/sprite-2-3.png | Bin 0 -> 2084 bytes
.../res/Images/sprites_test/sprite-2-4.png | Bin 0 -> 2883 bytes
.../res/Images/sprites_test/sprite-2-5.png | Bin 0 -> 2331 bytes
.../res/Images/sprites_test/sprite-2-6.png | Bin 0 -> 3008 bytes
.../res/Images/sprites_test/sprite-2-7.png | Bin 0 -> 2724 bytes
.../res/Images/sprites_test/sprite-3-0.png | Bin 0 -> 2485 bytes
.../res/Images/sprites_test/sprite-3-1.png | Bin 0 -> 2067 bytes
.../res/Images/sprites_test/sprite-3-2.png | Bin 0 -> 2879 bytes
.../res/Images/sprites_test/sprite-3-3.png | Bin 0 -> 2774 bytes
.../res/Images/sprites_test/sprite-3-4.png | Bin 0 -> 2477 bytes
.../res/Images/sprites_test/sprite-3-5.png | Bin 0 -> 2825 bytes
.../res/Images/sprites_test/sprite-3-6.png | Bin 0 -> 2941 bytes
.../res/Images/sprites_test/sprite-3-7.png | Bin 0 -> 2400 bytes
.../res/Images/sprites_test/sprite-4-0.png | Bin 0 -> 2893 bytes
.../res/Images/sprites_test/sprite-4-1.png | Bin 0 -> 2835 bytes
.../res/Images/sprites_test/sprite-4-2.png | Bin 0 -> 1983 bytes
.../res/Images/sprites_test/sprite-4-3.png | Bin 0 -> 2444 bytes
.../res/Images/sprites_test/sprite-4-4.png | Bin 0 -> 3203 bytes
.../res/Images/sprites_test/sprite-4-5.png | Bin 0 -> 3398 bytes
.../res/Images/sprites_test/sprite-4-6.png | Bin 0 -> 2879 bytes
.../res/Images/sprites_test/sprite-4-7.png | Bin 0 -> 3214 bytes
.../res/Images/sprites_test/sprite-5-0.png | Bin 0 -> 3351 bytes
.../res/Images/sprites_test/sprite-5-1.png | Bin 0 -> 3129 bytes
.../res/Images/sprites_test/sprite-5-2.png | Bin 0 -> 2540 bytes
.../res/Images/sprites_test/sprite-5-3.png | Bin 0 -> 3239 bytes
.../res/Images/sprites_test/sprite-5-4.png | Bin 0 -> 2616 bytes
.../res/Images/sprites_test/sprite-5-5.png | Bin 0 -> 2363 bytes
.../res/Images/sprites_test/sprite-5-6.png | Bin 0 -> 3385 bytes
.../res/Images/sprites_test/sprite-5-7.png | Bin 0 -> 2230 bytes
.../res/Images/sprites_test/sprite-6-0.png | Bin 0 -> 2183 bytes
.../res/Images/sprites_test/sprite-6-1.png | Bin 0 -> 2093 bytes
.../res/Images/sprites_test/sprite-6-2.png | Bin 0 -> 3258 bytes
.../res/Images/sprites_test/sprite-6-3.png | Bin 0 -> 1799 bytes
.../res/Images/sprites_test/sprite-6-4.png | Bin 0 -> 2999 bytes
.../res/Images/sprites_test/sprite-6-5.png | Bin 0 -> 3138 bytes
.../res/Images/sprites_test/sprite-6-6.png | Bin 0 -> 2525 bytes
.../res/Images/sprites_test/sprite-6-7.png | Bin 0 -> 3413 bytes
.../res/Images/sprites_test/sprite-7-0.png | Bin 0 -> 2867 bytes
.../res/Images/sprites_test/sprite-7-1.png | Bin 0 -> 2951 bytes
.../res/Images/sprites_test/sprite-7-2.png | Bin 0 -> 2158 bytes
.../res/Images/sprites_test/sprite-7-3.png | Bin 0 -> 2471 bytes
.../res/Images/sprites_test/sprite-7-4.png | Bin 0 -> 2290 bytes
.../res/Images/sprites_test/sprite-7-5.png | Bin 0 -> 3211 bytes
.../res/Images/sprites_test/sprite-7-6.png | Bin 0 -> 3513 bytes
.../res/Images/sprites_test/sprite-7-7.png | Bin 0 -> 2973 bytes
.../res/Images/stars-grayscale.png | Bin 0 -> 1080 bytes
test/visual-tests/res/Images/stars.png | Bin 0 -> 1080 bytes
.../res/Images/stars2-grayscale.png | Bin 0 -> 2066 bytes
test/visual-tests/res/Images/stars2.png | Bin 0 -> 2066 bytes
test/visual-tests/res/Images/stone.png | Bin 0 -> 105975 bytes
test/visual-tests/res/Images/streak.png | Bin 0 -> 1357 bytes
test/visual-tests/res/Images/test-rgba1.png | Bin 0 -> 23848 bytes
.../res/Images/test_1021x1024_a8.pvr.gz | Bin 0 -> 86117 bytes
...test_256x256_ATC_RGBA_Explicit_mipmaps.ktx | Bin 0 -> 87508 bytes
..._256x256_ATC_RGBA_Interpolated_mipmaps.ktx | Bin 0 -> 87508 bytes
.../Images/test_256x256_ATC_RGB_mipmaps.ktx | Bin 0 -> 43804 bytes
.../Images/test_256x256_s3tc_dxt1_mipmaps.dds | Bin 0 -> 43832 bytes
.../Images/test_256x256_s3tc_dxt3_mipmaps.dds | Bin 0 -> 87536 bytes
.../Images/test_256x256_s3tc_dxt5_mipmaps.dds | Bin 0 -> 87536 bytes
...test_512x512_s3tc_dxt5_with_no_mipmaps.dds | Bin 0 -> 262272 bytes
test/visual-tests/res/Images/test_blend.png | Bin 0 -> 4261 bytes
.../res/Images/test_image-bad_encoding.pvr | Bin 0 -> 65588 bytes
test/visual-tests/res/Images/test_image.jpeg | Bin 0 -> 7544 bytes
test/visual-tests/res/Images/test_image.png | Bin 0 -> 10114 bytes
test/visual-tests/res/Images/test_image.pvr | Bin 0 -> 8244 bytes
.../visual-tests/res/Images/test_image.pvrraw | Bin 0 -> 8192 bytes
test/visual-tests/res/Images/test_image.tiff | Bin 0 -> 65906 bytes
test/visual-tests/res/Images/test_image.webp | Bin 0 -> 6720 bytes
.../visual-tests/res/Images/test_image_a8.pvr | Bin 0 -> 16436 bytes
.../res/Images/test_image_a8_v3.pvr | Bin 0 -> 16436 bytes
.../res/Images/test_image_ai88.png | Bin 0 -> 126 bytes
.../res/Images/test_image_ai88.pvr | Bin 0 -> 32820 bytes
.../res/Images/test_image_ai88_v3.pvr | Bin 0 -> 32820 bytes
.../res/Images/test_image_bgra8888.pvr | Bin 0 -> 65588 bytes
.../res/Images/test_image_bgra8888_v3.pvr | Bin 0 -> 65588 bytes
.../visual-tests/res/Images/test_image_i8.png | Bin 0 -> 730 bytes
.../visual-tests/res/Images/test_image_i8.pvr | Bin 0 -> 16436 bytes
.../res/Images/test_image_i8_v3.pvr | Bin 0 -> 16436 bytes
.../res/Images/test_image_pvrtc2bpp.pvr | Bin 0 -> 4148 bytes
.../res/Images/test_image_pvrtc2bpp_v3.pvr | Bin 0 -> 4148 bytes
.../res/Images/test_image_pvrtc4bpp.pvr | Bin 0 -> 8244 bytes
.../res/Images/test_image_pvrtc4bpp_v3.pvr | Bin 0 -> 8244 bytes
.../res/Images/test_image_pvrtcii2bpp_v3.pvr | Bin 0 -> 5532 bytes
.../res/Images/test_image_pvrtcii4bpp_v3.pvr | Bin 0 -> 10988 bytes
.../res/Images/test_image_rgb565.pvr | Bin 0 -> 32820 bytes
.../res/Images/test_image_rgb565_v3.pvr | Bin 0 -> 43742 bytes
.../res/Images/test_image_rgb888.png | Bin 0 -> 145 bytes
.../res/Images/test_image_rgb888.pvr | Bin 0 -> 49204 bytes
.../res/Images/test_image_rgb888_v3.pvr | Bin 0 -> 65587 bytes
.../res/Images/test_image_rgba4444.pvr | Bin 0 -> 32820 bytes
.../res/Images/test_image_rgba4444.pvr.ccz | Bin 0 -> 23792 bytes
.../res/Images/test_image_rgba4444.pvr.gz | Bin 0 -> 23805 bytes
.../res/Images/test_image_rgba4444_mipmap.pvr | Bin 0 -> 43742 bytes
.../res/Images/test_image_rgba4444_v3.pvr | Bin 0 -> 43742 bytes
.../res/Images/test_image_rgba5551.pvr | Bin 0 -> 32820 bytes
.../res/Images/test_image_rgba5551_v3.pvr | Bin 0 -> 43742 bytes
.../res/Images/test_image_rgba8888.png | Bin 0 -> 182 bytes
.../res/Images/test_image_rgba8888.pvr | Bin 0 -> 65588 bytes
.../res/Images/test_image_rgba8888_v3.pvr | Bin 0 -> 65588 bytes
.../res/Images/texture1024x1024.png | Bin 0 -> 222 bytes
.../res/Images/texture2048x2048.png | Bin 0 -> 605 bytes
.../res/Images/texture512x512.png | Bin 0 -> 126 bytes
test/visual-tests/res/Images/texturemode.png | Bin 0 -> 8002 bytes
test/visual-tests/res/Images/ui.plist | 139 +
test/visual-tests/res/Images/ui.png | Bin 0 -> 7292 bytes
test/visual-tests/res/Images/water_2_dxt1.dds | Bin 0 -> 22024 bytes
test/visual-tests/res/Images/water_2_dxt3.dds | Bin 0 -> 43920 bytes
test/visual-tests/res/Images/water_2_dxt5.dds | Bin 0 -> 43920 bytes
.../visual-tests/res/Images/white-512x512.png | Bin 0 -> 126 bytes
test/visual-tests/res/Images/wood.jpg | Bin 0 -> 2138 bytes
.../Manifests/AMTestScene1/project.manifest | 16 +
.../Manifests/AMTestScene2/project.manifest | 15 +
.../Manifests/AMTestScene3/project.manifest | 16 +
.../Manifests/AMTestScene4/project.manifest | 16 +
.../res/Manifests/ScriptTest/project.manifest | 13 +
.../res/Particles/BoilingFoam.plist | 102 +
.../res/Particles/BoilingFoamStar.plist | 110 +
.../res/Particles/BurstPipe.plist | 102 +
.../res/Particles/ButterFly.plist | 120 +
.../res/Particles/ButterFlyYFlipped.plist | 120 +
test/visual-tests/res/Particles/Comet.plist | 102 +
.../res/Particles/ExplodingRing.plist | 102 +
test/visual-tests/res/Particles/Flower.plist | 102 +
test/visual-tests/res/Particles/Galaxy.plist | 102 +
.../visual-tests/res/Particles/LavaFlow.plist | 102 +
test/visual-tests/res/Particles/Phoenix.plist | 102 +
.../visual-tests/res/Particles/SmallSun.plist | 110 +
.../res/Particles/SpinningPeas.plist | 110 +
test/visual-tests/res/Particles/Spiral.plist | 102 +
.../res/Particles/SpookyPeas.plist | 102 +
.../Particles/TestPremultipliedAlpha.plist | 110 +
.../res/Particles/Upsidedown.plist | 102 +
test/visual-tests/res/Particles/debian.plist | 104 +
test/visual-tests/res/Particles/lines.plist | 118 +
.../res/Shaders/example_3D_PositionTex.fsh | 12 +
.../res/Shaders/example_3D_PositionTex.vsh | 11 +
.../res/Shaders/example_Bloom.fsh | 54 +
.../visual-tests/res/Shaders/example_Blur.fsh | 46 +
.../res/Shaders/example_Blur_winrt.fsh | 36 +
.../res/Shaders/example_CelShading.fsh | 63 +
.../res/Shaders/example_ColorBars.fsh | 43 +
.../res/Shaders/example_ColorBars.vsh | 16 +
.../res/Shaders/example_EdgeDetection.fsh | 41 +
.../res/Shaders/example_Flower.fsh | 34 +
.../res/Shaders/example_Flower.vsh | 8 +
.../res/Shaders/example_GreyScale.fsh | 13 +
.../res/Shaders/example_Heart.fsh | 33 +
.../res/Shaders/example_Heart.vsh | 8 +
.../res/Shaders/example_HorizontalColor.fsh | 27 +
.../res/Shaders/example_Julia.fsh | 29 +
.../res/Shaders/example_Julia.vsh | 8 +
.../res/Shaders/example_LensFlare.fsh | 100 +
.../res/Shaders/example_Mandelbrot.fsh | 41 +
.../res/Shaders/example_Mandelbrot.vsh | 8 +
.../res/Shaders/example_Monjori.fsh | 35 +
.../res/Shaders/example_Monjori.vsh | 8 +
.../res/Shaders/example_MultiTexture.fsh | 17 +
.../res/Shaders/example_MultiTexture.vsh | 19 +
.../res/Shaders/example_Noisy.fsh | 26 +
.../res/Shaders/example_Normal.fsh | 11 +
.../res/Shaders/example_Outline.fsh | 27 +
.../res/Shaders/example_Outline.vsh | 13 +
.../res/Shaders/example_Outline_noMVP.vsh | 13 +
.../res/Shaders/example_Plasma.fsh | 22 +
.../res/Shaders/example_Plasma.vsh | 8 +
.../res/Shaders/example_Sepia.fsh | 17 +
.../res/Shaders/example_Simple.vsh | 18 +
.../res/Shaders/example_Twist.fsh | 26 +
.../res/Shaders/example_Twist.vsh | 8 +
.../res/Shaders/shadertoy_FireBall.fsh | 55 +
.../res/Shaders/shadertoy_Glow.fsh | 108 +
.../res/Shaders/shadertoy_LensFlare.fsh | 100 +
test/visual-tests/res/Test.html | 5 +
.../res/TileMaps/fixed-ortho-test2.png | Bin 0 -> 50336 bytes
test/visual-tests/res/TileMaps/grass.png | Bin 0 -> 14449 bytes
test/visual-tests/res/TileMaps/grass01.png | Bin 0 -> 64329 bytes
test/visual-tests/res/TileMaps/hexa-test.tmx | 12 +
test/visual-tests/res/TileMaps/hexa-tiles.png | Bin 0 -> 271978 bytes
.../res/TileMaps/iso-test-bug787.tmx | 17 +
.../res/TileMaps/iso-test-movelayer.tmx | 27 +
.../res/TileMaps/iso-test-objectgroup.tmx | 28 +
.../res/TileMaps/iso-test-vertexz.tmx | 23 +
.../res/TileMaps/iso-test-zorder.tmx | 26 +
test/visual-tests/res/TileMaps/iso-test.png | Bin 0 -> 14572 bytes
test/visual-tests/res/TileMaps/iso-test.tmx | 16 +
test/visual-tests/res/TileMaps/iso-test1.tmx | 21 +
.../res/TileMaps/iso-test2-uncompressed.tmx | 17 +
test/visual-tests/res/TileMaps/iso-test2.png | Bin 0 -> 3478 bytes
test/visual-tests/res/TileMaps/iso-test2.tmx | 17 +
test/visual-tests/res/TileMaps/iso.png | Bin 0 -> 1158 bytes
test/visual-tests/res/TileMaps/levelmap.tga | Bin 0 -> 5808 bytes
.../res/TileMaps/ortho-objects.tmx | 28 +
.../res/TileMaps/ortho-rotation-test.tmx | 23 +
.../visual-tests/res/TileMaps/ortho-test1.png | Bin 0 -> 459304 bytes
.../res/TileMaps/ortho-test1_bw.png | Bin 0 -> 119558 bytes
.../visual-tests/res/TileMaps/ortho-test2.png | Bin 0 -> 46116 bytes
.../res/TileMaps/ortho-tile-property.tmx | 46 +
.../TileMaps/orthogonal-test-movelayer.tmx | 27 +
.../res/TileMaps/orthogonal-test-vertexz.tmx | 21 +
.../res/TileMaps/orthogonal-test-zorder.tmx | 26 +
.../res/TileMaps/orthogonal-test1.tmx | 9 +
.../res/TileMaps/orthogonal-test1.tsx | 4 +
.../res/TileMaps/orthogonal-test2.tmx | 11 +
.../res/TileMaps/orthogonal-test3.tmx | 13 +
.../res/TileMaps/orthogonal-test4-hd.tmx | 11 +
.../res/TileMaps/orthogonal-test4.tmx | 11 +
.../res/TileMaps/orthogonal-test5.tmx | 24 +
.../res/TileMaps/orthogonal-test6-hd.tmx | 11 +
.../res/TileMaps/orthogonal-test6.tmx | 11 +
.../res/TileMaps/test-object-layer.tmx | 18 +
.../res/TileMaps/test-staggered.tmx | 19 +
.../res/TileMaps/tile_iso_offset.png | Bin 0 -> 34465 bytes
.../res/TileMaps/tile_iso_offset.tmx | 37 +
test/visual-tests/res/TileMaps/tiles-hd.png | Bin 0 -> 23618 bytes
test/visual-tests/res/TileMaps/tiles.png | Bin 0 -> 28567 bytes
.../res/TileMaps/tmw_desert_spacing-hd.png | Bin 0 -> 47941 bytes
.../res/TileMaps/tmw_desert_spacing.png | Bin 0 -> 46318 bytes
test/visual-tests/res/TileMaps/xml-test.tmx | 152 +
test/visual-tests/res/TileMaps/xml-test.tsx | 19 +
.../res/animations/animations-2.plist | 133 +
.../res/animations/animations.plist | 65 +
.../res/animations/crystals.plist | 174 +
test/visual-tests/res/animations/crystals.png | Bin 0 -> 26684 bytes
.../res/animations/dragon_animation-hd.png | Bin 0 -> 26685 bytes
.../res/animations/dragon_animation.png | Bin 0 -> 12208 bytes
test/visual-tests/res/animations/ghosts.plist | 92 +
test/visual-tests/res/animations/ghosts.png | Bin 0 -> 11766 bytes
.../res/animations/grossini-aliases.plist | 254 +
.../res/animations/grossini-aliases.png | Bin 0 -> 14188 bytes
.../res/animations/grossini.plist | 282 +
.../res/animations/grossini.plist.xml | 282 +
test/visual-tests/res/animations/grossini.png | Bin 0 -> 6493 bytes
.../res/animations/grossini.pvr.gz | Bin 0 -> 5704 bytes
test/visual-tests/res/animations/grossini.zss | Bin 0 -> 29755 bytes
test/visual-tests/res/animations/grossini.ztp | Bin 0 -> 17283 bytes
.../res/animations/grossini_blue.plist | 92 +
.../res/animations/grossini_blue.png | Bin 0 -> 5381 bytes
.../res/animations/grossini_family.plist | 73 +
.../res/animations/grossini_family.png | Bin 0 -> 7423 bytes
.../res/animations/grossini_gray.plist | 282 +
.../res/animations/grossini_gray.png | Bin 0 -> 11001 bytes
.../res/animations/tcc_issue_1.plist | 61 +
.../res/animations/tcc_issue_1.png | Bin 0 -> 3129 bytes
.../res/animations/tcc_issue_2.plist | 61 +
.../res/animations/tcc_issue_2.png | Bin 0 -> 5225 bytes
test/visual-tests/res/audio/LuckyDay.mp3 | Bin 0 -> 270974 bytes
.../res/audio/SoundEffectsFX009/FX081.mp3 | Bin 0 -> 8515 bytes
.../res/audio/SoundEffectsFX009/FX082.mp3 | Bin 0 -> 11440 bytes
.../res/audio/SoundEffectsFX009/FX083.mp3 | Bin 0 -> 11440 bytes
.../res/audio/SoundEffectsFX009/FX084.mp3 | Bin 0 -> 11440 bytes
.../res/audio/SoundEffectsFX009/FX085.mp3 | Bin 0 -> 16665 bytes
.../res/audio/SoundEffectsFX009/FX086.mp3 | Bin 0 -> 16665 bytes
.../res/audio/SoundEffectsFX009/FX087.mp3 | Bin 0 -> 11231 bytes
.../res/audio/SoundEffectsFX009/FX088.mp3 | Bin 0 -> 13530 bytes
.../res/audio/SoundEffectsFX009/FX089.mp3 | Bin 0 -> 13530 bytes
.../res/audio/SoundEffectsFX009/FX090.mp3 | Bin 0 -> 13530 bytes
.../res/audio/SoundEffectsFX009/README.txt | 4 +
.../visual-tests/res/background-music-aac.mp3 | Bin 0 -> 299291 bytes
test/visual-tests/res/background.caf | Bin 0 -> 163584 bytes
test/visual-tests/res/background.mp3 | Bin 0 -> 128313 bytes
test/visual-tests/res/background.ogg | Bin 0 -> 89234 bytes
test/visual-tests/res/ccs-res/XueJ2312F.ttf | Bin 0 -> 453216 bytes
.../res/ccs-res/cocosui/100/100.ExportJson | 283 +
.../res/ccs-res/cocosui/100/100.csb | Bin 0 -> 1834 bytes
.../res/ccs-res/cocosui/100/1000.plist | 65 +
.../res/ccs-res/cocosui/100/1000.png | Bin 0 -> 1411 bytes
.../res/ccs-res/cocosui/CloseNormal.png | Bin 0 -> 6311 bytes
.../res/ccs-res/cocosui/CloseSelected.png | Bin 0 -> 5499 bytes
.../res/ccs-res/cocosui/CocoGUISample.json | 397 +
.../cocosui/CocoGUI_PageView_Sample.csb | Bin 0 -> 805 bytes
.../cocosui/CocoGUI_PageView_Sample.json | 49 +
.../CustomImageViewTest/NewProject_20.plist | 46 +
.../CustomImageViewTest/NewProject_20.png | Bin 0 -> 13472 bytes
.../NewProject_2_1.ExportJson | 139 +
.../CustomImageViewTest/NewProject_2_1.csb | Bin 0 -> 2181 bytes
.../CustomWidgetCallbackBindTest.csb | Bin 0 -> 3360 bytes
.../Default/Button_Disable.png | Bin 0 -> 1111 bytes
.../Default/Button_Normal.png | Bin 0 -> 1113 bytes
.../Default/Button_Press.png | Bin 0 -> 1153 bytes
.../Default/CheckBoxNode_Disable.png | Bin 0 -> 1231 bytes
.../Default/CheckBoxNode_Normal.png | Bin 0 -> 1241 bytes
.../Default/CheckBox_Disable.png | Bin 0 -> 1204 bytes
.../Default/CheckBox_Normal.png | Bin 0 -> 1204 bytes
.../Default/CheckBox_Press.png | Bin 0 -> 1243 bytes
.../CustomWidgetCallbackBindTest/Layer.csb | Bin 0 -> 1768 bytes
.../PageViewBugScene.csb | Bin 0 -> 676 bytes
.../res/ccs-res/cocosui/Hello.png | Bin 0 -> 138777 bytes
.../res/ccs-res/cocosui/Marker Felt.ttf | Bin 0 -> 25776 bytes
.../res/ccs-res/cocosui/UITest/UITest.csb | Bin 0 -> 3726 bytes
.../res/ccs-res/cocosui/UITest/UITest.json | 446 +
.../res/ccs-res/cocosui/UITest/b1.png | Bin 0 -> 3877 bytes
.../res/ccs-res/cocosui/UITest/b2.png | Bin 0 -> 4027 bytes
.../res/ccs-res/cocosui/UITest/background.png | Bin 0 -> 103086 bytes
.../cocosui/UITest/buttonBackground.png | Bin 0 -> 498 bytes
.../res/ccs-res/cocosui/UITest/f1.png | Bin 0 -> 3915 bytes
.../res/ccs-res/cocosui/UITest/f2.png | Bin 0 -> 4046 bytes
.../res/ccs-res/cocosui/UITest/r1.png | Bin 0 -> 1956 bytes
.../res/ccs-res/cocosui/UITest/r2.png | Bin 0 -> 2209 bytes
.../res/ccs-res/cocosui/UITest/ribbon.png | Bin 0 -> 983 bytes
.../res/ccs-res/cocosui/android9patch.plist | 100 +
.../res/ccs-res/cocosui/android9patch.png | Bin 0 -> 27140 bytes
.../ccs-res/cocosui/animationbuttonnormal.png | Bin 0 -> 8046 bytes
.../cocosui/animationbuttonpressed.png | Bin 0 -> 8152 bytes
.../res/ccs-res/cocosui/arrow.png | Bin 0 -> 3437 bytes
test/visual-tests/res/ccs-res/cocosui/b11.png | Bin 0 -> 163116 bytes
.../res/ccs-res/cocosui/backtotopnormal.png | Bin 0 -> 8445 bytes
.../res/ccs-res/cocosui/backtotoppressed.png | Bin 0 -> 8509 bytes
.../res/ccs-res/cocosui/bitmapFontTest2.fnt | 188 +
.../res/ccs-res/cocosui/bitmapFontTest2.png | Bin 0 -> 126215 bytes
.../res/ccs-res/cocosui/btn_exercise01_n.png | Bin 0 -> 8420 bytes
.../res/ccs-res/cocosui/btn_exercise01_p.png | Bin 0 -> 8144 bytes
.../res/ccs-res/cocosui/btn_exercise02_n.png | Bin 0 -> 7033 bytes
.../res/ccs-res/cocosui/btn_exercise02_p.png | Bin 0 -> 6903 bytes
.../res/ccs-res/cocosui/btn_exercise03_n.png | Bin 0 -> 7658 bytes
.../res/ccs-res/cocosui/btn_exercise03_p.png | Bin 0 -> 7416 bytes
.../res/ccs-res/cocosui/button.png | Bin 0 -> 840 bytes
.../res/ccs-res/cocosui/buttonHighlighted.png | Bin 0 -> 896 bytes
.../res/ccs-res/cocosui/ccicon.png | Bin 0 -> 10831 bytes
.../res/ccs-res/cocosui/check_box_active.png | Bin 0 -> 4621 bytes
.../cocosui/check_box_active_disable.png | Bin 0 -> 4576 bytes
.../cocosui/check_box_active_press.png | Bin 0 -> 4650 bytes
.../res/ccs-res/cocosui/check_box_normal.png | Bin 0 -> 4522 bytes
.../cocosui/check_box_normal_disable.png | Bin 0 -> 4426 bytes
.../cocosui/check_box_normal_press.png | Bin 0 -> 4533 bytes
.../Button/button_country_n.png | Bin 0 -> 8345 bytes
.../Button/button_country_p.png | Bin 0 -> 10246 bytes
.../Button/button_country_un.png | Bin 0 -> 4412 bytes
.../Test/UIResForEditor/Button/symbol_1B.png | Bin 0 -> 6550 bytes
.../Test/UIResForEditor/Button/symbol_1a.png | Bin 0 -> 5393 bytes
.../Test/UIResForEditor/Button/symbol_1c.png | Bin 0 -> 3027 bytes
.../ccs-res/cocosui/examples/equip/111.png | Bin 0 -> 1707 bytes
.../res/ccs-res/cocosui/examples/equip/12.png | Bin 0 -> 623 bytes
.../res/ccs-res/cocosui/examples/equip/13.png | Bin 0 -> 563 bytes
.../res/ccs-res/cocosui/examples/equip/14.png | Bin 0 -> 452 bytes
.../res/ccs-res/cocosui/examples/equip/15.png | Bin 0 -> 465 bytes
.../res/ccs-res/cocosui/examples/equip/2.png | Bin 0 -> 12493 bytes
.../cocosui/examples/equip/button_end_01.png | Bin 0 -> 1062 bytes
.../cocosui/examples/equip/button_end_02.png | Bin 0 -> 1901 bytes
.../examples/equip/button_green_n2.png | Bin 0 -> 1553 bytes
.../examples/equip/button_green_p2.png | Bin 0 -> 1315 bytes
.../examples/equip/button_green_un2.png | Bin 0 -> 1605 bytes
.../ccs-res/cocosui/examples/equip/eg/1.png | Bin 0 -> 11743 bytes
.../ccs-res/cocosui/examples/equip/eg/10.png | Bin 0 -> 4964 bytes
.../ccs-res/cocosui/examples/equip/eg/11.png | Bin 0 -> 5237 bytes
.../ccs-res/cocosui/examples/equip/eg/3.png | Bin 0 -> 4364 bytes
.../ccs-res/cocosui/examples/equip/eg/4.png | Bin 0 -> 4834 bytes
.../ccs-res/cocosui/examples/equip/eg/5.png | Bin 0 -> 4774 bytes
.../ccs-res/cocosui/examples/equip/eg/6.png | Bin 0 -> 4758 bytes
.../ccs-res/cocosui/examples/equip/eg/7.png | Bin 0 -> 4862 bytes
.../ccs-res/cocosui/examples/equip/eg/8.png | Bin 0 -> 4491 bytes
.../ccs-res/cocosui/examples/equip/eg/9.png | Bin 0 -> 4713 bytes
.../cocosui/examples/equip/eg/crab.png | Bin 0 -> 3062 bytes
.../cocosui/examples/equip/eg/research.png | Bin 0 -> 3458 bytes
.../cocosui/examples/equip/eg/sell.png | Bin 0 -> 3205 bytes
.../examples/equip/eg/shop_shield_1.png | Bin 0 -> 3374 bytes
.../examples/equip/eg/shop_shield_2.png | Bin 0 -> 3382 bytes
.../examples/equip/eg/shop_shield_3.png | Bin 0 -> 3786 bytes
.../cocosui/examples/equip/eg/train.png | Bin 0 -> 3174 bytes
.../cocosui/examples/equip/eg/upgrade.png | Bin 0 -> 3609 bytes
.../res/ccs-res/cocosui/examples/examples.csb | Bin 0 -> 18546 bytes
.../ccs-res/cocosui/examples/examples.json | 3898 ++++++
.../cocosui/examples/weapon_introduce/4.png | Bin 0 -> 3555 bytes
.../cocosui/examples/weapon_introduce/5.png | Bin 0 -> 3180 bytes
.../cocosui/examples/weapon_introduce/6.png | Bin 0 -> 804 bytes
.../weapon_introduce/button_end_01.png | Bin 0 -> 6719 bytes
.../weapon_introduce/button_end_02.png | Bin 0 -> 6507 bytes
.../weapon_item_1/weapon_item/1.png | Bin 0 -> 3244 bytes
.../weapon_item_1/weapon_item/2.png | Bin 0 -> 3276 bytes
.../weapon_item_1/weapon_item/7.png | Bin 0 -> 6174 bytes
.../weapon_item_1/weapon_item_1.csb | Bin 0 -> 2182 bytes
.../weapon_item_1/weapon_item_1.json | 210 +
.../res/ccs-res/cocosui/green_edit.png | Bin 0 -> 6749 bytes
.../res/ccs-res/cocosui/grossini-aliases.png | Bin 0 -> 14188 bytes
.../UIAction_1/CocoStudio_UIEditor.png | Bin 0 -> 14593 bytes
.../gui_examples/UIAction_1/UIAction_1.csb | Bin 0 -> 2599 bytes
.../gui_examples/UIAction_1/UIAction_1.json | 260 +
.../ccs-res/cocosui/gui_examples/buy_1/5.png | Bin 0 -> 3180 bytes
.../ccs-res/cocosui/gui_examples/buy_1/7.png | Bin 0 -> 6174 bytes
.../cocosui/gui_examples/buy_1/button.png | Bin 0 -> 4617 bytes
.../gui_examples/buy_1/buttonHighlighted.png | Bin 0 -> 4617 bytes
.../cocosui/gui_examples/buy_1/buy_1.csb | Bin 0 -> 3547 bytes
.../cocosui/gui_examples/buy_1/buy_1.json | 337 +
.../gui_examples/equip_1/equip/111.png | Bin 0 -> 1170 bytes
.../cocosui/gui_examples/equip_1/equip/12.png | Bin 0 -> 623 bytes
.../cocosui/gui_examples/equip_1/equip/13.png | Bin 0 -> 563 bytes
.../cocosui/gui_examples/equip_1/equip/14.png | Bin 0 -> 452 bytes
.../cocosui/gui_examples/equip_1/equip/15.png | Bin 0 -> 465 bytes
.../cocosui/gui_examples/equip_1/equip/2.png | Bin 0 -> 12493 bytes
.../equip_1/equip/button_end_01.png | Bin 0 -> 1062 bytes
.../equip_1/equip/button_end_02.png | Bin 0 -> 1901 bytes
.../equip_1/equip/button_green_n2.png | Bin 0 -> 1553 bytes
.../equip_1/equip/button_green_p2.png | Bin 0 -> 1315 bytes
.../equip_1/equip/button_green_un2.png | Bin 0 -> 1605 bytes
.../gui_examples/equip_1/equip/eg/1.png | Bin 0 -> 11743 bytes
.../gui_examples/equip_1/equip/eg/10.png | Bin 0 -> 4964 bytes
.../gui_examples/equip_1/equip/eg/11.png | Bin 0 -> 5237 bytes
.../gui_examples/equip_1/equip/eg/3.png | Bin 0 -> 4364 bytes
.../gui_examples/equip_1/equip/eg/4.png | Bin 0 -> 4834 bytes
.../gui_examples/equip_1/equip/eg/5.png | Bin 0 -> 4774 bytes
.../gui_examples/equip_1/equip/eg/6.png | Bin 0 -> 4758 bytes
.../gui_examples/equip_1/equip/eg/7.png | Bin 0 -> 4862 bytes
.../gui_examples/equip_1/equip/eg/8.png | Bin 0 -> 4491 bytes
.../gui_examples/equip_1/equip/eg/9.png | Bin 0 -> 4713 bytes
.../gui_examples/equip_1/equip/eg/crab.png | Bin 0 -> 3062 bytes
.../equip_1/equip/eg/research.png | Bin 0 -> 3458 bytes
.../gui_examples/equip_1/equip/eg/sell.png | Bin 0 -> 3205 bytes
.../equip_1/equip/eg/shop_shield_1.png | Bin 0 -> 3374 bytes
.../equip_1/equip/eg/shop_shield_2.png | Bin 0 -> 3382 bytes
.../equip_1/equip/eg/shop_shield_3.png | Bin 0 -> 3786 bytes
.../gui_examples/equip_1/equip/eg/train.png | Bin 0 -> 3174 bytes
.../gui_examples/equip_1/equip/eg/upgrade.png | Bin 0 -> 3609 bytes
.../cocosui/gui_examples/equip_1/equip_1.csb | Bin 0 -> 14880 bytes
.../cocosui/gui_examples/equip_1/equip_1.json | 3234 +++++
.../gui_examples/map_1/image_castle.png | Bin 0 -> 17482 bytes
.../cocosui/gui_examples/map_1/map_1.csb | Bin 0 -> 4242 bytes
.../cocosui/gui_examples/map_1/map_1.json | 530 +
.../cocosui/gui_examples/map_1/map_pve.png | Bin 0 -> 354187 bytes
.../cocosui/gui_examples/map_alert_1/5.png | Bin 0 -> 3180 bytes
.../cocosui/gui_examples/map_alert_1/7.png | Bin 0 -> 6174 bytes
.../gui_examples/map_alert_1/close_02.png | Bin 0 -> 1758 bytes
.../gui_examples/map_alert_1/close_03.png | Bin 0 -> 1758 bytes
.../gui_examples/map_alert_1/close_04.png | Bin 0 -> 1758 bytes
.../gui_examples/map_alert_1/map_alert_1.csb | Bin 0 -> 3041 bytes
.../gui_examples/map_alert_1/map_alert_1.json | 264 +
.../gui_examples/page_1/background.png | Bin 0 -> 103086 bytes
.../gui_examples/page_1/buttonBackground.png | Bin 0 -> 498 bytes
.../cocosui/gui_examples/page_1/page_1.csb | Bin 0 -> 5041 bytes
.../cocosui/gui_examples/page_1/page_1.json | 706 +
.../CocoStudio_AnimationEditor.png | Bin 0 -> 15654 bytes
.../page_content/CocoStudio_DataEditor.png | Bin 0 -> 14930 bytes
.../page_content/CocoStudio_SceneEditor.png | Bin 0 -> 14604 bytes
.../page_content/CocoStudio_UIEditor.png | Bin 0 -> 14593 bytes
.../cocosui/gui_examples/page_1/ribbon.png | Bin 0 -> 983 bytes
.../teehanlax - iOS 6 - iPhone_check.png | Bin 0 -> 11484 bytes
.../teehanlax - iOS 6 - iPhone_check01.png | Bin 0 -> 11114 bytes
.../gui_examples/register_1/128_128.png | Bin 0 -> 10249 bytes
.../register_1/Rosewood stdloadingH.fnt | 116 +
.../register_1/Rosewood stdloadingH.png | Bin 0 -> 43935 bytes
.../gui_examples/register_1/button_d.png | Bin 0 -> 6639 bytes
.../gui_examples/register_1/button_n.png | Bin 0 -> 6991 bytes
.../gui_examples/register_1/e-mail.png | Bin 0 -> 18555 bytes
.../gui_examples/register_1/register_1.csb | Bin 0 -> 5789 bytes
.../gui_examples/register_1/register_1.json | 719 +
.../register_1/ui_shop_005-hd.png | Bin 0 -> 6035 bytes
.../weapon_introduce_1/weapon_introduce/4.png | Bin 0 -> 3555 bytes
.../weapon_introduce_1/weapon_introduce/5.png | Bin 0 -> 3180 bytes
.../weapon_introduce_1/weapon_introduce/6.png | Bin 0 -> 804 bytes
.../weapon_introduce/button_end_01.png | Bin 0 -> 6719 bytes
.../weapon_introduce/button_end_02.png | Bin 0 -> 6507 bytes
.../weapon_introduce_1/weapon_introduce_1.csb | Bin 0 -> 3927 bytes
.../weapon_introduce_1.json | 447 +
.../weapon_item_1/weapon_item/1.png | Bin 0 -> 3244 bytes
.../weapon_item_1/weapon_item/2.png | Bin 0 -> 3276 bytes
.../weapon_item_1/weapon_item/7.png | Bin 0 -> 6174 bytes
.../weapon_item_1/weapon_item_1.csb | Bin 0 -> 2180 bytes
.../weapon_item_1/weapon_item_1.json | 210 +
.../weapon_item_1/weapons/weapons_1.png | Bin 0 -> 6369 bytes
.../weapon_item_1/weapons/weapons_10.png | Bin 0 -> 6037 bytes
.../weapon_item_1/weapons/weapons_11.png | Bin 0 -> 6164 bytes
.../weapon_item_1/weapons/weapons_12.png | Bin 0 -> 7639 bytes
.../weapon_item_1/weapons/weapons_13.png | Bin 0 -> 4314 bytes
.../weapon_item_1/weapons/weapons_14.png | Bin 0 -> 5703 bytes
.../weapon_item_1/weapons/weapons_15.png | Bin 0 -> 6137 bytes
.../weapon_item_1/weapons/weapons_16.png | Bin 0 -> 4581 bytes
.../weapon_item_1/weapons/weapons_17.png | Bin 0 -> 4871 bytes
.../weapon_item_1/weapons/weapons_18.png | Bin 0 -> 4799 bytes
.../weapon_item_1/weapons/weapons_19.png | Bin 0 -> 6302 bytes
.../weapon_item_1/weapons/weapons_2.png | Bin 0 -> 6620 bytes
.../weapon_item_1/weapons/weapons_20.png | Bin 0 -> 5594 bytes
.../weapon_item_1/weapons/weapons_21.png | Bin 0 -> 7449 bytes
.../weapon_item_1/weapons/weapons_22.png | Bin 0 -> 5326 bytes
.../weapon_item_1/weapons/weapons_23.png | Bin 0 -> 5797 bytes
.../weapon_item_1/weapons/weapons_24.png | Bin 0 -> 6223 bytes
.../weapon_item_1/weapons/weapons_25.png | Bin 0 -> 7198 bytes
.../weapon_item_1/weapons/weapons_26.png | Bin 0 -> 6275 bytes
.../weapon_item_1/weapons/weapons_27.png | Bin 0 -> 11880 bytes
.../weapon_item_1/weapons/weapons_28.png | Bin 0 -> 9365 bytes
.../weapon_item_1/weapons/weapons_29.png | Bin 0 -> 12507 bytes
.../weapon_item_1/weapons/weapons_3.png | Bin 0 -> 5615 bytes
.../weapon_item_1/weapons/weapons_30.png | Bin 0 -> 6196 bytes
.../weapon_item_1/weapons/weapons_31.png | Bin 0 -> 6929 bytes
.../weapon_item_1/weapons/weapons_4.png | Bin 0 -> 7118 bytes
.../weapon_item_1/weapons/weapons_5.png | Bin 0 -> 6339 bytes
.../weapon_item_1/weapons/weapons_6.png | Bin 0 -> 9766 bytes
.../weapon_item_1/weapons/weapons_7.png | Bin 0 -> 7647 bytes
.../weapon_item_1/weapons/weapons_8.png | Bin 0 -> 6352 bytes
.../weapon_item_1/weapons/weapons_9.png | Bin 0 -> 8498 bytes
.../res/ccs-res/cocosui/labelatlas.png | Bin 0 -> 11830 bytes
.../res/ccs-res/cocosui/loadingbar.png | Bin 0 -> 2794 bytes
.../res/ccs-res/cocosui/monster.9.png | Bin 0 -> 1083 bytes
.../res/ccs-res/cocosui/player.9.png | Bin 0 -> 2150 bytes
.../res/ccs-res/cocosui/radio_button_off.png | Bin 0 -> 2062 bytes
.../res/ccs-res/cocosui/radio_button_on.png | Bin 0 -> 2515 bytes
.../res/ccs-res/cocosui/scrollviewbg.png | Bin 0 -> 13454 bytes
.../res/ccs-res/cocosui/slidbar.png | Bin 0 -> 2409 bytes
.../res/ccs-res/cocosui/sliderProgress.png | Bin 0 -> 396 bytes
.../res/ccs-res/cocosui/sliderProgress2.png | Bin 0 -> 3024 bytes
.../res/ccs-res/cocosui/sliderThumb.png | Bin 0 -> 1441 bytes
.../res/ccs-res/cocosui/sliderTrack.png | Bin 0 -> 539 bytes
.../res/ccs-res/cocosui/sliderTrack2.png | Bin 0 -> 3199 bytes
.../cocosui/slider_bar_active_9patch.png | Bin 0 -> 3290 bytes
.../cocosui/slider_bar_active_9patch2.png | Bin 0 -> 1002 bytes
.../res/ccs-res/cocosui/sliderballnormal.png | Bin 0 -> 4138 bytes
.../res/ccs-res/cocosui/sliderballpressed.png | Bin 0 -> 4116 bytes
.../res/ccs-res/cocosui/switch-mask.png | Bin 0 -> 10704 bytes
.../res/configs/config-example.plist | 34 +
.../res/configs/config-test-invalid.plist | 282 +
.../res/configs/config-test-ok.plist | 34 +
test/visual-tests/res/effect1.raw | Bin 0 -> 8000 bytes
test/visual-tests/res/effect1.wav | Bin 0 -> 10026 bytes
test/visual-tests/res/effect2.mp3 | Bin 0 -> 13407 bytes
test/visual-tests/res/effect2.ogg | Bin 0 -> 4278 bytes
.../CCControlColourPickerSpriteSheet.plist | 113 +
.../CCControlColourPickerSpriteSheet.png | Bin 0 -> 38149 bytes
.../res/extensions/background.png | Bin 0 -> 103086 bytes
test/visual-tests/res/extensions/button.png | Bin 0 -> 840 bytes
.../res/extensions/buttonBackground.png | Bin 0 -> 498 bytes
.../res/extensions/buttonHighlighted.png | Bin 0 -> 896 bytes
.../res/extensions/green_edit.png | Bin 0 -> 6749 bytes
.../res/extensions/orange_edit.png | Bin 0 -> 3758 bytes
.../res/extensions/potentiometerButton.png | Bin 0 -> 5504 bytes
.../res/extensions/potentiometerProgress.png | Bin 0 -> 10441 bytes
.../res/extensions/potentiometerTrack.png | Bin 0 -> 4057 bytes
test/visual-tests/res/extensions/ribbon.png | Bin 0 -> 983 bytes
.../res/extensions/sliderProgress.png | Bin 0 -> 396 bytes
.../res/extensions/sliderProgress2.png | Bin 0 -> 3024 bytes
.../res/extensions/sliderThumb.png | Bin 0 -> 1441 bytes
.../res/extensions/sliderTrack.png | Bin 0 -> 539 bytes
.../res/extensions/sliderTrack2.png | Bin 0 -> 3199 bytes
.../res/extensions/stepper-minus.png | Bin 0 -> 545 bytes
.../res/extensions/stepper-plus.png | Bin 0 -> 522 bytes
.../res/extensions/switch-mask.png | Bin 0 -> 2996 bytes
.../res/extensions/switch-off.png | Bin 0 -> 1169 bytes
.../visual-tests/res/extensions/switch-on.png | Bin 0 -> 1080 bytes
.../res/extensions/switch-thumb.png | Bin 0 -> 2292 bytes
.../res/extensions/yellow_edit.png | Bin 0 -> 6394 bytes
test/visual-tests/res/fileLookup.plist | 13 +
test/visual-tests/res/fonts/A Damn Mess.ttf | Bin 0 -> 35428 bytes
test/visual-tests/res/fonts/Abberancy.ttf | Bin 0 -> 29948 bytes
test/visual-tests/res/fonts/Abduction.ttf | Bin 0 -> 50868 bytes
.../res/fonts/American Typewriter.ttf | Bin 0 -> 64088 bytes
test/visual-tests/res/fonts/Courier New.ttf | Bin 0 -> 709600 bytes
test/visual-tests/res/fonts/Fingerpop.ttf | Bin 0 -> 11240 bytes
test/visual-tests/res/fonts/HKYuanMini.ttf | Bin 0 -> 155300 bytes
test/visual-tests/res/fonts/Japanese.ttf | Bin 0 -> 49748 bytes
test/visual-tests/res/fonts/Marker Felt.ttf | Bin 0 -> 25776 bytes
test/visual-tests/res/fonts/Paint Boy.ttf | Bin 0 -> 87396 bytes
test/visual-tests/res/fonts/Roboto.bmf.fnt | Bin 0 -> 2112 bytes
test/visual-tests/res/fonts/Roboto.bmf_0.png | Bin 0 -> 8652 bytes
.../res/fonts/Schwarzwald Regular.ttf | Bin 0 -> 49088 bytes
test/visual-tests/res/fonts/Schwarzwald.ttf | Bin 0 -> 49088 bytes
.../res/fonts/Schwarzwald_Regular.eot | Bin 0 -> 49376 bytes
test/visual-tests/res/fonts/Scissor Cuts.ttf | Bin 0 -> 29328 bytes
test/visual-tests/res/fonts/Thonburi.ttf | Bin 0 -> 223404 bytes
test/visual-tests/res/fonts/ThonburiBold.ttf | Bin 0 -> 255412 bytes
.../visual-tests/res/fonts/arial-26-en-ru.fnt | 638 +
.../res/fonts/arial-26-en-ru_0.png | Bin 0 -> 162616 bytes
.../res/fonts/arial-unicode-26.GlyphProject | Bin 0 -> 3462 bytes
.../res/fonts/arial-unicode-26.fnt | 206 +
.../res/fonts/arial-unicode-26.png | Bin 0 -> 178317 bytes
test/visual-tests/res/fonts/arial.ttf | Bin 0 -> 778552 bytes
test/visual-tests/res/fonts/arial16.fnt | 192 +
test/visual-tests/res/fonts/arial16.png | Bin 0 -> 18410 bytes
.../res/fonts/bitmapFontChinese.fnt | 210 +
.../res/fonts/bitmapFontChinese.png | Bin 0 -> 110840 bytes
.../visual-tests/res/fonts/bitmapFontTest.fnt | 100 +
.../visual-tests/res/fonts/bitmapFontTest.png | Bin 0 -> 143693 bytes
.../res/fonts/bitmapFontTest2.bmp | Bin 0 -> 2097206 bytes
.../res/fonts/bitmapFontTest2.fnt | 188 +
.../res/fonts/bitmapFontTest2.png | Bin 0 -> 126215 bytes
.../res/fonts/bitmapFontTest3.fnt | 102 +
.../res/fonts/bitmapFontTest3.png | Bin 0 -> 40153 bytes
.../res/fonts/bitmapFontTest4.fnt | 99 +
.../res/fonts/bitmapFontTest4.png | Bin 0 -> 28312 bytes
.../res/fonts/bitmapFontTest5.fnt | 99 +
.../res/fonts/bitmapFontTest5.png | Bin 0 -> 46741 bytes
.../visual-tests/res/fonts/boundsTestFont.fnt | 343 +
.../visual-tests/res/fonts/boundsTestFont.png | Bin 0 -> 249811 bytes
test/visual-tests/res/fonts/cyril.ttf | Bin 0 -> 27900 bytes
test/visual-tests/res/fonts/cyrillic.ttf | Bin 0 -> 36452 bytes
.../res/fonts/font-issue1343-hd.fnt | 75 +
.../res/fonts/font-issue1343-hd.png | Bin 0 -> 238653 bytes
.../visual-tests/res/fonts/font-issue1343.fnt | 75 +
.../visual-tests/res/fonts/font-issue1343.png | Bin 0 -> 53555 bytes
test/visual-tests/res/fonts/futura-48.fnt | 182 +
test/visual-tests/res/fonts/futura-48.png | Bin 0 -> 178532 bytes
test/visual-tests/res/fonts/geneva-32.fnt | 99 +
test/visual-tests/res/fonts/helvetica-32.fnt | 99 +
.../res/fonts/helvetica-geneva-32.png | Bin 0 -> 202706 bytes
test/visual-tests/res/fonts/konqa32-hd.fnt | 96 +
test/visual-tests/res/fonts/konqa32-hd.png | Bin 0 -> 39380 bytes
test/visual-tests/res/fonts/konqa32.fnt | 96 +
test/visual-tests/res/fonts/konqa32.png | Bin 0 -> 19460 bytes
test/visual-tests/res/fonts/labelatlas.png | Bin 0 -> 6203 bytes
.../res/fonts/larabie-16-hd.plist | 16 +
test/visual-tests/res/fonts/larabie-16-hd.png | Bin 0 -> 4128 bytes
test/visual-tests/res/fonts/larabie-16.plist | 16 +
test/visual-tests/res/fonts/larabie-16.png | Bin 0 -> 4775 bytes
test/visual-tests/res/fonts/markerFelt-hd.fnt | 3770 ++++++
test/visual-tests/res/fonts/markerFelt-hd.png | Bin 0 -> 106771 bytes
test/visual-tests/res/fonts/markerFelt.fnt | 3769 ++++++
test/visual-tests/res/fonts/markerFelt.png | Bin 0 -> 52520 bytes
test/visual-tests/res/fonts/strings.xml | 14 +
test/visual-tests/res/fonts/tahoma.ttf | Bin 0 -> 700180 bytes
.../fonts/tuffy_bold_italic-charmap-hd.plist | 16 +
.../fonts/tuffy_bold_italic-charmap-hd.png | Bin 0 -> 614681 bytes
.../res/fonts/tuffy_bold_italic-charmap.plist | 16 +
.../res/fonts/tuffy_bold_italic-charmap.png | Bin 0 -> 22986 bytes
.../res/fonts/west_england-64.fnt | 99 +
.../res/fonts/west_england-64.png | Bin 0 -> 35632 bytes
.../res/fonts/xingkai-incomplete.ttf | Bin 0 -> 25856 bytes
test/visual-tests/res/fps_images.png | Bin 0 -> 6953 bytes
test/visual-tests/res/music.mid | Bin 0 -> 46465 bytes
.../res/resjs/Shaders/example_ColorBars.fsh | 43 +
.../res/resjs/Shaders/example_ColorBars.vsh | 16 +
.../res/resjs/Shaders/example_Flower.fsh | 34 +
.../res/resjs/Shaders/example_Flower.vsh | 8 +
.../res/resjs/Shaders/example_Heart.fsh | 33 +
.../res/resjs/Shaders/example_Heart.vsh | 8 +
.../res/resjs/Shaders/example_Julia.fsh | 29 +
.../res/resjs/Shaders/example_Julia.vsh | 8 +
.../res/resjs/Shaders/example_Mandelbrot.fsh | 41 +
.../res/resjs/Shaders/example_Mandelbrot.vsh | 8 +
.../res/resjs/Shaders/example_Monjori.fsh | 35 +
.../res/resjs/Shaders/example_Monjori.vsh | 8 +
.../res/resjs/Shaders/example_Outline.fsh | 27 +
.../res/resjs/Shaders/example_Outline.vsh | 13 +
.../resjs/Shaders/example_Outline_noMVP.vsh | 13 +
.../res/resjs/Shaders/example_Plasma.fsh | 22 +
.../res/resjs/Shaders/example_Plasma.vsh | 8 +
.../res/resjs/Shaders/example_Twist.fsh | 26 +
.../res/resjs/Shaders/example_Twist.vsh | 8 +
test/visual-tests/res/spine/goblins-ffd.atlas | 292 +
test/visual-tests/res/spine/goblins-ffd.json | 1081 ++
test/visual-tests/res/spine/goblins-ffd.png | Bin 0 -> 163618 bytes
test/visual-tests/res/spine/goblins.atlas | 285 +
test/visual-tests/res/spine/goblins.json | 499 +
test/visual-tests/res/spine/goblins.png | Bin 0 -> 147696 bytes
test/visual-tests/res/spine/raptor.atlas | 251 +
test/visual-tests/res/spine/raptor.json | 1333 ++
test/visual-tests/res/spine/raptor.png | Bin 0 -> 563690 bytes
test/visual-tests/res/spine/spineboy.atlas | 194 +
test/visual-tests/res/spine/spineboy.json | 2412 ++++
test/visual-tests/res/spine/spineboy.png | Bin 0 -> 244976 bytes
test/visual-tests/res/spine/sprite.png | Bin 0 -> 3774 bytes
test/visual-tests/run-helper.sh | 3 +
test/visual-tests/run.sh | 6 +
test/visual-tests/server.js | 39 +
.../ActionManagerTest/ActionManagerTest.js | 428 +
.../src/ActionsTest/ActionsTest.js | 2994 +++++
.../src/BakeLayerTest/BakeLayerTest.js | 239 +
.../src/BaseTestLayer/BaseTestLayer.js | 328 +
.../src/ClippingNodeTest/ClippingNodeTest.js | 768 ++
.../CocosDenshionTest/CocosDenshionTest.js | 328 +
.../src/CocosNodeTest/CocosNodeTest.js | 846 ++
.../DrawPrimitivesTest/DrawPrimitivesTest.js | 246 +
.../src/EaseActionsTest/EaseActionsTest.js | 1223 ++
.../AssetsManagerTest/AssetsManagerTest.js | 231 +
.../ExtensionsTest/CCPoolTest/CCPoolTest.js | 190 +
.../src/ExtensionsTest/ExtensionsTest.js | 101 +
.../NetworkTest/SocketIOTest.js | 278 +
.../NetworkTest/WebSocketTest.js | 264 +
.../S9SpriteTest/S9SpriteTest.js | 993 ++
.../TableViewTest/TableViewTestScene.js | 137 +
.../src/GUITest/UIButtonTest/UIButtonTest.js | 581 +
.../GUITest/UICheckBoxTest/UICheckBoxTest.js | 120 +
.../src/GUITest/UIFocusTest/UIFocusTest.js | 550 +
.../UIImageViewTest/UIImageViewTest.js | 171 +
.../UILabelAtlasTest/UILabelAtlasTest.js | 45 +
.../UILabelBMFontTest/UILabelBMFontTest.js | 46 +
.../src/GUITest/UILabelTest/UILabelTest.js | 102 +
.../src/GUITest/UILayoutTest/UILayoutTest.js | 536 +
.../GUITest/UIListViewTest/UIListViewTest.js | 334 +
.../UILoadingBarTest/UILoadingBarTest.js | 170 +
.../UINodeContainerTest.js | 49 +
.../GUITest/UIPageViewTest/UIPageViewTest.js | 570 +
.../GUITest/UIRichTextTest/UIRichTextTest.js | 91 +
.../UIS9NinePatchTest/UIS9NinePatchTest.js | 73 +
test/visual-tests/src/GUITest/UIScene.js | 102 +
.../src/GUITest/UISceneManager.js | 709 +
.../UIScrollViewTest/UIScrollViewTest.js | 598 +
.../src/GUITest/UISliderTest/UISliderTest.js | 175 +
.../UITextFieldTest/UITextFieldTest.js | 339 +
.../src/GUITest/UITextTest/UITextTest.js | 182 +
.../GUITest/UIWebViewTest/UIWebViewTest.js | 107 +
.../src/GUITest/UIWebViewTest/webview.html | 21 +
.../src/GUITest/UIWebViewTest/webview2.html | 21 +
.../src/IntervalTest/IntervalTest.js | 156 +
test/visual-tests/src/LabelTest/LabelTest.js | 2162 +++
test/visual-tests/src/LayerTest/LayerTest.js | 579 +
.../visual-tests/src/LoaderTest/LoaderTest.js | 221 +
.../src/NativeTest/AudioEngineTest.js | 463 +
.../src/NativeTest/FileUtils/FileUtilsTest.js | 398 +
.../src/NativeTest/JSBExtendTest.js | 167 +
.../visual-tests/src/NativeTest/NativeTest.js | 82 +
.../NewEventManagerTest.js | 1294 ++
.../visual-tests/src/OpenGLTest/OpenGLTest.js | 1368 ++
.../src/ParallaxTest/ParallaxTest.js | 265 +
.../src/ParticleTest/ParticleTest.js | 1232 ++
test/visual-tests/src/PathTest/PathTest.js | 132 +
.../ProgressActionsTest.js | 413 +
.../src/ReflectionTest/ReflectionTest.js | 84 +
.../RenderTextureTest/RenderTextureTest.js | 698 +
.../src/SchedulerTest/SchedulerTest.js | 750 ++
test/visual-tests/src/SpineTest/SpineTest.js | 301 +
.../SpritePolygonTest/SpritePolygonTest.js | 497 +
.../visual-tests/src/SpriteTest/SpriteTest.js | 5503 ++++++++
.../src/SysTest/ScriptTestTempFile.js | 38 +
test/visual-tests/src/SysTest/SysTest.js | 370 +
.../src/TextureCacheTest/TextureCacheTest.js | 341 +
.../src/TileMapTest/TileMapTest.js | 1741 +++
test/visual-tests/src/TouchesTest/Ball.js | 98 +
test/visual-tests/src/TouchesTest/Paddle.js | 106 +
.../src/TouchesTest/TouchesTest.js | 123 +
.../src/XHRTest/XHRArrayBufferTest.js | 121 +
test/visual-tests/src/XHRTest/XHRTest.js | 188 +
test/visual-tests/src/tests-main.js | 512 +
test/visual-tests/src/tests_resources.js | 1044 ++
tools/XmlCheck.js | 143 +
tools/compiler/compiler.jar | Bin 0 -> 6243182 bytes
tools/core4cc.js | 245 +
tools/genBuildXml.js | 89 +
tools/publish.js | 72 +
tools/readme for tools.txt | 8 +
1463 files changed, 265287 insertions(+)
create mode 100644 .gitignore
create mode 100644 AUTHORS.txt
create mode 100644 Base64Images.js
create mode 100644 CCBoot.js
create mode 100644 CCDebugger.js
create mode 100644 CHANGELOG.txt
create mode 100644 README.mdown
create mode 100644 bower.json
create mode 100644 cocos2d/ToMerge/qunit/test-event-system.js
create mode 100644 cocos2d/ToMerge/qunit/test-ticker.js
create mode 100644 cocos2d/ToMerge/qunit/test-time.js
create mode 100644 cocos2d/ToMerge/wrappers/bitmap-font.js
create mode 100644 cocos2d/ToMerge/wrappers/draw-node.js
create mode 100644 cocos2d/ToMerge/wrappers/edit-box.js
create mode 100644 cocos2d/ToMerge/wrappers/index.js
create mode 100644 cocos2d/ToMerge/wrappers/label-ttf.js
create mode 100644 cocos2d/ToMerge/wrappers/layer-color.js
create mode 100644 cocos2d/ToMerge/wrappers/layer.js
create mode 100644 cocos2d/ToMerge/wrappers/progress-timer.js
create mode 100644 cocos2d/ToMerge/wrappers/sprite-batch-node.js
create mode 100644 cocos2d/ToMerge/wrappers/tiled-map.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/button.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/check-box.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/layout.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/list-view.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/loading-bar.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/page-view.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/scale9-sprite.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/scale9.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/scroll-view.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/slider.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/text-atlas.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/text-bitmap-font.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/text-field.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/text.js
create mode 100644 cocos2d/ToMerge/wrappers/ui/widget.js
create mode 100644 cocos2d/ToMerge/wrappers/utils.js
create mode 100644 cocos2d/actions/CCAction.js
create mode 100644 cocos2d/actions/CCActionCamera.js
create mode 100644 cocos2d/actions/CCActionCatmullRom.js
create mode 100644 cocos2d/actions/CCActionEase.js
create mode 100644 cocos2d/actions/CCActionInstant.js
create mode 100644 cocos2d/actions/CCActionInterval.js
create mode 100644 cocos2d/actions/CCActionTween.js
create mode 100644 cocos2d/actions3d/CCActionGrid.js
create mode 100644 cocos2d/actions3d/CCActionGrid3D.js
create mode 100644 cocos2d/actions3d/CCActionPageTurn3D.js
create mode 100644 cocos2d/actions3d/CCActionTiledGrid.js
create mode 100644 cocos2d/animation/animation-animator.js
create mode 100644 cocos2d/animation/animation-clip.js
create mode 100644 cocos2d/animation/animation-curves.js
create mode 100644 cocos2d/animation/animation-manager.js
create mode 100644 cocos2d/animation/animation-state.js
create mode 100644 cocos2d/animation/animators.js
create mode 100644 cocos2d/animation/bezier.js
create mode 100644 cocos2d/animation/binary-search.js
create mode 100644 cocos2d/animation/easing.js
create mode 100644 cocos2d/animation/index.js
create mode 100644 cocos2d/animation/motion-path-helper.js
create mode 100644 cocos2d/animation/playable.js
create mode 100644 cocos2d/animation/types.js
create mode 100644 cocos2d/audio/CCAudio.js
create mode 100644 cocos2d/clipping-nodes/CCClippingNode.js
create mode 100644 cocos2d/clipping-nodes/CCClippingNodeCanvasRenderCmd.js
create mode 100644 cocos2d/clipping-nodes/CCClippingNodeWebGLRenderCmd.js
create mode 100644 cocos2d/compression/ZipUtils.js
create mode 100644 cocos2d/compression/base64.js
create mode 100644 cocos2d/compression/gzip.js
create mode 100644 cocos2d/compression/zlib.min.js
create mode 100644 cocos2d/core/CCActionManager.js
create mode 100644 cocos2d/core/CCCamera.js
create mode 100644 cocos2d/core/CCConfiguration.js
create mode 100644 cocos2d/core/CCDirector.js
create mode 100644 cocos2d/core/CCDirectorCanvas.js
create mode 100644 cocos2d/core/CCDirectorWebGL.js
create mode 100644 cocos2d/core/CCDrawingPrimitivesCanvas.js
create mode 100644 cocos2d/core/CCDrawingPrimitivesWebGL.js
create mode 100644 cocos2d/core/CCGame.js
create mode 100644 cocos2d/core/CCNode.js
create mode 100644 cocos2d/core/CCScene.js
create mode 100644 cocos2d/core/CCScheduler.js
create mode 100644 cocos2d/core/assets/CCAsset.js
create mode 100644 cocos2d/core/assets/CCAudioClip.js
create mode 100644 cocos2d/core/assets/CCBitmapFont.js
create mode 100644 cocos2d/core/assets/CCPrefab.js
create mode 100644 cocos2d/core/assets/CCRawAsset.js
create mode 100644 cocos2d/core/assets/CCSceneAsset.js
create mode 100644 cocos2d/core/assets/CCScripts.js
create mode 100644 cocos2d/core/assets/CCSpriteAnimation.js
create mode 100644 cocos2d/core/assets/CCSpriteAtlas.js
create mode 100644 cocos2d/core/assets/CCTTFFont.js
create mode 100644 cocos2d/core/assets/CCTiledMapAsset.js
create mode 100644 cocos2d/core/assets/index.js
create mode 100644 cocos2d/core/base-nodes/BaseNodesPropertyDefine.js
create mode 100644 cocos2d/core/base-nodes/CCAtlasNode.js
create mode 100644 cocos2d/core/base-nodes/CCAtlasNodeCanvasRenderCmd.js
create mode 100644 cocos2d/core/base-nodes/CCAtlasNodeWebGLRenderCmd.js
create mode 100644 cocos2d/core/base-nodes/CCNode.js
create mode 100644 cocos2d/core/base-nodes/CCNodeCanvasRenderCmd.js
create mode 100644 cocos2d/core/base-nodes/CCNodeWebGLRenderCmd.js
create mode 100644 cocos2d/core/base-ui/CCWidgetManager.js
create mode 100644 cocos2d/core/cocos2d_externs.js
create mode 100644 cocos2d/core/components/CCAnimation.js
create mode 100644 cocos2d/core/components/CCAudioSource.js
create mode 100644 cocos2d/core/components/CCButton.js
create mode 100644 cocos2d/core/components/CCCanvas.js
create mode 100644 cocos2d/core/components/CCComponent.js
create mode 100644 cocos2d/core/components/CCComponentInSG.js
create mode 100644 cocos2d/core/components/CCELabel.js
create mode 100644 cocos2d/core/components/CCSpriteRenderer.js
create mode 100644 cocos2d/core/components/CCWidget.js
create mode 100644 cocos2d/core/components/index.js
create mode 100644 cocos2d/core/event-manager/CCEventListener.js
create mode 100644 cocos2d/core/event-manager/CCEventManager.js
create mode 100644 cocos2d/core/event-manager/CCSystemEvent.js
create mode 100644 cocos2d/core/event-manager/CCTouch.js
create mode 100644 cocos2d/core/event/event-listeners.js
create mode 100644 cocos2d/core/event/event-target.js
create mode 100644 cocos2d/core/event/event.js
create mode 100644 cocos2d/core/event/index.js
create mode 100644 cocos2d/core/index.js
create mode 100644 cocos2d/core/labelttf/CCLabelTTF.js
create mode 100644 cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js
create mode 100644 cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js
create mode 100644 cocos2d/core/labelttf/LabelTTFPropertyDefine.js
create mode 100644 cocos2d/core/layers/CCLayer.js
create mode 100644 cocos2d/core/layers/CCLayerCanvasRenderCmd.js
create mode 100644 cocos2d/core/layers/CCLayerWebGLRenderCmd.js
create mode 100644 cocos2d/core/platform/CCAssetLibrary.js
create mode 100644 cocos2d/core/platform/CCClass.js
create mode 100644 cocos2d/core/platform/CCCommon.js
create mode 100644 cocos2d/core/platform/CCConfig.js
create mode 100644 cocos2d/core/platform/CCEGLView.js
create mode 100644 cocos2d/core/platform/CCInputExtension.js
create mode 100644 cocos2d/core/platform/CCInputManager.js
create mode 100644 cocos2d/core/platform/CCLoader.js
create mode 100644 cocos2d/core/platform/CCLoaders.js
create mode 100644 cocos2d/core/platform/CCMacro.js
create mode 100644 cocos2d/core/platform/CCObject.js
create mode 100644 cocos2d/core/platform/CCSAXParser.js
create mode 100644 cocos2d/core/platform/CCScreen.js
create mode 100644 cocos2d/core/platform/CCSys.js
create mode 100644 cocos2d/core/platform/CCVisibleRect.js
create mode 100644 cocos2d/core/platform/_CCClass.js
create mode 100644 cocos2d/core/platform/attribute.js
create mode 100644 cocos2d/core/platform/callbacks-invoker.js
create mode 100644 cocos2d/core/platform/deserialize.js
create mode 100644 cocos2d/core/platform/index.js
create mode 100644 cocos2d/core/platform/instantiate.js
create mode 100644 cocos2d/core/platform/js.js
create mode 100644 cocos2d/core/platform/load-manager.js
create mode 100644 cocos2d/core/platform/miniFramework.js
create mode 100644 cocos2d/core/platform/prefab-info.js
create mode 100644 cocos2d/core/platform/preprocess-attrs.js
create mode 100644 cocos2d/core/platform/requiring-frame.js
create mode 100644 cocos2d/core/platform/url.js
create mode 100644 cocos2d/core/platform/utils.js
create mode 100644 cocos2d/core/renderer/RendererCanvas.js
create mode 100644 cocos2d/core/renderer/RendererWebGL.js
create mode 100644 cocos2d/core/scenes/CCLoaderScene.js
create mode 100644 cocos2d/core/scenes/CCScene.js
create mode 100644 cocos2d/core/sprites/CCAnimation.js
create mode 100644 cocos2d/core/sprites/CCAnimationCache.js
create mode 100644 cocos2d/core/sprites/CCBakeSprite.js
create mode 100644 cocos2d/core/sprites/CCSprite.js
create mode 100644 cocos2d/core/sprites/CCSpriteBatchNode.js
create mode 100644 cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js
create mode 100644 cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js
create mode 100644 cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js
create mode 100644 cocos2d/core/sprites/CCSpriteFrame.js
create mode 100644 cocos2d/core/sprites/CCSpriteFrameCache.js
create mode 100644 cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js
create mode 100644 cocos2d/core/sprites/SpritesPropertyDefine.js
create mode 100644 cocos2d/core/support/CCPointExtension.js
create mode 100644 cocos2d/core/support/CCVertex.js
create mode 100644 cocos2d/core/support/TransformUtils.js
create mode 100644 cocos2d/core/textures/CCTexture2D.js
create mode 100644 cocos2d/core/textures/CCTextureAtlas.js
create mode 100644 cocos2d/core/textures/CCTextureCache.js
create mode 100644 cocos2d/core/textures/index.js
create mode 100644 cocos2d/core/utils/Async.js
create mode 100644 cocos2d/core/utils/BinaryLoader.js
create mode 100644 cocos2d/core/utils/CCPath.js
create mode 100644 cocos2d/core/utils/CCProfiler.js
create mode 100644 cocos2d/core/utils/base-node.js
create mode 100644 cocos2d/core/utils/find.js
create mode 100644 cocos2d/core/utils/index.js
create mode 100644 cocos2d/core/utils/misc.js
create mode 100644 cocos2d/core/utils/scene-graph-helper.js
create mode 100644 cocos2d/core/value-types/CCAffineTransform.js
create mode 100644 cocos2d/core/value-types/CCColor.js
create mode 100644 cocos2d/core/value-types/CCEnum.js
create mode 100644 cocos2d/core/value-types/CCRect.js
create mode 100644 cocos2d/core/value-types/CCSize.js
create mode 100644 cocos2d/core/value-types/CCTypes.js
create mode 100644 cocos2d/core/value-types/CCTypesWebGL.js
create mode 100644 cocos2d/core/value-types/CCValueType.js
create mode 100644 cocos2d/core/value-types/CCVec2.js
create mode 100644 cocos2d/core/value-types/index.js
create mode 100644 cocos2d/deprecated.js
create mode 100644 cocos2d/effects/CCGrabber.js
create mode 100644 cocos2d/effects/CCGrid.js
create mode 100644 cocos2d/kazmath/SIMDPolyfill.js
create mode 100644 cocos2d/kazmath/aabb.js
create mode 100644 cocos2d/kazmath/gl/mat4stack.js
create mode 100644 cocos2d/kazmath/gl/matrix.js
create mode 100644 cocos2d/kazmath/mat3.js
create mode 100644 cocos2d/kazmath/mat4.js
create mode 100644 cocos2d/kazmath/mat4SIMD.js
create mode 100644 cocos2d/kazmath/plane.js
create mode 100644 cocos2d/kazmath/quaternion.js
create mode 100644 cocos2d/kazmath/ray2.js
create mode 100644 cocos2d/kazmath/simd_benchmark/base.js
create mode 100644 cocos2d/kazmath/simd_benchmark/index.html
create mode 100644 cocos2d/kazmath/simd_benchmark/kernel-template.js
create mode 100644 cocos2d/kazmath/simd_benchmark/kmMat4AreEqual.js
create mode 100644 cocos2d/kazmath/simd_benchmark/kmMat4Assign.js
create mode 100644 cocos2d/kazmath/simd_benchmark/kmMat4Inverse.js
create mode 100644 cocos2d/kazmath/simd_benchmark/kmMat4IsIdentity.js
create mode 100644 cocos2d/kazmath/simd_benchmark/kmMat4LookAt.js
create mode 100644 cocos2d/kazmath/simd_benchmark/kmMat4Multiply.js
create mode 100644 cocos2d/kazmath/simd_benchmark/kmMat4Transpose.js
create mode 100644 cocos2d/kazmath/simd_benchmark/kmVec3TransformCoord.js
create mode 100644 cocos2d/kazmath/simd_benchmark/run.js
create mode 100644 cocos2d/kazmath/simd_benchmark/run_browser.js
create mode 100644 cocos2d/kazmath/utility.js
create mode 100644 cocos2d/kazmath/vec2.js
create mode 100644 cocos2d/kazmath/vec3.js
create mode 100644 cocos2d/kazmath/vec3SIMD.js
create mode 100644 cocos2d/kazmath/vec4.js
create mode 100644 cocos2d/labels/CCLabel.js
create mode 100644 cocos2d/labels/CCLabelAtlas.js
create mode 100644 cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js
create mode 100644 cocos2d/labels/CCLabelAtlasWebGLRenderCmd.js
create mode 100644 cocos2d/labels/CCLabelBMFont.js
create mode 100644 cocos2d/labels/CCLabelBMFontCanvasRenderCmd.js
create mode 100644 cocos2d/labels/CCLabelBMFontWebGLRenderCmd.js
create mode 100644 cocos2d/labels/CCLabelCanvasRenderCmd.js
create mode 100644 cocos2d/labels/CCLabelWebGLRenderCmd.js
create mode 100644 cocos2d/menus/CCMenu.js
create mode 100644 cocos2d/menus/CCMenuItem.js
create mode 100644 cocos2d/motion-streak/CCMotionStreak.js
create mode 100644 cocos2d/motion-streak/CCMotionStreakWebGLRenderCmd.js
create mode 100644 cocos2d/node-grid/CCNodeGrid.js
create mode 100644 cocos2d/node-grid/CCNodeGridWebGLRenderCmd.js
create mode 100644 cocos2d/parallax/CCParallaxNode.js
create mode 100644 cocos2d/parallax/CCParallaxNodeRenderCmd.js
create mode 100644 cocos2d/particle/CCEParticleSystem.js
create mode 100644 cocos2d/particle/CCPNGReader.js
create mode 100644 cocos2d/particle/CCParticleAsset.js
create mode 100644 cocos2d/particle/CCParticleBatchNode.js
create mode 100644 cocos2d/particle/CCParticleBatchNodeCanvasRenderCmd.js
create mode 100644 cocos2d/particle/CCParticleBatchNodeWebGLRenderCmd.js
create mode 100644 cocos2d/particle/CCParticleExamples.js
create mode 100644 cocos2d/particle/CCParticleSystem.js
create mode 100644 cocos2d/particle/CCParticleSystemCanvasRenderCmd.js
create mode 100644 cocos2d/particle/CCParticleSystemWebGLRenderCmd.js
create mode 100644 cocos2d/particle/CCTIFFReader.js
create mode 100644 cocos2d/physics/CCPhysicsDebugNode.js
create mode 100644 cocos2d/physics/CCPhysicsDebugNodeCanvasRenderCmd.js
create mode 100644 cocos2d/physics/CCPhysicsDebugNodeWebGLRenderCmd.js
create mode 100644 cocos2d/physics/CCPhysicsSprite.js
create mode 100644 cocos2d/physics/CCPhysicsSpriteCanvasRenderCmd.js
create mode 100644 cocos2d/physics/CCPhysicsSpriteWebGLRenderCmd.js
create mode 100644 cocos2d/progress-timer/CCActionProgressTimer.js
create mode 100644 cocos2d/progress-timer/CCProgressTimer.js
create mode 100644 cocos2d/progress-timer/CCProgressTimerCanvasRenderCmd.js
create mode 100644 cocos2d/progress-timer/CCProgressTimerWebGLRenderCmd.js
create mode 100644 cocos2d/render-texture/CCRenderTexture.js
create mode 100644 cocos2d/render-texture/CCRenderTextureCanvasRenderCmd.js
create mode 100644 cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js
create mode 100644 cocos2d/shaders/CCGLProgram.js
create mode 100644 cocos2d/shaders/CCGLStateCache.js
create mode 100644 cocos2d/shaders/CCShaderCache.js
create mode 100644 cocos2d/shaders/CCShaders.js
create mode 100644 cocos2d/shape-nodes/CCDrawNode.js
create mode 100644 cocos2d/shape-nodes/CCDrawNodeCanvasRenderCmd.js
create mode 100644 cocos2d/shape-nodes/CCDrawNodeWebGLRenderCmd.js
create mode 100644 cocos2d/text-input/CCIMEDispatcher.js
create mode 100644 cocos2d/text-input/CCTextFieldTTF.js
create mode 100644 cocos2d/tilemap/CCTGAlib.js
create mode 100644 cocos2d/tilemap/CCTMXLayer.js
create mode 100644 cocos2d/tilemap/CCTMXLayerCanvasRenderCmd.js
create mode 100644 cocos2d/tilemap/CCTMXLayerWebGLRenderCmd.js
create mode 100644 cocos2d/tilemap/CCTMXObjectGroup.js
create mode 100644 cocos2d/tilemap/CCTMXTiledMap.js
create mode 100644 cocos2d/tilemap/CCTMXXMLParser.js
create mode 100644 cocos2d/transitions/CCTransition.js
create mode 100644 cocos2d/transitions/CCTransitionPageTurn.js
create mode 100644 cocos2d/transitions/CCTransitionProgress.js
create mode 100644 docs/cocos2d/core/CCActionManager/ActionManager.js
create mode 100644 docs/cocos2d/core/CCScheduler/schedule.js
create mode 100644 docs/cocos2d/core/CCScheduler/scheduleCallbackForTarget.js
create mode 100644 docs/cocos2d/core/CCScheduler/scheduleUpdateForTarget.js
create mode 100644 docs/cocos2d/core/CCScheduler/unscheduleCallbackForTarget.js
create mode 100644 docs/cocos2d/core/CCScheduler/unscheduleUpdateForTarget.js
create mode 100644 docs/cocos2d/core/components/CCSpriteRenerer/initWithSpriteFrameName.js
create mode 100644 docs/cocos2d/core/event-manager/CCEventListener/create.js
create mode 100644 docs/cocos2d/core/event/_getCapturingTargets.js
create mode 100644 docs/cocos2d/core/platform/CCCommon/KEY.js
create mode 100644 docs/cocos2d/core/platform/CCMacro/lerp.js
create mode 100644 docs/cocos2d/core/platform/attribute/attr.js
create mode 100644 docs/cocos2d/core/platform/url/raw.js
create mode 100644 docs/cocos2d/core/sprites/SpriteFrame.js
create mode 100644 docs/cocos2d/core/sprites/addSpriteFrames.js
create mode 100644 docs/cocos2d/core/sprites/getSpriteFrame.js
create mode 100644 docs/cocos2d/core/support/pAdd.js
create mode 100644 docs/cocos2d/core/support/pCompOp.js
create mode 100644 docs/cocos2d/core/textures/TextureAtlas.js
create mode 100644 docs/cocos2d/core/textures/addImage.js
create mode 100644 docs/cocos2d/core/textures/getKeyByTexture.js
create mode 100644 docs/cocos2d/core/textures/getTextureColors.js
create mode 100644 docs/cocos2d/core/textures/getTextureForKey.js
create mode 100644 docs/cocos2d/core/textures/initWithFile.js
create mode 100644 docs/cocos2d/core/textures/initWithTexture.js
create mode 100644 docs/cocos2d/core/textures/removeAllTextures.js
create mode 100644 docs/cocos2d/core/textures/removeTexture.js
create mode 100644 docs/cocos2d/core/textures/removeTextureForKey.js
create mode 100644 docs/cocos2d/core/textures/textureForKey.js
create mode 100644 docs/cocos2d/core/utils/CCPath/basename.js
create mode 100644 docs/cocos2d/core/utils/CCPath/changeBasename.js
create mode 100644 docs/cocos2d/core/utils/CCPath/changeExtname.js
create mode 100644 docs/cocos2d/core/utils/CCPath/dirname.js
create mode 100644 docs/cocos2d/core/utils/CCPath/extname.js
create mode 100644 docs/cocos2d/core/utils/CCPath/join.js
create mode 100644 docs/cocos2d/core/utils/node-wrapper/setPosition.js
create mode 100644 docs/cocos2d/core/value-types/CCColor/color.js
create mode 100644 docs/cocos2d/core/value-types/CCSize/size.js
create mode 100644 docs/extensions/ccpool/putInPool.js
create mode 100644 editor/dashboard/banner.jpg
create mode 100644 editor/dashboard/banner.png
create mode 100644 editor/dashboard/logo.png
create mode 100644 editor/template/new-scene.fire
create mode 100644 editor/template/new-script.coffee
create mode 100644 editor/template/new-script.js
create mode 100644 extends.js
create mode 100644 extensions/ccb-reader/CCBAnimationManager.js
create mode 100644 extensions/ccb-reader/CCBKeyframe.js
create mode 100644 extensions/ccb-reader/CCBReader.js
create mode 100644 extensions/ccb-reader/CCBReaderUtil.js
create mode 100644 extensions/ccb-reader/CCBRelativePositioning.js
create mode 100644 extensions/ccb-reader/CCBSequence.js
create mode 100644 extensions/ccb-reader/CCBValue.js
create mode 100644 extensions/ccb-reader/CCControlLoader.js
create mode 100644 extensions/ccb-reader/CCNodeLoader.js
create mode 100644 extensions/ccb-reader/CCNodeLoaderLibrary.js
create mode 100644 extensions/ccb-reader/CCSpriteLoader.js
create mode 100644 extensions/ccpool/CCPool.js
create mode 100644 extensions/ccui/base-classes/CCProtectedNode.js
create mode 100644 extensions/ccui/base-classes/CCProtectedNodeCanvasRenderCmd.js
create mode 100644 extensions/ccui/base-classes/CCProtectedNodeWebGLRenderCmd.js
create mode 100644 extensions/ccui/base-classes/UIScale9Sprite.js
create mode 100644 extensions/ccui/base-classes/UIScale9SpriteCanvasRenderCmd.js
create mode 100644 extensions/ccui/base-classes/UIScale9SpriteWebGLRenderCmd.js
create mode 100644 extensions/ccui/base-classes/UIWidget.js
create mode 100644 extensions/ccui/base-classes/UIWidgetRenderCmd.js
create mode 100644 extensions/ccui/layouts/UIHBox.js
create mode 100644 extensions/ccui/layouts/UILayout.js
create mode 100644 extensions/ccui/layouts/UILayoutCanvasRenderCmd.js
create mode 100644 extensions/ccui/layouts/UILayoutComponent.js
create mode 100644 extensions/ccui/layouts/UILayoutManager.js
create mode 100644 extensions/ccui/layouts/UILayoutParameter.js
create mode 100644 extensions/ccui/layouts/UILayoutWebGLRenderCmd.js
create mode 100644 extensions/ccui/layouts/UIRelativeBox.js
create mode 100644 extensions/ccui/layouts/UIVBox.js
create mode 100644 extensions/ccui/system/CocosGUI.js
create mode 100644 extensions/ccui/system/UIHelper.js
create mode 100644 extensions/ccui/uiwidgets/UIButton.js
create mode 100644 extensions/ccui/uiwidgets/UICheckBox.js
create mode 100644 extensions/ccui/uiwidgets/UIImageView.js
create mode 100644 extensions/ccui/uiwidgets/UILoadingBar.js
create mode 100644 extensions/ccui/uiwidgets/UIRichText.js
create mode 100644 extensions/ccui/uiwidgets/UISlider.js
create mode 100644 extensions/ccui/uiwidgets/UIText.js
create mode 100644 extensions/ccui/uiwidgets/UITextAtlas.js
create mode 100644 extensions/ccui/uiwidgets/UITextBMFont.js
create mode 100644 extensions/ccui/uiwidgets/UITextField.js
create mode 100644 extensions/ccui/uiwidgets/UIVideoPlayer.js
create mode 100644 extensions/ccui/uiwidgets/UIWebView.js
create mode 100644 extensions/ccui/uiwidgets/scroll-widget/UIListView.js
create mode 100644 extensions/ccui/uiwidgets/scroll-widget/UIPageView.js
create mode 100644 extensions/ccui/uiwidgets/scroll-widget/UIScrollView.js
create mode 100644 extensions/ccui/uiwidgets/scroll-widget/UIScrollViewCanvasRenderCmd.js
create mode 100644 extensions/ccui/uiwidgets/scroll-widget/UIScrollViewWebGLRenderCmd.js
create mode 100644 extensions/cocostudio/CocoStudio.js
create mode 100644 extensions/cocostudio/action/CCActionFrame.js
create mode 100644 extensions/cocostudio/action/CCActionManager.js
create mode 100644 extensions/cocostudio/action/CCActionNode.js
create mode 100644 extensions/cocostudio/action/CCActionObject.js
create mode 100644 extensions/cocostudio/armature/CCArmature.js
create mode 100644 extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js
create mode 100644 extensions/cocostudio/armature/CCArmatureWebGLRenderCmd.js
create mode 100644 extensions/cocostudio/armature/CCBone.js
create mode 100644 extensions/cocostudio/armature/animation/CCArmatureAnimation.js
create mode 100644 extensions/cocostudio/armature/animation/CCProcessBase.js
create mode 100644 extensions/cocostudio/armature/animation/CCTween.js
create mode 100644 extensions/cocostudio/armature/datas/CCDatas.js
create mode 100644 extensions/cocostudio/armature/display/CCBatchNode.js
create mode 100644 extensions/cocostudio/armature/display/CCDecorativeDisplay.js
create mode 100644 extensions/cocostudio/armature/display/CCDisplayFactory.js
create mode 100644 extensions/cocostudio/armature/display/CCDisplayManager.js
create mode 100644 extensions/cocostudio/armature/display/CCSkin.js
create mode 100644 extensions/cocostudio/armature/display/CCSkinCanvasRenderCmd.js
create mode 100644 extensions/cocostudio/armature/display/CCSkinWebGLRenderCmd.js
create mode 100644 extensions/cocostudio/armature/physics/CCColliderDetector.js
create mode 100644 extensions/cocostudio/armature/utils/CCArmatureDataManager.js
create mode 100644 extensions/cocostudio/armature/utils/CCArmatureDefine.js
create mode 100644 extensions/cocostudio/armature/utils/CCDataReaderHelper.js
create mode 100644 extensions/cocostudio/armature/utils/CCSpriteFrameCacheHelper.js
create mode 100644 extensions/cocostudio/armature/utils/CCTransformHelp.js
create mode 100644 extensions/cocostudio/armature/utils/CCTweenFunction.js
create mode 100644 extensions/cocostudio/armature/utils/CCUtilMath.js
create mode 100644 extensions/cocostudio/components/CCComAttribute.js
create mode 100644 extensions/cocostudio/components/CCComAudio.js
create mode 100644 extensions/cocostudio/components/CCComController.js
create mode 100644 extensions/cocostudio/components/CCComRender.js
create mode 100644 extensions/cocostudio/components/CCComponent.js
create mode 100644 extensions/cocostudio/components/CCComponentContainer.js
create mode 100644 extensions/cocostudio/loader/load.js
create mode 100644 extensions/cocostudio/loader/parsers/action-1.x.js
create mode 100644 extensions/cocostudio/loader/parsers/action-2.x.js
create mode 100644 extensions/cocostudio/loader/parsers/compatible.js
create mode 100644 extensions/cocostudio/loader/parsers/scene-1.x.js
create mode 100644 extensions/cocostudio/loader/parsers/timelineParser-1.x.js
create mode 100644 extensions/cocostudio/loader/parsers/timelineParser-2.x.js
create mode 100644 extensions/cocostudio/loader/parsers/uiParser-1.x.js
create mode 100644 extensions/cocostudio/timeline/ActionTimeline.js
create mode 100644 extensions/cocostudio/timeline/CCBoneNode.js
create mode 100644 extensions/cocostudio/timeline/CCSkeletonNode.js
create mode 100644 extensions/cocostudio/timeline/CCSkinNode.js
create mode 100644 extensions/cocostudio/timeline/Frame.js
create mode 100644 extensions/cocostudio/timeline/Timeline.js
create mode 100644 extensions/cocostudio/trigger/ObjectFactory.js
create mode 100644 extensions/cocostudio/trigger/TriggerBase.js
create mode 100644 extensions/cocostudio/trigger/TriggerMng.js
create mode 100644 extensions/cocostudio/trigger/TriggerObj.js
create mode 100644 extensions/editbox/CCEditBox.js
create mode 100644 extensions/editbox/CCdomNode.js
create mode 100644 extensions/gui/control-extension/CCControl.js
create mode 100644 extensions/gui/control-extension/CCControlButton.js
create mode 100644 extensions/gui/control-extension/CCControlColourPicker.js
create mode 100644 extensions/gui/control-extension/CCControlHuePicker.js
create mode 100644 extensions/gui/control-extension/CCControlPotentiometer.js
create mode 100644 extensions/gui/control-extension/CCControlSaturationBrightnessPicker.js
create mode 100644 extensions/gui/control-extension/CCControlSlider.js
create mode 100644 extensions/gui/control-extension/CCControlStepper.js
create mode 100644 extensions/gui/control-extension/CCControlSwitch.js
create mode 100644 extensions/gui/control-extension/CCControlUtils.js
create mode 100644 extensions/gui/control-extension/CCInvocation.js
create mode 100644 extensions/gui/control-extension/CCMenuPassive.js
create mode 100644 extensions/gui/scrollview/CCScrollView.js
create mode 100644 extensions/gui/scrollview/CCScrollViewCanvasRenderCmd.js
create mode 100644 extensions/gui/scrollview/CCScrollViewWebGLRenderCmd.js
create mode 100644 extensions/gui/scrollview/CCSorting.js
create mode 100644 extensions/gui/scrollview/CCTableView.js
create mode 100644 extensions/runtime/CCLoaderLayer.js
create mode 100644 extensions/spine/CCSkeleton.js
create mode 100644 extensions/spine/CCSkeletonAnimation.js
create mode 100644 extensions/spine/CCSkeletonCanvasRenderCmd.js
create mode 100644 extensions/spine/CCSkeletonWebGLRenderCmd.js
create mode 100644 extensions/spine/Spine.js
create mode 100644 external/box2d/box2d.js
create mode 100644 external/chipmunk/chipmunk.js
create mode 100644 external/gaf/GAFBoot.js
create mode 100644 external/gaf/GAFMacros.js
create mode 100644 external/gaf/Library/GAFAsset.js
create mode 100644 external/gaf/Library/GAFAssetPreload.js
create mode 100644 external/gaf/Library/GAFAtlasLoader.js
create mode 100644 external/gaf/Library/GAFDataReader.js
create mode 100644 external/gaf/Library/GAFLoader.js
create mode 100644 external/gaf/Library/GAFMask.js
create mode 100644 external/gaf/Library/GAFMaskProto.js
create mode 100644 external/gaf/Library/GAFObject.js
create mode 100644 external/gaf/Library/GAFShaderManager.js
create mode 100644 external/gaf/Library/GAFShaders.js
create mode 100644 external/gaf/Library/GAFSprite.js
create mode 100644 external/gaf/Library/GAFSpriteCanvasRenderCmd.js
create mode 100644 external/gaf/Library/GAFSpriteProto.js
create mode 100644 external/gaf/Library/GAFSpriteWebGLRenderCmd.js
create mode 100644 external/gaf/Library/GAFTags.js
create mode 100644 external/gaf/Library/GAFTextField.js
create mode 100644 external/gaf/Library/GAFTimeLine.js
create mode 100644 external/gaf/Library/GAFTimeLineProto.js
create mode 100644 external/gaf/gaf_viewer.css
create mode 100644 external/gaf/gaf_viewer.html
create mode 100644 external/gaf/gaf_viewer.js
create mode 100644 external/pluginx/Plugin.js
create mode 100644 external/pluginx/platform/facebook.js
create mode 100644 external/pluginx/platform/facebook_sdk.js
create mode 100644 external/socketio/socket.io.js
create mode 100644 external/socketio/socket.io.min.js
create mode 100644 gulp/tasks/build-cocos2d.js
create mode 100644 gulp/tasks/build.js
create mode 100644 gulp/tasks/clean.js
create mode 100644 gulp/tasks/test.js
create mode 100644 gulp/util/handleErrors.js
create mode 100644 gulpfile.js
create mode 100644 index.js
create mode 100644 jsb_apis.js
create mode 100644 jsb_predefine.js
create mode 100644 licenses/LICENSE_cocos2d-html5.txt
create mode 100644 licenses/LICENSE_cocos2d-x.txt
create mode 100644 licenses/LICENSE_zlib.js.txt
create mode 100644 moduleConfig.json
create mode 100644 package.json
create mode 100644 polyfill/bind.js
create mode 100644 polyfill/index.js
create mode 100644 polyfill/string.js
create mode 100644 predefine.js
create mode 100644 test/core.js
create mode 100644 test/fixtures/assets/atlas.plist
create mode 100644 test/fixtures/assets/atlas.png
create mode 100644 test/fixtures/assets/bitmap-font.fnt
create mode 100644 test/fixtures/assets/bitmap-font.png
create mode 100644 test/fixtures/assets/button.png
create mode 100644 test/fixtures/assets/particle.plist
create mode 100644 test/fixtures/assets/sprite.jpg
create mode 100644 test/fixtures/library/22/223456/1.ttf
create mode 100644 test/fixtures/library/22/223459.json
create mode 100644 test/index.js
create mode 100644 test/lib/init.js
create mode 100644 test/lib/runner.html
create mode 100644 test/lib/spawn-runner.js
create mode 100644 test/page.html
create mode 100644 test/page.js
create mode 100644 test/page/asset.js
create mode 100644 test/page/bitmap-font.js
create mode 100644 test/page/button.js
create mode 100644 test/page/engine.js
create mode 100644 test/page/index.js
create mode 100644 test/page/label-ttf.js
create mode 100644 test/page/node.js
create mode 100644 test/page/particle.js
create mode 100644 test/page/scale9-sprite.js
create mode 100644 test/page/scene.js
create mode 100644 test/page/sprite.js
create mode 100644 test/qunit/assets/background.mp3
create mode 100644 test/qunit/assets/button.png
create mode 100644 test/qunit/assets/library/12/123200.json
create mode 100644 test/qunit/assets/library/12/1232218.json
create mode 100644 test/qunit/assets/library/19/19851210.json
create mode 100644 test/qunit/assets/library/65/65341123490
create mode 100644 test/qunit/assets/library/65/6545543
create mode 100644 test/qunit/assets/library/65/6545543.png
create mode 100644 test/qunit/assets/library/74/748321.json
create mode 100644 test/qunit/assets/library/74/748321.json.host
create mode 100644 test/qunit/assets/library/deferred-loading/12/1232218.json
create mode 100644 test/qunit/assets/library/deferred-loading/74/748321.json
create mode 100644 test/qunit/lib/assert-deep-close.js
create mode 100644 test/qunit/lib/qunit-assert-callback.js
create mode 100644 test/qunit/lib/qunit-assert-close.js
create mode 100644 test/qunit/lib/qunit-large-module.js
create mode 100644 test/qunit/lib/qunit-runner.html
create mode 100644 test/qunit/lib/qunit.css
create mode 100644 test/qunit/lib/qunit.js
create mode 100644 test/qunit/run-helper.sh
create mode 100644 test/qunit/run.sh
create mode 100644 test/qunit/server.js
create mode 100644 test/qunit/unit/_callback-tester.js
create mode 100644 test/qunit/unit/_init.js
create mode 100644 test/qunit/unit/_polyfill-for-phantom.js
create mode 100644 test/qunit/unit/test-animation.js
create mode 100644 test/qunit/unit/test-asset-library.js
create mode 100644 test/qunit/unit/test-attribute.js
create mode 100644 test/qunit/unit/test-audioSource.js
create mode 100644 test/qunit/unit/test-callbacks-invoker.js
create mode 100644 test/qunit/unit/test-class.js
create mode 100644 test/qunit/unit/test-color.js
create mode 100644 test/qunit/unit/test-component.js
create mode 100644 test/qunit/unit/test-deserialize.js
create mode 100644 test/qunit/unit/test-instantiate.js
create mode 100644 test/qunit/unit/test-js.js
create mode 100644 test/qunit/unit/test-load-manager.js
create mode 100644 test/qunit/unit/test-load-scene.js
create mode 100644 test/qunit/unit/test-node-serialization.js
create mode 100644 test/qunit/unit/test-node.js
create mode 100644 test/qunit/unit/test-object.js
create mode 100644 test/qunit/unit/test-prefab.js
create mode 100644 test/qunit/unit/test-record-object.js
create mode 100644 test/qunit/unit/test-serialize-missing-script.js
create mode 100644 test/qunit/unit/test-serialize.js
create mode 100644 test/qunit/unit/test-spriteRenderer.js
create mode 100644 test/qunit/unit/test-utils.js
create mode 100644 test/qunit/unit/test-vec2.js
create mode 100644 test/test-env-page.js
create mode 100644 test/test-env.js
create mode 100644 test/visual-tests/.cocos-project.json
create mode 100644 test/visual-tests/index.html
create mode 100644 test/visual-tests/main.js
create mode 100755 test/visual-tests/res/.gitignore
create mode 100755 test/visual-tests/res/Hello.png
create mode 100644 test/visual-tests/res/Images/BoilingFoam.plist
create mode 100755 test/visual-tests/res/Images/Comet.png
create mode 100755 test/visual-tests/res/Images/CyanSquare.png
create mode 100755 test/visual-tests/res/Images/CyanTriangle.png
create mode 100755 test/visual-tests/res/Images/ETC1.pkm
create mode 100755 test/visual-tests/res/Images/Fog.png
create mode 100755 test/visual-tests/res/Images/HelloWorld.png
create mode 100755 test/visual-tests/res/Images/Icon.png
create mode 100755 test/visual-tests/res/Images/MagentaSquare.png
create mode 100755 test/visual-tests/res/Images/Pea.png
create mode 100755 test/visual-tests/res/Images/SendScoreButton.png
create mode 100755 test/visual-tests/res/Images/SendScoreButtonPressed.png
create mode 100755 test/visual-tests/res/Images/SpinningPeas.png
create mode 100755 test/visual-tests/res/Images/SpookyPeas.png
create mode 100755 test/visual-tests/res/Images/YellowSquare.png
create mode 100755 test/visual-tests/res/Images/YellowTriangle.png
create mode 100644 test/visual-tests/res/Images/arrows-hd.png
create mode 100755 test/visual-tests/res/Images/arrows.png
create mode 100644 test/visual-tests/res/Images/arrowsBar-hd.png
create mode 100755 test/visual-tests/res/Images/arrowsBar.png
create mode 100755 test/visual-tests/res/Images/assetMgrBackground1.jpg
create mode 100755 test/visual-tests/res/Images/assetMgrBackground2.png
create mode 100755 test/visual-tests/res/Images/assetMgrBackground3.png
create mode 100755 test/visual-tests/res/Images/atlastest.png
create mode 100755 test/visual-tests/res/Images/b1.png
create mode 100755 test/visual-tests/res/Images/b2.png
create mode 100755 test/visual-tests/res/Images/background.png
create mode 100755 test/visual-tests/res/Images/background1.jpg
create mode 100755 test/visual-tests/res/Images/background1.png
create mode 100755 test/visual-tests/res/Images/background2.jpg
create mode 100755 test/visual-tests/res/Images/background2.png
create mode 100755 test/visual-tests/res/Images/background3.jpg
create mode 100755 test/visual-tests/res/Images/background3.png
create mode 100755 test/visual-tests/res/Images/ball.png
create mode 100755 test/visual-tests/res/Images/bitmapFontTest3.fnt
create mode 100755 test/visual-tests/res/Images/bitmapFontTest3.png
create mode 100755 test/visual-tests/res/Images/blocks.png
create mode 100755 test/visual-tests/res/Images/blocks9.png
create mode 100755 test/visual-tests/res/Images/blocks9r.png
create mode 100755 test/visual-tests/res/Images/blocks9ss.plist
create mode 100755 test/visual-tests/res/Images/blocks9ss.png
create mode 100755 test/visual-tests/res/Images/blocks9ss.tps
create mode 100755 test/visual-tests/res/Images/btn-about-normal-vertical.png
create mode 100755 test/visual-tests/res/Images/btn-about-normal.png
create mode 100755 test/visual-tests/res/Images/btn-about-selected.png
create mode 100755 test/visual-tests/res/Images/btn-highscores-normal.png
create mode 100755 test/visual-tests/res/Images/btn-highscores-selected.png
create mode 100755 test/visual-tests/res/Images/btn-play-normal.png
create mode 100755 test/visual-tests/res/Images/btn-play-selected.png
create mode 100644 test/visual-tests/res/Images/bug12847_sprite.png
create mode 100644 test/visual-tests/res/Images/bug12847_spriteframe.plist
create mode 100644 test/visual-tests/res/Images/bug12847_spriteframe.png
create mode 100755 test/visual-tests/res/Images/bugs/RetinaDisplay.jpg
create mode 100755 test/visual-tests/res/Images/bugs/bug886.jpg
create mode 100755 test/visual-tests/res/Images/bugs/bug886.png
create mode 100755 test/visual-tests/res/Images/bugs/circle.plist
create mode 100755 test/visual-tests/res/Images/bugs/circle.png
create mode 100755 test/visual-tests/res/Images/bugs/corner.png
create mode 100755 test/visual-tests/res/Images/bugs/edge.png
create mode 100755 test/visual-tests/res/Images/bugs/fill.png
create mode 100755 test/visual-tests/res/Images/bugs/picture.png
create mode 100755 test/visual-tests/res/Images/close.png
create mode 100644 test/visual-tests/res/Images/cocos-html5.png
create mode 100644 test/visual-tests/res/Images/cocos2dbanner.png
create mode 100644 test/visual-tests/res/Images/dot.png
create mode 100755 test/visual-tests/res/Images/elephant1_Diffuse.png
create mode 100755 test/visual-tests/res/Images/elephant1_Normal.png
create mode 100755 test/visual-tests/res/Images/encryptedAtlas.plist
create mode 100755 test/visual-tests/res/Images/encryptedAtlas.pvr.ccz
create mode 100755 test/visual-tests/res/Images/encryptedAtlas.tps
create mode 100755 test/visual-tests/res/Images/f1.png
create mode 100755 test/visual-tests/res/Images/f2.png
create mode 100644 test/visual-tests/res/Images/favicon.ico
create mode 100755 test/visual-tests/res/Images/fire-grayscale.png
create mode 100755 test/visual-tests/res/Images/fire.png
create mode 100755 test/visual-tests/res/Images/fire_rgba8888.pvr
create mode 100644 test/visual-tests/res/Images/fps_images.png
create mode 100755 test/visual-tests/res/Images/grossini.png
create mode 100755 test/visual-tests/res/Images/grossini_128x256_mipmap.pvr
create mode 100755 test/visual-tests/res/Images/grossini_dance_01.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_02.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_03.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_04.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_05.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_06.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_07.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_08.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_09.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_10.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_11.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_12.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_13.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_14.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_atlas-mono.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_atlas.png
create mode 100755 test/visual-tests/res/Images/grossini_dance_atlas_nomipmap.png
create mode 100755 test/visual-tests/res/Images/grossini_pvr_rgba4444.pvr
create mode 100755 test/visual-tests/res/Images/grossini_pvr_rgba8888.pvr
create mode 100755 test/visual-tests/res/Images/grossinis_sister1-testalpha.png
create mode 100755 test/visual-tests/res/Images/grossinis_sister1-testalpha.ppng
create mode 100755 test/visual-tests/res/Images/grossinis_sister1-testalpha_nopremult.pvr
create mode 100755 test/visual-tests/res/Images/grossinis_sister1-testalpha_premult.pvr
create mode 100755 test/visual-tests/res/Images/grossinis_sister1.png
create mode 100755 test/visual-tests/res/Images/grossinis_sister2.png
create mode 100644 test/visual-tests/res/Images/heightfield64x64.raw
create mode 100755 test/visual-tests/res/Images/hole_effect.png
create mode 100755 test/visual-tests/res/Images/hole_stencil.png
create mode 100755 test/visual-tests/res/Images/labelatlas.png
create mode 100755 test/visual-tests/res/Images/logo-mipmap.pvr
create mode 100755 test/visual-tests/res/Images/logo-nomipmap.pvr
create mode 100644 test/visual-tests/res/Images/lookup-desktop.plist
create mode 100644 test/visual-tests/res/Images/lookup-html5.plist
create mode 100644 test/visual-tests/res/Images/lookup-mobile.plist
create mode 100755 test/visual-tests/res/Images/menuitemsprite.png
create mode 100644 test/visual-tests/res/Images/movement.png
create mode 100755 test/visual-tests/res/Images/noise.png
create mode 100755 test/visual-tests/res/Images/nonencryptedAtlas.plist
create mode 100755 test/visual-tests/res/Images/nonencryptedAtlas.pvr.ccz
create mode 100755 test/visual-tests/res/Images/nonencryptedAtlas.tps
create mode 100755 test/visual-tests/res/Images/paddle.png
create mode 100644 test/visual-tests/res/Images/particles-hd.png
create mode 100755 test/visual-tests/res/Images/particles.png
create mode 100755 test/visual-tests/res/Images/pattern1.png
create mode 100755 test/visual-tests/res/Images/piece.png
create mode 100755 test/visual-tests/res/Images/powered.png
create mode 100755 test/visual-tests/res/Images/r1.png
create mode 100755 test/visual-tests/res/Images/r2.png
create mode 100644 test/visual-tests/res/Images/shapemode.png
create mode 100755 test/visual-tests/res/Images/snow.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-0-0.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-0-1.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-0-2.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-0-3.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-0-4.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-0-5.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-0-6.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-0-7.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-1-0.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-1-1.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-1-2.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-1-3.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-1-4.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-1-5.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-1-6.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-1-7.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-2-0.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-2-1.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-2-2.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-2-3.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-2-4.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-2-5.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-2-6.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-2-7.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-3-0.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-3-1.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-3-2.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-3-3.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-3-4.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-3-5.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-3-6.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-3-7.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-4-0.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-4-1.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-4-2.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-4-3.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-4-4.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-4-5.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-4-6.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-4-7.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-5-0.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-5-1.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-5-2.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-5-3.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-5-4.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-5-5.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-5-6.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-5-7.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-6-0.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-6-1.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-6-2.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-6-3.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-6-4.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-6-5.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-6-6.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-6-7.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-7-0.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-7-1.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-7-2.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-7-3.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-7-4.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-7-5.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-7-6.png
create mode 100755 test/visual-tests/res/Images/sprites_test/sprite-7-7.png
create mode 100755 test/visual-tests/res/Images/stars-grayscale.png
create mode 100755 test/visual-tests/res/Images/stars.png
create mode 100755 test/visual-tests/res/Images/stars2-grayscale.png
create mode 100755 test/visual-tests/res/Images/stars2.png
create mode 100755 test/visual-tests/res/Images/stone.png
create mode 100755 test/visual-tests/res/Images/streak.png
create mode 100755 test/visual-tests/res/Images/test-rgba1.png
create mode 100755 test/visual-tests/res/Images/test_1021x1024_a8.pvr.gz
create mode 100755 test/visual-tests/res/Images/test_256x256_ATC_RGBA_Explicit_mipmaps.ktx
create mode 100755 test/visual-tests/res/Images/test_256x256_ATC_RGBA_Interpolated_mipmaps.ktx
create mode 100755 test/visual-tests/res/Images/test_256x256_ATC_RGB_mipmaps.ktx
create mode 100755 test/visual-tests/res/Images/test_256x256_s3tc_dxt1_mipmaps.dds
create mode 100755 test/visual-tests/res/Images/test_256x256_s3tc_dxt3_mipmaps.dds
create mode 100755 test/visual-tests/res/Images/test_256x256_s3tc_dxt5_mipmaps.dds
create mode 100755 test/visual-tests/res/Images/test_512x512_s3tc_dxt5_with_no_mipmaps.dds
create mode 100755 test/visual-tests/res/Images/test_blend.png
create mode 100755 test/visual-tests/res/Images/test_image-bad_encoding.pvr
create mode 100755 test/visual-tests/res/Images/test_image.jpeg
create mode 100755 test/visual-tests/res/Images/test_image.png
create mode 100755 test/visual-tests/res/Images/test_image.pvr
create mode 100755 test/visual-tests/res/Images/test_image.pvrraw
create mode 100755 test/visual-tests/res/Images/test_image.tiff
create mode 100755 test/visual-tests/res/Images/test_image.webp
create mode 100644 test/visual-tests/res/Images/test_image_a8.pvr
create mode 100755 test/visual-tests/res/Images/test_image_a8_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_ai88.png
create mode 100755 test/visual-tests/res/Images/test_image_ai88.pvr
create mode 100755 test/visual-tests/res/Images/test_image_ai88_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_bgra8888.pvr
create mode 100755 test/visual-tests/res/Images/test_image_bgra8888_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_i8.png
create mode 100755 test/visual-tests/res/Images/test_image_i8.pvr
create mode 100755 test/visual-tests/res/Images/test_image_i8_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_pvrtc2bpp.pvr
create mode 100755 test/visual-tests/res/Images/test_image_pvrtc2bpp_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_pvrtc4bpp.pvr
create mode 100755 test/visual-tests/res/Images/test_image_pvrtc4bpp_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_pvrtcii2bpp_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_pvrtcii4bpp_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgb565.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgb565_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgb888.png
create mode 100755 test/visual-tests/res/Images/test_image_rgb888.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgb888_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgba4444.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgba4444.pvr.ccz
create mode 100755 test/visual-tests/res/Images/test_image_rgba4444.pvr.gz
create mode 100755 test/visual-tests/res/Images/test_image_rgba4444_mipmap.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgba4444_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgba5551.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgba5551_v3.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgba8888.png
create mode 100755 test/visual-tests/res/Images/test_image_rgba8888.pvr
create mode 100755 test/visual-tests/res/Images/test_image_rgba8888_v3.pvr
create mode 100755 test/visual-tests/res/Images/texture1024x1024.png
create mode 100755 test/visual-tests/res/Images/texture2048x2048.png
create mode 100755 test/visual-tests/res/Images/texture512x512.png
create mode 100644 test/visual-tests/res/Images/texturemode.png
create mode 100755 test/visual-tests/res/Images/ui.plist
create mode 100755 test/visual-tests/res/Images/ui.png
create mode 100755 test/visual-tests/res/Images/water_2_dxt1.dds
create mode 100755 test/visual-tests/res/Images/water_2_dxt3.dds
create mode 100755 test/visual-tests/res/Images/water_2_dxt5.dds
create mode 100755 test/visual-tests/res/Images/white-512x512.png
create mode 100644 test/visual-tests/res/Images/wood.jpg
create mode 100644 test/visual-tests/res/Manifests/AMTestScene1/project.manifest
create mode 100644 test/visual-tests/res/Manifests/AMTestScene2/project.manifest
create mode 100644 test/visual-tests/res/Manifests/AMTestScene3/project.manifest
create mode 100755 test/visual-tests/res/Manifests/AMTestScene4/project.manifest
create mode 100644 test/visual-tests/res/Manifests/ScriptTest/project.manifest
create mode 100644 test/visual-tests/res/Particles/BoilingFoam.plist
create mode 100644 test/visual-tests/res/Particles/BoilingFoamStar.plist
create mode 100644 test/visual-tests/res/Particles/BurstPipe.plist
create mode 100644 test/visual-tests/res/Particles/ButterFly.plist
create mode 100644 test/visual-tests/res/Particles/ButterFlyYFlipped.plist
create mode 100644 test/visual-tests/res/Particles/Comet.plist
create mode 100644 test/visual-tests/res/Particles/ExplodingRing.plist
create mode 100644 test/visual-tests/res/Particles/Flower.plist
create mode 100644 test/visual-tests/res/Particles/Galaxy.plist
create mode 100644 test/visual-tests/res/Particles/LavaFlow.plist
create mode 100644 test/visual-tests/res/Particles/Phoenix.plist
create mode 100644 test/visual-tests/res/Particles/SmallSun.plist
create mode 100644 test/visual-tests/res/Particles/SpinningPeas.plist
create mode 100644 test/visual-tests/res/Particles/Spiral.plist
create mode 100644 test/visual-tests/res/Particles/SpookyPeas.plist
create mode 100644 test/visual-tests/res/Particles/TestPremultipliedAlpha.plist
create mode 100644 test/visual-tests/res/Particles/Upsidedown.plist
create mode 100644 test/visual-tests/res/Particles/debian.plist
create mode 100644 test/visual-tests/res/Particles/lines.plist
create mode 100644 test/visual-tests/res/Shaders/example_3D_PositionTex.fsh
create mode 100644 test/visual-tests/res/Shaders/example_3D_PositionTex.vsh
create mode 100644 test/visual-tests/res/Shaders/example_Bloom.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Blur.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Blur_winrt.fsh
create mode 100644 test/visual-tests/res/Shaders/example_CelShading.fsh
create mode 100644 test/visual-tests/res/Shaders/example_ColorBars.fsh
create mode 100644 test/visual-tests/res/Shaders/example_ColorBars.vsh
create mode 100644 test/visual-tests/res/Shaders/example_EdgeDetection.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Flower.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Flower.vsh
create mode 100644 test/visual-tests/res/Shaders/example_GreyScale.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Heart.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Heart.vsh
create mode 100644 test/visual-tests/res/Shaders/example_HorizontalColor.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Julia.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Julia.vsh
create mode 100644 test/visual-tests/res/Shaders/example_LensFlare.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Mandelbrot.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Mandelbrot.vsh
create mode 100644 test/visual-tests/res/Shaders/example_Monjori.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Monjori.vsh
create mode 100644 test/visual-tests/res/Shaders/example_MultiTexture.fsh
create mode 100644 test/visual-tests/res/Shaders/example_MultiTexture.vsh
create mode 100644 test/visual-tests/res/Shaders/example_Noisy.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Normal.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Outline.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Outline.vsh
create mode 100644 test/visual-tests/res/Shaders/example_Outline_noMVP.vsh
create mode 100644 test/visual-tests/res/Shaders/example_Plasma.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Plasma.vsh
create mode 100644 test/visual-tests/res/Shaders/example_Sepia.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Simple.vsh
create mode 100644 test/visual-tests/res/Shaders/example_Twist.fsh
create mode 100644 test/visual-tests/res/Shaders/example_Twist.vsh
create mode 100644 test/visual-tests/res/Shaders/shadertoy_FireBall.fsh
create mode 100644 test/visual-tests/res/Shaders/shadertoy_Glow.fsh
create mode 100644 test/visual-tests/res/Shaders/shadertoy_LensFlare.fsh
create mode 100644 test/visual-tests/res/Test.html
create mode 100755 test/visual-tests/res/TileMaps/fixed-ortho-test2.png
create mode 100755 test/visual-tests/res/TileMaps/grass.png
create mode 100755 test/visual-tests/res/TileMaps/grass01.png
create mode 100755 test/visual-tests/res/TileMaps/hexa-test.tmx
create mode 100755 test/visual-tests/res/TileMaps/hexa-tiles.png
create mode 100755 test/visual-tests/res/TileMaps/iso-test-bug787.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso-test-movelayer.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso-test-objectgroup.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso-test-vertexz.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso-test-zorder.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso-test.png
create mode 100755 test/visual-tests/res/TileMaps/iso-test.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso-test1.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso-test2-uncompressed.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso-test2.png
create mode 100755 test/visual-tests/res/TileMaps/iso-test2.tmx
create mode 100755 test/visual-tests/res/TileMaps/iso.png
create mode 100755 test/visual-tests/res/TileMaps/levelmap.tga
create mode 100755 test/visual-tests/res/TileMaps/ortho-objects.tmx
create mode 100755 test/visual-tests/res/TileMaps/ortho-rotation-test.tmx
create mode 100755 test/visual-tests/res/TileMaps/ortho-test1.png
create mode 100755 test/visual-tests/res/TileMaps/ortho-test1_bw.png
create mode 100755 test/visual-tests/res/TileMaps/ortho-test2.png
create mode 100755 test/visual-tests/res/TileMaps/ortho-tile-property.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test-movelayer.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test-vertexz.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test-zorder.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test1.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test1.tsx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test2.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test3.tmx
create mode 100644 test/visual-tests/res/TileMaps/orthogonal-test4-hd.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test4.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test5.tmx
create mode 100644 test/visual-tests/res/TileMaps/orthogonal-test6-hd.tmx
create mode 100755 test/visual-tests/res/TileMaps/orthogonal-test6.tmx
create mode 100755 test/visual-tests/res/TileMaps/test-object-layer.tmx
create mode 100755 test/visual-tests/res/TileMaps/test-staggered.tmx
create mode 100644 test/visual-tests/res/TileMaps/tile_iso_offset.png
create mode 100644 test/visual-tests/res/TileMaps/tile_iso_offset.tmx
create mode 100644 test/visual-tests/res/TileMaps/tiles-hd.png
create mode 100755 test/visual-tests/res/TileMaps/tiles.png
create mode 100644 test/visual-tests/res/TileMaps/tmw_desert_spacing-hd.png
create mode 100755 test/visual-tests/res/TileMaps/tmw_desert_spacing.png
create mode 100755 test/visual-tests/res/TileMaps/xml-test.tmx
create mode 100755 test/visual-tests/res/TileMaps/xml-test.tsx
create mode 100755 test/visual-tests/res/animations/animations-2.plist
create mode 100755 test/visual-tests/res/animations/animations.plist
create mode 100644 test/visual-tests/res/animations/crystals.plist
create mode 100644 test/visual-tests/res/animations/crystals.png
create mode 100644 test/visual-tests/res/animations/dragon_animation-hd.png
create mode 100755 test/visual-tests/res/animations/dragon_animation.png
create mode 100755 test/visual-tests/res/animations/ghosts.plist
create mode 100755 test/visual-tests/res/animations/ghosts.png
create mode 100755 test/visual-tests/res/animations/grossini-aliases.plist
create mode 100755 test/visual-tests/res/animations/grossini-aliases.png
create mode 100755 test/visual-tests/res/animations/grossini.plist
create mode 100755 test/visual-tests/res/animations/grossini.plist.xml
create mode 100755 test/visual-tests/res/animations/grossini.png
create mode 100755 test/visual-tests/res/animations/grossini.pvr.gz
create mode 100755 test/visual-tests/res/animations/grossini.zss
create mode 100755 test/visual-tests/res/animations/grossini.ztp
create mode 100755 test/visual-tests/res/animations/grossini_blue.plist
create mode 100755 test/visual-tests/res/animations/grossini_blue.png
create mode 100755 test/visual-tests/res/animations/grossini_family.plist
create mode 100755 test/visual-tests/res/animations/grossini_family.png
create mode 100755 test/visual-tests/res/animations/grossini_gray.plist
create mode 100755 test/visual-tests/res/animations/grossini_gray.png
create mode 100644 test/visual-tests/res/animations/tcc_issue_1.plist
create mode 100644 test/visual-tests/res/animations/tcc_issue_1.png
create mode 100644 test/visual-tests/res/animations/tcc_issue_2.plist
create mode 100644 test/visual-tests/res/animations/tcc_issue_2.png
create mode 100644 test/visual-tests/res/audio/LuckyDay.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX081.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX082.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX083.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX084.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX085.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX086.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX087.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX088.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX089.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/FX090.mp3
create mode 100644 test/visual-tests/res/audio/SoundEffectsFX009/README.txt
create mode 100644 test/visual-tests/res/background-music-aac.mp3
create mode 100755 test/visual-tests/res/background.caf
create mode 100755 test/visual-tests/res/background.mp3
create mode 100755 test/visual-tests/res/background.ogg
create mode 100644 test/visual-tests/res/ccs-res/XueJ2312F.ttf
create mode 100644 test/visual-tests/res/ccs-res/cocosui/100/100.ExportJson
create mode 100644 test/visual-tests/res/ccs-res/cocosui/100/100.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/100/1000.plist
create mode 100644 test/visual-tests/res/ccs-res/cocosui/100/1000.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CloseNormal.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CloseSelected.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CocoGUISample.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CocoGUI_PageView_Sample.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CocoGUI_PageView_Sample.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CustomImageViewTest/NewProject_20.plist
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CustomImageViewTest/NewProject_20.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CustomImageViewTest/NewProject_2_1.ExportJson
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CustomImageViewTest/NewProject_2_1.csb
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.csb
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Default/Button_Disable.png
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Default/Button_Normal.png
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Default/Button_Press.png
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Default/CheckBoxNode_Disable.png
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Default/CheckBoxNode_Normal.png
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Default/CheckBox_Disable.png
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Default/CheckBox_Normal.png
create mode 100755 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Default/CheckBox_Press.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/Layer.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest/PageViewBugScene.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/Hello.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/Marker Felt.ttf
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/UITest.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/UITest.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/b1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/b2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/background.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/buttonBackground.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/f1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/f2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/r1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/r2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/UITest/ribbon.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/android9patch.plist
create mode 100644 test/visual-tests/res/ccs-res/cocosui/android9patch.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/animationbuttonnormal.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/animationbuttonpressed.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/arrow.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/b11.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/backtotopnormal.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/backtotoppressed.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/bitmapFontTest2.fnt
create mode 100644 test/visual-tests/res/ccs-res/cocosui/bitmapFontTest2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/btn_exercise01_n.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/btn_exercise01_p.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/btn_exercise02_n.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/btn_exercise02_p.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/btn_exercise03_n.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/btn_exercise03_p.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/button.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/buttonHighlighted.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/ccicon.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/check_box_active.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/check_box_active_disable.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/check_box_active_press.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/check_box_normal.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/check_box_normal_disable.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/check_box_normal_press.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/Test/UIResForEditor/Button/button_country_n.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/Test/UIResForEditor/Button/button_country_p.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/Test/UIResForEditor/Button/button_country_un.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/Test/UIResForEditor/Button/symbol_1B.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/Test/UIResForEditor/Button/symbol_1a.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/Test/UIResForEditor/Button/symbol_1c.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/111.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/12.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/13.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/14.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/15.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/button_end_01.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/button_end_02.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/button_green_n2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/button_green_p2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/button_green_un2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/10.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/11.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/3.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/4.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/5.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/6.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/7.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/8.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/9.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/crab.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/research.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/sell.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/shop_shield_1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/shop_shield_2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/shop_shield_3.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/train.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/equip/eg/upgrade.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/examples.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/examples.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/4.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/5.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/6.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/button_end_01.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/button_end_02.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/weapon_item_1/weapon_item/1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/weapon_item_1/weapon_item/2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/weapon_item_1/weapon_item/7.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/weapon_item_1/weapon_item_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/examples/weapon_introduce/weapon_item_1/weapon_item_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/green_edit.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/grossini-aliases.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/UIAction_1/CocoStudio_UIEditor.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/UIAction_1/UIAction_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/UIAction_1/UIAction_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/buy_1/5.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/buy_1/7.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/buy_1/button.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/buy_1/buttonHighlighted.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/buy_1/buy_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/buy_1/buy_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/111.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/12.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/13.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/14.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/15.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/button_end_01.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/button_end_02.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/button_green_n2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/button_green_p2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/button_green_un2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/10.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/11.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/3.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/4.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/5.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/6.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/7.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/8.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/9.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/crab.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/research.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/sell.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/shop_shield_1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/shop_shield_2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/shop_shield_3.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/train.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip/eg/upgrade.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/equip_1/equip_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_1/image_castle.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_1/map_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_1/map_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_1/map_pve.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_alert_1/5.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_alert_1/7.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_alert_1/close_02.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_alert_1/close_03.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_alert_1/close_04.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_alert_1/map_alert_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/map_alert_1/map_alert_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/background.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/buttonBackground.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/page_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/page_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/page_content/CocoStudio_AnimationEditor.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/page_content/CocoStudio_DataEditor.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/page_content/CocoStudio_SceneEditor.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/page_content/CocoStudio_UIEditor.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/ribbon.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/teehanlax - iOS 6 - iPhone_check.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/page_1/teehanlax - iOS 6 - iPhone_check01.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/128_128.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/Rosewood stdloadingH.fnt
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/Rosewood stdloadingH.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/button_d.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/button_n.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/e-mail.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/register_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/register_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/register_1/ui_shop_005-hd.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_introduce/4.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_introduce/5.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_introduce/6.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_introduce/button_end_01.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_introduce/button_end_02.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_introduce_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_introduce_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapon_item/1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapon_item/2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapon_item/7.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapon_item_1.csb
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapon_item_1.json
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_1.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_10.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_11.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_12.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_13.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_14.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_15.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_16.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_17.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_18.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_19.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_20.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_21.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_22.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_23.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_24.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_25.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_26.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_27.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_28.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_29.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_3.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_30.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_31.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_4.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_5.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_6.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_7.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_8.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/gui_examples/weapon_introduce_1/weapon_item_1/weapons/weapons_9.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/labelatlas.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/loadingbar.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/monster.9.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/player.9.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/radio_button_off.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/radio_button_on.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/scrollviewbg.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/slidbar.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/sliderProgress.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/sliderProgress2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/sliderThumb.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/sliderTrack.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/sliderTrack2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/slider_bar_active_9patch.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/slider_bar_active_9patch2.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/sliderballnormal.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/sliderballpressed.png
create mode 100644 test/visual-tests/res/ccs-res/cocosui/switch-mask.png
create mode 100755 test/visual-tests/res/configs/config-example.plist
create mode 100755 test/visual-tests/res/configs/config-test-invalid.plist
create mode 100755 test/visual-tests/res/configs/config-test-ok.plist
create mode 100755 test/visual-tests/res/effect1.raw
create mode 100755 test/visual-tests/res/effect1.wav
create mode 100644 test/visual-tests/res/effect2.mp3
create mode 100755 test/visual-tests/res/effect2.ogg
create mode 100755 test/visual-tests/res/extensions/CCControlColourPickerSpriteSheet.plist
create mode 100755 test/visual-tests/res/extensions/CCControlColourPickerSpriteSheet.png
create mode 100755 test/visual-tests/res/extensions/background.png
create mode 100755 test/visual-tests/res/extensions/button.png
create mode 100755 test/visual-tests/res/extensions/buttonBackground.png
create mode 100755 test/visual-tests/res/extensions/buttonHighlighted.png
create mode 100755 test/visual-tests/res/extensions/green_edit.png
create mode 100755 test/visual-tests/res/extensions/orange_edit.png
create mode 100755 test/visual-tests/res/extensions/potentiometerButton.png
create mode 100755 test/visual-tests/res/extensions/potentiometerProgress.png
create mode 100755 test/visual-tests/res/extensions/potentiometerTrack.png
create mode 100755 test/visual-tests/res/extensions/ribbon.png
create mode 100755 test/visual-tests/res/extensions/sliderProgress.png
create mode 100755 test/visual-tests/res/extensions/sliderProgress2.png
create mode 100755 test/visual-tests/res/extensions/sliderThumb.png
create mode 100755 test/visual-tests/res/extensions/sliderTrack.png
create mode 100755 test/visual-tests/res/extensions/sliderTrack2.png
create mode 100755 test/visual-tests/res/extensions/stepper-minus.png
create mode 100755 test/visual-tests/res/extensions/stepper-plus.png
create mode 100755 test/visual-tests/res/extensions/switch-mask.png
create mode 100755 test/visual-tests/res/extensions/switch-off.png
create mode 100755 test/visual-tests/res/extensions/switch-on.png
create mode 100755 test/visual-tests/res/extensions/switch-thumb.png
create mode 100755 test/visual-tests/res/extensions/yellow_edit.png
create mode 100755 test/visual-tests/res/fileLookup.plist
create mode 100755 test/visual-tests/res/fonts/A Damn Mess.ttf
create mode 100755 test/visual-tests/res/fonts/Abberancy.ttf
create mode 100755 test/visual-tests/res/fonts/Abduction.ttf
create mode 100755 test/visual-tests/res/fonts/American Typewriter.ttf
create mode 100755 test/visual-tests/res/fonts/Courier New.ttf
create mode 100644 test/visual-tests/res/fonts/Fingerpop.ttf
create mode 100644 test/visual-tests/res/fonts/HKYuanMini.ttf
create mode 100755 test/visual-tests/res/fonts/Japanese.ttf
create mode 100755 test/visual-tests/res/fonts/Marker Felt.ttf
create mode 100755 test/visual-tests/res/fonts/Paint Boy.ttf
create mode 100755 test/visual-tests/res/fonts/Roboto.bmf.fnt
create mode 100755 test/visual-tests/res/fonts/Roboto.bmf_0.png
create mode 100644 test/visual-tests/res/fonts/Schwarzwald Regular.ttf
create mode 100755 test/visual-tests/res/fonts/Schwarzwald.ttf
create mode 100644 test/visual-tests/res/fonts/Schwarzwald_Regular.eot
create mode 100755 test/visual-tests/res/fonts/Scissor Cuts.ttf
create mode 100755 test/visual-tests/res/fonts/Thonburi.ttf
create mode 100755 test/visual-tests/res/fonts/ThonburiBold.ttf
create mode 100755 test/visual-tests/res/fonts/arial-26-en-ru.fnt
create mode 100755 test/visual-tests/res/fonts/arial-26-en-ru_0.png
create mode 100755 test/visual-tests/res/fonts/arial-unicode-26.GlyphProject
create mode 100755 test/visual-tests/res/fonts/arial-unicode-26.fnt
create mode 100755 test/visual-tests/res/fonts/arial-unicode-26.png
create mode 100755 test/visual-tests/res/fonts/arial.ttf
create mode 100755 test/visual-tests/res/fonts/arial16.fnt
create mode 100755 test/visual-tests/res/fonts/arial16.png
create mode 100755 test/visual-tests/res/fonts/bitmapFontChinese.fnt
create mode 100755 test/visual-tests/res/fonts/bitmapFontChinese.png
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest.fnt
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest.png
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest2.bmp
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest2.fnt
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest2.png
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest3.fnt
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest3.png
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest4.fnt
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest4.png
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest5.fnt
create mode 100755 test/visual-tests/res/fonts/bitmapFontTest5.png
create mode 100755 test/visual-tests/res/fonts/boundsTestFont.fnt
create mode 100755 test/visual-tests/res/fonts/boundsTestFont.png
create mode 100755 test/visual-tests/res/fonts/cyril.ttf
create mode 100755 test/visual-tests/res/fonts/cyrillic.ttf
create mode 100755 test/visual-tests/res/fonts/font-issue1343-hd.fnt
create mode 100755 test/visual-tests/res/fonts/font-issue1343-hd.png
create mode 100755 test/visual-tests/res/fonts/font-issue1343.fnt
create mode 100755 test/visual-tests/res/fonts/font-issue1343.png
create mode 100755 test/visual-tests/res/fonts/futura-48.fnt
create mode 100755 test/visual-tests/res/fonts/futura-48.png
create mode 100755 test/visual-tests/res/fonts/geneva-32.fnt
create mode 100755 test/visual-tests/res/fonts/helvetica-32.fnt
create mode 100755 test/visual-tests/res/fonts/helvetica-geneva-32.png
create mode 100644 test/visual-tests/res/fonts/konqa32-hd.fnt
create mode 100644 test/visual-tests/res/fonts/konqa32-hd.png
create mode 100755 test/visual-tests/res/fonts/konqa32.fnt
create mode 100755 test/visual-tests/res/fonts/konqa32.png
create mode 100755 test/visual-tests/res/fonts/labelatlas.png
create mode 100644 test/visual-tests/res/fonts/larabie-16-hd.plist
create mode 100644 test/visual-tests/res/fonts/larabie-16-hd.png
create mode 100755 test/visual-tests/res/fonts/larabie-16.plist
create mode 100755 test/visual-tests/res/fonts/larabie-16.png
create mode 100644 test/visual-tests/res/fonts/markerFelt-hd.fnt
create mode 100644 test/visual-tests/res/fonts/markerFelt-hd.png
create mode 100755 test/visual-tests/res/fonts/markerFelt.fnt
create mode 100755 test/visual-tests/res/fonts/markerFelt.png
create mode 100755 test/visual-tests/res/fonts/strings.xml
create mode 100755 test/visual-tests/res/fonts/tahoma.ttf
create mode 100644 test/visual-tests/res/fonts/tuffy_bold_italic-charmap-hd.plist
create mode 100644 test/visual-tests/res/fonts/tuffy_bold_italic-charmap-hd.png
create mode 100755 test/visual-tests/res/fonts/tuffy_bold_italic-charmap.plist
create mode 100755 test/visual-tests/res/fonts/tuffy_bold_italic-charmap.png
create mode 100755 test/visual-tests/res/fonts/west_england-64.fnt
create mode 100755 test/visual-tests/res/fonts/west_england-64.png
create mode 100644 test/visual-tests/res/fonts/xingkai-incomplete.ttf
create mode 100644 test/visual-tests/res/fps_images.png
create mode 100755 test/visual-tests/res/music.mid
create mode 100644 test/visual-tests/res/resjs/Shaders/example_ColorBars.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_ColorBars.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Flower.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Flower.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Heart.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Heart.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Julia.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Julia.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Mandelbrot.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Mandelbrot.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Monjori.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Monjori.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Outline.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Outline.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Outline_noMVP.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Plasma.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Plasma.vsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Twist.fsh
create mode 100644 test/visual-tests/res/resjs/Shaders/example_Twist.vsh
create mode 100644 test/visual-tests/res/spine/goblins-ffd.atlas
create mode 100644 test/visual-tests/res/spine/goblins-ffd.json
create mode 100644 test/visual-tests/res/spine/goblins-ffd.png
create mode 100755 test/visual-tests/res/spine/goblins.atlas
create mode 100755 test/visual-tests/res/spine/goblins.json
create mode 100755 test/visual-tests/res/spine/goblins.png
create mode 100644 test/visual-tests/res/spine/raptor.atlas
create mode 100644 test/visual-tests/res/spine/raptor.json
create mode 100644 test/visual-tests/res/spine/raptor.png
create mode 100644 test/visual-tests/res/spine/spineboy.atlas
create mode 100644 test/visual-tests/res/spine/spineboy.json
create mode 100644 test/visual-tests/res/spine/spineboy.png
create mode 100644 test/visual-tests/res/spine/sprite.png
create mode 100644 test/visual-tests/run-helper.sh
create mode 100644 test/visual-tests/run.sh
create mode 100644 test/visual-tests/server.js
create mode 100644 test/visual-tests/src/ActionManagerTest/ActionManagerTest.js
create mode 100644 test/visual-tests/src/ActionsTest/ActionsTest.js
create mode 100644 test/visual-tests/src/BakeLayerTest/BakeLayerTest.js
create mode 100644 test/visual-tests/src/BaseTestLayer/BaseTestLayer.js
create mode 100644 test/visual-tests/src/ClippingNodeTest/ClippingNodeTest.js
create mode 100644 test/visual-tests/src/CocosDenshionTest/CocosDenshionTest.js
create mode 100644 test/visual-tests/src/CocosNodeTest/CocosNodeTest.js
create mode 100644 test/visual-tests/src/DrawPrimitivesTest/DrawPrimitivesTest.js
create mode 100644 test/visual-tests/src/EaseActionsTest/EaseActionsTest.js
create mode 100644 test/visual-tests/src/ExtensionsTest/AssetsManagerTest/AssetsManagerTest.js
create mode 100644 test/visual-tests/src/ExtensionsTest/CCPoolTest/CCPoolTest.js
create mode 100644 test/visual-tests/src/ExtensionsTest/ExtensionsTest.js
create mode 100644 test/visual-tests/src/ExtensionsTest/NetworkTest/SocketIOTest.js
create mode 100644 test/visual-tests/src/ExtensionsTest/NetworkTest/WebSocketTest.js
create mode 100644 test/visual-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js
create mode 100644 test/visual-tests/src/ExtensionsTest/TableViewTest/TableViewTestScene.js
create mode 100644 test/visual-tests/src/GUITest/UIButtonTest/UIButtonTest.js
create mode 100644 test/visual-tests/src/GUITest/UICheckBoxTest/UICheckBoxTest.js
create mode 100644 test/visual-tests/src/GUITest/UIFocusTest/UIFocusTest.js
create mode 100644 test/visual-tests/src/GUITest/UIImageViewTest/UIImageViewTest.js
create mode 100644 test/visual-tests/src/GUITest/UILabelAtlasTest/UILabelAtlasTest.js
create mode 100644 test/visual-tests/src/GUITest/UILabelBMFontTest/UILabelBMFontTest.js
create mode 100644 test/visual-tests/src/GUITest/UILabelTest/UILabelTest.js
create mode 100644 test/visual-tests/src/GUITest/UILayoutTest/UILayoutTest.js
create mode 100644 test/visual-tests/src/GUITest/UIListViewTest/UIListViewTest.js
create mode 100644 test/visual-tests/src/GUITest/UILoadingBarTest/UILoadingBarTest.js
create mode 100644 test/visual-tests/src/GUITest/UINodeContainerTest/UINodeContainerTest.js
create mode 100644 test/visual-tests/src/GUITest/UIPageViewTest/UIPageViewTest.js
create mode 100644 test/visual-tests/src/GUITest/UIRichTextTest/UIRichTextTest.js
create mode 100644 test/visual-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js
create mode 100644 test/visual-tests/src/GUITest/UIScene.js
create mode 100644 test/visual-tests/src/GUITest/UISceneManager.js
create mode 100644 test/visual-tests/src/GUITest/UIScrollViewTest/UIScrollViewTest.js
create mode 100644 test/visual-tests/src/GUITest/UISliderTest/UISliderTest.js
create mode 100644 test/visual-tests/src/GUITest/UITextFieldTest/UITextFieldTest.js
create mode 100644 test/visual-tests/src/GUITest/UITextTest/UITextTest.js
create mode 100644 test/visual-tests/src/GUITest/UIWebViewTest/UIWebViewTest.js
create mode 100644 test/visual-tests/src/GUITest/UIWebViewTest/webview.html
create mode 100644 test/visual-tests/src/GUITest/UIWebViewTest/webview2.html
create mode 100644 test/visual-tests/src/IntervalTest/IntervalTest.js
create mode 100644 test/visual-tests/src/LabelTest/LabelTest.js
create mode 100644 test/visual-tests/src/LayerTest/LayerTest.js
create mode 100644 test/visual-tests/src/LoaderTest/LoaderTest.js
create mode 100644 test/visual-tests/src/NativeTest/AudioEngineTest.js
create mode 100644 test/visual-tests/src/NativeTest/FileUtils/FileUtilsTest.js
create mode 100644 test/visual-tests/src/NativeTest/JSBExtendTest.js
create mode 100644 test/visual-tests/src/NativeTest/NativeTest.js
create mode 100644 test/visual-tests/src/NewEventManagerTest/NewEventManagerTest.js
create mode 100644 test/visual-tests/src/OpenGLTest/OpenGLTest.js
create mode 100644 test/visual-tests/src/ParallaxTest/ParallaxTest.js
create mode 100644 test/visual-tests/src/ParticleTest/ParticleTest.js
create mode 100644 test/visual-tests/src/PathTest/PathTest.js
create mode 100644 test/visual-tests/src/ProgressActionsTest/ProgressActionsTest.js
create mode 100644 test/visual-tests/src/ReflectionTest/ReflectionTest.js
create mode 100644 test/visual-tests/src/RenderTextureTest/RenderTextureTest.js
create mode 100644 test/visual-tests/src/SchedulerTest/SchedulerTest.js
create mode 100644 test/visual-tests/src/SpineTest/SpineTest.js
create mode 100644 test/visual-tests/src/SpritePolygonTest/SpritePolygonTest.js
create mode 100644 test/visual-tests/src/SpriteTest/SpriteTest.js
create mode 100644 test/visual-tests/src/SysTest/ScriptTestTempFile.js
create mode 100644 test/visual-tests/src/SysTest/SysTest.js
create mode 100644 test/visual-tests/src/TextureCacheTest/TextureCacheTest.js
create mode 100644 test/visual-tests/src/TileMapTest/TileMapTest.js
create mode 100644 test/visual-tests/src/TouchesTest/Ball.js
create mode 100644 test/visual-tests/src/TouchesTest/Paddle.js
create mode 100644 test/visual-tests/src/TouchesTest/TouchesTest.js
create mode 100644 test/visual-tests/src/XHRTest/XHRArrayBufferTest.js
create mode 100644 test/visual-tests/src/XHRTest/XHRTest.js
create mode 100644 test/visual-tests/src/tests-main.js
create mode 100644 test/visual-tests/src/tests_resources.js
create mode 100644 tools/XmlCheck.js
create mode 100644 tools/compiler/compiler.jar
create mode 100644 tools/core4cc.js
create mode 100644 tools/genBuildXml.js
create mode 100644 tools/publish.js
create mode 100644 tools/readme for tools.txt
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..8ba66418219
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+/lib
+/bin
+/web.config
+.idea
+.DS_Store
+build
+aspnet_client
+node_modules
+/tools/jsdoc_toolkit-2.4.0
+/package
+/tools/jsdoc_toolkit/jsdoc_toolkit-2.4.0
+/.project
diff --git a/AUTHORS.txt b/AUTHORS.txt
new file mode 100644
index 00000000000..5a20dc7535b
--- /dev/null
+++ b/AUTHORS.txt
@@ -0,0 +1,288 @@
+Cocos2d-html5 authors
+
+(Ordered by join time)
+
+Core Developers:
+
+ Shun Lin (Sean Lin)
+
+ Ricardo Quesada
+
+ Huabin LING (@pandamicro)
+
+ Sijie Wang (@VisualSJ)
+
+ Long Jiang (@jianglong0156)
+
+ Menghe Zhang (@ZhangMenghe)
+
+Contributors:
+Name GithubID Main contribution
+
+Dali Kilani @dadilcool added instruction to read me
+
+Chris @hannon235 added node.js api for box2d
+ added SocketIO and SocketIO tests
+
+Jason Aeschliman @jaeschliman fixed cc.Node setposition
+
+Zhuoshi Sun(Intel) @sunzhuoshi engine loader fixed
+
+Alejandro Reyero @KaTXi fixed error message
+
+Long Xiang @seanlong resource loader count
+
+Timm Drevensek(Zynga) @timmjd cc.Class fixed
+ add CCScale9Sprite test
+
+Lzzy Chen @czizzy audio engine fixed
+ cleanup comments
+
+Mcscooter @mcscooter tilempapxml fixed
+
+Roed @roed Mouse rightclick api
+ Mouse scroll fix for firefox
+ cc.Screen bug fix
+
+Surith Thekkiam(Zynga) @folecr match Cocos2dx api
+
+Robert Boyd @rboyd fixed stackable actions
+
+Ivo Wetzel(Zynga Germany) @BonsaiDen Fixes for Audio Support Detection,
+ Texture Support in Particle System,
+ and Performance improvements
+
+Mario Adrian @many20 Code review, multi touch improvements,
+ ccbi bugs fixed
+
+keisuke hata(Square) @Seasons7 Code review, bug fix
+
+Marat Yakupov @moadib Various bug fixes
+
+Liang Wu @akira-cn Touch location fix for designResolution
+ ScrollView on paused bugs fix
+
+Jimmy Sambuo @jsambuo AudioEngine improvements
+
+Jose Antonio Andujar Clavell Scale9Sprite improvements
+
+TadeuszWlodarkiewic @TadeuszWlodarkiewic Tizen Compatibility
+
+smshuja @smshuja Parallax node bug fix
+
+rickms @rickms EGLView Optimizations
+
+Szymon Piłkowski @ardcore CCTexture Bug fix
+
+Tomasz Tunik @tomasztunik CCNode Memory leak fix
+
+Xuankang Lin(Intel) @AndriyLin cc.WebAudioEngine implements
+
+Kang-Hao Lu(Opera/Oupeng) @kennyluck Optimize John Resig's inheritance pattern
+ cc.clone improvements
+
+Mark Henderson @MarkEHenderson Code review, LabelTTF and Scale9Sprite bug fix
+
+Jing Wang @06wj CCScheduler improvements
+ Js file loading image add
+ cc.RectApplyAffineTransform improvements
+ Fixed a bug of cc.Node.setPosition that parameter check is incorrect
+
+Ze Wang @WanderWang Fix crash when BrowserTypes match nothing from navigator.userAgent
+ LabelTTF improvements
+ cc.TextureCache.dumpCachedTextureInfo 's bug fix
+ CCTween bug fix
+ CCScale9Sprite bug fix
+ sys.localStorage bug fix
+ CCArmature refactoring
+ cc.SpriteFrame and cc.SpriteFrameCache refactoring
+
+Christian Schwartz @cschwartz SpriteFrame.initWithTextureFilename converted fix
+
+XiaoJun Zheng @SmallAiTT _getResType error fix
+ cc.ScrollView bug fix
+ cc.LabelTTF bug fix
+ rewrite functions in CCNS.js with regex
+ refactor CCScheduler.js and CCCommon.js
+ cc.BMFontConfiguration bug fix
+ refactor cc.Application to cc.game
+ refactor cc.loader
+ refactor cc.Textur2D
+ refactor some functions about array operation
+ move sys.xxx to cc.sys.xxx
+ refactor some public functions in cc to private
+ add node.js scripts for publishing game
+ refactor cc.CCBReader
+ cc.view bug fix
+ multiple property object supports in extend function
+
+Guozhu Cheng @bengol cc.SimpleAudioEngine bug fix
+
+Jing Xiao @xbruce cc.SAXParser bug fix
+ cc.ActionManager refactoring
+ cc.Scheduler refactoring
+ cc.LabelTTF refactoring
+
+JiaHui He @garfield_ho cc.FileUtils bug fix
+ cc.Builder and SpriteLoader bugs fix
+ CCBAnimation bug fix
+
+Luis Parravicini @luisparravicini cc.Director refactoring
+ cc.LabelTTF documentation
+ typo fix
+
+Jose Antonio @jandujar cc.ParticleSystem bug fix for CocoStudio animations
+ SceneReader bug fix
+
+BoHao Tang @btspoony cc.TableView bug fix
+
+Claudiu @csaftoiu cc.LabelTTF bug fix
+ cc.DrawNode bugs fix
+ cc.NodeRGBA bug fix
+ cc.Texture2D bug fix
+
+Pei Wu @rablwupei cc.ProgressTimer bug fix
+ cc.ParticleBatchNode bug fix
+
+kuaipao @kuaipao CocoStudio GUIReader bug fix
+ CocoStudio UIScrollView bug fix
+ CocoStudio UIWidget bug fix
+
+XieDaijin @NijiadeIX CCControl bug fix
+
+samael @samael65535 CCPhysicsSprite bug fix
+
+NatWeiss @NatWeiss Add analytics plugin protocol ,Flurry plugin and ProtocolAds.js plugin protocol
+ cc.FileUtils refactoring
+ cc.Audio bugs fix
+ cc.Texture2D bug fix
+
+Andor Salga @asalga typo fix
+
+erykwalder @erykwalder Function.prototype.bind bug fix
+
+ZippoLag @ZippoLag cc.Application.getCurrentLanguage bug fix
+ typo fix
+ Fixed `cc.TMXObjectGroup#objectNamed` not returning the result bug
+
+Asano @LaercioAsano cc.Node bug fix
+
+Bruno Assarisse @bassarisse cc.LabelBMFont bug fix
+
+Mykyta Usikov @musikov cc.ClippingNode bugs fix
+ cc.fontLoader bug fix
+ Inverted ClippingNode with DrawNode as stencil bug fix under canvas render mode
+ JumpTo bug with wrong _delta position bug fix
+ cc.ProgressTimer bugs fix
+ cc.Scale9Sprite bugs fix
+ cc.RenderTexture bug fix
+ cc.ParticleSystem bug fix
+ Made CCProgressTimerCanvasRenderCmd to properly show colorized sprites
+ cc.ScrollView and cc.TableView: added check for parent visibility in onTouchBegan method
+
+Han XiaoLong @kpkhxlgy0 cc.ParticleSytem bug fix
+
+AaronRZH @AaronRZH Creation of a sequence objcet or a spawn object by using new method bug fix
+
+Xiaodong Liu @tianxing113 cc.Spawn.create bug fix
+ ccui.LoadingBar.setPercent crash bug fix
+
+Park Hyun Chen @sincntx Touch anywhere of screen to finish input when using cc.EditBox
+ ccui.TextBMFont bug fix
+ cc.game bug fix
+ Fixed an issue of cc.ArmatureAnimation's setMovementEventCallFunc
+
+Ninja Lau @mutoo A typo bug in UILayout fix
+ One-loop CCArmatureAnimation can't finish when setSpeedScale is less than 1.0 bug fix
+ A transform error in CCTransformHelp.js fix
+ ccs.DisplayManager bug fix
+ Fix child armature lost _parentBone issue
+ cc.eventManager bug fix
+ ccs.Bone bug fix
+ ccs.ActionFrame bug fix
+ ccui.Widget bug fix
+ ccui.LoadingBar bug fix
+
+Taras Tovchenko @tovchenko cc.Skin bounding box calculation bug fix under canvas render mode
+
+Minh Quy @MQuy cc.MenuItemSprite bug fix
+ Check empty string for textureData
+ Adds type check functions
+
+Michael Yin @layerssss cc.game refactored
+
+Yang Yuchen @yycdef cc.sys bug fix
+
+K @kiwigrc cc.ParticleSystem bug fix
+
+Claudio Freitas @claudiofreitas ccui.TextField typo fix.
+
+nopakos @nopakos cc.Texture2D bug fix
+
+Robert Rouhani @Robmaister cc.TMXMapInfo bug fix
+ cc.TMXLayer bug fix
+
+Igor Mats @IgorMats cc.Scale9Sprite bug fix
+ Spine runtime update
+ Add getStroke and setStroke method to cc.MotionStreak
+
+Tim @duhaibo0404 ccs.csLoader bug fix
+
+Hermanto @man2 cc.loader bug fix
+
+Long Jiang @jianglong0156 cc.LabelBMFont bug fix
+ KeyCode bug fix
+ ccui.ListView bug fix
+
+Joe Lafiosca @lafiosca Added Javascript file loader
+
+galapagosit @galapagosit ccs.actionManager bug fix
+
+Dany Ellement @DEllement cc.FontDefinition & ccui.RichText improvements
+ cc.LayerGradient improvements
+
+IShm @IShm cc.Screen bug fix
+ cc.ParticleSystem bug fix
+ ccui.PageView bug fix
+ Fixed crash when character not found into BMP font
+ Fixed restoring of sprite's color issue
+
+Thomas Jablonski @thomas-jablonski cc.audioEngine bug fix
+ Cocostudio typo fix
+
+WingGao @WingGao cc.TMXLayer bug fix
+
+Skliar Ihor @igogo5yo Add Bower support
+
+feijing566 @feijing566 cc.Audio bug fix
+
+RackovychV @RackovychV Fixed a bug of `cc.Scheduler`'s `pauseAllTargetsWithMinPriority`
+
+giuseppelt @giuseppelt Fixed TransitionSlideX callback sequence issue
+
+YShumov @pixmaster Fixed issue in music end event
+
+SPACELAN @spacelan Fixed `inverse` function bug of `cc.math.Matrix4`
+
+patriciog @patriciog Allowed timeline animations with only one frame
+
+Ningxin Hu @huningxin SIMD.js optimization for kazmath functions
+
+Zachary Lester @ZLester Fix typo in AUTHORS.txt
+
+Juan Carlos @Ruluk Fixed a bug where not resetting cc.Audio._ignoreEnded when replaying a sound caused it to stay in a "playing" state
+
+Maxim Litvinov @metalim Throw new Error object instead of error message string
+
+Retired Core Developers:
+ Shengxiang Chen (Nero Chan)
+ Xingsen Ma
+ Jialong Zhai (@JoshuaAstray)
+ Hao Wu (WuHao)
+ Dingping Lv (David Lv)
+
+Cocos2d-x and cocos2d-html5 can not grow so fast without the active community.
+
+Thanks to all developers who report & trace bugs, discuss the engine usage in forum & QQ groups!
+
+Special thanks to Ricardo Quesada for giving us lots of guidances & suggestions.
diff --git a/Base64Images.js b/Base64Images.js
new file mode 100644
index 00000000000..0d983506be8
--- /dev/null
+++ b/Base64Images.js
@@ -0,0 +1,32 @@
+/****************************************************************************
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+var cc = cc || {};
+
+cc._loadingImage = "data:image/gif;base64,R0lGODlhEAAQALMNAD8/P7+/vyoqKlVVVX9/fxUVFUBAQGBgYMDAwC8vL5CQkP///wAAAP///wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAAANACwAAAAAEAAQAAAEO5DJSau9OOvNex0IMnDIsiCkiW6g6BmKYlBFkhSUEgQKlQCARG6nEBwOgl+QApMdCIRD7YZ5RjlGpCUCACH5BAUAAA0ALAAAAgAOAA4AAAQ6kLGB0JA4M7QW0hrngRllkYyhKAYqKUGguAws0ypLS8JxCLQDgXAIDg+FRKIA6v0SAECCBpXSkstMBAAh+QQFAAANACwAAAAACgAQAAAEOJDJORAac6K1kDSKYmydpASBUl0mqmRfaGTCcQgwcxDEke+9XO2WkxQSiUIuAQAkls0n7JgsWq8RACH5BAUAAA0ALAAAAAAOAA4AAAQ6kMlplDIzTxWC0oxwHALnDQgySAdBHNWFLAvCukc215JIZihVIZEogDIJACBxnCSXTcmwGK1ar1hrBAAh+QQFAAANACwAAAAAEAAKAAAEN5DJKc4RM+tDyNFTkSQF5xmKYmQJACTVpQSBwrpJNteZSGYoFWjIGCAQA2IGsVgglBOmEyoxIiMAIfkEBQAADQAsAgAAAA4ADgAABDmQSVZSKjPPBEDSGucJxyGA1XUQxAFma/tOpDlnhqIYN6MEAUXvF+zldrMBAjHoIRYLhBMqvSmZkggAIfkEBQAADQAsBgAAAAoAEAAABDeQyUmrnSWlYhMASfeFVbZdjHAcgnUQxOHCcqWylKEohqUEAYVkgEAMfkEJYrFA6HhKJsJCNFoiACH5BAUAAA0ALAIAAgAOAA4AAAQ3kMlJq704611SKloCAEk4lln3DQgyUMJxCBKyLAh1EMRR3wiDQmHY9SQslyIQUMRmlmVTIyRaIgA7";
+
+cc._fpsImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAAgCAYAAAD9qabkAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLkQAQZzQyefcAAJO/+Y9AKwEAzZek4wAAvOgYXKiUF0zGCAAARKCBKrBBBwzBFKzADpzBHbzAFwJhBkRADCTAPBBCBuSAHAqhGJZBGVTAOtgEtbADGqARmuEQtMExOA3n4BJcgetwFwZgGJ7CGLyGCQRByAgTYSE6iBFijtgizggXmY4EImFINJKApCDpiBRRIsXIcqQCqUJqkV1II/ItchQ5jVxA+pDbyCAyivyKvEcxlIGyUQPUAnVAuagfGorGoHPRdDQPXYCWomvRGrQePYC2oqfRS+h1dAB9io5jgNExDmaM2WFcjIdFYIlYGibHFmPlWDVWjzVjHVg3dhUbwJ5h7wgkAouAE+wIXoQQwmyCkJBHWExYQ6gl7CO0EroIVwmDhDHCJyKTqE+0JXoS+cR4YjqxkFhGrCbuIR4hniVeJw4TX5NIJA7JkuROCiElkDJJC0lrSNtILaRTpD7SEGmcTCbrkG3J3uQIsoCsIJeRt5APkE+S+8nD5LcUOsWI4kwJoiRSpJQSSjVlP+UEpZ8yQpmgqlHNqZ7UCKqIOp9aSW2gdlAvU4epEzR1miXNmxZDy6Qto9XQmmlnafdoL+l0ugndgx5Fl9CX0mvoB+nn6YP0dwwNhg2Dx0hiKBlrGXsZpxi3GS+ZTKYF05eZyFQw1zIbmWeYD5hvVVgq9ip8FZHKEpU6lVaVfpXnqlRVc1U/1XmqC1SrVQ+rXlZ9pkZVs1DjqQnUFqvVqR1Vu6k2rs5Sd1KPUM9RX6O+X/2C+mMNsoaFRqCGSKNUY7fGGY0hFsYyZfFYQtZyVgPrLGuYTWJbsvnsTHYF+xt2L3tMU0NzqmasZpFmneZxzQEOxrHg8DnZnErOIc4NznstAy0/LbHWaq1mrX6tN9p62r7aYu1y7Rbt69rvdXCdQJ0snfU6bTr3dQm6NrpRuoW623XP6j7TY+t56Qn1yvUO6d3RR/Vt9KP1F+rv1u/RHzcwNAg2kBlsMThj8MyQY+hrmGm40fCE4agRy2i6kcRoo9FJoye4Ju6HZ+M1eBc+ZqxvHGKsNN5l3Gs8YWJpMtukxKTF5L4pzZRrmma60bTTdMzMyCzcrNisyeyOOdWca55hvtm82/yNhaVFnMVKizaLx5balnzLBZZNlvesmFY+VnlW9VbXrEnWXOss623WV2xQG1ebDJs6m8u2qK2brcR2m23fFOIUjynSKfVTbtox7PzsCuya7AbtOfZh9iX2bfbPHcwcEh3WO3Q7fHJ0dcx2bHC866ThNMOpxKnD6VdnG2ehc53zNRemS5DLEpd2lxdTbaeKp26fesuV5RruutK10/Wjm7ub3K3ZbdTdzD3Ffav7TS6bG8ldwz3vQfTw91jicczjnaebp8LzkOcvXnZeWV77vR5Ps5wmntYwbcjbxFvgvct7YDo+PWX6zukDPsY+Ap96n4e+pr4i3z2+I37Wfpl+B/ye+zv6y/2P+L/hefIW8U4FYAHBAeUBvYEagbMDawMfBJkEpQc1BY0FuwYvDD4VQgwJDVkfcpNvwBfyG/ljM9xnLJrRFcoInRVaG/owzCZMHtYRjobPCN8Qfm+m+UzpzLYIiOBHbIi4H2kZmRf5fRQpKjKqLupRtFN0cXT3LNas5Fn7Z72O8Y+pjLk722q2cnZnrGpsUmxj7Ju4gLiquIF4h/hF8ZcSdBMkCe2J5MTYxD2J43MC52yaM5zkmlSWdGOu5dyiuRfm6c7Lnnc8WTVZkHw4hZgSl7I/5YMgQlAvGE/lp25NHRPyhJuFT0W+oo2iUbG3uEo8kuadVpX2ON07fUP6aIZPRnXGMwlPUit5kRmSuSPzTVZE1t6sz9lx2S05lJyUnKNSDWmWtCvXMLcot09mKyuTDeR55m3KG5OHyvfkI/lz89sVbIVM0aO0Uq5QDhZML6greFsYW3i4SL1IWtQz32b+6vkjC4IWfL2QsFC4sLPYuHhZ8eAiv0W7FiOLUxd3LjFdUrpkeGnw0n3LaMuylv1Q4lhSVfJqedzyjlKD0qWlQyuCVzSVqZTJy26u9Fq5YxVhlWRV72qX1VtWfyoXlV+scKyorviwRrjm4ldOX9V89Xlt2treSrfK7etI66Trbqz3Wb+vSr1qQdXQhvANrRvxjeUbX21K3nShemr1js20zcrNAzVhNe1bzLas2/KhNqP2ep1/XctW/a2rt77ZJtrWv913e/MOgx0VO97vlOy8tSt4V2u9RX31btLugt2PGmIbur/mft24R3dPxZ6Pe6V7B/ZF7+tqdG9s3K+/v7IJbVI2jR5IOnDlm4Bv2pvtmne1cFoqDsJB5cEn36Z8e+NQ6KHOw9zDzd+Zf7f1COtIeSvSOr91rC2jbaA9ob3v6IyjnR1eHUe+t/9+7zHjY3XHNY9XnqCdKD3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAgcQLxxUBNp/AAAQZ0lEQVR42u2be3QVVZbGv1N17829eRLyIKAEOiISEtPhJTJAYuyBDmhWjAEx4iAGBhxA4wABbVAMWUAeykMCM+HRTcBRWkNH2l5moS0LCCrQTkYeQWBQSCAIgYRXEpKbW/XNH5zS4noR7faPEeu31l0h4dSpvc+t/Z199jkFWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhY/H9D/MR9qfKnLj/00U71aqfJn9+HCkCR/Wk36ddsgyJ/1wF4fkDfqqm9/gPsUeTnVr6a2xlQfnxdI7zs0W7irzD17Ytb2WT7EeNv/r4ox1O3Quf2QP2pgt9utwfout4FQE8AVBSlnaRmfvAURQkg2RlAbwB9AThlW5L0GaiKojhJhgOIBqDa7XaPrusdPtr5kQwF0BVAAoBIABRCKDd5aFUhRDAAw57eAOwAhKIoupft3zoqhB1AqLwuHIBut9uFt02qqvqRDJR2dAEQJj/BAOjn56dqmma+xiaECAEQAWAggLsB6A6HQ2iaZggBhBAqgEAAnQB0kzaEmT4hAITT6VQ8Ho/HJAKKECJQtr8LwD1y/A1/vcdfEUIEyfZ9AcQbYvZ942Px88L2UwlJR0dH0EMPPbRj5syZPUeNGrXR7Xb/641xIwJ1XY9NSUlZm52dfW+XLl1w8uRJzJ8//+OGhoYJqqqe1TSt1Wsm9NN1PSIqKmr12rVrR5WUlHy1bdu2AQCumWc3IYRD1/UwVVXnFRQUTIuNjUVzczN2797dWFJSkq8oymZd15sAGAEnFEUJ1nX9nzIzM1dnZmZGh4SE4OTJk5g5c+Zf29vbp9pstrMej6fVOyhIhgAYU1hY+B+hoaGoqKg4XVlZea+XTULTNFdCQsLGiRMnPuR2u3UhBOV9eeDAAWXTpk095DUe6WsoyRE5OTlr0tLSAux2O/bs2cO5c+e+pijKUpIXSHaQVAGkvPLKK++6XK4OksJLCFlXV2cvKSlJBFAjhU+x2WwhHo9nUHp6+urMzMy7wsLCUF9fjxdffPHjxsbGiTab7WuPx9NiEutOuq4PyMjI+M+srKyYqKgoHD58GDNmzNjq8XhyVFU9b/q+LH7hBAEYu3PnTlZVVRFAGgCX6f/tAHoOHDjwa0p27txp/JO9e/f+QM7cipw9nfL3kQBKt2zZQpJ87rnn6mQmoHilw2EACs+cOUOSrK+vZ1NTE0nyo48+IoBpxswoBcMJ4Ndjx471kOTFixe5d+9ekqTH42H//v13A4jyzpAURfEH0H/OnDnthu1z5sw558MmFUCPWbNmnaMP3nrrLZoyDmP8Hl68eDFJ8siRI9/Yc+zYMQKYKdtAztrTrl27xptRXV1NAKMAOAyBBBA/Y8aMdpLs6Ojgxx9//E37+++//29yvFXppwvAwMcee8xjtDHsuXLlCqOjo//ia3wsfpkoALqFhoZuIckJEyackimm3dQmEMDUmpoakmRISMhhAHOHDx/eQJIbN24kgKEyMAHAFRMTs2XXrl1saWkhSZ0kp0+ffhrAr3wEW/S8efOukORLL72kA1gKYMPWrVtJkk899dRJAHeYrgsEsIQkjx8/TgDvAPjd448/3kaSb7zxBmUa7vC6z53BwcFbSHL9+vU6Sc6aNes8gF5ewWAH0PfVV18lSQL4DMBGIcQ6AKtcLleBFC2jXtFt8ODBe0iyoqKCAJYByC8qKmJDQwOzsrK+MAmqo1OnTveHhoa+GRkZ+XZkZOSWiIiIvzgcjk9mzpypkWRmZuZpmbYbGV4AgPnNzc1sa2sjgN0A5iQmJtaSZHl5OQHcb/K3s81mW0uSTU1NBFAFYFbfvn1Pk+Tbb79NAA8IIVzW42/hByA+Pz/fLR/2ZXIda05NI/z9/TeR5J49ewhgqlxTrtI0jY2NjQQw3zTLuWJiYjaUlJToS5Ys6fjkk080kwDEeAmADcA9GzZsIElGRUW9CyAWwLApU6Y0kOSKFSsog9QICGdERMTGsrIyZmVlEcC9AB4IDw/fTpLbtm0jgN94CUAnAJmVlZVcs2aNZ/LkyRdJcvbs2b4EwAkgZfPmzTxw4AABFAN4BkC6vFeUSewcAO5duXIlSTIhIaEawGMAxgKYAmAGgCS73e5vrKVk/yGythANYEhCQsIhkly+fDkBpKqqGmL6DgIALDKN/3yZpVWQZGVlJQE8aPI3KiMjo5okV61aRQAjAPQBMPfIkSN0u90EUCBtsPiFEwpgbn19PdetW2fM5N4zQ9ekpKQqkty0aRMBpMjiWM6JEydIkoqirJUFJ6iq6pAPVy8A6cZMehMBUACEuVyuFwG8HBwcPEIWx367ZMkSjSQXLVrUJouTRorrkAHdA8BdQogsAOsKCwtJkmPGjDkvMw2bDDo/ADEjRoz4XylyFbm5uY0mAbjLyyZ/AOOrq6tZVlbWsWDBgo69e/eyoqKCgwcPPg4gSQaoIRbp27dvN7KF+tLSUr28vJwFBQXtMpvpYRIM7+wrAkDeqVOnePbsWQIoNKfzpiXPg8uXLydJJicnNwF4f+nSpW6STEtLq5fjYwhk1wkTJtSQ5Ouvv04AqTKj+N2xY8dIkgEBAW/Ie1v8wncRegwZMmQvSfbr12+3Ua33WqPfOWbMmP0kWVpaSgCDZAqcfejQIWNZsEGKgvnh9gfQb9myZd8nAEJVVZtMkUNk8CcNHTq0liR1XWdYWNhmH1mJIme80OnTp18x1rp5eXkEsNJms92Fb7e/IgEsvHz5Mp999tkmAI/l5uZeMC0B7vEqqAYAyL106RJJsra2lpWVld+sucePH38ZQG+5NncBeOrgwYMkqbe3t/Po0aOsra011wAWyl0H7x0JJ4DE+fPnu0kyPT29DsDdUrBuyNKEEAkAdpw/f/6GeoEM8GUmfwEgPCIiopwkGxsbabPZPgOw6L777vvm4p49e26VGYjFLxUhhD+ApLKyMp44ccIoVnXybgbgzkcfffRzklyzZg0BDJYCMMmoCwQFBXkLgLGWvvcWAgBToSsKwNPTp09vMR7UuLi4rwH0lgU8c/Db5ezbeeTIkRWzZ8++aMxu+fn5BPCADBwHgP4LFy701NXVEUAJgAnPP/98kyxMNgHo53A4zH77BQQETMvPz7+Um5vbBuAlAFMSExPPmdbVL0qh8Acw8fDhw5SCchVAEYAVb775JknyhRdeaJYztHfxMwLAaqNwCGC2FArv8x0hAHKNLGPKlCme5OTk/Zs3bzb7O0wKiiG8KXl5ed8IxenTp0mSR48e1UmyW7duWywBuD2xyQcgFECgoih+8H1gyJgZV5Lkyy+/3CbTRIePtl2HDBmyw1QBHyGDdXZdXR1JUghRKkXBjOMHCoBdpr0L3nvvPZLkF198wejo6O0A4lVVDTb74HQ6AwD8Wq7Jh8rgGgDgQ13XjVR8qaxJuADMbmlpYXl5uV5UVNRWUFDgfv/993Vj/ZydnU1c37eHXML4S3viAcQqitJD2l104cIFY8lTKsXSBWBMVVWVcd9yed2A1NTUQ6Zl00CvLMMOoHdubm6zFIlWOf5+PsY/Kj09vdrU11QAwwGsv3jxIk21m2DZr10I0RXAuAcffPBgaWkpV69eTYfDcdiwUxY0w6xw+flX8L1xApjevXv3lREREaW6rofB93aPDUDQpEmTMgHgtddeqwBwEd/utZvpqK6uPgEAcXFxkA94NwB9unfvjrNnz4LklwDcf08iIqv66Zs2bXrl4YcfxooVKxAbG7uqrq5uAYA2TdOEqqpGYIi2tjbl6aeffu/YsWPv5uTk7JaC1wHg4Pnz542MwoVvTx+21dbWYvjw4WLixIl+2dnZ9lGjRgmSTE1NRUpKCkwFTGiaxtTU1OXTpk3707Bhw/6g67pDipnT4biuj7qut+Lbk3Vf1tTUXI9qu91Pjq1QFEUBgJaWFgBo8yGOQ8eNGxcAAOvXr/8QwBUfYygAKL169eoCABcuXACAWtn2hOGv0+kMNO1KiPDw8F4A4rZv3/7R1KlTR0+bNu1ht9u9r1+/fqitrQXJgwDarRC6/QjPzs4+QJIffPCB9/aQmSAA43ft2mW0e1QGoi8CAPyLsZccExNTC2BlRkbGRdOyYJCP2csBIN6UAZzCd7cBbQCijYp/dXU1ExMTz6SmptaMHj36f9LS0vYlJCRsl6mxIWSdu3fv/g5J7t+/nwC2AShMTk6+SJKff/45AWRLYbD7+fndAeDf5BJnLoCCyZMnt5JkdnZ2C4B/F0KEm1Pu+Pj4rST55ZdfEsBWAK+mpaVdMo3raDn7KwDuSEpK+m+S3LBhAwG8DuCtHTt2UBbpjgC408vvcFVV15HkuXPnjMp+p5uMf0RcXNyHJNnQ0EBVVfcCWBQXF3fG+Jv0yxABPwB5LS0tRmFxN4BlTzzxxGWSXLx4sS5F3GGFy+1Hp5SUlJq6ujoWFxdTpsZ2H+0iIyMj/0iSWVlZX5mr5jfJFroPGzasxlhTnjp1iiTZ3NxMl8tlrCd9pfa9SkpKSJI5OTmnZOageLUZZqxvfVFWVkZcPwdgNwnSCKPqb17jkmR8fPzfZMDZ5CRsFBmNI7h95s2b1yhT7/MAYmStwCx4vy0uLqa3v5qmEcCfvSr1QQAeXb16NY3Cm3HQ55133iGAp+SxZTNhKSkpfzUddkrFjYevzAQCeGjp0qXfsYckY2NjTwD4leGDLCL2HTdunNtoY+zWSHFcIHdsFCtcfuZ1vO9Eqs3m7/F47sb1k2qX/f3997W2tl7BjWfpBYDOzzzzzIVJkyZh0KBBCwEsB3AJvl9AETabLcDj8dwRFRW1ctasWb8JCgpSzp07d62wsPC/Wltb8xRFadR1/ZqPXYbgAQMGbI2Pjw/+6quv9ldVVT0r01ezuPRJSUn5Y9euXXVd11WzDaqq6kePHm3+7LPPRgO4KlNuxWazhXo8nuTk5OSXMjIyEl0uFxoaGtqKior+dPXq1VdUVT0jj7r68ieoT58+vx8yZMjdx48fP1JVVTVF9m20VW02WyfZf97YsWPjXS4X6urqWvPy8jYCWCyEuEDS8FdVFKWzruv//OSTTy5OTk7uqWkaPv3007qysrJ8RVH+LI8ym8/rB3Tu3HnRI488knLo0KG2ffv2ZQI4C98vP6mqqoZqmpaclpa2cOTIkX39/f3R0NDQUVxc/G5TU9PLqqrWa5rWLH1QVFUN0TStX1JSUvH48eP7BwYG4uDBg1cKCgpeBbBe2u+2Qug2EwD5N5sMPuNtMe8XP4TT6Qxoa2sbIGeXvUKIK7d4IISiKC5d1wPljOfA9bPwzYqiXNV13dd6Uqiq6qdpml2mpe02m63d4/G4vcTF5fF47LJf71nJA6BZVVW3pmntuPHlmAD5wk6Q9NnbHp9vHaqq6tA0zU/64PZhk1FfCZB9G/23ALiqKEqzD39tpvbGUqoFwFUhRLP3yzpCCDtJpxyXDulfG27+pqRR3DXsUWVd4Yq0x/taVQjhIhksC8L+ABpM9ljBf5sKwI8pIBr75L5E4vvu+UNeG/a+hv+AL7yFH8qPtOfHjtOP6V/Bja8D6z/B2Nys/1u9Xv33tLf4GfF/LC4GCJwByWIAAAAASUVORK5CYII=";
+
+cc._loaderImage = "data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAlAAD/4QMpaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjAtYzA2MCA2MS4xMzQ3NzcsIDIwMTAvMDIvMTItMTc6MzI6MDAgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjM4MDBEMDY2QTU1MjExRTFBQTAzQjEzMUNFNzMxRkQwIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjM4MDBEMDY1QTU1MjExRTFBQTAzQjEzMUNFNzMxRkQwIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzUgV2luZG93cyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU2RTk0OEM4OERCNDExRTE5NEUyRkE3M0M3QkE1NTlEIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU2RTk0OEM5OERCNDExRTE5NEUyRkE3M0M3QkE1NTlEIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+/+4ADkFkb2JlAGTAAAAAAf/bAIQADQkJCQoJDQoKDRMMCwwTFhENDREWGhUVFhUVGhkUFhUVFhQZGR0fIB8dGScnKionJzk4ODg5QEBAQEBAQEBAQAEODAwOEA4RDw8RFA4RDhQVERISERUfFRUXFRUfKB0ZGRkZHSgjJiAgICYjLCwoKCwsNzc1NzdAQEBAQEBAQEBA/8AAEQgAyACgAwEiAAIRAQMRAf/EALAAAAEFAQEAAAAAAAAAAAAAAAQAAgMFBgcBAQEAAwEBAAAAAAAAAAAAAAAAAQMEAgUQAAIBAgIEBwoLBgQGAwAAAAECAwAEEQUhMRIGQVFxsTITFGGBwdEiQlKSMzWRoeFicqKyI1NzFYJjJDQWB9KjVCbxwkNkJWXik3QRAAIBAgMFBQcDBQEAAAAAAAABAhEDIRIEMUFRcTJhwVIUBZGhsSJyEzOB0ULhYpIjUxX/2gAMAwEAAhEDEQA/AMJSpUqAVKlXuFAeUq9wpUB5XuFe4V6ooDzZHDox0CnGMinzwl7Z8NajaHeoO3vmTBZBtp9YUIqTEV5ROxHKnWRnaU8VRMhFBUjpV7hSoSeUq9pUB5Sr2lhQHlKvcK8oBV7hSFSRrtaKAZs07YNPM1pG2xJIAw1jSeandry/8X4m8VCKkWwaWwam7Xl/4v1W8VLtmX/i/VbxUoKkWwakSM407tmX/i/VbxUmzGwjQsjdY41IARie/U0IbZO0kNtCXnOCkEBeFu4KI3Bs7DNb27ya+jDx3kJeEnpJJEcQVbWDsk17u5urd591ucZkWhym2Vnd9RkCDEpFxDRpbw0bunu5mlp2De2FMLYXOD2wB2xbOeraUcYGJ72mlSUiqzzdzMd3Z3mixltA2yzcK/NlHM1DQyRXce1HocdNOEfJXZ88y9ZojOqhiBszIRiHQ8Y4cK5TvHuzLljHNMqxNoDjLFraHHnjPxcNCGVbxEUzYNTx5jZSxhpW6qTzlwJ+DCvO2Zf+L9VvFSgqyHYNLYNTdssPxfibxUu15f8Ai/VPiqCakOwa82DU/a8v/F+JvFTDdWPBL8R8VKCvYRYV5UzoMAy6QdIIqI0B4KJtxiRQwou16QoGUkntH5Tz0RbZbmF2hktraSVBo2lUkY8tDye0flPPXTslVUyiyVRsjqUOA4yMT8dW2ram2m6UVTNq9S7EIyUVJydMTn/6DnP+im9Wl+g5z/opvVrpteEhQWY4AaSTwAVf5WPiZh/9S5/zj7zltzlmYWkfWXNvJDGTgGcYDHirR7i7mSbwXParsFMrgb7w6jKw/wCmnc9I14kF3vpvCljbMyWMOJL4aEiB8qU/ObUK7HYWVrl1pFZWiCOCBQqKOLjPGTrNZZqKbUXVHq2nNwTuJRk1VpbgXN8s7Rk5ym0UQQzhIG2NAjhxHWbI+gCBVjBBFbwxwQqEiiUJGg1BVGAFe7dV28WYLYZFmF2Th1UD7JGjymGyn1iK5OyzIBGB1HgrLZhamzumQAGJwSqnSCh1q3GOCodxt4cxurdcpzuN4cyhiWaF5Bg09udUmnWw1H/jV9nFuJ7Quo+8h8peThFA+047vduyMtk7fYqTl07YFdfUufMPzT5p71UdtlmYXaGS2t3mQHAsgxANdadYJopLe4QS2867EsZ4QfCNYrCFbjdDPmgkYyWFxgVf04ifJf6ScNdRUW1XBb6FU5TjF5EpSSrGu/s5lN+g5z/opvVpfoOc/wCim9WtdHnatvObJXDW7xLGhB8nrPaY9/HCr+tEdPCVaSeDoYLnqF63lzW4/PFSW3ecxbI84VSzWUwUaSdg0DXXK5nvAipnd6qgKvWnQO7pri9ZUEmm3Vl2j1kr8pRlFRyquBNZjGxQ/S56Y1S2fu9OVueon11Szahoou06QoQUXadIVCD2FJJ7R+U89dMydv8Axdn+TH9muZye0flPPXQstlK5Tbka1gUjlC1q0vVLkeb6r+O3Tx9xcY1nt8c0NrZCyiOE1108NYjGv1joo7Js1jzKyScYLIvkzL6LDwHXVJksH9Sb49dKNq0tj1jA6uriOCL+02FWX7iVtZX1/AzaHTyeoauKn2MX9W79zebiZCuR5MjSrhfXuEtwTrUeZH+yNfdrRNcxI6IzhXlJEak6WIGJ2Rw4ChWnChndtlVBLMdQA0k1gbXNMzzDfDLs6mjaPKppJbWwJ1bOwwxw43OnHh71YT3DpfWUJmFlb5jHHDdeXBHIsrRea5TSqvxqG04cNN62vetoCS4tre5mgnkGE9q+3DKOkuI2WX6LDQRRHWDh1UCtwj7QRg2wdl8Djgw1qe7XvW0BQ3kfZ7mSLgU+T9E6RVbnuVrnWVSWqj+Lt8ZbRuHEdKPkYVcZ2MJY5fSGyeVar45+rkWQHAqccalPE5km1htWK5nK4Wnt5FuUBUwOMG4nGkA/BXUrW4S6torlOjMgcd/xVn7rLo7zKs0uEjCNeSvdwoBhgsZxX1l2j36k3Lu+uyprdj5Vs5A+i/lD48a0aaVJOPi7jB6lbzWozpjB48pf1NDXNN4vfl7+Z4BXS65pvF78vfzPAK71XTHmZ/S/yT+jvJ7L3fHytz1E+upbL+Qj5W56jfXWRnsIYKLtekKEFGWvSFQgyjk9o/Keet3YthlMP/5x9msJJ7R+U89biyb/AMXEv7gD6tadL1T+kwepRrC39ZkLDMbiwMvUHRPG0bjlGg8ore/23sxBldxfMPLupNhT8yL/AORNZbdzJ484scytxgLqJY5LZj6Q2sV5G1Vud1mjjyG0ij0NEGSZToKyhjtqw4waztuiXA3qKTbSxltfGhbZlE95ZtZqxVbgiOZhrER9ph3Svk9+pJILZ4Y4DGBFCUMKjRsGPobPFhUfW0NJmljE2xJcIrcI2vFUEln1lRXd6lrazXT9GCNpD+yNqoI7mOVduNw6nzlOIoPOUa6yye1XXcbMR5GdQ3xY0BSbj31/FcTQZirJ+q431q7anbHCTZ72Bw7lbPrKBMcBWNNgbMBBh+bsjBdni0VJ1lARZs6yWiupxCuMDy6KpS2IwOo6DTr3Mre3e5tZZVUM4ZBjqOOJoWO4jkXajcOOMHGgDISvWIrdAkKR80+TzVl908bPPL3LzxOuHdifxVfiTAg92qI/w+/8gGgSyN/mR7XPVlp0lF/3L3mbVKtu5Hjbk/8AHE2Fc03i9+Xv5ngFdKNc13i9+Xv5ngFaNV0x5nn+l/kn9HeEWXu+PlbnqJ9dS2Xu9OVueon11kZ7CGCjLXpCgxRlr0hUIPYUcntH5Tz1s8vb+Bt1/dqPirGSe0flPPWusG/g4Py15q06XqlyMWvVYQ+ruI9xJOqzO9hOto/sP8tbGOFIrmWeM7IuMDMnAXXQJOUjQeOsJk0nY96ip0CYunrjaHx1t+srPJUbXBm2LrFPikwTOb+T+VhbZxGMrDXp83x1QSy2tucJpUjPETp+Cn5/ftaRvKvtp3Kx48HG3erHMzOxZiWZtLMdJNQSbbL71Vk6yynViOkqnEEfOWtPbXi3EQkGg6mXiNckjeSJxJGxR10qw0GtxuxmvbImD4CZMFlA4fRfv0BqesqqzTMZNMEDbIHtHH2QeCiZJSqMQdOGiue53mz3czQwsRbIcNHnkec3c4qAMuriz68gTIToxwOOnlp0MjxMJYW741Gs3RVldtbygE/dMcHX/moDaxTiWNZB53B3arb8/wC+4SOF4sf/AKxU9kcBsfOGHfoUHtG/RbzY5Die5HHhXdvavqiZ9Q8Jdlq4/gbKua7xe/L38zwCuhpf2Uk/Zo50kmwJKIdogDjw1VzzeL35e/meAVp1LTgqY4nn+mRauzqmqwrjzCLL3fHytz1E+upLL+Qj5W56jfXWRnroYKLtekKEFF2vSFQg9hSSe0flPPWosm/hIfoLzVl5PaPynnrRWb/w0X0F5q06XqlyM2sVYx5gmbFre/t71NY2T+0h8VbSO5SWNJUOKSAMp7jDGspmMPaLRlXS6eWve1/FRO7WYdbZm1Y/eW/R7qHxHRXGojlm3ulid6aVbaW+OALvgCLq2Hm9WxHKWqjhj6xsK1e8dm15l4niG1LZkswGsxtrPeOmsvayBJA1VItlWjptLuTdPMo7LtjRDq9naK4+WF9IrUW7BaHOljGqVHB7w2hzVoZt87d8vaNYSLl02CcRsDEbJbj71Uu7UBkvJ7/D7q2QoDxySaAO8MTXdxRVMpRp5XZOWdF/ms7R5XdyKfKWJsO/5PhrG5XlNxmEywW6bTnTxAAcJNbGSMXkM1pjgbiNo1PziPJ+Os7u7m/6ReM00ZOgxSpqYYHT3wRXMKN4ll9zUG4bQfNshu8sZVuEA2hirA4qe/VOwwrVbzbww5mI44UKRRYkbWG0S3JWctbd7u5WFfOOLHiUdJqmaipfLsIsObhWe001lMkMVvJNjhghIALMcBxCs7fxXQmkupx1bXDswGPlaTidVaEyKNXkoo4eBV+Sq7L7Vs9zcBgeyQ4GQ/MB1crmoim2orezqcowTuSeEY48jQ7oZX2PLzdyLhNd6RjrEY6I7+uspvH78vfzPAK6UAAAFGAGgAcArmu8Xvy9/M8ArTfio24RW5nnaG67uou3H/KPuqT2X8hHytz1G+upLL3enK3PUb66ys9RDBRdr0hQgou06QqEGUkntH5Tz1e238vF9BeaqKT2j8p56vbb+Xi+gvNWjTdUuRn1XTHmTh8KrJTJlt8t1CPIY44cGnpJVjTJYkmjaN9Ib4u7V923njTethRauZJV3PaW1rfLIiXEDYg6R4VYc9CXW7thfOZbKdbGZtLW8uPVY/u3GrkNUkM9zlcxUjbhfWOA90cRq4gv4LhdqN+VToNYWmnRm9NNVWNTyHc6VWBv8wt4YeHqm6xyPmroq1Z7WGFLSxTq7WLSuPSdjrkfumq5yHXDUeA92oO2SKpVumNAaoJLMXH3myp0rpJ4uKhc3tbDM5BMri1zAj79j7KTiY8TcdBpcsith0286o+sPCagEX9Pzg4zXUCp6QYse8oouCG3tk6m1BYv05W6T+IdyolxbHDAAa2OgDlNCz3ryN2WxBd5PJMg1t81eId2ukqnLlTBbfcuY+9uJLiRcvtPvHdsHK+cfRHcHDWsyawjyy0WBcDI3lTP6TeIcFV+S5OmXx9bJg1048o8Cj0V8Jq2DVu09nL80up7OxHi+oal3P8AXB/IsZS8T/YOV65zvCcc7vfzPAK3ivWCz445zeH954BXOr6I8yfSfyz+jvCLP3fHytz1G+upLP3fHytz1E+usbPaQ0UXadIUIKLtekKhB7Ckk9o/Keer22/l4/oLzVRSe0flPPV7b/y8X0F5q0abqlyM+q6Y8yQsBTDMor1o8aiaE1pbluMqS3sbLLHIhSRQyngqukhaJ9uBjo+H5aOa3ao2t34qouRlLajTalGP8v0IY8ylXQ+PKPFU/bYXOLPge6CKia0LaxTOxHu1Q7cuBd9yPEJ7TbjXKO8CajbMIF6CNIeNvJHjqIWJ7tSpYkalqVblwIdyG+RGXur0hXYJFxal+Dhq5y3slkv3Y2pD0pTr+QUClpJRUdo9XW4OLrTHtM16cZLLWkeC7y4jvlNEpcRtw1Ux27Ci448NZrTFy3nn3IQWxlgGrDZ3pza7/M8ArZo+ArF5171uvp+CqdV0R5l/psUrs2vB3hdl7vTlbnqJ9dS2Xu+PlbnqJ9dY2eshooq16QoQUXa9IVCD2FLJ7RuU89WNtmUSQqkgYMgw0accKrpPaPynnrZWG4Vi+VWmY5tnMWXG+XrIYnA0rhj0mdcTgdNdwnKDqjmduM1SRR/qlr8/4KX6pa8T/BVzDuLZXudRZblmbxXcPUNPc3KqCIwrbOzgrHEnHjoyD+3eSXkht7DeKG4umDGOJVUklfouThXfmbnZ7Cvy1vt9pmv1W1+d8FL9VteJvgq5yrcOGfLmzHN80iyyETPbptAEFo2ZG8pmUa1OFNn3Ky6W/sbDKM5hv5bx2WTZA+7RF2y52WOPJTzE+z2Dy1vt9pT/AKpacTerS/U7Tib1a04/t7kDXPY03jhN0W6sQ7K7W3q2dnrMccaDy/8At80kuZfqWYxWNtlcvUPPhiGYhWDeUy7IwYU8xPs9g8tb7faUn6pacTerTxm9oOBvVq3v9z927aynuId44LiWKNnjhAXF2UYhRg516qpsryjLr21665zFLSTaK9U2GOA87SwqY37knRU+BzOzags0s1Oyr+BKM6sxwP6tSDPLMen6vy0rvdm3Sxlu7K/S7WDDrFUDUTxgnTU826eXW7KlxmqQuwDBXUKcD+1Xee/wXuKX5XDGWLapSVcOyhEM/seJ/V+WnjeGx4pPV+Wkm6kKZlFay3Jlt7iFpYZY8ASVK6DjtDDA0f8A0Tl340/1f8Ndx8xJVWXB0KbktFFpNzdVXAC/qOwA0CQni2flrO3Vwbm5lnI2TKxbDirX/wBE5d+NcfV/wVR7xZPa5U9utvI8nWhmbbw0YEAYYAVxfhfy5rlKR4Fulu6X7mW1mzT8S4Yis/5CPlbnqJ9dSWfu9OVueon11mZvQ2i7XpChKKtekKhBlNJ7R+U89bDfGTb3a3ZX0Lcj6kdY+T2j8p560288m1kWQr6MJ+ylSAr+2cnV5renjs3H1loX+3j9XvbbtxLN9lqW4UnV5jdnjtXHxihtyZNjeSBu5J9k1BJe7xy7W5CJ/wCzuD/mTVTf2+fq97LJuLrPsNRueS7W6aJ/38x+vLVXuY+xvHaNxbf2GoCezf8A36j/APsSf8w1sLnqczTefJluYoLm5uo5F61sBshItP1cNFYe1f8A3ir/APfE/wCZUe9bB94r5jwuPsrQFhmG4l/Z2M17HdW90tuu3IkTHaCjWdIw0VVZdks9/C06yJFEp2dp+E1bbqybGTZ8vpQD7L1XRv8A7blT96Oda7tpNuuNE37Cq9KSisjyuUoxrStKllHbLlWTXsMs8chuSuwEPDqwoLe5y+YRE/gLzmqRekvKKtd4327yM/ulHxmrHJStySWVRyrjxKI2XC/CTlnlPPKTpTdFbP0L1bgrf5Lp0G3dPhQHwV0S1lzBsns3sESR8Crh9WAJGjSOKuU3E+zdZQ3oJh8IArdZXFDmOTpHa3i2+YrI2KtKy4ricBsBuHHgFXSo440+Wa2qqxjvM9uMoy+WvzWpLCWWWE28HxL6e43ojgkeSCBY1Ri5BGIUDT51cl3vm276BBqSEH4WbxV0tlkyXJcxTMb+OW6uY9mGHrCzDQwwAbTp2uKuTZ9N1uYsfRRR8WPhrm419mSSjRyiqxVK7y23B/ftuTm2oSdJyzNVw3BFn7vTlbnqF9dS2fu9OVueon11lZuQ2iLdsGFD05H2dNQGV0ntG5Tz1dWm9N1b2kVq8EVwsI2UaQaQOKhmitZGLOmk68DhSFvY+gfWNSAg7z3Qvo7yKCKIohiaNR5LKxx8qpxvjcqS0VpbxvwOAcRQPZ7D0G9Y0uz2HoH1jUCpLY7zXlpbm3eKO5QuzjrBqZji3x17PvNcyT288VvDBJbMWUovS2hslW7mFQ9nsPQPrGl2ew9A+saCod/WNxtbYsrfb17WBxx5ddD2281xC88klvDcSXEnWuzrqOGGC9zRUPZ7D0G9Y0uzWHoH1jQVCLreq6ntZbaO3it1mGy7RjTs1X2mYy20ZiCq8ZOODcdEdmsPQb1jS7PYegfWNdJuLqnQiSUlRqpFLmryxtH1Ma7Qw2gNNPOdSt0oI27p007s9h6B9Y0uz2HoH1jXX3Z+I4+1b8IJdX89xLHKQFMXQUahpxoiPN5P+onfU+A0/s9h6DesaXZ7D0D6xpG7OLbUtu0StW5JJx2bBsmbtiSiEk+cxoCWWSaVpZOk2vDVo0VYdnsPQb1jSNvZcCH1jSd2c+p1XAmFqEOmOPEfaH+BQd1ueo211IzrgFUYKNAAqI1WztCpUqVCRUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoBUqVKgFSpUqAVKlSoD/9k=";
diff --git a/CCBoot.js b/CCBoot.js
new file mode 100644
index 00000000000..e9eb020bc1b
--- /dev/null
+++ b/CCBoot.js
@@ -0,0 +1,343 @@
+/****************************************************************************
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2015 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ * The main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace
+ * @namespace
+ * @name cc
+ */
+var cc = cc || {};
+cc._tmp = cc._tmp || {};
+cc._LogInfos = cc._LogInfos || {};
+
+var _p = window;
+/** @expose */
+_p.gl;
+/** @expose */
+_p.WebGLRenderingContext;
+/** @expose */
+_p.DeviceOrientationEvent;
+/** @expose */
+_p.DeviceMotionEvent;
+/** @expose */
+_p.AudioContext;
+if (!_p.AudioContext) {
+ /** @expose */
+ _p.webkitAudioContext;
+}
+/** @expose */
+_p.mozAudioContext;
+_p = Object.prototype;
+/** @expose */
+_p._super;
+/** @expose */
+_p.ctor;
+_p = null;
+
+/**
+ * Device oriented vertically, home button on the bottom
+ * @constant
+ * @type {Number}
+ */
+cc.ORIENTATION_PORTRAIT = 0;
+
+/**
+ * Device oriented vertically, home button on the top
+ * @constant
+ * @type {Number}
+ */
+cc.ORIENTATION_PORTRAIT_UPSIDE_DOWN = 1;
+
+/**
+ * Device oriented horizontally, home button on the right
+ * @constant
+ * @type {Number}
+ */
+cc.ORIENTATION_LANDSCAPE_LEFT = 2;
+
+/**
+ * Device oriented horizontally, home button on the left
+ * @constant
+ * @type {Number}
+ */
+cc.ORIENTATION_LANDSCAPE_RIGHT = 3;
+
+/**
+ * drawing primitive of game engine
+ * @type {cc.DrawingPrimitive}
+ */
+cc._drawingUtil = null;
+
+/**
+ * main Canvas 2D/3D Context of game engine
+ * @type {CanvasRenderingContext2D|WebGLRenderingContext}
+ */
+cc._renderContext = null;
+cc._supportRender = false;
+
+/**
+ * Main canvas of game engine
+ * @type {HTMLCanvasElement}
+ */
+cc._canvas = null;
+
+/**
+ * The element contains the game canvas
+ * @type {HTMLDivElement}
+ */
+cc.container = null;
+cc._gameDiv = null;
+
+cc.isEditor = typeof Editor !== 'undefined';
+
+/**
+ * Iterate over an object or an array, executing a function for each matched element.
+ * @param {object|array} obj
+ * @param {function} iterator
+ * @param {object} [context]
+ */
+cc.each = function (obj, iterator, context) {
+ if (!obj)
+ return;
+ if (obj instanceof Array) {
+ for (var i = 0, li = obj.length; i < li; i++) {
+ if (iterator.call(context, obj[i], i) === false)
+ return;
+ }
+ } else {
+ for (var key in obj) {
+ if (iterator.call(context, obj[key], key) === false)
+ return;
+ }
+ }
+};
+
+/**
+ * Check the url whether cross origin
+ * @param {String} url
+ * @returns {boolean}
+ */
+cc.isCrossOrigin = function (url) {
+ if (!url) {
+ cc.log("invalid URL");
+ return false;
+ }
+ var startIndex = url.indexOf("://");
+ if (startIndex === -1)
+ return false;
+
+ var endIndex = url.indexOf("/", startIndex + 3);
+ var urlOrigin = (endIndex === -1) ? url : url.substring(0, endIndex);
+ return urlOrigin !== location.origin;
+};
+
+/**
+ * A string tool to construct a string with format string.
+ * for example:
+ * cc.formatStr("a: %d, b: %b", a, b);
+ * cc.formatStr(a, b, c);
+ * @returns {String}
+ */
+cc.formatStr = function(){
+ var args = arguments;
+ var l = args.length;
+ if(l < 1)
+ return "";
+
+ var str = args[0];
+ var needToFormat = true;
+ if(typeof str === "object"){
+ needToFormat = false;
+ }
+ for(var i = 1; i < l; ++i){
+ var arg = args[i];
+ if(needToFormat){
+ while(true){
+ var result = null;
+ if(typeof arg === "number"){
+ result = str.match(/(%d)|(%s)/);
+ if(result){
+ str = str.replace(/(%d)|(%s)/, arg);
+ break;
+ }
+ }
+ result = str.match(/%s/);
+ if(result)
+ str = str.replace(/%s/, arg);
+ else
+ str += " " + arg;
+ break;
+ }
+ }else
+ str += " " + arg;
+ }
+ return str;
+};
+
+require('../cocos2d/core/utils');
+require('../cocos2d/core/platform/CCLoader');
+require('../cocos2d/core/platform/CCSys');
+
+require('../cocos2d/core/CCGame');
+
+
+//+++++++++++++++++++++++++Engine initialization function begin+++++++++++++++++++++++++++
+(function () {
+
+var _jsAddedCache = {}, //cache for js and module that has added into jsList to be loaded.
+ _engineInitCalled = false,
+ _engineLoadedCallback = null;
+
+cc._engineLoaded = false;
+
+function _determineRenderType(config) {
+ var CONFIG_KEY = cc.game.CONFIG_KEY,
+ userRenderMode = parseInt(config[CONFIG_KEY.renderMode]) || 0,
+ shieldOs = [cc.sys.OS_ANDROID],
+ shieldBrowser = [];
+
+ // Adjust RenderType
+ if (isNaN(userRenderMode) || userRenderMode > 2 || userRenderMode < 0)
+ config[CONFIG_KEY.renderMode] = 0;
+
+ // Determine RenderType
+ cc._renderType = cc.game.RENDER_TYPE_CANVAS;
+ cc._supportRender = true;
+
+ if ( userRenderMode === 2 ||
+ ( userRenderMode === 0 &&
+ shieldOs.indexOf(cc.sys.os) === -1 &&
+ shieldBrowser.indexOf(cc.sys.browserType) === -1 )) {
+ if (cc.sys.capabilities["opengl"]) {
+ cc._renderType = cc.game.RENDER_TYPE_WEBGL;
+ cc._supportRender = true;
+ }
+ else {
+ cc._supportRender = false;
+ }
+ }
+ if (userRenderMode === 1
+ || (userRenderMode === 0 && !cc._supportRender)) {
+ if (cc.sys.capabilities["canvas"]) {
+ cc._renderType = cc.game.RENDER_TYPE_CANVAS;
+ cc._supportRender = true;
+ }
+ else {
+ cc._supportRender = false;
+ }
+ }
+}
+
+function _getJsListOfModule(moduleMap, moduleName, dir) {
+ if (_jsAddedCache[moduleName]) return null;
+ dir = dir || "";
+ var jsList = [];
+ var tempList = moduleMap[moduleName];
+ if (!tempList) throw new Error("can not find module [" + moduleName + "]");
+ var ccPath = cc.path;
+ for (var i = 0, li = tempList.length; i < li; i++) {
+ var item = tempList[i];
+ if (_jsAddedCache[item]) continue;
+ var extname = ccPath.extname(item);
+ if (!extname) {
+ var arr = _getJsListOfModule(moduleMap, item, dir);
+ if (arr) jsList = jsList.concat(arr);
+ } else if (extname.toLowerCase() === ".js") jsList.push(ccPath.join(dir, item));
+ _jsAddedCache[item] = 1;
+ }
+ return jsList;
+}
+
+function _afterEngineLoaded(config) {
+ cc._initDebugSetting(config[cc.game.CONFIG_KEY.debugMode]);
+ cc._engineLoaded = true;
+ cc.log(cc.ENGINE_VERSION);
+ if (_engineLoadedCallback) _engineLoadedCallback();
+}
+
+function _load(config) {
+ var self = this;
+ var CONFIG_KEY = cc.game.CONFIG_KEY, engineDir = config[CONFIG_KEY.engineDir], loader = cc.loader;
+
+ if (cc._Class) {
+ // Single file loaded
+ _afterEngineLoaded(config);
+ } else {
+ // Load cocos modules
+ var ccModulesPath = cc.path.join(engineDir, "moduleConfig.json");
+ loader.loadJson(ccModulesPath, function (err, modulesJson) {
+ if (err) throw new Error(err);
+ var modules = config["modules"] || [];
+ var moduleMap = modulesJson["module"];
+ var jsList = [];
+ if (cc.sys.capabilities["opengl"] && modules.indexOf("base4webgl") < 0) modules.splice(0, 0, "base4webgl");
+ else if (modules.indexOf("core") < 0) modules.splice(0, 0, "core");
+ for (var i = 0, li = modules.length; i < li; i++) {
+ var arr = _getJsListOfModule(moduleMap, modules[i], engineDir);
+ if (arr) jsList = jsList.concat(arr);
+ }
+ cc.loader.loadJsWithImg(jsList, function (err) {
+ if (err) throw err;
+ _afterEngineLoaded(config);
+ });
+ });
+ }
+}
+
+function _windowLoaded() {
+ window.removeEventListener('load', _windowLoaded, false);
+ _load(cc.game.config);
+}
+
+cc.initEngine = function (config, cb) {
+ if (_engineInitCalled) {
+ var previousCallback = _engineLoadedCallback;
+ _engineLoadedCallback = function () {
+ previousCallback && previousCallback();
+ cb && cb();
+ }
+ return;
+ }
+
+ _engineLoadedCallback = cb;
+
+ // Config uninitialized and given, initialize with it
+ if (!cc.game.config && config) {
+ cc.game.config = config;
+ }
+ // No config given and no config set before, load it
+ else if (!cc.game.config) {
+ cc.game._loadConfig();
+ }
+ config = cc.game.config;
+
+ _determineRenderType(config);
+
+ document.body ? _load(config) : window.addEventListener('load', _windowLoaded, false);
+ _engineInitCalled = true;
+}
+
+})();
+//+++++++++++++++++++++++++Engine initialization function end+++++++++++++++++++++++++++++
diff --git a/CCDebugger.js b/CCDebugger.js
new file mode 100644
index 00000000000..ee1b2d273a2
--- /dev/null
+++ b/CCDebugger.js
@@ -0,0 +1,459 @@
+/****************************************************************************
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+cc._LogInfos = {
+
+ ActionManager: {
+ addAction: "cc.ActionManager.addAction(): action must be non-null",
+ removeAction: "cocos2d: removeAction: Target not found",
+ removeActionByTag: "cc.ActionManager.removeActionByTag(): an invalid tag",
+ removeActionByTag_2: "cc.ActionManager.removeActionByTag(): target must be non-null",
+ getActionByTag: "cc.ActionManager.getActionByTag(): an invalid tag",
+ getActionByTag_2: "cocos2d : getActionByTag(tag = %s): Action not found",
+ },
+
+ configuration: {
+ dumpInfo: "cocos2d: **** WARNING **** CC_ENABLE_PROFILERS is defined. Disable it when you finish profiling (from ccConfig.js)",
+ loadConfigFile: "Expected 'data' dict, but not found. Config file: %s",
+ loadConfigFile_2: "Please load the resource first : %s",
+ },
+
+ Director: {
+ resume: "cocos2d: Director: Error in gettimeofday",
+ setProjection: "cocos2d: Director: unrecognized projection",
+ popToSceneStackLevel: "cocos2d: Director: unrecognized projection",
+ popToSceneStackLevel_2: "cocos2d: Director: Error in gettimeofday",
+ popScene: "running scene should not null",
+ pushScene: "the scene should not null",
+ },
+
+ Array: {
+ verifyType: "element type is wrong!",
+ },
+
+ deprecated: '"%s" is deprecated, please use "%s" instead.',
+
+ Scheduler: {
+ scheduleCallbackForTarget: "CCSheduler#scheduleCallback. Callback already scheduled. Updating interval from:%s to %s",
+ scheduleCallbackForTarget_2: "cc.scheduler.scheduleCallbackForTarget(): callback_fn should be non-null.",
+ scheduleCallbackForTarget_3: "cc.scheduler.scheduleCallbackForTarget(): target should be non-null.",
+ pauseTarget: "cc.Scheduler.pauseTarget():target should be non-null",
+ resumeTarget: "cc.Scheduler.resumeTarget():target should be non-null",
+ isTargetPaused: "cc.Scheduler.isTargetPaused():target should be non-null",
+ },
+
+ Node: {
+ getZOrder: "getZOrder is deprecated. Please use getLocalZOrder instead.",
+ setZOrder: "setZOrder is deprecated. Please use setLocalZOrder instead.",
+ getRotation: "RotationX != RotationY. Don't know which one to return",
+ getScale: "ScaleX != ScaleY. Don't know which one to return",
+ addChild: "An Node can't be added as a child of itself.",
+ addChild_2: "child already added. It can't be added again",
+ addChild_3: "child must be non-null",
+ removeFromParentAndCleanup: "removeFromParentAndCleanup is deprecated. Use removeFromParent instead",
+ boundingBox: "boundingBox is deprecated. Use getBoundingBox instead",
+ removeChildByTag: "argument tag is an invalid tag",
+ removeChildByTag_2: "cocos2d: removeChildByTag(tag = %s): child not found!",
+ removeAllChildrenWithCleanup: "removeAllChildrenWithCleanup is deprecated. Use removeAllChildren instead",
+ stopActionByTag: "cc.Node.stopActionBy(): argument tag an invalid tag",
+ getActionByTag: "cc.Node.getActionByTag(): argument tag is an invalid tag",
+ reumeSchedulerAndActions: "resumeSchedulerAndActions is deprecated, please use resume instead.",
+ pauseSchedulerAndActions: "pauseSchedulerAndActions is deprecated, please use pause instead.",
+ _arrayMakeObjectsPerformSelector: "Unknown callback function",
+ reorderChild: "child must be non-null",
+ runAction: "cc.Node.runAction(): action must be non-null",
+ schedule: "callback function must be non-null",
+ schedule_2: "interval must be positive",
+ initWithTexture: "cocos2d: Could not initialize cc.AtlasNode. Invalid Texture."
+ },
+
+ AtlasNode: {
+ _updateAtlasValues: "cc.AtlasNode.updateAtlasValues(): Shall be overridden in subclasses",
+ _initWithTileFile: "",
+ _initWithTexture: "cocos2d: Could not initialize cc.AtlasNode. Invalid Texture.",
+ },
+
+ _checkEventListenerAvailable: {
+ keyboard: "cc._EventListenerKeyboard.checkAvailable(): Invalid EventListenerKeyboard!",
+ touchOneByOne: "cc._EventListenerTouchOneByOne.checkAvailable(): Invalid EventListenerTouchOneByOne!",
+ touchAllAtOnce: "cc._EventListenerTouchAllAtOnce.checkAvailable(): Invalid EventListenerTouchAllAtOnce!",
+ acceleration: "cc._EventListenerAcceleration.checkAvailable(): _onAccelerationEvent must be non-nil",
+ },
+
+ EventListener: {
+ create: "Invalid parameter.",
+ },
+
+ __getListenerID: "Don't call this method if the event is for touch.",
+
+ LayerMultiplex: {
+ initWithLayers: "parameters should not be ending with null in Javascript",
+ switchTo: "Invalid index in MultiplexLayer switchTo message",
+ switchToAndReleaseMe: "Invalid index in MultiplexLayer switchTo message",
+ addLayer: "cc.Layer.addLayer(): layer should be non-null",
+ },
+
+ view: {
+ setDesignResolutionSize: "Resolution not valid",
+ setDesignResolutionSize_2: "should set resolutionPolicy",
+ },
+
+ inputManager: {
+ handleTouchesBegin: "The touches is more than MAX_TOUCHES, nUnusedIndex = %s",
+ },
+
+ swap: "cc.swap is being modified from original macro, please check usage",
+
+ checkGLErrorDebug: "WebGL error %s",
+
+ animationCache: {
+ _addAnimationsWithDictionary: "cocos2d: cc.AnimationCache: No animations were found in provided dictionary.",
+ _addAnimationsWithDictionary_2: "cc.AnimationCache. Invalid animation format",
+ addAnimations: "cc.AnimationCache.addAnimations(): File could not be found",
+ _parseVersion1: "cocos2d: cc.AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",
+ _parseVersion1_2: "cocos2d: cc.AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",
+ _parseVersion1_3: "cocos2d: cc.AnimationCache: None of the frames for animation '%s' were found in the cc.SpriteFrameCache. Animation is not being added to the Animation Cache.",
+ _parseVersion1_4: "cocos2d: cc.AnimationCache: An animation in your dictionary refers to a frame which is not in the cc.SpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.",
+ _parseVersion2: "cocos2d: CCAnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.",
+ _parseVersion2_2: "cocos2d: cc.AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the cc.SpriteFrameCache. This frame will not be added to the animation.",
+ addAnimations_2: "cc.AnimationCache.addAnimations(): Invalid texture file name",
+ },
+
+ Sprite: {
+ reorderChild: "cc.Sprite.reorderChild(): this child is not in children list",
+ ignoreAnchorPointForPosition: "cc.Sprite.ignoreAnchorPointForPosition(): it is invalid in cc.Sprite when using SpriteBatchNode",
+ setDisplayFrameWithAnimationName: "cc.Sprite.setDisplayFrameWithAnimationName(): Frame not found",
+ setDisplayFrameWithAnimationName_2: "cc.Sprite.setDisplayFrameWithAnimationName(): Invalid frame index",
+ setDisplayFrame: "setDisplayFrame is deprecated, please use setSpriteFrame instead.",
+ _updateBlendFunc: "cc.Sprite._updateBlendFunc(): _updateBlendFunc doesn't work when the sprite is rendered using a cc.CCSpriteBatchNode", initWithSpriteFrame: "cc.Sprite.initWithSpriteFrame(): spriteFrame should be non-null",
+ initWithSpriteFrameName: "cc.Sprite.initWithSpriteFrameName(): spriteFrameName should be non-null",
+ initWithSpriteFrameName1: " is null, please check.",
+ initWithFile: "cc.Sprite.initWithFile(): filename should be non-null",
+ setDisplayFrameWithAnimationName_3: "cc.Sprite.setDisplayFrameWithAnimationName(): animationName must be non-null",
+ reorderChild_2: "cc.Sprite.reorderChild(): child should be non-null",
+ addChild: "cc.Sprite.addChild(): cc.Sprite only supports cc.Sprites as children when using cc.SpriteBatchNode",
+ addChild_2: "cc.Sprite.addChild(): cc.Sprite only supports a sprite using same texture as children when using cc.SpriteBatchNode",
+ addChild_3: "cc.Sprite.addChild(): child should be non-null",
+ setTexture: "cc.Sprite.texture setter: Batched sprites should use the same texture as the batchnode",
+ updateQuadFromSprite: "cc.SpriteBatchNode.updateQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children", insertQuadFromSprite: "cc.SpriteBatchNode.insertQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",
+ addChild_4: "cc.SpriteBatchNode.addChild(): cc.SpriteBatchNode only supports cc.Sprites as children",
+ addChild_5: "cc.SpriteBatchNode.addChild(): cc.Sprite is not using the same texture",
+ initWithTexture: "Sprite.initWithTexture(): Argument must be non-nil ",
+ setSpriteFrame: "Invalid spriteFrameName",
+ setTexture_2: "Invalid argument: cc.Sprite.texture setter expects a CCTexture2D.",
+ updateQuadFromSprite_2: "cc.SpriteBatchNode.updateQuadFromSprite(): sprite should be non-null",
+ insertQuadFromSprite_2: "cc.SpriteBatchNode.insertQuadFromSprite(): sprite should be non-null",
+ },
+
+ SpriteBatchNode: {
+ addSpriteWithoutQuad: "cc.SpriteBatchNode.addQuadFromSprite(): SpriteBatchNode only supports cc.Sprites as children",
+ increaseAtlasCapacity: "cocos2d: CCSpriteBatchNode: resizing TextureAtlas capacity from %s to %s.",
+ increaseAtlasCapacity_2: "cocos2d: WARNING: Not enough memory to resize the atlas",
+ reorderChild: "cc.SpriteBatchNode.addChild(): Child doesn't belong to Sprite",
+ removeChild: "cc.SpriteBatchNode.addChild(): sprite batch node should contain the child",
+ addSpriteWithoutQuad_2: "cc.SpriteBatchNode.addQuadFromSprite(): child should be non-null",
+ reorderChild_2: "cc.SpriteBatchNode.addChild(): child should be non-null",
+ updateQuadFromSprite: "cc.SpriteBatchNode.updateQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",
+ insertQuadFromSprite: "cc.SpriteBatchNode.insertQuadFromSprite(): cc.SpriteBatchNode only supports cc.Sprites as children",
+ addChild: "cc.SpriteBatchNode.addChild(): cc.SpriteBatchNode only supports cc.Sprites as children",
+ initWithTexture: "Sprite.initWithTexture(): Argument must be non-nil ",
+ addChild_2: "cc.Sprite.addChild(): child should be non-null",
+ setSpriteFrame: "Invalid spriteFrameName",
+ setTexture: "Invalid argument: cc.Sprite texture setter expects a CCTexture2D.",
+ updateQuadFromSprite_2: "cc.SpriteBatchNode.updateQuadFromSprite(): sprite should be non-null",
+ insertQuadFromSprite_2: "cc.SpriteBatchNode.insertQuadFromSprite(): sprite should be non-null",
+ addChild_3: "cc.SpriteBatchNode.addChild(): child should be non-null",
+ },
+
+ spriteFrameCache: {
+ _getFrameConfig: "cocos2d: WARNING: originalWidth/Height not found on the cc.SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist",
+ addSpriteFrames: "cocos2d: WARNING: an alias with name %s already exists",
+ _checkConflict: "cocos2d: WARNING: Sprite frame: %s has already been added by another source, please fix name conflit",
+ getSpriteFrame: "cocos2d: cc.SpriteFrameCahce: Frame %s not found",
+ _getFrameConfig_2: "Please load the resource first : %s",
+ addSpriteFrames_2: "cc.SpriteFrameCache.addSpriteFrames(): plist should be non-null",
+ addSpriteFrames_3: "Argument must be non-nil",
+ },
+
+ TextureAtlas: {
+ initWithFile: "cocos2d: Could not open file: %s",
+ insertQuad: "cc.TextureAtlas.insertQuad(): invalid totalQuads",
+ initWithTexture: "cc.TextureAtlas.initWithTexture():texture should be non-null",
+ updateQuad: "cc.TextureAtlas.updateQuad(): quad should be non-null",
+ updateQuad_2: "cc.TextureAtlas.updateQuad(): Invalid index",
+ insertQuad_2: "cc.TextureAtlas.insertQuad(): Invalid index",
+ insertQuads: "cc.TextureAtlas.insertQuad(): Invalid index + amount",
+ insertQuadFromIndex: "cc.TextureAtlas.insertQuadFromIndex(): Invalid newIndex",
+ insertQuadFromIndex_2: "cc.TextureAtlas.insertQuadFromIndex(): Invalid fromIndex",
+ removeQuadAtIndex: "cc.TextureAtlas.removeQuadAtIndex(): Invalid index",
+ removeQuadsAtIndex: "cc.TextureAtlas.removeQuadsAtIndex(): index + amount out of bounds",
+ moveQuadsFromIndex: "cc.TextureAtlas.moveQuadsFromIndex(): move is out of bounds",
+ moveQuadsFromIndex_2: "cc.TextureAtlas.moveQuadsFromIndex(): Invalid newIndex",
+ moveQuadsFromIndex_3: "cc.TextureAtlas.moveQuadsFromIndex(): Invalid oldIndex",
+ },
+
+ textureCache: {
+ addPVRTCImage: "TextureCache:addPVRTCImage does not support on HTML5",
+ addETCImage: "TextureCache:addPVRTCImage does not support on HTML5",
+ textureForKey: "textureForKey is deprecated. Please use getTextureForKey instead.",
+ addPVRImage: "addPVRImage does not support on HTML5",
+ addUIImage: "cocos2d: Couldn't add UIImage in TextureCache",
+ dumpCachedTextureInfo: "cocos2d: '%s' id=%s %s x %s",
+ dumpCachedTextureInfo_2: "cocos2d: '%s' id= HTMLCanvasElement %s x %s",
+ dumpCachedTextureInfo_3: "cocos2d: TextureCache dumpDebugInfo: %s textures, HTMLCanvasElement for %s KB (%s MB)",
+ addUIImage_2: "cc.Texture.addUIImage(): image should be non-null",
+ },
+
+ Texture2D: {
+ initWithETCFile: "initWithETCFile does not support on HTML5",
+ initWithPVRFile: "initWithPVRFile does not support on HTML5",
+ initWithPVRTCData: "initWithPVRTCData does not support on HTML5",
+ addImage: "cc.Texture.addImage(): path should be non-null",
+ initWithImage: "cocos2d: cc.Texture2D. Can't create Texture. UIImage is nil",
+ initWithImage_2: "cocos2d: WARNING: Image (%s x %s) is bigger than the supported %s x %s",
+ initWithString: "initWithString isn't supported on cocos2d-html5",
+ initWithETCFile_2: "initWithETCFile does not support on HTML5",
+ initWithPVRFile_2: "initWithPVRFile does not support on HTML5",
+ initWithPVRTCData_2: "initWithPVRTCData does not support on HTML5",
+ bitsPerPixelForFormat: "bitsPerPixelForFormat: %s, cannot give useful result, it's a illegal pixel format",
+ _initPremultipliedATextureWithImage: "cocos2d: cc.Texture2D: Using RGB565 texture since image has no alpha",
+ addImage_2: "cc.Texture.addImage(): path should be non-null",
+ initWithData: "NSInternalInconsistencyException",
+ },
+
+ MissingFile: "Missing file: %s",
+ radiansToDegress: "cc.radiansToDegress() should be called cc.radiansToDegrees()",
+ RectWidth: "Rect width exceeds maximum margin: %s",
+ RectHeight: "Rect height exceeds maximum margin: %s",
+
+ EventManager: {
+ addListener: "0 priority is forbidden for fixed priority since it's used for scene graph based priority.",
+ removeListeners: "Invalid listener type!",
+ setPriority: "Can't set fixed priority with scene graph based listener.",
+ addListener_2: "Invalid parameters.",
+ addListener_3: "listener must be a cc.EventListener object when adding a fixed priority listener",
+ addListener_4: "The listener has been registered, please don't register it again.",
+ _forceAddEventListener: "Invalid scene graph priority!",
+ _updateListeners: "If program goes here, there should be event in dispatch.",
+ _updateListeners_2: "_inDispatch should be 1 here."
+ }
+};
+
+if (CC_EDITOR || CC_TEST) {
+ cc._LogInfos.Editor = {
+ Class: {
+ callSuperCtor: "cc.Class will automatically call super constructor of %s, you should not call it manually."
+ }
+ };
+}
+
+//+++++++++++++++++++++++++something about log start++++++++++++++++++++++++++++
+cc._logToWebPage = function (msg) {
+ if (!cc._canvas)
+ return;
+
+ var logList = cc._logList;
+ var doc = document;
+ if (!logList) {
+ var logDiv = doc.createElement("Div");
+ var logDivStyle = logDiv.style;
+
+ logDiv.setAttribute("id", "logInfoDiv");
+ cc._canvas.parentNode.appendChild(logDiv);
+ logDiv.setAttribute("width", "200");
+ logDiv.setAttribute("height", cc._canvas.height);
+ logDivStyle.zIndex = "99999";
+ logDivStyle.position = "absolute";
+ logDivStyle.top = "0";
+ logDivStyle.left = "0";
+
+ logList = cc._logList = doc.createElement("textarea");
+ var logListStyle = logList.style;
+
+ logList.setAttribute("rows", "20");
+ logList.setAttribute("cols", "30");
+ logList.setAttribute("disabled", true);
+ logDiv.appendChild(logList);
+ logListStyle.backgroundColor = "transparent";
+ logListStyle.borderBottom = "1px solid #cccccc";
+ logListStyle.borderRightWidth = "0px";
+ logListStyle.borderLeftWidth = "0px";
+ logListStyle.borderTopWidth = "0px";
+ logListStyle.borderTopStyle = "none";
+ logListStyle.borderRightStyle = "none";
+ logListStyle.borderLeftStyle = "none";
+ logListStyle.padding = "0px";
+ logListStyle.margin = 0;
+
+ }
+ logList.value = logList.value + msg + "\r\n";
+ logList.scrollTop = logList.scrollHeight;
+};
+
+//to make sure the cc.log, cc.warn, cc.error and cc.assert would not throw error before init by debugger mode.
+cc._formatString = function (arg) {
+ if (cc.js.isObject(arg)) {
+ try {
+ return JSON.stringify(arg);
+ } catch (err) {
+ return "";
+ }
+ } else
+ return arg;
+};
+
+/**
+ * Enum for debug modes.
+ * @readOnly
+ * @enum DebugMode
+ */
+cc.DebugMode = cc.Enum({
+ /**
+ * @property {number} NONE - The debug mode none.
+ */
+ NONE: 0,
+ /**
+ * @property {number} INFO - The debug mode info.
+ */
+ INFO: 1,
+ /**
+ * @property {number} WARN - The debug mode warn.
+ */
+ WARN: 2,
+ /**
+ * @property {number} ERROR - The debug mode error.
+ */
+ ERROR: 3,
+ /**
+ * @property {number} INFO_FOR_WEB_PAGE - The debug mode info for web page.
+ */
+ INFO_FOR_WEB_PAGE: 4,
+ /**
+ * @property {number} WARN_FOR_WEB_PAGE - The debug mode warn for web page.
+ */
+ WARN_FOR_WEB_PAGE: 5,
+ /**
+ * @property {number} ERROR_FOR_WEB_PAGE - The debug mode error for web page.
+ */
+ ERROR_FOR_WEB_PAGE: 6
+});
+
+/**
+ * Init Debug setting.
+ * @function
+ * @param {cc.DebugMode} mode
+ */
+cc._initDebugSetting = function (mode) {
+ if(mode === cc.DebugMode.NONE)
+ return;
+
+ var locLog;
+ if(mode > cc.DebugMode.ERROR){
+ //log to web page
+ locLog = cc._logToWebPage.bind(cc);
+ cc.error = function(){
+ locLog("ERROR : " + cc.formatStr.apply(cc, arguments));
+ };
+ cc.assert = function(cond, msg) {
+ 'use strict';
+ if (!cond && msg) {
+ for (var i = 2; i < arguments.length; i++)
+ msg = msg.replace(/(%s)|(%d)/, cc._formatString(arguments[i]));
+ locLog("Assert: " + msg);
+ }
+ };
+ if(mode !== cc.DebugMode.ERROR_FOR_WEB_PAGE){
+ cc.warn = function(){
+ locLog("WARN : " + cc.formatStr.apply(cc, arguments));
+ };
+ }
+ if(mode === cc.DebugMode.INFO_FOR_WEB_PAGE){
+ cc.log = cc.info = function(){
+ locLog(cc.formatStr.apply(cc, arguments));
+ };
+ }
+ } else if(console && console.log.apply){//console is null when user doesn't open dev tool on IE9
+ //log to console
+
+ /**
+ * Outputs an error message to the Fireball Console (editor) or Web Console (runtime).
+ * - In Fireball, error is red.
+ * - In Chrome, error have a red icon along with red message text.
+ * @param {any|string} obj - A JavaScript string containing zero or more substitution strings.
+ * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
+ */
+ if (console.error.bind) {
+ // use bind to avoid pollute call stacks
+ cc.error = console.error.bind(console);
+ }
+ else {
+ cc.error = function(){
+ return console.error.apply(console, arguments);
+ };
+ }
+ cc.assert = function (cond, msg) {
+ if (!cond && msg) {
+ for (var i = 2; i < arguments.length; i++)
+ msg = msg.replace(/(%s)|(%d)/, cc._formatString(arguments[i]));
+ throw new Error(msg);
+ }
+ };
+ if(mode !== cc.DebugMode.ERROR)
+ /**
+ * Outputs a warning message to the Fireball Console (editor) or Web Console (runtime).
+ * - In Fireball, warning is yellow.
+ * - In Chrome, warning have a yellow warning icon with the message text.
+ * @param {any|string} obj - A JavaScript string containing zero or more substitution strings.
+ * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
+ */
+ cc.warn = function(){
+ return console.warn.apply(console, arguments);
+ };
+ if(mode === cc.DebugMode.INFO) {
+ /**
+ * Outputs a message to the Fireball Console (editor) or Web Console (runtime).
+ * @param {any|string} obj - A JavaScript string containing zero or more substitution strings.
+ * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
+ */
+ cc.log = function () {
+ return console.log.apply(console, arguments);
+ };
+ /**
+ * Outputs an informational message to the Fireball Console (editor) or Web Console (runtime).
+ * - In Fireball, info is blue.
+ * - In Firefox and Chrome, a small "i" icon is displayed next to these items in the Web Console's log.
+ * @param {any|string} obj - A JavaScript string containing zero or more substitution strings.
+ * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.
+ */
+ cc.info = function () {
+ (console.info || console.log).apply(console, arguments);
+ };
+ }
+ }
+ cc._throw = function (error) {
+ cc.error(error.stack || error);
+ };
+};
+//+++++++++++++++++++++++++something about log end+++++++++++++++++++++++++++++
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
new file mode 100644
index 00000000000..14124a4cdcb
--- /dev/null
+++ b/CHANGELOG.txt
@@ -0,0 +1,952 @@
+ChangeLog:
+
+Cocos2d-x v3.8 @ September.6 2015
+
+ [NEW] spine: Supported Spine runtime 2.3 (Both native and web engine)
+ [NEW] Animate: Added Animate's getCurrentFrameIndex function
+ [NEW] network: Upgrade SocketIO support to v1.x
+
+ [REFINE] web: Avoid re-bake the content when the parent node's position get changed
+ [REFINE] web: Added GameNodeObjectData and GameLayerObjectData in JSON parser
+ [REFINE] web: Updated skeleton animation to the latest version
+ [REFINE] web: Optimized resources automatic loading in JSON parser
+ [REFINE] web: Avoid cc.loader resource loading being terminated while encounter errors
+ [REFINE] web: Throw new Error object instead of error message string
+ [REFINE] web: Move setDepthTest to renderer
+ [REFINE] web: Added BlendFuncFrame parser
+ [REFINE] web: Permitted webp image loading on Chrome
+ [REFINE] web: Suspended the video player when the browser is minimized
+
+ [FIX] web: Fixed a bug that VideoPlayer remove event throw error
+ [FIX] web: Fixed Armature position error in studio JSON parser
+ [FIX] web: Fixed default clearColor error in director
+ [FIX] web: Fixed rotation value parsing error in the timeline parser
+ [FIX] web: Fixed a bug that nested animation may be affected by outer animation
+ [FIX] web: Made LabelAtlas ignoring invalid characters and updating correctly the content size
+ [FIX] web: Fixed a bug that VideoPlayer remove event throw error
+ [FIX] web: Fixed a bug that cc.director.setNotificationNode(null) doesn't take effect
+ [FIX] web: Fixed texture rect update issue while changing sprite frame
+ [FIX] web: Fixed effect issue in ActionGrid and NodeGrid
+ [FIX] web: Fixed logic issue in Menu's _onTouchCancelled function
+ [FIX] web: Fixed MenuItem crash when normal image is null
+ [FIX] web: Fixed incomplete fadeout effects
+ [FIX] web: Fixed issue that return value of cc.screen.fullScreen is not boolean
+ [FIX] web: Fixed a bug that SkeletonNode is not drawing children
+
+ [TEST] web: Rewrote testcase for stencil depth mask in RenderTextureTest
+ [TEST] web: Improved renderTexture stencilDepth test
+ [TEST] web: Fixed abnormal effects in effectsTest
+ [TEST] web: Fixed invisiable testcase of effects
+
+Cocos2d-x v3.7.1 @ August.12 2015
+ [HIGHLIGHT] studio: Added new skeleton animation support and JSON parser for cocos v2.3.2 beta
+
+ [NEW] Node: Added getNodeToParentTransform with selected ancestor
+ [NEW] web: Added cc.director.setClearColor and support transparent background
+ [NEW] web: Added Animate's getCurrentFrameIndex function
+
+ [REFINE] studio: Optimized JSON parser's performance by removing audio play
+ [REFINE] studio: Optimized editor related extension data to a component instead of hosting in _userObject
+ [REFINE] web: Improved color/opacity manipulations in MenuItems
+
+ [FIX] studio: Fixed ccs.Skin construction issue in JSON parser
+ [FIX] web: Fixed an issue that loading process won't trigger callback problem
+ [FIX] web: Fixed a bug where not resetting cc.Audio._ignoreEnded when replaying a sound caused it to stay in a "playing" state
+ [FIX] web: cc.ScrollView and cc.TableView: added check for parent visibility in onTouchBegan method
+ [FIX] web: Fixed TurnPageDown effect
+ [FIX] web: Fixed Cocos Studio parser issue that all elements are missing while the timeline action contains rotation
+
+Cocos2d-x v3.7 Final @ July 20 2015
+ [REFINE] web: Add compatible Uint16Array defintion
+
+ [FIX] web: Fixed url check regular expression not supporting localhost issue
+ [FIX] web: Fixed issue that sprite doesn't update texture rect correctly
+
+Cocos2d-x v3.7 RC1 @ July 14 2015
+ [REFINE] Improved localStorage warning when disabled
+
+ [FIX] Fixed a bug that SingleNode's color isn't set
+ [FIX] studio: Fixed a bug of JSON parser that texture address is wrong
+ [FIX] Fixed MenuItems' color/opacity setter issue with child nodes
+ [FIX] Fixed page view's layout issue for JSON parser
+ [FIX] Add ttc loader and prevent the pure digital fonts is invalid
+ [FIX] Fixed Float32Array initialization
+ [FIX] Fixed a bug that layout background is missing
+ [FIX] Fixed a bug that ObjectExtensionData miss setCustomProperty and getCustomProperty function
+
+Cocos2d-x v3.7 RC0 @ July 1 2015
+
+* The json loader of Cocos Studio will automatically load dependencies resources
+* SIMD.js optimization for kazmath functions (from Intel)
+* Deleted the redundant variables defined and log informations in ccui.RichText
+* Allowed timeline animations with only one frame
+* Improved property declaration of cc.Texture2D
+
+* Bug fixes:
+ 1. Fixed positionType error of particle system in timeline parser
+ 2. Fixed setAnimationName issue while the property is undefined in timeline parser
+ 3. Fixed `cc.TMXObjectGroup#objectNamed` not returning the result bug
+ 4. Fixed TransitionSlideX callback sequence issue
+ 5. Fixed issue in music end event
+ 6. Fixed bug that LayerColor's color will disappear when update transform after being baked
+ 7. Fixed `inverse` function bug of `cc.math.Matrix4`
+ 8. Fixed the webaudio's invalid loop attribute bug for chrome 42
+ 9. Fixed crash when character not found into BMP font
+ 10. Fixed spine's js parser issue by avoid NaN duration
+ 11. Fixed LabelTTF multiline detection
+ 12. Fixed issue in ccui.Widget#getScale
+ 13. Fixed texture is not updated in some cases
+ 14. PlayMusic should not use the search path (timeline 2.x)
+ 15. Fixed bug of loading path of resources
+ 16. Premultiply texture's alpha for png by default to fix Cocos Studio render issues
+ 17. Fixed cache update issue of Layout after bake
+ 18. Fixed isBaked returning undefined issue
+ 19. Made CCProgressTimerCanvasRenderCmd to properly show colorized sprites
+ 20. Fixed attributes being reset issue while baked cache canvas' size changed
+ 21. Fixed texture does not rotate bug of ccui.LoadingBar
+ 22. Fixed color not being set issue in timeline parser
+ 23. Fixed custom easing animation bug
+ 24. Fixed return empty texture2d bug when adding image with same url multiple times
+ 25. Fixed actiontimeline can not step to last frame issue when loop play
+ 26. Fixed the prompt can not be used in iOS wechat 6.2
+ 27. Fixed restoring of sprite's color issue
+ 28. Fixed Uint8Array initialize issue
+ 29. Fixed cc.TextFieldTTF Delegate memory leaks
+ 30. Fixed sorted result is wrong in cc.eventManager (_sortEventListenersOfSceneGraphPriorityDes)
+ 31. Fixed BinaryLoader issue on IE11
+ 32. Fixed the sprite's texture bug when frequently change the color
+ 33. Fixed an issue that action will result in automatic termination
+ 34. Fixed ScrollView initWithViewSize issue
+
+Cocos2d-JS v3.6 @ April 29 2015
+
+* Added GAF web runtime to the web engine, the native support will be merged in future version.
+* Synchronised Cocos2d-x v3.6.
+
+* Bug fixes:
+ 1. Fixed a bug of Cocos Studio parser that it doesn't parse correctly the outline of text widget and button widget.
+ 2. Fixed a bug of Cocos Studio parser that it doesn't support inner action correctly.
+ 3. Fixed a bug of Cocos Studio parser that `ccui.Text`'s content size is set incorrectly.
+ 4. Fixed a bug of Cocos Studio parser that `ccui.Layout`'s background color is set incorrectly.
+ 5. Fixed a bug of `cc.Node`'s `removeAllChildren` that it doesn't notify the renderer to update.
+ 6. Fixed a bug of audio system that the resume of music may start from the beginning.
+ 7. Fixed a bug that sprite's `setTexture` fails to update its content size.
+ 8. Fixed a bug that Scale9Sprite's children doesn't get transformed recursively.
+ 9. Fixed constant naming issue of `ccs.FrameEaseType`.
+ 10. Fixed `cc.LoaderScene.preload` API inconsistency between web engine and native engine.
+ 11. Fixed a bug that `ccui.Slider` doesn't act correctly when it's scaled.
+ 12. Fixed a bug that `ccui.Button` renders incorrectly when scale9sprite option enabled.
+ 13. Fixed circular invocation issue in `cc.Sprite`'s canvas render command.
+
+Cocos2d-JS v3.6 Beta @ April 22 2015
+
+* Improved TMX transform to support RotationX and RotationY.
+* Refactored Spine skeleton render command.
+* Added checks to prevent issues when `cc.Node.WebGLRenderCmd` is not exist.
+* Improved iOS browsers detection.
+* Added getter setter function for `cc.MotionStreak`'s stroke property.
+* Improved the detection of render mode.
+* Upgraded Action Timeline and parser for the latest version of Cocos editor.
+* Added `enumerateChildren` function for `cc.Node`.
+* Make `cc.Scale9Sprite` support unpreloaded texture.
+* Added `cc.sys.isObjectValid` to detect whether an object is still valid (in web and native engine).
+
+* Bug fixes:
+ 1. Fixed a bug that `cc.Scheduler`'s `scheduleOnce` runs multiply times.
+ 2. Fixed a bug of `cc.Scheduler`'s `pauseAllTargetsWithMinPriority`.
+ 3. Fixed a bug of `cc.eventManager` that its event listeners' order is incorrect when some nodes haven't been added to the scene graph or have been removed from parent without cleanup.
+ 4. Fixed a bug of `cc.LabelTTF` that `enableShadow` doesn't work.
+ 5. Fixed a bug of `cc.LabelTTF` that `setColor` doesn't set shadow color under Canvas render mode.
+ 6. Fixed a bug that stopped audios can be resume after invoking pause on them.
+ 7. Fixed a bug that `ccui.LoadingBar`'s texture renders incorrectly without preload.
+ 8. Fixed a bug that cocos builder's callback doesn't get invoked.
+ 9. Fixed a bug that TMX objects' position is incorrect when content scale factor is modified.
+ 10. Fixed a mistaken usage of `cc.isObject` in `cc.Sprite` implementation.
+ 11. Fixed a bug that position type haven't been copied in `cc.ParticleSystem`'s `clone` function.
+ 12. Fixed some undefined parameter check issues in `cc.Node`.
+ 13. Fixed a bug that setter for `scaleY` of `cc.EditBox` is incorrect.
+ 14. Fixed a bug of `cc.SkeletonAnimation` that its canvas render command doesn't work correctly.
+ 15. Fixed a parsing issue for the width of `cc.LabelBMFont`.
+ 16. Fixed `ccs.TweenType`'s constants naming issue.
+ 17. Fixed a bug that the spine skeleton may be rendered under the unsupported mode.
+ 18. Fixed a bug when setting `cc.ParticleSystem`'s blend function in the ActionTimeline parser.
+ 19. Added check to prevent issues that functions may not exist in the ActionTimeline parser.
+ 20. Fixed a typo of `ccs.displayFactory`.
+ 21. Fixed a bug of `cc.Node.setPosition` that parameter check is incorrect.
+
+Cocos2d-JS v3.5 @ April 1 2015
+
+* Upgraded Cocos Studio parser to support Cocos Studio v2.2.
+* Upgraded Spine support to v2.1, added spine test case with FFD. FFD is supported in native but not in web, both engine can parse the new version file correctly, but the web engine will ignore FFD informations.
+* Replaced '==' with '===' for better performance.
+* Added `path` parameter in `ccs.load` to support modifying cocostudio project resource path.
+* Added animationList to Cocostudio ActionTimeline to support playing animation by name.
+* Made ParticleSystem support creation from an map object.
+* Added missing functions to `cc.Grid3D` and `cc.PageTurn3D`.
+* Added tip message functions to `cc.TextFieldTTF` for mobile browser.
+* Added a function `cc.sys.openURL`.
+* Disabled retina display by default for better performance.
+* Added Bower support.
+* Updated `cc.sys.OS_XXX` informations for supported systems.
+
+* Bug fixes:
+ 1. Fixed a bug of chipmunk.js that it doesn't work under closure compiler advanced mode.
+ 2. Fixed a bug of Cocos Studio parser that widget didn't set its layout component.
+ 3. Fixed grammatical mistakes in cocostudio parser logs.
+ 4. Fixed memory leak issue in `cc.LabelBMFont`.
+ 5. Fixed a bug of `cc.Scale9Sprite` that its `updateDisplayColor` doesn't take effect.
+ 6. Fixed a bug of Cocos Studio parser that `cc.Scale9Sprite` doesn't display correctly if its texture isn't preloaded.
+ 7. Fixed a bug of `cc.MenuItemSprite` that the construction will fail when parameter `selectedSprite` is a Scale9Sprite instance.
+ 8. Fixed a bug of Cocos Studio parser that the background color of `ccui.Layout` can't be parsed correctly.
+ 9. Fixed a bug of `cc.ClippingNode` that it doesn't work when set `inverted` to true in Canvas Mode.
+ 10. Fixed a bug of `ccs.Armature` that its name was modified to animation name when loading from json files.
+ 11. Fixed a bug of `ccui.PageView` that it cancel child touch during movment of page view.
+ 12. Fixed a bug of `cc.Scheduler` that its parameter `repeat` is invalid in schedule function.
+ 13. Fixed a bug of `cc.Scheduler` that `unschedule` function may fail.
+
+Cocos2d-JS v3.4 Beta0 @ March 19 2015
+
+* Added Windows Phone 8.0 platform support.
+* Upgraded SpiderMonkey to v33, greatly improved JS object garbage collection and performance.
+* Bound 3D modules including camera, light, sprite 3d, animation 3d, billboard, etc.
+* Improved `cc.FontDefinition` & `ccui.RichText` in the web engine.
+* Added gradient stops feature to `cc.LayerGradient` [Web exclusive].
+* Upgraded `cc.Scheduler` in the web engine with Cocos2d-x v3.4 implementation.
+* Added a loading screen when scripts are loading.
+* Improved performance by replacing `Object.defineProperties` with `cc.defineGetterSetter`.
+* Supported loading sprite frames from json object.
+* Refactored math library to improve web engine performance.
+* Removed some variables from `cc` namespace to improve web engine performance.
+* Added the Firefox OS Web manifest to support Firefox OS apps.
+* Added `cocos` attr to the script element in templates.
+* Moved loading.js to res folder for Cocos Console release mode.
+
+* Bug fixes:
+ 1. Added `getSpriteFrame` to `cc.Sprite` to fix API inconsistency.
+ 2. Added `getObejct` to `cc.TMXObjectGroup` to fix API inconsistency.
+ 3. Added `addImageAsync` to `cc.textureCache` to fix API inconsistency.
+ 4. Fixed a bug of `cc.text` that its default font name is incorrect.
+ 5. Fixed a bug of `ccui.PageView` that its `getPage` doesn't work.
+ 6. Fixed a bug of `ccui.ImageView` that its `loadTexture` doesn't work while it's invoked multiple times at the same frame.
+ 7. Fixed a bug of `ccui` that its load event callbacks have some mistakes.
+ 8. Fixed a bug of `cc.Layer` that its bake function doesn't work when the layer has a parent node.
+ 9. Fixed typos in `cc.ClippingNode.WebGLRenderCmd` and `cc.ParticleSystem.WebGLRenderCmd` creation.
+ 10. Fixed a bug of `cc.Sprite` in `setTextureRect`.
+ 11. Fixed a bug of `cc.Screen`.
+ 12. Fixed a bug of `cc.view` that it doesn't work on iOS 8.1.2.
+ 13. Fixed a bug of cc.DrawNode that its lineWidth is always to default value when set linewidth to zero.
+ 14. Fixed a bug in hack for particles performance on canvas.
+ 15. Fixed a bug of `cc.audioEngine` that it doesn't work after minified/compiled.
+ 16. Fixed a bug in `CCBoot.js` that WebGL is not activated in web view of iOS 8.
+ 17. Fixed a bug of `cc.CheckBox` that its position is incorrect when its texture isn't preloaded.
+ 18. Fixed a bug of `cc.TMXLayer` that it stops to work after `setTileGID` called.
+ 19. Fixed a bug of Cocos parser 2.x that it doesn't set widget's LayoutComponent.
+ 20. Fixed a bug of `cc.isObject` that it considered function as an object.
+
+Cocos2d-JS v3.3 @ Feb.9, 2015
+
+* Upgraded spine runtime to support the latest version and updated its test case.
+* Added an option "noCache" for debugging on browsers.
+* Set the default value of `cc.ParticleSystem`'s draw mode to texture mode.
+* Added message to `ccs.load` when loading armature json file.
+* Improved particle system test case.
+
+* Bug fixes:
+ 1. Fixed a bug of `cc.Sprite` that its `setSpriteFrame` doesn't work when sprite frame's `rotated` property is true.
+ 2. Fixed a bug of `cc.ClippingNode` when its stencil is `cc.Node` object in canvas mode.
+ 3. Fixed a ccui bug that the position of widgets is incorrect after loaded v2.x json file with `ccs.load`.
+ 4. Fixed a bug of `cc.PhysicsSprite` that `setIgnoreBodyRotation` function doesn't work.
+ 5. Fixed a bug of `ccui.Button` that setting pressed texture doesn't work when scale9 enabled.
+ 6. Fixed a bug of `ccui.ScrollView` that its `dir` property is null when passing `DIR_NONE` as `direction` in `_endRecordSlidAction` function.
+
+Cocos2d-JS v3.3 RC0 @ Feb.1, 2015
+
+* Added web exclusive functions: `_getFontStyle`, `_setFontStyle`, `_getFontWeight` and `_setFontWeight` APIs to `cc.LabelTTF`.
+* Observed orientation change event on mobile for resolution policy adaptation.
+
+* Bug fixes:
+ 1. Fixed Cocos Studio JSON parser's issues for parsing nested animation.
+ 2. Fixed Cocos Studio JSON parser's parameters parsing issues.
+ 3. Fixed Cocos Studio JSON parser's issue for parsing layer.
+ 4. Fixed Cocos Studio JSON action parser's issues.
+ 5. Fixed Cocos Studio JSON parser's issue for parsing Scale9Sprite.
+ 6. Fixed Cocos Studio JSON parser's issues caused by parsing process order.
+ 7. Fixed Cocos Studio JSON parser's issue for parsing loading bar's direction.
+ 8. Fixed UI layout system issues.
+ 9. Fixed `cc.EditBox`'s position issue under certain resolution policies.
+ 10. Fixed `ccui.ListView`'s issue for setting direction.
+ 11. Fixed an issue of `cc.Tween` that its `_currentPercent` is incorrect in `updateHandler` function.
+ 12. Fixed an issue of `ccui.Button` that its state is incorrect in `_onPressStateChangedToNormal`.
+ 13. Fixed an issue of `cc.ArmatureAnimation`'s `setMovementEventCallFunc`.
+ 14. Fixed an issue of `cc.Sequence` action when it's repeated.
+ 15. Fixed `_anchorPointInPoints` usage issue.
+ 16. Fixed an issue of `cc.GLProgram` that it doesn't work on some devices which didn't support highp float precision.
+ 17. Fixed an issue of fade actions that they don't work when duration is 0.
+ 18. Fixed `onended` callback issue of audio engine on iOS.
+ 19. Fixed Cocos Builder's parser issue for auto playing animations.
+ 20. Added a message to `ccs.Armature` that it doesn't support adding widget as its child.
+ 21. Improved test cases for stability.
+
+Cocos2d-JS v3.3 Beta @ Jan.24, 2015
+
+* Added Cocos Studio v2.x parser and refactored 1.x parser.
+* Upgraded new flow layout UI system in web engine.
+* Refactored `load` events of texture2d, sprite and so on to be more intuitive.
+* Added JavaScript file loader.
+* Allowed set texture to null in `cc.Sprite`.
+* Added full test cases for Cocos Studio v2.x parser and the new flow layout UI system.
+* Upgraded MoonWarriors sample's UI and graphic design.
+
+* Bug fixes:
+ 1. Fixed a bug of Cocos2d UI, their focus event has been supported.
+ 2. Fixed a buf of `ccui.Widget` that its percent position doesn't work.
+ 3. Fixed a bug of `ccs.Armature` that its position doesn't update in visit on WebGL render mode.
+ 4. Fixed a bug of `cc.Sprite` that its `setTextureRect` function doesn't work when `setColor` invoked.
+ 5. Fixed a bug of `cc.PhysicsSprite` that its position is incorrect.
+ 6. Fixed a bug of `ccs.Bone` that its `setOpacity` and `setColor` doesn't work.
+ 7. Fixed a bug of `cc.LabelBMFont` that its word wrap doesn't work.
+ 8. Fixed a bug of `cc.sys` that it gets the incorrect OS type when system is Linux.
+ 9. Fixed a bug of `cc.audioEngine` that its loading path is incorrect.
+ 10. Fixed a bug of `ccui.Widget` that it can't touch when it's reused.
+ 11. Fixed a bug of UI system that the `setNormalizedPosition` doesn't work.
+ 12. Fixed a bug of `cc.ActionInterval` that its `_times` conflict with `cc.Blink`.
+ 13. Fixed release texture issue in canvas mode.
+ 14. Fixed a bug of `ccs.actionManager` that its `getActionByName` doesn't work.
+ 15. Fixed a bug of `cc.Sprite` that it can't draw without texture on WebGL mode.
+ 16. Fixed a bug of `cc.audioEngine` that it doesn't work on baidu browser.
+ 17. Fixed a bug of `cc.EditBox` that its position is incorrect on Canvas Mode and its string value is wrong when PlaceHolder is showing.
+ 18. Fixed a bug of `cc.loader` that its `loadImg` function doesn't work when image is accessed cross origin.
+ 19. Fixed a bug of `ccui.TextField` that its `contentSize` is incorrect in text field event.
+
+Cocos2d-JS v3.2 @ Dec.29, 2014
+
+* Replaced `transform` function with `setTransform` function under canvas render mode for better performance.
+* Added a timer in `cc.audioEngine` to check audio element loading event, prevent the loading process being stucked when load audio file failed.
+* Added some new browser types to `cc.sys`.
+* Added some audio resource loading codes to ensure compatibility with Wechat browser.
+* Added check for WebAudio support to ensure compatibility.
+
+* Bug fixes:
+ 1. Fixed an issue that `cc.InputManager` doesn't trigger touch event on chrome mobile emulator.
+ 2. Fixed an issue that `cc.game.setFrameRate` doesn't work.
+ 3. Fixed an issue that `cc.view` can't remove resize event listener.
+ 4. Fixed an issue that `cc.EventManager` didn't set register flag to false when a listener is removed.
+ 5. Fixed an issue that `cc.audioEngine` doesn't play some audios on some iOS devices.
+ 6. Fixed an issue of ccui controls that their `setColor` doesn't work when cascade color is enabled.
+ 7. Fixed an issue that `ccs.Armature`'s `setColor` doesn't work in canvas render mode.
+ 8. Fixed an issue that `ccs.Armature` crashes when adding a child to it.
+ 9. Fixed an issue that `cc.SpriteBatchNode`'s status is incorrect in WebGL render mode.
+ 10. Fixed an issue of `cc.Layer` that its position is incorrect under bake mode.
+ 11. Fixed an issue of `ccui.RichText` that its `setContentSize` doesn't work.
+ 12. Fixed an issue of `cc.LabelTTF` that its `setColor` doesn't work when cascade color is enabled.
+ 13. Fixed an issue of spine that its skeletons position is incorrect when scaleX equals to -1 and scaleY equals to 1.
+ 14. Fixed `sp.Skeleton`'s API inconsistence by renaming `boundingBox` to `getBoundingBox`.
+ 15. Removed all usages of deprecated create functions in the test cases.
+
+Cocos2d-JS v3.2 RC0 @ Dec.11, 2014
+
+* Refactoration of web engine by separating the render logic, the arthictecture level refactoration is now completed and brounght great performance improvement.
+* Refactoration of web engine's resolution adaptation and audio engine with polyfilled adaptation logics for different devices and browsers. This ensures better compatibility and better extensibility for future needs.
+* Added `setRotation` method to `ccui.ImageView`.
+* Added a function that fill sprite with repeated texture in Canvas mode.
+* Added `setLineHeight` method to `cc.LabelTTF`.
+* Added `dumpAudioInfo` to `cc.audioEngine` for debugging purpose on mobile browser.
+* Removed Cocos Studio's Protobuffer support from the framework.
+* Added an outline shader sample.
+
+* Bug fixes:
+ 1. Fixed an issue of `cc.Sprite` that its rendering is incorrect without texture.
+ 2. Fixed an issue of `cc.ClippingNode` that its stencil drawing is incorrect on Canvas Mode.
+ 3. Fixed an issue of `TextFieldReader` that it will throw an error when 'areaWidth' and 'areaHeight' equal to zero.
+ 4. Fixed an issue of `ccui.CheckBox` that its getSelectedState doesn't return its state.
+ 5. Fixed an issue of `cc.LabelTTF` that it doesn't update the string when its string become to empty string.
+ 6. Fixed an issue of `cc.ParticleSystem` that it can't change its texture mode and shape type in Canvas mode.
+ 7. Fixed an issue of `cc.Layer`'s bake function that its position is incorrect when cc.view's scale isn't 1.
+ 8. Fixed an issue of `ccs.ArmatureAnimation`'s `setMovementEventCallFunc` and `setFrameEventCallFunc`.
+ 9. Fixed an issue of `console.log` that it isn't a funtion on IE9.
+ 10. Fixed an issue of `CSLoader` that it will add duplicate resources to sprite frame cache.
+ 11. Fixed an issue of `cc.ProgressTimer` that its setColor is not taking effect.
+ 12. Fixed an issue of `cc.loader` that it will throw an error when loading a remote texture.
+ 13. Upgrade html5 version chipmunk to the latest release.
+
+Cocos2d-JS-v3.1 @ Oct.22, 2014
+
+* Released Facebook Integration for Cocos2d-JS v1.0, all APIs have been significantly polished and stabilized. Improved test cases for Facebook with more features demonstrated.
+* Upgraded Cocos2d-x to v3.3 rc0
+* Supported Cocos Studio v2.0 including Timeline animation support and proto buffers format support for both web engine and JSB engine.
+* Refactored load event of texture, sprite frame and sprite for better maintainability.
+* Refactored `cc.rendererCanvas` for improving performance.
+* Moved the `CC_Texture0` definition of fragment shader to cc.GLProgram to ensure compatibility with JSB.
+* Added normalized position functions to cc.Node.
+* Refactored the constructor of Cocos Studio's classes and deprecated all create functions.
+* Refactored Cocos Studio reader for better maintainability.
+* Improved Facebook SDK.
+* Modified `cc.ProgressTo`'s behavior, its progression didn't reset to zero when the progression is 100.
+* Changed `ccui.Widget`'s default anchor point to (0, 0) in widget reader.
+* Removed all deprecated create function usage in engine and in the test cases.
+
+* Bug fixes:
+ 1. Fixed an issue of `cc.UILayout` that its scissor mode didn't work.
+ 2. Fixed an issue of `ccui.TextBMFont` that its 'string' property setting was incorrect.
+ 3. Fixed an issue of `cc.DrawNode` that its element's position was incorrect in Canvas mode.
+ 4. Fixed an issue of `cc.Layer` that its bake function didn't work in new renderer.
+ 5. Fixed an issue of `cc.Scale9Sprite` that its cached canvas size was incorrect.
+ 6. Fixed an issue of `cc.Director` that its position was incorrect when calling `setProjection` in new renderer.
+ 7. Fixed an issue of `cc.view` that the reinitialization logic of frame size was incorrect.
+ 8. Fixed incorrect usage of `cc.progressTo` in progress action test.
+ 9. Fixed an issue of CocosNodeTest for the new renderer.
+ 10. Fixed minor issues in test cases.
+
+* Known Issues:
+ 1. `jsb.AssetsManager` doesn't work on windows due to a bug in libcurl
+
+Cocos2d-JS v3.1 beta @ Oct.13, 2014
+
+* Refactoration of the web engine with new renderer on the architecture level, optimization is under going.
+* Released Facebook SDK for Cocos2d-JS beta2, its API have been significantly improved and stablized.
+* Upgraded MoonWarriors sample with new set of graphical assets.
+* Automatically enabled WebGL on iOS 8 safari.
+* Upgraded chipmunk.js to the newest version.
+* Supported setting color of shadow for `cc.LabelTTF`.
+* Added `getTitleRenderer` function to ccui.Button.
+* Supported Coco Studio timeline animation.
+* Set the default value of LabelAtlas's `cascadeOpacityEnabled` and `cascadeColorEnabled` to true.
+* Added a listener of texture to `cc.Sprite#setTexture` when the texture hasn't loaded.
+* Activated `cc.pool` for all kind of objects.
+* Added query test for chipmunk and added necessary JavaScript bindings.
+
+* Bugs fix:
+ 1. Fixed a bug of `cc.ComponentContainer` that a 'if' statement behavior is incorrect.
+ 2. Fixed a bug of `cc.Scale9Sprite` that the behavior of Canvas and WebGL is different.
+ 3. Fixed a bug of `cc.EventListener` that its pause state should set to true.
+ 4. Fixed a bug of `cc.ParticleSystem` that it should apply canvas scaling on canvas rendering mode.
+ 5. Fixed a bug of CCBoot.js that `cc.loader` should add a condition to check whether `crossOrign` property is undefined on IE9 and IE10.
+ 6. Fixed a bug of `ccui.Widget` that its `setPosition` function's behavior is incorrect.
+ 7. Fixed a bug of `ccui.LoadingBar` that its `barRenderer` should add to protected children array.
+ 8. Fixed a bug of `cc.Texture2D` that its `TEXTURE_MAG_FILTER` should set to LINEAR.
+ 9. Fixed a bug of `cc.TMXMapInfo` that its doesn't parse `rotation` property.
+
+Cocos2d-JS-v3.0 Final @ Sep.10, 2014
+
+* Facebook SDK Beta2: Added `appRequest` API.
+* Facebook SDK Beta2: Added permission request in `login` API, removed `requestPermission` API.
+* Facebook SDK Beta2: Renamed `request` API to `api`.
+* Facebook SDK Beta2: Renamed `publishInstall` API to `activateApp`.
+* Added getter and setter function for browser's density dpi: `cc.view.setTargetDensityDPI`, `cc.view.getTargetDensityDPI`.
+* Added some type check functions.
+* Added audio support for wechat browser.
+* Added setPlaceHolderColor and setTextColor to ccui.TextField.
+* Added API reference for Cocos Studio extension.
+
+* Bugs fix:
+ 1. Fixed an issue of `cc.Menu` that its item's touch priority is different than cc.eventManager.
+ 2. Fixed an issue of `cc.view` that its NO_BORDER mode doesn't work correctly.
+ 3. Fixed an issue of `cc.LabelBMFont` that its content size is different than JSB.
+ 4. Fixed an issue of `cc.LabelBMFont` that its `setColor` is invalid on some mobile devices.
+ 5. Fixed an issue of `cc.PageView` that it can't receive TOUCH_CANCEL event.
+ 6. Fixed an issue of `cc.loader` that it can't load cross origin textures.
+ 7. Fixed an issue that Facebook SDK Web's `appRequest` wraps info parameter incorrectly.
+ 8. Fixed an issue of ccui widgets' `addEventListener` that it doesn't accept function's target as parameter.
+
+Cocos2d-JS-v3.0 RC3 @ Aug.29, 2014
+
+* Facebook SDK Beta: Unified the callback parameters for different platform.
+* Facebook SDK Beta: Added payment API on Web platform.
+* Facebook SDK Beta: Supported app request and share open graph API on Web platform.
+* Facebook SDK Beta: Remove plugin configuration for Facebook SDK to simplify the usage.
+* Facebook SDK Beta: Added test case for new features and improve all test cases.
+* Cocos Console: Improved web compile with `--advanced` tag.
+* Improved Cocos2d-JS inline docs to provide a better API reference document.
+* Refactored cc.game for maintainability.
+* Refactored cc.async to simplify and improve the usage.
+* Added `cc.formatStr` for string formatting, for example: `cc.formatStr("a: %d, b: %b", a, b)`.
+* Refactored cc.log to support formatted string.
+* Refactored cc.pool's `hasObj` to `hasObject` and `removeObj` to `removeObject`.
+* Added some state check to cc.audioEngine.
+* Refactored sprite's blend function to support more features on Canvas.
+* Refactored `cc.textureCache.textureForKey` to `cc.textureCache.getTextureForKey`, `cc.TMXTilemap#propertiesForGID` to `cc.TMXTilemap#getPropertiesForGID` to follow the standard API naming style.
+* Detected mouse event on touch screen tablets.
+* Support new construction for cc.PhysicsDebugNode and deprecated `cc.PhysicsDebugNode.create`
+* Made cc.Texture2D's setTexParameters supports two types of parameters.
+* Added test case for remote image loading.
+
+* Bugs fix:
+ 1. Fixed an issue of tilemap that it can't runAction in canvas render mode.
+ 2. Fixed an issue of cc.eventManager that its removeListeners' codes are unreachable.
+ 3. Fixed an issue of cc.EditBox that its position is incorrect.
+ 4. Fixed an issue of cc.WebAudio that its stopped state is incorrect.
+ 5. Fixed an issue of cc.audioEngine that it doesn't work on firefox after it compiled with advanced mode.
+ 6. Fixed an issue of ccs.Bone that it doesn't update color and opacity correctly.
+ 7. Fixed an issue of ccs.Armature that its setShaderProgram doesn't work.
+ 8. Fixed cc.Sprite and cc.Scale9Sprite's issue so that their texture loads incorrectly.
+ 9. Fixed an issue of ccui.LoadingBar that its setPercent is invalid.
+ 10. Fixed an issue of Armature reader that it can't parse isTween property.
+ 11. Fixed an issue of ccui.PageView that its getTouchBeganPosition returns incorrect value.
+ 12. Fixed an issue of ccui.ImageView that its setColor doesn't work.
+ 13. Fixed an issue of cc.RenderTexture that it doesn't support parameter depthStencilFormat.
+ 14. Fixed an issue of ccs.ArmatureAnimation.setSpeedScale.
+ 15. Fixed an issue of cc.Scale9Sprite that it has a line on iOS device.
+ 16. Fixed CCProgressTimer draw on canvas with colorized sprite
+ 17. Fixed an issue of cc.game that its frameRate setter is invalid.
+ 18. Fixed an issue of cc.loader that its callback state is incorrect.
+
+Cocos2d-html5-v3.0 RC2 @ Aug.8, 2014
+
+* Refactored Cocos UI for more stable and friendly user experience.
+* Upgraded Cocostudio reader to support version 1.2 - 1.5.x.
+* Upgraded Cocostudio Armature animation from Cocos2d-x v3.2.
+* Added back 2.x createWithXXX functions and deprecate all create/createWithXXX functions.
+* Merged cc.NodeRGBA and cc.LayerRGBA to cc.Node.
+* Fixed ctor functions bugs to support new construction.
+* Refactored cc.Sprite's setColor to improve its performance.
+* Renamed CCAffineTransform.js's functions to lowercase started functions.
+* Upgraded cc.Scale9Sprite from Cocos2d-x 3.2.
+* Improved cc.LabelTTF's line break algorithms to support multi-languages.
+* Made cc.RenderTexture's beginWithClear accept color value from 0-255.
+* Improved implementation of all Actions lower case alias creation functions.
+* Added lower case creation functions for 3d actions and progress actions.
+* Added cc.sys.platform API for detecting platform.
+* Upgraded HelloWorld project with v3.0 APIs.
+
+* Bugs fix:
+ 1. Fixed a bug of cc.WebAudio that sourceNode's playbackState is invalid on some browsers.
+ 2. Fixed a bug of cc.MenuItemToggle that callback is not correctly initialized when using new construction.
+ 3. Fixed a bug of ccui.Layout that its clipping area is incorrect.
+ 4. Fixed a bug of requestAnimFrame that it doesn't work after re-focus WeChat browser on Samsung mobile.
+ 5. Fixed a bug of CCBoot.js that bind function is undefined in Safari for iOS 5.1.
+ 6. Fixed a bug in cc.layer's bake function that its position is incorrect when cc.view is scaled.
+ 7. Fixed a bug of cc.LayerMultiplex.
+ 8. Fixed a bug of cc.TMXLayer that it can't display all map image when its type is hexagonal.
+ 9. Fixed a transform error in ccs.TransformHelp.
+ 10. Fixed a bug of cc.ControlSwitch.
+ 11. Fixed image format constant inconsistence.
+ 12. Fixed a bug of ccui.Widget that it is invisible after popScene.
+ 13. Correct behavior of cc.TransitionSlideInB and cc.TransitionSlideInT.
+ 14. Fixed bugs of ccui.Widget and ccui.Text's clone functions.
+
+
+Cocos2d-html5-v3.0 RC0 @ July.3, 2014
+* Added Facebook SDK plugin into Pluginx extension.
+* Refactoration of gui system `ccui` for better performance, usage and maintainbility.
+* Added `bake` function to `cc.Layer` to support layer baking.
+* Added object pool extension: `cc.pool`.
+* Added new easing functions: bezier action, quadratic actions, quartic actions, quintic actions, circle actions, cubic actions.
+* Made `cc.loader` continue the counter process even if a resource failed to be loaded.
+* Supported multiple property objects in `cc.Class.extend` function.
+* Refactored `ccui.Widget`'s `getLeftInParent`, `getBottomInParent`, `getRightInParent`, `getTopInParent` to `getLeftBoundary`, `getBottomBoundary`, `getRightBoundary`, `getTopBoundary`.
+* Refactored `cc.FadeIn.create(duration, toOpacity)` to `cc.FadeIn.create(duration)`.
+* Refactroed all string access functions in `ccui` extension to `setString` and `getString`.
+* Added `getContentSize` and `setContentSize` in `ccui` extension.
+* Changed the default alpha value of `cc.Color` from `undefined` to 255.
+* Made `cc.log` support formatted string.
+
+* Bugs fix:
+ 1. Fix bugs on creating sequence objcet or spawn object using new method.
+ 2. Fix a bug that `ccui.LoadingBar`'s `setPercent` function will crash when its texture is in a plist file and scale9Enabled is true.
+ 3. Fixed a bug of `cc.audioEngine` that it crashs when audio isn't correctly loaded and its duration is infinity.
+ 4. Correction of the calculation of `cc.visibleRect`.
+ 5. Fix `cc.Skin`'s bounding box calculation for canvas rendering.
+ 6. Fix an issue that `cc.TextureCache` doesn't handle loaded texture in some case.
+ 7. Fix an issue that texture rect could be zero sized in `initWithFile` function of `cc.Sprite`.
+ 8. Fix a bug on inverted ClippingNode with DrawNode as stencil in Canvas render mode.
+ 9. Fix a bug that `cc.SpriteFrame` didn't support initialization with texture name parameter.
+ 10. Fix a bug on `ccs.ArmatureAnimation`'s loop parameter.
+ 11. Fix a bug that `cc.JumpTo`'s `_delta` position calculation is incorrect.
+ 12. Fix a bug of `cc._audioLoader` that it doesn't work when it failed to load an audio file.
+
+Cocos2d-html5-v3.0 beta @ May.23, 2014
+
+* Refactored actions to make it more friendly and easy-to-use.
+* Integrated Spine skeleton animation feature.
+* Renamed constants of ProgressTimer, Scale9Sprite, TMXLayerInfo, Node, ParticleSystem for maintainability.
+* Modified mouseMove event behavior of cc.inputManager to compatible with Cocos2d-x
+* Modified cc.game.run to receive a canvas id as parameter.
+* Added local audio file playing from 'file://' origin.
+* Added local images file displaying from 'file://' origin.
+* Refactored cc.TMXLayer's setTileAt etc functions to support point or x,y as their parameters.
+* Added a check to cc.Sprite and cc.SpriteFrame to avoid its texture rect out of bounds.
+* Added a check to cc.SpriteFrame to avoid cc.loader release invalid sprite frame file.
+* Made cc.Touch return copies of point.
+* Made the default of cc.Color alpha value is 255 to avoid cc.Sprite's setColor is invalid.
+* Optimized cc.Node.sortAllChildren for better performance.
+* Added warning of cc.Texture2D if it has an invalid texture.
+
+* Bugs fix:
+ 1. Fixed a bug of cc.winSize that it returns incorrect value when using setDesignResolution.
+ 2. Added a check to cc._setup to avoid double invocation.
+ 3. Fixed a bug of cc.TMXMapInfo that its tile's property id is incorrect.
+ 4. Fixed a bug of cc.Scale9Sprite that its CascadeColor and CascadeOpacity are invalid.
+ 5. Fixed a bug of ccs.UILoadingBar which its barRendererScaleChangedWithSize is incorrect.
+ 6. Added some forgotten files to build.xml for minimize core.
+ 7. Corrected a mistake of renderMode default value in CCBoot.js.
+ 8. Fixed a bug of ccui.Layout's draw function that its scaleX, scaleY value is incorrect.
+ 9. Fixed a bug of cc.Audio's stopMusic function.
+ 10. Fixed a bug of TextureCache that it can't remove image's event handler.
+ 11. Fixed ClippingNode's DrawNode stencil bug on Canvas.
+ 12. Fixed a typo 'cc.radiansToDegress' function to 'cc.radiansToDegrees'.
+ 13. Fixed a bug of ccui.ImageView that its setSize is invalid when the picture without pre-load.
+ 14. Fixed a bug of cc.ParticleSystem that it throws a error when create from CocosBuilder.
+ 15. Fixed a bug of cc.LabelAtlas that it can't display its children.
+ 16. Fixed a bug of cc.fontLoader that it can't load custom font.
+ 17. Fixed a bug of ccui.Widget that its setOpacity is invalid.
+ 18. Fixed a bug of cc.Node that it transform value is incorrect when a node skew to a special value.
+
+Cocos2d-html5-v3.0 alpha2 @ April.14, 2014
+
+* Minimized the size of core from 254k to 113k after google closure advanced compiling
+* Made cc.DrawNode support some DrawingPrimitive's drawing function on WebGL mode
+* Added undefined checking in cc.loader for better performance.
+* cc.Sprite supports creating a sprite through external URL.
+* Added the warning information to notice developers that their project.json cannot be loaded or parsed.
+* Added retina display support to cc.Editbox.
+* cc.Node's pauseSchedulerAndActions and resumeSchedulerAndActions are deprecated, please use pause and resume instead.
+* Added render mode checking to 3D action classes.
+* Added SocketIO
+* Sync cc.eventManager to the latest version of Cocos2d-x v3.0 Stable.
+* ccui.Layout's doLayout function has been set to private function "_doLayout"
+* Made actions extendable directly via ctor
+* Added null callback check in cc.textureCache.addImage
+* Fixed the API inconsistence of ccs.ArmatureAnimation.play
+* Fixed compatibility and performance for ctor
+* Renamed all Uppercase functions to lowercase in CCMacro
+* Added necessary GL constants in H5
+* Fixed CONSTANTS inconsistence between h5 and JSB
+
+* Bugs fix:
+ 1. Fixed ccs.comAttribute API incompatible issue
+ 2. Fixed a bug of Cocostudio's data reader that getting isTween value is incorrect when the attribute value is false.
+ 3. Fixed a bug of Sprite that it doesn't work when its texture doesn't preload and its parent is a SpriteBatchNode
+ 4. Fixed a bug in CCBoot.js that console.error is invalid on firefox.
+ 5. Fixed some comment errors of framework.
+ 6. Fixed a bug of cc.LabelBMFont that it's multiline works incorrectly.
+ 7. Fixed a bug that Touches event doesn't work in release mode on IE browser.
+ 8. Fixed a bug that cc.winSize has not been reset after cc.view.setDesignResolutionSize.
+ 9. Fixed typo in ccui.Widget.TOUCH_BEGAN
+ 10. Fixed a bug of cc.MenuItemSprite.create that
+ 11. Fixed a bug of cc.loader that it need to set value before call the callback.
+ 12. Fixed a bug of cc.log that it doesn't work in IE9
+ 13. Fixed IE incompatible issue with __lookupGetter__
+ 14. Fixed a mistake of cc.Node that it return a reference of _position in getPosition
+ 15. Fixed a bug of cc.ClippingNode that its _super is undefined
+ 16. Fixed a bug of inputManager's touch event in IE browser
+
+* Known Issues:
+ 1. EventListener is not extendable.
+
+
+Cocos2d-html5-v3.0 alpha @ March.15, 2014
+
+* Refactor some properties of all rendering classes with getter setter for providing javascript user friendly APIs.
+* Provide `attr` function for cc.Node and its descendants to permit modify multiple properties at the same time with a key-value object.
+* Refactor foundational data structures for better maintainability.
+* Add event manager to cocos2d-html5, all events are dispatched via cc.eventManager to event listener.
+* Refactor cc.Application to cc.game.
+* Refactor singleton Classes to javascript object.
+* Refactor all createWithXXX functions into unified create function with different parameters.
+* Use `moduleConfig.json` to config the paths of engine scripts.
+* `cocos2d.js` is replaced with `project.json`.
+* Refactoring cc.loader.
+* CocoStudio GUI updated to 3.0, and ccs prefix of UI widgets have been changed to ccui.
+* CocoStudio v1.3.0 has been supported in v3.0.
+* richText has been supported in v3.0.
+* Use `cc.BuilderReader.registerController` to register controller of ccb.
+* Add `cc.path` to handle operations of file path.
+* Add `cc.async` to handle async operations.
+* Add cc.NodeGrid in v3.0.
+* Replace `replaceWithScene` and `runWithScene` with `runScene`.
+* move sys.xxx to cc.sys.xxx.
+* Refactor CCEGLView.js for better maintainability.
+* Refactor CCScheduler.js for better maintainability.
+* Remove arguments.callee which is forbidden in ECMAScript strict mode.
+* Refactor Array clean function for better performance.
+* Refactor some functions about array operation.
+* Refactor FadeIn/FadeOut to fix a bug that it always start from/to 255.
+* Rewrite functions in CCNS.js with regex.
+* Move CCFormatHelper and CCNS content into CCCommon.js.
+* Refactor cc.Screen to support all browsers.
+* Add retina display support for Apple devices to cc.view.
+* Add "allLayers" function to cc.TMXTiledMap.
+* Make cc.p and cc.size support two types of parameters.
+* cc.DrawNode supports all functions of cc.DrawingPrimitive on Canvas mode.
+* WebAudioEngine is supported on iOS now.
+* Use event on cc.canvas to make full screen.
+* Add a browser white list that support multiple audio playback at the same time.
+* Removed in/hasOwnProperty usage in engine for better performance.
+* Refactoring CCCommon.js, delete some unused functions, rename some functions for better maintainability.
+* Add analytics plugin protocol ,Flurry plugin and ProtocolAds.js plugin protocol.
+* Arguments length check replaced by undefined check for better performance.
+* Fix legacy Function.prototype.bind support.
+
+* Bugs fix:
+ 1. Avoid CCLabelTTF enter in infinite loop while character's width larger than the dimension width
+ 2. Add jsDoc Flags to cc.NodeRGBA and cc.LayerRGBA
+ 3. Fixed a bug that Schedule doesn't restart when widget is re-added after being removed
+ 4. Correction of split logic in CCLabelTTF
+ 5. Fixed a bug that armature animation does not display correctly on canvas mode
+ 6. Correct gui widget clone functions
+ 7. Fixed a bug of cc.SpriteFrameCache that filePath is needed in `loadedFileNames`
+ 8. Add a condition check to avoid texture out of range bug
+ 9. Fixed a bug of cc.Editbox that its position is incorrect when its parent node isn't root node.
+ 10. Fixed a SimpleAudioEngine's state error.
+ 11. Fixed a bug of cc.TMXTileMap that its `_tileProperties` should be a dictionary object
+ 12. Fixed a bug of cc.DrawNode that it need to deep-copy verts in `drawPoly`
+ 13. Fixed a bug of UILabelBMFont that variable `_strStringValue` should be `_stringValue`
+ 14. Fixed a bug in SceneReader's `setPropertyFromJsonDict` function
+ 15. Fixed a bug when margin not set in ccs.Margin
+ 16. Fixed a bug of cc.TMXLayer that its `removeChild` works incorrectly.
+
+* Known Issues:
+
+Cocos2d-html5-v2.2.2 @ Dec.31, 2013
+* Resolution policy now act as a combination of cc.ContainerStrategy and cc.ContentStrategy so that user can beautifully customize its behavior.
+* cc.LabelTTF's now support perfectly automatic line break with occidental and Chinese characters.
+* cc.ClippingNode for canvas render mode is implemented.
+* Refactored cc.Node and cc.Sprite by adding cc._PointConst and cc._SizeConst for better Performance. Now the performance of setPosition and getPosition is faster 65% than before.
+* CCNode's setContentSize and setAnchorPoint support two types of parameters, more friendly and more efficient. setAnchorPoint(x,y) is faster 35% than setAnchorPoint(cc.p(x,y)).
+* Added NPM support and adjusted folder structure. It supports modules customization, the mini HelloWorld is just 185KB when package all files into single file.Please visit NPM Guide for more details.
+* Added SpriteFrameCache JSON format support.
+* Added source map generating of Closure Compiler advance mode , please make sure your JDK version is 7.0 and up.
+* Improved audio compatibility for mobile browser, added playing queue to solve the one audio restriction of some mobile browser.
+* Refactoring TMXLayer for better performance.
+* set cc.Rect's origin and size from public to private for compatibility with JSB.
+* CocoStudio supports async image loading.
+* cc.log supports printing object content to console
+* Refactoring indexing of actionManager and Scheduler for better performance.
+* ClippingNode supports some features on Canvas Mode.
+* Migrated Armature to v2.2.2.
+* Add callback function to CocoStudio action completion and refactoring it for better performance.
+* CCBReader supports that CCControl can send action by all types of event.
+* Add create function to cc.NodeRGBA
+* Add jsdoc document to CocoStudio classes
+
+* Bugs fix:
+ 1. Fixed a bug of TMXLayer that it has thin lines at tile's border when EGLView's scale doesn't equal 1.
+ 2. Fixed bugs of LabelBMFont about updateDisplayedOpacity and multi-line is incorrect.
+ 3. Fixed a bug of LabelTTF that enter an infinite loop when setting special string and fontSize to it.
+ 4. Fixed a bug of NodeRGBA and LayerRGBA about updateDisplayedColor and updateDisplayedOpacity.
+ 5. Fixed a bug of ProgressTimer that it can't change color and opacity when calling setColor and setOpacity directly.
+ 6. Fixed a bug of cc.ProgressTimer that it has a blink when its reverseDirection equals false and type equals cc.PROGRESS_TIMER_TYPE_RADIAL.
+ 7. Some Loaders need modify their default value to adapt CocosBuilder that CocosBuilder ignores some two properties object like cc.Point when all the properties equals to zero.
+ 8. Fixed a bug of Fixed a bug of TMXTileMap that its getProperty doesn't work.
+ 9. Fixed a bug of ActionInterval that it throws error when its target doesn't have RGBAProtocol property.
+ 10. Fixed a bug of MenuItemSprite that it throws an error when create a MenuItemSprite object with cc.Node.
+ 11. Fixed a bug of UIWidget that its container intercept touch event while they can't.
+ 12. Fixed a bug of ccs.UILayout about relative positioning.
+ 13. Fixed a bug of Armature that its nodeToParentTransformCanvas correct.
+
+* Known Issues:
+ 1. Effect Advanced Lens3D doesn't work
+ 2. ClipNodeTest effects varies in different browsers
+ 3. Stencil of cc.ClippingNode doesn't work well with WEBGL render mode, the stencil have the right size and shape but it masks the content with a monochrome mask.
+
+Cocos2d-html5-v2.2.1 @ Nov.19, 2013
+* CocoStudio is now supported on Cocos2d-html5. The GUI, scene and component modules have been added to it.
+* cc.EGLView and most render classes have been re-written to adapt multiple resolution resources in-order to optimize performance on mobile browsers.
+* Refactored cc.LabelTTF, now its contentSize and position is correct for labels which has defined stroke and shadow.
+* Corrected the behavior of "CascadeColorEnabled" and "CascadeOpacityEnabled" for cc.NodeRGBA and cc.LayerRGBA.
+* All cc.Assert has being replaced, and more arguments checking and log information have added to engine's function.
+* Added cc.Screen to engine, it uses to enter/exit FullScreen mode.
+* Added cc.VisibleRect to engine, it provides nine points of game view for positioning.
+* cc.WebAudioEngine now works perfectly on chrome.
+* CocoStudio's namespace changes to 'ccs' now, and the other module's namespace will be renamed and support NPM in next version.
+* cc.rect now accepts more types of parameters on JSB and HTML5 now, for example: cc.rect(1,1,1,1) and cc.rect(aRect), and cc.rect(cc.p(1,1),cc.size(10,10));
+* Optimized cc.Node's getBoundingBoxToWorld for better Performance.
+* Modified the _sequenceCompleted method in CCBAnimation, it can set the next sequence in callback now.
+* Improved the maintainability for _drawSceneForWebGL and _drawSceneForCanvas.
+* ParticleExamples has been refactored for JSB.
+* HelloHTML5World's CircleSprite has been removed, because it doesn't work on JSB.
+
+* Bugs fix:
+ 1. Fixed a Scale9Sprite's bug that setCapInsets is invalid.
+ 2. Fixed a bug that prevents the game to run on Chrome 31 WebGL mode.
+ 3. Fixed a bug of LabelTTF that doesn't work on Baidu browser.
+ 4. Fixed a bug of Sprite that it shouldn't to set transform dirty when setting color or opacity.
+ 5. Fixed a bug that cc.EditBox's setFontSize is invalid.
+ 6. Fixed a bug that Particles doesn't work when search path in FileUtils was set.
+ 7. Fixed a bug of Scale9Sprite that it throws an error when _scale9Image is null.
+ 8. Fixed a bug of LayerGradient that it shows wrong size when setting content size.
+ 9. It should listen to the method "onLoad" in cc.FileUtils when the browser isn't IE.
+
+* Known Issues:
+ 1. Effect Advanced Lens3D doesn't work
+ 2. ClipNodeTest effects varies in different browsers
+
+Cocos2d-html5-v2.2 @ Sep.19, 2013
+* Improved Sprite, Node, LabelTTF class define from separated code to combined code for maintainability, now it is clean and clear
+* added a new sample game "Fruit attack" which works great on PC browsers, mobile browsers, and can even be run natively as an android and iOS app with JSB
+* cc.Sprite and its subClasses's texture has been replaced from DOM element to cc.Texture2D on Canvas mode
+* Improved cc.Texture2d for direct using without pre-loading image resources, you don't need to wait resources loading when create a new scene or layers
+* Migrated CCBReader and GUI to Cocos2d-x 2.1.4
+* Improved update function of Action, and avoid using temporary object, it is good for GC and performance
+* Modified LabelTTF's rendering from direct drawing to pre-rendering for performance, 100% faster than before on mobile browser
+* Fixed APIs of HTML5 according to JSB for compatibility, e.g. cc.ParticleSystemQuad has merged into cc.ParticleSystem, please check it on upgrade guide v2.1.5 to v2.2(http://www.cocos2d-x.org/wiki/Upgrade_Guide_from_Cocos2d-html5_v215_to_v22)
+* Added Hiding url address bar for mobile browser, please check the template and hello world
+* Re-writed Canvas Mode of RenderTexture to adapt WebGL interface
+* Added frame event, collider and blend type supporting for Armature. Now Armature supports two tools:1.CocoStudio(windows,http://www.cocostudio.org),2.DragonBones(flash, https://github.com/2youyouo2/SkeletonAnimationDesignPanel)
+* Set auto render mode default value to canvas in mobile browsers and WebGL in desktop browsers
+
+* Bug fix:
+1. Fixed cc.Sprite's displayFrame returns wrong value on Canvas mode.
+2. Fixed cc.LabelBMFont is very slow when calling setString
+3. Fixed a bug of CCBReader that cc.ControlButton doesn't work when its controller is _jsControlled
+4. Fixed a bug of cc.TextureCache that the status of texture is wrong in callback
+5. Fixed a bug of cc.Scale9Sprite that its contentSize is wrong when call setCapInsets
+6. Fixed a bug of cc.TableView's that contentSize is wrong when change datasource
+7. Fixed a bug of cc.Sprite that its children also follow fliped when it was fliped
+8. Fixed cc.Node's nodeToWorldTransform returns wrong value on Canvas Mode
+9. Fixed a bug of cc.LayerColor that represent incorrect opacity passed into init method
+10. Stop listening and remove the event for HtmlImageElement object onload
+11. Fixed cc.ProgressTimer display wrong when its sprite was flipped
+12. Fixed some bugs for actions that set their object property through reference when initiating actions.
+
+* Known Issues:
+ 1. Effect Advanced Lens3D doesn't work
+ 2. ClipNodeTest effects varies in different browsers
+
+Cocos2d-html5-v2.1.5 @ July.24, 2013
+* Ported engine API to keep the same as Cocos2d-x v2.1.4 API
+* Optimized John Resig's inheritance pattern (cc.Class.extend) with advanced property initialization.
+* Implemented the rest of extensions features according to Cocos2d-x v2.1.4
+* Integrated Armature module
+* Rewrote CCGrid, CCMotionStreak , CCProgressTimer with TypeArray
+* Optimized performance for actions
+* Optimized performance for MoonWarriors and CocosDragonJS
+
+* Bug fix:
+ 1. Fixed cc.EditBox Dom Element position issue when EGLView is set
+ 2. Fixed cc.EGLView adjustSize bug
+ 3. Fixed the bug of cc.ParticleBatchNode that it doesn't hide particles after particle life has expired when calling stopSystem()
+ 4. Fixed a bug that LabelTTF dimension behavior doesn't support height=0
+ 5. Fixed line height for multiline LabelTTF and overlapping pixels in Scale9Sprite on Canvas browsers
+ 6. Fixed a bug of cc.SimpleAudioEngine that unloading effect doesn't work
+* Known Issues:
+ 1. Effect Advanced Lens3D doesn't work
+ 2. ClipNodeTest effects varies in different browsers
+ 3. nodeToParentTransform in cc.Node returns wrong value on Canvas mode
+
+Cocos2d-html5-v2.1.4 @ Jun.12, 2013
+* Added support for multiple resources loading. This mechanic is the same as cocos2d-x now
+* Optimised "Performance Tests -> Sprites Test", and increased its benchmark to 220%!
+* Migrated audio (CocosDenshion) API to keep the same as Cocos2d JS API
+* Added auto test for NodeTests and TilemapTests
+* Changed CCTextureCache member functions such as addImage(path), addImageAysnc(path), removeTextureForKey(key) from using relative path to absolute path
+* Added support for particle batch node
+
+* Bug fix:
+ 1. Fixed preLoading issue on iOS 5.1.1
+ 2. Fixed cc.Menu / cc.MenuItemImage remaining touchable issue after replaceScene
+ 3. Fixed Box2d and chipmunk path error for single engine file mode
+ 4. Fixed cc.EditBox Dom Element position issue when cc.EditBox skewed
+ 5. Fixed cc.ScrollView position issue when it's parent node moved
+ 6. Fixed cc.TouchDispatcher can't touch issue when WebPage has been scrolled on Firefox or IE
+* Known Issues:
+ 1. Effect Advanced Lens3D doesn't work
+ 2. ClipNodeTest effects varies in different browsers
+
+Cocos2d-html5-v2.1.3 @ May.1, 2013
+* CCEditbox now implemented for WebGL and JSB
+* Updated CCBReader to latest version
+* Performance optimization on Firefox 20%
+* Added render mode flag to switch between WebGL and canvas2d
+* Added support for Tizen
+* Now able to load embedded texture file in a plist
+* EGLView now works if canvas is placed inside another DOM element
+* Added a Simulator which can be found in MoonWarriors Directory
+
+* Bug fix:
+ 1. Preloading on some mobile browsers
+ 2. CCLoader for WebGL
+ 3. ccNode memory leak
+* Known Issues:
+ 1. Effect Advanced Lens3D doesn't work
+ 2. Particle System has some weird behavior when load from CCBReader
+ 3. RenderTextureTest RenderTextureIssue937 & Issue1464 doesn't work properly
+ 4. ClipNodeTest effects varies in different browsers
+
+
+Cocos2d-html5-v2.1.2-beta @ Mar.20, 2013
+* WebGL rendering mode implemented - blazing fast on supported browsers
+* Added many WegGL test to testbed
+* cc.Loader now supports multiple stage preloading - all tests now preload by multi resource groups
+* Now warns the user if their browser does not support html5
+* cc.Node now uses transform matrix - better performance
+* Accelerometer implemented - Also works on Javascript binding (JSB) for Cocos2d-x & Cocos2d-iPhone
+* Supports MP4 and M4a Audio format now
+* Designer resolution for multi resolution support - Also works on Javascript binding for Cocos2d-x
+* Faster Particle - thanks to Ivo Wetzel
+* Bug fixes:
+ 1. File utility fixed
+ 2. Audio support bug fixed
+ 3. Removed some trailing coma which prevents blocks closure compiler
+ 4. Local storage bug fixed
+ 5. cc.MenuItemImage and cc.MenuItemToggle bugs fixed
+ 6. Fixed compatibility with some UIWebView
+ 7. Fixed rounding errors on ease actions
+* Known Issues:
+ 1. Effect Advanced Lens3D doesn't work
+ 2. particle system can't load texture from plist
+ 3. EditBox doesn't work on WebGL mode
+ 4. Particle System has some weird behavior when load from CCBReader
+ 5. RenderTextureTest RenderTextureIssue937 & Issue1464 doesn't work properly
+ 6. ClipNodeTest effects varies in different browsers
+
+Cocos2d-html5-v2.1.1 @ Jan.28, 2013
+* Fixed bugs
+* Added mouse button to MouseDispatcher, supports right-click
+* Changed preload audio type from "bgm" and "effect" to "sound"
+* Added "Sys" class for system capabilities
+* Improved cc.BuilderReader to support .ccbi extension auto-completion
+* Improved TMXXMLParser to support XML, CSV and zlib compression
+* Changed cc.Time.gettimeofdayCocos2d to Date.now which is more javascript friendly.
+* Added support for stackable actions
+
+Cocos2d-html5-v2.1.0 @ Dec.4, 2012
+* Improved cc.Class and add Release Mode
+* All tests and games can now be run on Cocos2d-html5, Cocos2d-iPhone and Cocos2d-x
+* Added support for google.base
+* Added support for CocosBuilder and Bone Animation
+* Updated API for Javascript Binding
+* Integrated Chipmunk physical engine and chipmunk tests
+* Added physicsDebugNode, physicsSprite, drawNode
+* Built cocos2d-js-tests repo for tests
+* Fixed support for mouse/touch/keyboard
+* Fixed bugs
+* Added WaterMelon with me and CocosDragon games for sample
+* Added Edit Box for input
+
+Cocos2d-html5-v2.0.0 @ Aug.28, 2012
+* Updated API to Cocos2d-x V2.0
+* Updated template and directory name
+* Improved JS files loader
+* Added support for Dom rendering
+* Updated JSDoc comments and shell
+* Added TileMap property process and flip
+* Improved BMFont
+* Added Actions spline paths and cc.AnimationFrame
+* Added support for multi-touch
+* Added mini-framework for Dom manipulation
+* Changed cc.Animation, cc.AudioEngine, cc.LableTTF and cc.Sprite API
+
+
+Cocos2d-html5-v0.5.0-alpha2 @ Jun.18, 2012
+* Changed API, use "create" to construct all objects
+* Fixed naming of variables
+* Added JSDoc comments and shell
+* Fixed Dom Menu flicker bug
+* Changed code for closure compiler Advance optional
+* Added version control
+
+Cocos2d-html5-v0.5.0-alpha @ May.28, 2012
+* supports canvas and Dom Menu
+* part of test cases were added and tested in chrome
+* porting from cocos2d-x is not finished
+* files must load from http server
+
+Cocos2d-html5-v0.1.0 @ Jan.29, 2012
+* Build the directory structure of Engine
+* cocos2d-html5 first version
+* more details: http://www.cocos2d-x.org/
+
+
+
+
diff --git a/README.mdown b/README.mdown
new file mode 100644
index 00000000000..c41b79bc2c8
--- /dev/null
+++ b/README.mdown
@@ -0,0 +1,52 @@
+Cocos2d-html5
+==================
+
+[Cocos2d-html5][1] is a cross-platform 2D game engine written in Javascript, based on [Cocos2d-X][2] and licensed under MIT.
+It incorporates the same high level api as “Cocos2d JS-binding engine†and compatible with Cocos2d-X.
+It currently supports canvas and WebGL renderer.
+
+Cross Platform
+-------------
+ * Popular browsers: Chrome 14+, Safari 5.0+, IE9+, Firefox 3.5+.
+ * Mobile platforms: coming soon.
+ * Native App: Same piece of code can run on "Cocos2d JS-Binding Engine" without or with little modification.
+
+Documentation
+------------------
+ * Website: [www.cocos2d-x.org][3]
+ * API References: [http://www.cocos2d-x.org/wiki/Reference] [4]
+
+
+Installing from [bower][8] (version >=3.4)
+------------------
+
+```shell
+$ bower install cocos2d-html5
+```
+
+Running the tests (version <3)
+------------------
+
+```shell
+$ git clone git://github.com/cocos2d/cocos2d-html5.git
+$ cd cocos2d-html5
+$ git submodule update --init
+$ python -m SimpleHTTPServer
+```
+... and then open a browser and go to `http://localhost:8000/tests`
+
+
+Contact us
+------------------
+ * Forum: [http://forum.cocos2d-x.org][5]
+ * Twitter: [http://www.twitter.com/cocos2dhtml5][6]
+ * Sina Microblog: [http://t.sina.com.cn/cocos2dhtml5][7]
+
+[1]: http://www.cocos2d-x.org "Cocos2d-html5"
+[2]: http://www.cocos2d-x.org "Cocos2d-X"
+[3]: http://www.cocos2d-x.org "www.cocos2d-x.org"
+[4]: http://www.cocos2d-x.org/wiki/Reference "API References"
+[5]: http://forum.cocos2d-x.org "http://forum.cocos2d-x.org"
+[6]: http://www.twitter.com/cocos2dhtml5 "http://www.twitter.com/cocos2dhtml5"
+[7]: http://t.sina.com.cn/cocos2dhtml5 "http://t.sina.com.cn/cocos2dhtml5"
+[8]: http://bower.io "http://bower.io"
\ No newline at end of file
diff --git a/bower.json b/bower.json
new file mode 100644
index 00000000000..e97d56bb83e
--- /dev/null
+++ b/bower.json
@@ -0,0 +1,36 @@
+{
+ "name": "cocos2d-html5",
+ "homepage": "http://www.cocos2d-x.org",
+ "authors": [
+ "AUTHORS.txt"
+ ],
+ "description": "Cocos2d-html5 is a cross-platform 2D game engine written in Javascript, based on Cocos2d-X and licensed under MIT. It incorporates the same high level api as “Cocos2d JS-binding engine†and compatible with Cocos2d-X. It currently supports canvas and WebGL renderering.",
+ "main": "README.mdown",
+ "keywords": [
+ "cocos2d-x",
+ "cocos2d",
+ "game",
+ "engine",
+ "opengl",
+ "cross",
+ "multi",
+ "platform",
+ "iphone",
+ "ipad",
+ "android",
+ "windows",
+ "metro",
+ "bada",
+ "marmalade",
+ "playbook"
+ ],
+ "license": "MIT",
+ "private": false,
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ]
+}
diff --git a/cocos2d/ToMerge/qunit/test-event-system.js b/cocos2d/ToMerge/qunit/test-event-system.js
new file mode 100644
index 00000000000..aa1dd99a41a
--- /dev/null
+++ b/cocos2d/ToMerge/qunit/test-event-system.js
@@ -0,0 +1,360 @@
+
+module('EventTarget');
+
+test('basic test', function () {
+ var target = new cc.EventTarget();
+ var fireEvent = new cc.Event('fire');
+ var jumpEvent = new cc.Event('jump');
+
+ var cb1 = new Callback();
+ var cb2 = new Callback();
+ var cb3 = new Callback();
+
+ target.on('fire', cb1);
+ target.on('fire', cb2);
+ target.on('jump', cb3);
+
+ cb1.enable();
+ cb2.enable();
+ cb3.disable('should only invoke the callbacks with the same event type');
+ target.dispatchEvent(fireEvent);
+ cb1.once('callback1 should be invoked by fire event');
+ cb2.once('callback2 should be invoked by fire event');
+
+ cb3.enable();
+ target.dispatchEvent(jumpEvent);
+ cb3.once('callback3 should be invoked by jump event');
+
+ target.dispatchEvent(fireEvent);
+ cb1.once('callback1 should be invoked again');
+ cb2.once('callback2 should be invoked again');
+
+ cb1.disable('should not invoke callback1 after `off`');
+ target.off('fire', cb1);
+ target.dispatchEvent(fireEvent);
+ cb2.once('callback2 should still be invoked after callback1 canceled');
+});
+
+test('emit', function () {
+ var target = new cc.EventTarget();
+ var cb1 = new Callback().enable();
+ target.on('fire', cb1);
+ cb1.callbackFunction(function (event) {
+ strictEqual(event.detail.param, 123, 'should pass the argument to listener');
+ });
+ target.emit('fire', {
+ param: 123
+ });
+ cb1.once('callback1 should be invoked by fire event');
+});
+
+test('once', function () {
+ var target = new cc.EventTarget();
+ var fireEvent = new cc.Event('fire');
+ var cb1 = new Callback();
+
+ // once
+ target.once('fire', cb1.enable());
+ target.dispatchEvent(fireEvent);
+ cb1.once('should be invoked if registered by once')
+ .disable('should only invoke once 1');
+ target.dispatchEvent(fireEvent);
+
+ // once + on
+ var cb2 = new Callback().enable();
+
+ target.once('fire', cb1.enable());
+ target.on('fire', cb2);
+
+ target.dispatchEvent(fireEvent);
+ cb1.once('should be invoked if registered by once and before other callback');
+ cb2.once('should still be invoked if previous event was removed');
+
+ cb1.disable('should only invoke once 2');
+ target.dispatchEvent(fireEvent);
+ cb2.once('should not remove common event');
+
+ // on + once
+
+ target.once('fire', cb1.enable());
+ target.dispatchEvent(fireEvent);
+ cb2.once();
+ cb1.once('should be invoked if registered by once and after other callback')
+ .disable('should only invoke once 3');
+ target.dispatchEvent(fireEvent);
+ cb2.once();
+});
+
+test('test useCapture in on/off', function () {
+ var target = new cc.EventTarget();
+ var event = new cc.Event('fire');
+ var cb1 = new Callback().enable();
+ var cb2 = new Callback().enable();
+
+ target.on('fire', cb1, true);
+ target.on('fire', cb2, false);
+ target.dispatchEvent(event);
+ cb1.once('registered as capturing phase should also be invoked in target phase');
+ cb2.once('registered as bubbling phase should also be invoked in target phase');
+
+ target.off('fire', cb1, false);
+ target.off('fire', cb2, false);
+ cb2.disable('should not invoke callback2 after `off` with the same phase');
+ target.dispatchEvent(event);
+ cb1.once('should still invoke callback1 after `off` but given another phase');
+});
+
+test('test propagation', function () {
+ // define hierarchy
+ var node1 = new cc.EventTarget();
+ var node2 = new cc.EventTarget();
+ node2.parent = node1;
+ node2._getCapturingTargets = function (type, array) {
+ for (var target = this.parent; target; target = target.parent) {
+ if (target._capturingListeners && target._capturingListeners.has(type)) {
+ array.push(target);
+ }
+ }
+ };
+ node2._getBubblingTargets = function (type, array) {
+ for (var target = this.parent; target; target = target.parent) {
+ if (target._bubblingListeners && target._bubblingListeners.has(type)) {
+ array.push(target);
+ }
+ }
+ };
+
+ var event = new cc.Event('fire', true);
+ var capture1 = new Callback();
+ var capture2 = new Callback();
+ var bubble1 = new Callback();
+ var bubble2 = new Callback();
+ // capture1 -> capture2 -> bubble2 -> bubble1
+ node1.on('fire', capture1, true);
+ node2.on('fire', capture2, true);
+ node1.on('fire', bubble1, false);
+ node2.on('fire', bubble2, false);
+
+ // dispatched by node1
+
+ capture1.callbackFunction(function (event) {
+ strictEqual(event.eventPhase, cc.FireEvent.AT_TARGET, 'event phase should be target if dispatched by self 1');
+ strictEqual(bubble1.calledCount, 0, 'captures should be invoked before bubbles');
+ }).enable();
+ bubble1.callbackFunction(function (event) {
+ strictEqual(event.eventPhase, cc.FireEvent.AT_TARGET, 'event phase should be target if dispatched by self 2');
+ }).enable();
+ node1.dispatchEvent(event);
+ capture1.once('callback also will be invoked at target phase if registered as capturing');
+ bubble1.once('callback also will be invoked at target phase if registered as bubbling');
+
+ // dispatched by node2
+
+ capture1.callbackFunction(function (event) {
+ strictEqual(event.eventPhase, cc.FireEvent.CAPTURING_PHASE, 'event phase should be capturing if dispatched by node2');
+ strictEqual(event.target, node2, 'target of capture1 should be node2');
+ strictEqual(event.currentTarget, node1, 'current target of capture1 should be node1');
+ strictEqual(capture2.calledCount, 0, 'captures1 -> capture2');
+ }).enable();
+ capture2.callbackFunction(function (event) {
+ strictEqual(event.eventPhase, cc.FireEvent.AT_TARGET, 'event phase of capture2 should be at target if dispatched by node2');
+ strictEqual(event.target, node2, 'target of capture2 should be node2');
+ strictEqual(event.currentTarget, node2, 'current target of capture2 should be node2');
+ strictEqual(bubble2.calledCount, 0, 'captures2 -> bubble2');
+ }).enable();
+ bubble2.callbackFunction(function (event) {
+ strictEqual(event.eventPhase, cc.FireEvent.AT_TARGET, 'event phase of bubble2 should be at target if dispatched by node2');
+ strictEqual(event.target, node2, 'target of bubble2 should be node2');
+ strictEqual(event.currentTarget, node2, 'current target of bubble2 should be node2');
+ strictEqual(bubble1.calledCount, 0, 'bubble2 -> bubble1');
+ }).enable();
+ bubble1.callbackFunction(function (event) {
+ strictEqual(event.eventPhase, cc.FireEvent.BUBBLING_PHASE, 'event phase should be bubble if dispatched by node2');
+ strictEqual(event.target, node2, 'target of bubble1 should be node2');
+ strictEqual(event.currentTarget, node1, 'current target of bubble1 should be node1');
+ }).enable();
+ node2.dispatchEvent(event);
+ capture1.once('capture1 should be invoked if dispatched by node2');
+ capture2.once('capture2 should be invoked if dispatched by node2');
+ bubble1.once('bubble1 should be invoked if dispatched by node2');
+ bubble2.once('bubble2 should be invoked if dispatched by node2');
+});
+
+test('test stop propagation', function () {
+ // define hierarchy
+ var node1 = new cc.EventTarget();
+ var node2 = new cc.EventTarget();
+ node2.parent = node1;
+ node2._getCapturingTargets = function (type, array) {
+ for (var target = this.parent; target; target = target.parent) {
+ if (target._capturingListeners && target._capturingListeners.has(type)) {
+ array.push(target);
+ }
+ }
+ };
+ node2._getBubblingTargets = function (type, array) {
+ for (var target = this.parent; target; target = target.parent) {
+ if (target._bubblingListeners && target._bubblingListeners.has(type)) {
+ array.push(target);
+ }
+ }
+ };
+
+ var event = new cc.Event('fire', true);
+ var capture1 = new Callback().enable();
+ var capture2 = new Callback().enable();
+ var bubble1 = new Callback().enable();
+ var bubble2 = new Callback().enable();
+ node1.on('fire', capture1, true);
+ node2.on('fire', capture2, true);
+ node1.on('fire', bubble1, false);
+ node2.on('fire', bubble2, false);
+
+ // stop at bubble 2
+
+ bubble2.callbackFunction(function (event) {
+ event.stop();
+ });
+ bubble1.disable('bubble1 should not be invoked if propagation stopped');
+ node2.dispatchEvent(event);
+ capture1.once('capture1 should be invoked if propagation not yet stopped before');
+ capture2.once('capture2 should be invoked if propagation not yet stopped before');
+ bubble2.once('bubble2 should be invoked if propagation not yet stopped before');
+
+ // stop at capture 2
+ capture2.callbackFunction(function (event) {
+ event.stop();
+ });
+ bubble2.disable('bubble2 should not be invoked if propagation stopped before');
+ node2.dispatchEvent(event);
+ capture1.once('capture1 should be invoked if propagation not yet stopped before');
+ capture2.once('capture2 should be invoked if propagation not yet stopped before');
+
+ // stop at capture 1
+ capture1.callbackFunction(function (event) {
+ event.stop();
+ });
+ capture2.disable('capture2 should not be invoked if propagation stopped before');
+ node2.dispatchEvent(event);
+ capture1.once('capture1 should be invoked if propagation not yet stopped before');
+});
+
+test('test stop propagation immediate', function () {
+ // define hierarchy
+ var node1 = new cc.EventTarget();
+ var node2 = new cc.EventTarget();
+ node2.parent = node1;
+ node2._getCapturingTargets = function (type, array) {
+ for (var target = this.parent; target; target = target.parent) {
+ if (target._capturingListeners && target._capturingListeners.has(type)) {
+ array.push(target);
+ }
+ }
+ };
+ node2._getBubblingTargets = function (type, array) {
+ for (var target = this.parent; target; target = target.parent) {
+ if (target._bubblingListeners && target._bubblingListeners.has(type)) {
+ array.push(target);
+ }
+ }
+ };
+
+ var event = new cc.Event('fire', true);
+ var capture1 = new Callback().enable();
+ var capture1_2nd = new Callback().enable();
+ var capture2 = new Callback().enable();
+ var bubble1 = new Callback().enable();
+ var bubble2 = new Callback().enable();
+ var bubble2_2nd = new Callback().enable();
+ node1.on('fire', capture1, true);
+ node1.on('fire', capture1_2nd, true);
+ node2.on('fire', capture2, true);
+ node1.on('fire', bubble1, false);
+ node2.on('fire', bubble2, false);
+ node2.on('fire', bubble2_2nd, false);
+
+ // stop at bubble 2
+
+ bubble2.callbackFunction(function (event) {
+ event.stop(true);
+ });
+ bubble2_2nd.disable('bubble2_2nd should not be invoked if propagation stopped immediate');
+ bubble1.disable('bubble1 should not be invoked if propagation stopped immediate');
+ node2.dispatchEvent(event);
+ capture1.once('capture1 should be invoked if propagation not yet stopped before');
+ capture2.once('capture2 should be invoked if propagation not yet stopped before');
+ bubble2.once('bubble2 should be invoked if propagation not yet stopped before');
+
+ // stop at capture 1
+ capture1.callbackFunction(function (event) {
+ event.stop(true);
+ });
+ capture1_2nd.disable('capture1_2nd should not be invoked if propagation stopped immediate');
+ capture2.disable('capture2 should not be invoked if propagation stopped immediate');
+ node2.dispatchEvent(event);
+ capture1.once('capture1 should be invoked if propagation not yet stopped before');
+});
+
+test('test Event.bubbles', function () {
+ // define hierarchy
+ var node1 = new cc.EventTarget();
+ var node2 = new cc.EventTarget();
+ node2.parent = node1;
+ node2._getBubblingTargets = function (type, array) {
+ for (var target = this.parent; target; target = target.parent) {
+ if (target._bubblingListeners && target._bubblingListeners.has(type)) {
+ array.push(target);
+ }
+ }
+ };
+
+ var bubble1 = new Callback();
+ node1.on('fire', bubble1, false);
+
+ var event = new cc.Event('fire');
+ event.bubbles = false;
+ bubble1.disable('bubble1 should not be invoked if set event.bubbles to false');
+ node2.dispatchEvent(event);
+
+ event.bubbles = true;
+ bubble1.enable();
+ node2.dispatchEvent(event);
+ bubble1.once('bubble1 should be invoked if set event.bubbles to true');
+});
+
+//test('', function () {
+// // define hierarchy
+// var node1 = new cc.EventTarget();
+// var node2 = new cc.EventTarget();
+// var node3 = new cc.EventTarget();
+// node2.parent = node1;
+// node3.parent = node2;
+// node3._getCapturingTargets = node2._getCapturingTargets = function (type, array) {
+// for (var target = this.parent; target; target = target.parent) {
+// if (target._capturingListeners && target._capturingListeners.has(type)) {
+// array.push(target);
+// }
+// }
+// };
+// node3._getBubblingTargets = node2._getBubblingTargets = function (type, array) {
+// for (var target = this.parent; target; target = target.parent) {
+// if (target._bubblingListeners && target._bubblingListeners.has(type)) {
+// array.push(target);
+// }
+// }
+// };
+
+// var event = new cc.Event('fire');
+// var capture1 = new Callback();
+// var capture2 = new Callback();
+// var capture3 = new Callback();
+// var bubble1 = new Callback();
+// var bubble2 = new Callback();
+// var bubble3 = new Callback();
+// node1.on('fire', capture1, true);
+// node2.on('fire', capture2, true);
+// node1.on('fire', bubble1, false);
+// node3.on('fire', capture3, true);
+// node2.on('fire', bubble2, false);
+// node3.on('fire', bubble3, false);
+//});
diff --git a/cocos2d/ToMerge/qunit/test-ticker.js b/cocos2d/ToMerge/qunit/test-ticker.js
new file mode 100644
index 00000000000..86bcd48a930
--- /dev/null
+++ b/cocos2d/ToMerge/qunit/test-ticker.js
@@ -0,0 +1,39 @@
+// jshint ignore: start
+
+module('ticker');
+
+asyncTest('test now', function() {
+ ok(typeof Ticker.now() === 'number');
+ ok(Ticker.now() >= 0);
+
+ var startTime = Ticker.now();
+ setTimeout(function () {
+ var delta = Ticker.now() - startTime;
+ ok(0 < delta && delta < 0.1, 'elpased time should in range (0, 0.1): ' + delta);
+ start();
+ }, 10);
+});
+
+asyncTest('test requestAnimationFrame', function() {
+ var startTime = Ticker.now();
+ var tolerance = 0.5;
+
+ var requestId = Ticker.requestAnimationFrame(function () {
+ var delta = Ticker.now() - startTime;
+ ok(0 <= delta && delta < (1 / 60) + tolerance, 'any time to next frame should <= 0.016: ' + delta);
+ start();
+ });
+ strictEqual(typeof requestId, 'number', 'requestAnimationFrame should return a request id');
+});
+
+asyncTest('test cancelAnimationFrame', 0, function() {
+ var requestId = Ticker.requestAnimationFrame(function () {
+ ok(false, 'should not callback after cancelAnimationFrame');
+ });
+ Ticker.cancelAnimationFrame(requestId);
+ setTimeout(function () {
+ start();
+ }, 30);
+});
+
+// jshint ignore: end
diff --git a/cocos2d/ToMerge/qunit/test-time.js b/cocos2d/ToMerge/qunit/test-time.js
new file mode 100644
index 00000000000..f6908d2a14c
--- /dev/null
+++ b/cocos2d/ToMerge/qunit/test-time.js
@@ -0,0 +1,40 @@
+module('time');
+
+var tolerance = 0.000001;
+
+test('test restart', function() {
+ var now = 321;
+ Time._restart(now);
+ strictEqual(Time.time, 0, 'reset time');
+ strictEqual(Time.realTime, 0, 'reset realTime');
+ strictEqual(Time.frameCount, 0, 'reset frameCount');
+});
+
+test('test update', function() {
+ Time.maxDeltaTime = 0.2;
+ var now = 321;
+ Time._restart(now);
+
+
+ now += 0.01;
+ var startTime = now;
+ Time._update(now);
+ close(Time.time, 0, tolerance, 'time should equals 0 in first frame');
+ close(Time.realTime, 0, tolerance, 'realTime should equals 0 in first frame');
+ close(Time.frameCount, 1, tolerance, 'frameCount should equals update count 1');
+
+ now += 0.01;
+ Time._update(now);
+ close(Time.deltaTime, 0.01, tolerance, 'deltaTime should equals 0.01');
+ close(Time.time, 0.01, tolerance, 'time should equals elapsed time since restart 2');
+ close(Time.realTime, now - startTime, tolerance, 'realTime should equals elapsed time since restart 2');
+ close(Time.frameCount, 2, tolerance, 'frameCount should equals update count 2');
+
+ now += 0.5;
+ Time._update(now);
+ close(Time.deltaTime, Time.maxDeltaTime, tolerance, 'deltaTime should less equals maxDeltaTime');
+ var expectedTime = now - startTime - 0.5 + Time.maxDeltaTime;
+ close(Time.time, expectedTime, tolerance, 'time should lag because of limitation by maxDeltaTime');
+ close(Time.realTime, now - startTime, tolerance, 'realTime should equals elapsed time since restart 3');
+ close(Time.frameCount, 3, tolerance, 'frameCount should equals update count 2');
+});
diff --git a/cocos2d/ToMerge/wrappers/bitmap-font.js b/cocos2d/ToMerge/wrappers/bitmap-font.js
new file mode 100644
index 00000000000..f9a228966d2
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/bitmap-font.js
@@ -0,0 +1,177 @@
+
+var TextAlign = cc.TextAlignment;
+
+/**
+ * Enum for text anchor
+ * @readOnly
+ * @enum {number}
+ */
+var TextAnchor = cc.Enum({
+ TopLeft: -1,
+ TopCenter: -1,
+ TopRight: -1,
+ MiddleLeft: -1,
+ MiddleCenter: -1,
+ MiddleRight: -1,
+ BottomLeft: -1,
+ BottomCenter: -1,
+ BottomRight: -1,
+});
+
+cc._TextAnchor = TextAnchor;
+
+var getAnchorPoint = (function () {
+ var Anchor2Point = new Array(TextAnchor.BottomRight + 1);
+ Anchor2Point[TextAnchor.TopLeft] = cc.p(0, 1);
+ Anchor2Point[TextAnchor.TopCenter] = cc.p(0.5, 1);
+ Anchor2Point[TextAnchor.TopRight] = cc.p(1, 1);
+ Anchor2Point[TextAnchor.MiddleLeft] = cc.p(0, 0.5);
+ Anchor2Point[TextAnchor.MiddleCenter] = cc.p(0.5, 0.5);
+ Anchor2Point[TextAnchor.MiddleRight] = cc.p(1, 0.5);
+ Anchor2Point[TextAnchor.BottomLeft] = cc.p(0, 0);
+ Anchor2Point[TextAnchor.BottomCenter] = cc.p(0.5, 0);
+ Anchor2Point[TextAnchor.BottomRight] = cc.p(1, 0);
+
+ return (function (textAnchor) {
+ var anchorPoint = Anchor2Point[textAnchor];
+ return cc.p(anchorPoint);
+ });
+})();
+
+
+var NodeWrapper = require('./node');
+
+var BitmapFontWrapper = cc.Class({
+ name: 'cc.BitmapFontWrapper',
+ extends: NodeWrapper,
+
+ ctor: function () {
+ },
+
+ properties: {
+
+ bitmapFont: {
+ get: function () {
+ return this.targetN._fntFile || '';
+ },
+ set: function (value) {
+ this.targetN._fntFile = value;
+
+ this.onBeforeSerialize();
+ this.createNode(this.targetN);
+ },
+ url: cc.BitmapFont
+ },
+
+ text: {
+ get: function () {
+ return this.targetN.string;
+ },
+ set: function ( value ) {
+ if (typeof value === 'string') {
+ this.targetN.string = value;
+ }
+ else {
+ cc.error('The new text must be string');
+ }
+ }
+ },
+
+ anchor: {
+ get: function () {
+ return this._anchor;
+ },
+ set: function ( value ) {
+ if (typeof value === 'number') {
+ this._anchor = value;
+
+ var anchorPoint = getAnchorPoint(value);
+ this.targetN.setAnchorPoint( anchorPoint );
+ }
+ else {
+ cc.error('The new text must be number');
+ }
+ },
+ type: TextAnchor
+ },
+
+ align: {
+ get: function () {
+ // jsb not implement yet
+ if (typeof jsb !== 'undefined') return TextAlign.Left;
+
+ return this.targetN.textAlign;
+ },
+ set: function ( value ) {
+ if (typeof value === 'number') {
+ this.targetN.textAlign = value;
+ }
+ else {
+ cc.error('The new text must be number');
+ }
+ },
+ type: TextAlign
+ },
+
+ childrenN: {
+ get: function () {
+ return [];
+ },
+ },
+
+
+ _text: {
+ default: ""
+ },
+
+ _anchor: {
+ default: TextAnchor.MiddleCenter
+ },
+
+ _align: {
+ default: TextAlign.Left
+ },
+
+ _bitmapFont: {
+ default: '',
+ url: cc.BitmapFont
+ }
+ },
+
+ onBeforeSerialize: function () {
+ NodeWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._text = this.text;
+ this._anchor = this.anchor;
+ this._align = this.align;
+ this._bitmapFont = this.bitmapFont;
+ },
+
+ createNode: function (node) {
+ node = node || new cc.LabelBMFont();
+
+ var bitmapFontUrl = this._bitmapFont;
+
+ if ( bitmapFontUrl ) {
+ node._fntFile = bitmapFontUrl;
+ cc.loader.load( bitmapFontUrl, function (err, results) {
+ node.initWithString(this._text, bitmapFontUrl);
+ node.setAnchorPoint( getAnchorPoint(this._anchor) );
+ node.textAlign = this._align;
+
+ NodeWrapper.prototype.createNode.call(this, node);
+ }.bind(this));
+ }
+ else {
+ node.string = this._text;
+ node.setAnchorPoint( getAnchorPoint(this._anchor) );
+ node.textAlign = this._align;
+
+ NodeWrapper.prototype.createNode.call(this, node);
+ }
+
+ return node;
+ }
+});
+
+cc.BitmapFontWrapper = module.exports = BitmapFontWrapper;
diff --git a/cocos2d/ToMerge/wrappers/draw-node.js b/cocos2d/ToMerge/wrappers/draw-node.js
new file mode 100644
index 00000000000..744def2b11d
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/draw-node.js
@@ -0,0 +1,17 @@
+var NodeWrapper = require('./node');
+
+var DrawNodeWrapper = cc.Class({
+ name: 'cc.DrawNodeWrapper',
+ extends: NodeWrapper,
+
+ createNode: function(node){
+ node = node || new cc.DrawNode();
+
+ NodeWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+
+});
+
+cc.DrawNodeWrapper = module.exports = DrawNodeWrapper;
diff --git a/cocos2d/ToMerge/wrappers/edit-box.js b/cocos2d/ToMerge/wrappers/edit-box.js
new file mode 100644
index 00000000000..e1834fd475e
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/edit-box.js
@@ -0,0 +1,250 @@
+var Vec2 = cc.Vec2;
+
+var NodeWrapper = require('./node');
+
+var EditBoxWrapper = cc.Class({
+ name: 'cc.EditBoxWrapper',
+ extends: NodeWrapper,
+
+ properties: {
+ normalBackground: {
+ default: '',
+ url: cc.Texture2D,
+
+ notify: function() {
+ if (!this.targetN) {
+ return;
+ }
+ var value = this.normalBackground;
+ var normalScale9Sprite = new cc.Scale9Sprite(value);
+ normalScale9Sprite.setPreferredSize(this.targetN.getContentSize());
+ var oldPosition = this.targetN.getPosition();
+
+ this.targetN.initWithSizeAndBackgroundSprite(this.targetN.getContentSize(), normalScale9Sprite);
+ this.targetN.setPosition(oldPosition);
+ }
+ },
+ childrenN: {
+ get: function() {
+ return [];
+ }
+ },
+ size: {
+ get: function() {
+ var size = this.targetN.getPreferredSize();
+ return new Vec2(size.width, size.height);
+ },
+
+ set: function(value) {
+ if (value instanceof Vec2) {
+ this.targetN.setPreferredSize(cc.size(value.x, value.y));
+ } else {
+ cc.error('The value must be cc.Vec2 -> size.');
+ }
+ }
+ },
+ _placeholder: {
+ default: 'input your text here'
+ },
+ placeholder: {
+ get: function() {
+ return this.targetN.getPlaceHolder();
+ },
+ set: function(value) {
+ if (typeof value === 'string') {
+ this.targetN.setPlaceHolder(value);
+ } else {
+ cc.error('The value must be string -> placeholder');
+ }
+ }
+ },
+ text: {
+ get: function() {
+ return this.targetN.getString();
+ },
+ set: function(value) {
+ if (typeof value === 'string') {
+ this.targetN.setString(value);
+ } else {
+ cc.error('The value must be string -> text.');
+ }
+ }
+ },
+ _text: {
+ default: ''
+ },
+ fontColor: {
+ default: cc.Color.WHITE,
+ type: cc.Color,
+
+ notify: function() {
+ if (!this.targetN) return;
+
+ var value = this.fontColor;
+ if (value instanceof cc.Color) {
+ this.targetN.setFontColor(value);
+ } else {
+ cc.error('The value must be cc.Color -> fontColor.');
+ }
+ }
+ },
+ fontName: {
+ default: 'Arial',
+
+ notify: function() {
+ if (!this.targetN) return;
+
+ var value = this.fontName;
+ if (typeof value === 'string') {
+ this.targetN.setFontName(value);
+ } else {
+ cc.error('The value must be a string -> fontName.');
+ }
+ }
+ },
+ fontSize: {
+ default: 14,
+
+ notify: function() {
+ if (!this.targetN) return;
+
+ var value = this.fontSize;
+ if (!isNaN(value)) {
+ this.targetN.setFontSize(value);
+ } else {
+ cc.error('The value is NaN.');
+ }
+ }
+ },
+ placeholderColor: {
+ default: cc.Color.WHITE,
+ type: cc.Color,
+
+ notify: function() {
+ if (!this.targetN) return;
+
+ var value = this.placeholderColor;
+ if (value instanceof cc.Color) {
+ this.targetN.setPlaceholderFontColor(value);
+ } else {
+ cc.error('The value must be cc.Color -> placeholderColor.');
+ }
+ }
+ },
+ placeholderSize: {
+ default: 12,
+
+ notify: function() {
+ if (!this.targetN) return;
+
+ var value = this.placeholderSize;
+ if (!isNaN(value)) {
+ this.targetN.setPlaceholderFontSize(value);
+ } else {
+ cc.error('The value is NaN!');
+ }
+ }
+ },
+ maxLength: {
+ get: function() {
+ return this.targetN.getMaxLength();
+ },
+ set: function(value) {
+ if (!isNaN(value)) {
+ this.targetN.setMaxLength(value);
+ } else {
+ cc.error('The value is NaN!');
+ }
+ }
+ },
+ _maxLength: {
+ default: 50
+ },
+ inputMode: {
+ default: cc.EditBox.InputMode.ANY,
+ type: cc.EditBox.InputMode,
+ notify: function() {
+ if (!this.targetN) return;
+
+ var value = this.inputMode;
+ if (!isNaN(value)) {
+ this.targetN.setInputMode(value);
+ } else {
+ cc.error('The value must be cc.EditBox.InputMode -> inputMode.');
+ }
+ }
+ },
+ inputFlag: {
+ default: cc.EditBox.InputFlag.SENSITIVE,
+ type: cc.EditBox.InputFlag,
+ notify: function() {
+ if (!this.targetN) return;
+
+ var value = this.inputFlag;
+ if (!isNaN(value)) {
+ this.targetN.setInputFlag(value);
+ } else {
+ cc.error('The value must be cc.EditBox.InputFlag -> inputFlag.');
+ }
+ }
+ },
+ keyboardType: {
+ default: cc.KeyboardReturnType.DEFAULT,
+ type: cc.KeyboardReturnType,
+ notify: function() {
+ if (!this.targetN) return;
+
+ var value = this.keyboardType;
+ if (!isNaN(value)) {
+ this.targetN.setReturnType(value);
+ } else {
+ cc.error('The value must be cc.KeyboardReturnType -> keyboardType.');
+ }
+ }
+
+ }
+ },
+ onBeforeSerialize: function() {
+ NodeWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._text = this.text;
+ this._placeholder = this.placeholder;
+ this._maxLength = this.maxLength;
+ },
+
+ createNode: function(node) {
+ var contentSize;
+ if (this._size) {
+ contentSize = cc.size(this._size[0], this._size[1]);
+ } else {
+ contentSize = cc.size(100, 50);
+ }
+
+ var normalScale9Sprite;
+ if (this.normalBackground) {
+ normalScale9Sprite = new cc.Scale9Sprite(this.normalBackground);
+ } else {
+ normalScale9Sprite = new cc.Scale9Sprite();
+ }
+
+ node = node || new cc.EditBox(contentSize, normalScale9Sprite, new cc.Scale9Sprite(), new cc.Scale9Sprite());
+ NodeWrapper.prototype.createNode.call(this, node);
+
+ node.setPreferredSize(contentSize);
+ node.setString(this._text);
+ node.setFontColor(this.fontColor);
+ node.setFontSize(this.fontSize);
+ node.setFontName(this.fontName);
+ node.setPlaceHolder(this._placeholder);
+ node.setPlaceholderFontSize(this.placeholderSize);
+ node.setPlaceholderFontColor(this.placeholderColor);
+ node.setMaxLength(this._maxLength);
+ node.setInputMode(this.inputMode);
+ node.setInputFlag(this.inputFlag);
+ node.setReturnType(this.keyboardType);
+
+ return node;
+ }
+});
+
+cc.EditBoxWrapper = module.exports = EditBoxWrapper;
diff --git a/cocos2d/ToMerge/wrappers/index.js b/cocos2d/ToMerge/wrappers/index.js
new file mode 100644
index 00000000000..0ca4abc4289
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/index.js
@@ -0,0 +1,27 @@
+module.exports = [
+ [cc, 'Node', require('./node'), 'Node'],
+ [cc, 'SpriteBatchNode',require('./sprite-batch-node'), 'SpriteBatchNode'],
+ [cc, 'LabelBMFont', require('./bitmap-font'), 'LabelBMFont'],
+ [cc, 'LabelTTF', require('./label-ttf'), 'LabelTTF'],
+ [cc, 'ParticleSystem', require('./particle'), 'ParticleSystem'],
+ [cc, 'ProgressTimer', require('./progress-timer'), 'ProgressTimer'],
+ [cc, 'TMXTiledMap', require('./tiled-map')],
+ [cc, 'Layer', require('./layer'), 'Layer'],
+ [cc, 'LayerColor', require('./layer-color'), 'LayerColor'],
+ [cc, 'DrawNode', require('./draw-node'), 'DrawNode'],
+ [cc, 'EditBox', require('./edit-box'), 'EditBox'],
+
+ [ccui, 'Button', require('./ui/button'), 'UI/Button'],
+ [ccui, 'ImageView', require('./ui/scale9-sprite'),'UI/Scale9Sprite'],
+ [ccui, 'CheckBox', require('./ui/check-box'), 'UI/CheckBox'],
+ [ccui, 'LoadingBar', require('./ui/loading-bar'), 'UI/LoadingBar'],
+ [ccui, 'Slider', require('./ui/slider'), 'UI/Slider'],
+ [ccui, 'ScrollView', require('./ui/scroll-view'), 'UI/ScrollView'],
+ [ccui, 'ListView', require('./ui/list-view'), 'UI/ListView'],
+ [ccui, 'PageView', require('./ui/page-view'), 'UI/PageView'],
+ [ccui, 'Layout', require('./ui/layout'), 'UI/Layout'],
+ [ccui, 'Text', require('./ui/text'), 'UI/Text'],
+ [ccui, 'TextField', require('./ui/text-field'), 'UI/TextField'],
+ [ccui, 'TextAtlas', require('./ui/text-atlas'), 'UI/TextAtlas'],
+ [ccui, 'TextBMFont', require('./ui/text-bitmap-font'), 'UI/TextBMFont'],
+];
diff --git a/cocos2d/ToMerge/wrappers/label-ttf.js b/cocos2d/ToMerge/wrappers/label-ttf.js
new file mode 100644
index 00000000000..28b6f76f8ca
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/label-ttf.js
@@ -0,0 +1,202 @@
+var Utils = require('./utils');
+var NodeWrapper = require('./node');
+
+var LabelTTFWrapper = cc.Class({
+ name: 'cc.LabelTTFWrapper',
+ extends: NodeWrapper,
+
+ properties: {
+
+ text: {
+ get: function () {
+ return this.targetN.string;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.string = value;
+ }
+ else {
+ cc.error('The new text must be String');
+ }
+ }
+ },
+
+ fontSize: {
+ get: function () {
+ return this.targetN.fontSize;
+ },
+ set: function (value) {
+ if ( !isNaN(value) ) {
+ this.targetN.fontSize = value;
+ }
+ else {
+ cc.error('The new fontSize must not be NaN');
+ }
+ }
+ },
+
+ font: {
+ default: null,
+ type: cc.TTFFont,
+
+ notify: function () {
+ if ( !this.targetN ) return;
+
+ var value = this.font;
+ if (!value || value instanceof cc.TTFFont) {
+ Utils.setFontToNode(value, this.targetN);
+ }
+ else {
+ cc.error('The new font must be cc.TTFFont');
+ }
+ }
+ },
+
+ fontFamily: {
+ get: function () {
+ return this.targetN.fontName;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.fontName = value;
+ }
+ else {
+ cc.error('The new fontFamily must be String');
+ }
+ }
+ },
+
+ align: {
+ get: function () {
+ return this.targetN.textAlign;
+ },
+ set: function ( value ) {
+ if (typeof value === 'number') {
+ this.targetN.textAlign = value;
+ }
+ else {
+ cc.error('The new textAlign must be number');
+ }
+ },
+ type: cc.TextAlignment
+ },
+
+ verticalAlign: {
+ get: function () {
+ return this.targetN.verticalAlign;
+ },
+ set: function ( value ) {
+ if (typeof value === 'number') {
+ this.targetN.verticalAlign = value;
+ }
+ else {
+ cc.error('The new verticalAlign must be number');
+ }
+ },
+ type: cc.VerticalTextAlignment
+ },
+
+ boundingBox: {
+ get: function () {
+ var target = this.targetN;
+ return new cc.Vec2(target.boundingWidth, target.boundingHeight);
+ },
+ set: function (value) {
+ if (value instanceof cc.Vec2) {
+ this.targetN.boundingWidth = value.x;
+ this.targetN.boundingHeight = value.y;
+ }
+ else {
+ cc.error('The new boundingBox must be Vec2');
+ }
+ },
+ type: cc.Vec2
+ },
+
+ lineHeight: {
+ get: function() {
+ return this.targetN.getLineHeight();
+ },
+ set: function (value) {
+ if (typeof value === 'number') {
+ this.targetN.setLineHeight( value );
+ this.targetN._setUpdateTextureDirty();
+ }
+ else {
+ cc.error('The new lineHeight must be number');
+ }
+ }
+ },
+
+
+ _text: {
+ default: 'Label'
+ },
+
+ _fontSize: {
+ default: 16
+ },
+
+ _fontFamily: {
+ default: null
+ },
+
+ _align: {
+ default: cc.TextAlignment.LEFT
+ },
+
+ _verticalAlign: {
+ default: cc.VerticalTextAlignment.TOP
+ },
+
+ _boundingBox: {
+ default: null
+ },
+
+ _lineHeight: {
+ default: null
+ }
+ },
+
+ onBeforeSerialize: function () {
+ NodeWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._text = this.text;
+ this._fontSize = this.fontSize;
+ this._fontFamily = this.fontFamily;
+ this._align = this.align;
+ this._verticalAlign = this.verticalAlign;
+ this._boundingBox = [this.boundingBox.x, this.boundingBox.y];
+ this._lineHeight = this.lineHeight;
+ },
+
+ createNode: function (node) {
+
+ node = node || new cc.LabelTTF();
+
+ NodeWrapper.prototype.createNode.call(this, node);
+
+ node.string = this._text;
+ node.fontSize = this._fontSize;
+ node.fontName = this._fontFamily === null ? node.fontName : this._fontFamily;
+ node.textAlign = this._align;
+ node.verticalAlign = this._verticalAlign;
+
+ if (typeof this._lineHeight === 'number' &&
+ node.setLineHeight) {
+ node.setLineHeight( this._lineHeight );
+ }
+
+ var boundingBox = this._boundingBox;
+ if (boundingBox) {
+ node.boundingWidth = boundingBox[0];
+ node.boundingHeight = boundingBox[1];
+ }
+
+ Utils.setFontToNode(this.font, node);
+
+ return node;
+ }
+});
+
+cc.LabelTTFWrapper = module.exports = LabelTTFWrapper;
diff --git a/cocos2d/ToMerge/wrappers/layer-color.js b/cocos2d/ToMerge/wrappers/layer-color.js
new file mode 100644
index 00000000000..e6e82bb82a2
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/layer-color.js
@@ -0,0 +1,17 @@
+
+var LayerWrapper = require('./layer');
+
+var LayerColorWrapper = cc.Class({
+ name: 'cc.LayerColorWrapper',
+ extends: LayerWrapper,
+
+ createNode: function (node) {
+ node = node || new cc.LayerColor();
+
+ LayerWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.LayerColorWrapper = module.exports = LayerColorWrapper;
diff --git a/cocos2d/ToMerge/wrappers/layer.js b/cocos2d/ToMerge/wrappers/layer.js
new file mode 100644
index 00000000000..1a1f0f1795b
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/layer.js
@@ -0,0 +1,44 @@
+
+var NodeWrapper = require('./node');
+
+var LayerWrapper = cc.Class({
+ name: 'cc.LayerWrapper',
+ extends: NodeWrapper,
+
+ properties: {
+ bake: {
+ default: false,
+
+ notify: function (value) {
+ if (!this.targetN) return;
+
+ if (typeof value === 'boolean') {
+ if (value) {
+ this.targetN.bake();
+ }
+ else {
+ this.targetN.unbake();
+ }
+ }
+ else {
+ cc.error('The new bake must be boolean');
+ }
+ }
+ }
+ },
+
+ createNode: function (node) {
+ node = node || new cc.Layer();
+ node.setAnchorPoint(0, 0);
+
+ if (this.bake) {
+ node.bake();
+ }
+
+ NodeWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.LayerWrapper = module.exports = LayerWrapper;
diff --git a/cocos2d/ToMerge/wrappers/progress-timer.js b/cocos2d/ToMerge/wrappers/progress-timer.js
new file mode 100644
index 00000000000..76ac5683fa5
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/progress-timer.js
@@ -0,0 +1,167 @@
+var NodeWrapper = require('./node');
+
+var ProgressTimerWrapper = cc.Class({
+ name: 'cc.ProgressTimerWrapper',
+ extends: NodeWrapper,
+
+ ctor: function () {
+ this._midPoint = [0.5, 0.5];
+ this._barChangeRate = [1, 1];
+ },
+
+ properties: {
+
+ _type: {
+ default: cc.ProgressTimer.Type.RADIAL,
+ type: cc.ProgressTimer.Type
+ },
+
+ type: {
+ get: function () {
+ return this.targetN.getType();
+ },
+ set: function (value) {
+ if (!isNaN(value)) {
+ this.targetN.setType(value);
+ }
+ else {
+ cc.error('The new type must not be NaN');
+ }
+ },
+ type: cc.ProgressTimer.Type
+ },
+
+ _percentage: {
+ default: 50,
+ },
+
+ percentage: {
+ get: function() {
+ return this.targetN.getPercentage();
+ },
+ set: function (value) {
+ if (!isNaN(value)) {
+ this.targetN.setPercentage(value);
+ }
+ else {
+ cc.error('The new percentage must not be NaN');
+ }
+ },
+ },
+
+ _midPoint: {
+ default: []
+ },
+
+ midPoint: {
+ get: function () {
+ var pt = this.targetN.getMidpoint();
+ return new cc.Vec2(pt.x, pt.y);
+ },
+ set: function (value) {
+ if ( value instanceof cc.Vec2 ) {
+ this.targetN.setMidpoint(cc.p(value.x, value.y));
+ }
+ else {
+ cc.error('The new midPoint must be cc.Vec2');
+ }
+ }
+ },
+
+ _barChangeRate: {
+ default: []
+ },
+
+ barChangeRate: {
+ get: function () {
+ var pt = this.targetN.getBarChangeRate();
+ return new cc.Vec2(pt.x, pt.y);
+ },
+ set: function (value) {
+ if ( value instanceof cc.Vec2 ) {
+ this.targetN.setBarChangeRate(cc.p(value.x, value.y));
+ }
+ else {
+ cc.error('The new barChangeRate must be cc.Vec2');
+ }
+ }
+ },
+
+ _reverseDirection : {
+ default: false,
+ },
+
+ reverseDirection: {
+ get: function () {
+ return this.targetN.isReverseDirection();
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ this.targetN.setReverseProgress(value);
+ }
+ else {
+ cc.error('The new reverseDirection must be Boolean');
+ }
+ }
+ },
+
+ _texture: {
+ default: '',
+ url: cc.Texture2D
+ },
+
+ texture: {
+ get: function () {
+ var tex = this.targetN.getSprite().texture;
+ return (tex && tex.url) || '';
+ },
+ set: function (value) {
+ this.targetN.getSprite().texture = value;
+ },
+ url: cc.Texture2D
+ }
+ },
+
+ onBeforeSerialize: function () {
+ NodeWrapper.prototype.onBeforeSerialize.call(this);
+ this._type = this.type;
+ this._percentage = this.percentage;
+ this._midPoint = [this.midPoint.x, this.midPoint.y];
+ this._barChangeRate = [this.barChangeRate.x, this.barChangeRate.y];
+ this._reverseDirection = this.reverseDirection;
+ this._texture = this.texture;
+ },
+
+ createNode: function (node) {
+ node = node || new cc.ProgressTimer(new cc.Sprite());
+
+ var sp = node.getSprite();
+ if (this._texture) {
+ sp.texture = this._texture;
+
+ if (cc.sys.isNative) {
+ // jsb Texture will not save url, so we save manually.
+ sp.texture.url = this._texture;
+ }
+ }
+
+ node.setType(this._type);
+ node.setPercentage(this._percentage);
+
+ if (this._midPoint) {
+ node.setMidpoint(cc.p(this._midPoint[0], this._midPoint[1]));
+ }
+
+ if (this._barChangeRate) {
+ node.setBarChangeRate(cc.p(this._barChangeRate[0], this._barChangeRate[1]));
+ }
+
+ node.setReverseProgress(this._reverseDirection);
+
+ NodeWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.ProgressTimerWrapper = module.exports = ProgressTimerWrapper;
diff --git a/cocos2d/ToMerge/wrappers/sprite-batch-node.js b/cocos2d/ToMerge/wrappers/sprite-batch-node.js
new file mode 100644
index 00000000000..60baf90946d
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/sprite-batch-node.js
@@ -0,0 +1,55 @@
+
+var NodeWrapper = require('./node');
+
+var SpriteBatchNodeWrapper = cc.Class({
+ name: 'cc.SpriteBatchNodeWrapper',
+ extends: NodeWrapper,
+
+ properties: {
+
+ texture_: {
+ get: function () {
+ var tex = this.targetN.texture;
+ return (tex && tex.url) || '';
+ },
+ set: function (value) {
+ this.targetN.initWithFile(value);
+ },
+ url: cc.Texture2D
+ },
+
+ texture: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ _textureObject: {
+ default: null
+ },
+ },
+
+ onBeforeSerialize: function () {
+ NodeWrapper.prototype.onBeforeSerialize.call(this);
+
+ this.texture = this.texture_;
+ this._textureObject = this.targetN.texture;
+ },
+
+ createNode: function (node) {
+ node = node || new cc.SpriteBatchNode(new cc.Texture2D());
+
+ NodeWrapper.prototype.createNode.call(this, node);
+
+ if (this.texture) {
+ node.texture = cc.textureCache.addImage(this.texture);
+ }
+ else if (this._textureObject) {
+ node.texture = this._textureObject;
+ }
+
+ return node;
+ }
+});
+
+cc.SpriteBatchNodeWrapper = module.exports = SpriteBatchNodeWrapper;
diff --git a/cocos2d/ToMerge/wrappers/tiled-map.js b/cocos2d/ToMerge/wrappers/tiled-map.js
new file mode 100644
index 00000000000..6a1fcf7d1f5
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/tiled-map.js
@@ -0,0 +1,103 @@
+
+var NodeWrapper = require('./node');
+
+var TiledMapWrapper = cc.Class({
+ name: 'cc.TiledMapWrapper',
+ extends: NodeWrapper,
+
+ properties: {
+
+ file_: {
+ get: function () {
+ return this.targetN._file || '';
+ },
+ set: function (value) {
+ if ( !value ) {
+ cc.error('The new file must not be null');
+ return;
+ }
+
+ // first remove all layers
+ var layers = target.allLayers();
+ layers.forEach( function (layer) {
+ target.removeChild(layer);
+ });
+
+ TiledMapWrapper.preloadTmx( value , function (err, textures) {
+ if (err) {
+ throw err;
+ return;
+ }
+
+ this._textures = textures;
+ target._file = value;
+ target.initWithTMXFile( value );
+ }.bind(this) );
+ },
+ url: cc.TiledMapAsset,
+ displayName: 'File'
+ },
+
+ childrenN: {
+ get: function () {
+ var children = this.targetN.children.filter( function (child) {
+ return !(child instanceof cc.TMXLayer);
+ });
+ return children;
+ },
+ },
+
+ _textures: {
+ default: [],
+ url: [cc.Texture2D]
+ },
+
+ file: {
+ default: '',
+ url: cc.TiledMapAsset,
+ visible: false
+ }
+ },
+
+ statics: {
+ preloadTmx: function (file, cb) {
+ cc.loader.load(file, function (err) {
+ if (err) {
+ if (cb) cb(err);
+ return;
+ }
+
+ var mapInfo = new cc.TMXMapInfo(file);
+ var sets = mapInfo.getTilesets();
+
+ if (sets) {
+ var textures = sets.map(function (set) {
+ return set.sourceImage;
+ });
+
+ cc.loader.load(textures, function (err) {
+ cb(err, textures);
+ });
+ }
+ else {
+ if (cb) cb();
+ }
+ });
+ }
+ },
+
+ onBeforeSerialize: function () {
+ this.file = this.file_;
+ },
+
+ createNode: function (node) {
+ node = node || new cc.TMXTiledMap( this.file );
+ node._file = this.file;
+
+ NodeWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.TiledMapWrapper = module.exports = TiledMapWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/button.js b/cocos2d/ToMerge/wrappers/ui/button.js
new file mode 100644
index 00000000000..aeb5b9f2c62
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/button.js
@@ -0,0 +1,182 @@
+var Utils = require('../utils');
+
+var Scale9Wrapper = require('./scale9');
+
+var ButtonWrapper = cc.Class({
+ name: 'cc.ButtonWrapper',
+ extends: Scale9Wrapper,
+
+ properties: {
+ normalTexture: {
+ get: function () {
+ return this._normalTexture;
+ },
+ set: function ( value ) {
+ this._normalTexture = value;
+ this.targetN.loadTextureNormal( value );
+ },
+ url: cc.Texture2D
+ },
+
+ pressedTexture: {
+ get: function () {
+ return this._pressedTexture;
+ },
+ set: function ( value ) {
+ this._pressedTexture = value;
+ this.targetN.loadTexturePressed( value );
+ },
+ url: cc.Texture2D
+ },
+
+ disabledTexture: {
+ get: function () {
+ return this._disabledTexture;
+ },
+ set: function ( value ) {
+ this._disabledTexture = value;
+ this.targetN.loadTextureDisabled( value );
+ },
+ url: cc.Texture2D
+ },
+
+ text: {
+ get: function () {
+ return this.targetN.titleText;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.titleText = value;
+ }
+ else {
+ cc.error('The new text must be String');
+ }
+ }
+ },
+
+ fontSize: {
+ get: function () {
+ return this.targetN.titleFontSize;
+ },
+ set: function (value) {
+ if ( !isNaN(value) ) {
+ this.targetN.titleFontSize = value;
+ }
+ else {
+ cc.error('The new fontSize must not be NaN');
+ }
+ }
+ },
+
+ _font: {
+ default: null,
+ type: cc.TTFFont,
+ visible: true,
+
+ notify: function () {
+ var value = this._font;
+ if (!value || value instanceof cc.TTFFont) {
+ Utils.setFontToNode(value, this.targetN);
+ }
+ else {
+ cc.error('The new font must be cc.TTFFont');
+ }
+ }
+ },
+
+ fontFamily: {
+ get: function () {
+ return this.targetN.titleFontName;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.titleFontName = value;
+ }
+ else {
+ cc.error('The new fontFamily must be String');
+ }
+ }
+ },
+
+ fontColor: {
+ get: function () {
+ var color = this.targetN.titleColor;
+ return color || cc.Color.WHITE;
+ },
+ set: function (value) {
+ if (value instanceof cc.Color) {
+ this.targetN.titleColor = value;
+ }
+ else {
+ cc.error('The new fontColor must be cc.Color');
+ }
+ },
+ },
+
+ _text: {
+ default: 'Button'
+ },
+
+ _fontSize: {
+ default: 16
+ },
+
+ _fontFamily: {
+ default: null
+ },
+
+ _fontColor: {
+ default: null
+ },
+
+ _normalTexture: {
+ default: '',
+ url: cc.Texture2D
+ },
+
+ _pressedTexture: {
+ default: '',
+ url: cc.Texture2D
+ },
+
+ _disabledTexture: {
+ default: '',
+ url: cc.Texture2D
+ }
+ },
+
+ onBeforeSerialize: function () {
+ Scale9Wrapper.prototype.onBeforeSerialize.call(this);
+
+ this._text = this.text;
+ this._fontSize = this.fontSize;
+ this._fontFamily = this.fontFamily;
+
+ var color = this.fontColor;
+ this._fontColor = [color.r, color.g, color.b, color.a];
+ },
+
+ createNode: function (node) {
+
+ node = node || new ccui.Button();
+ node.loadTextures(this._normalTexture, this._pressedTexture, this._disabledTexture);
+
+ node.titleText = this._text;
+ node.titleFontSize = this._fontSize;
+ node.titleFontName = this._fontFamily === null ? node.titleFontName : this._fontFamily;
+
+ Utils.setFontToNode(this._font, node);
+
+ var color = this._fontColor;
+ if (color) {
+ color = new cc.Color(this._fontColor[0], this._fontColor[1], this._fontColor[2], this._fontColor[3]);
+ node.titleColor = color;
+ }
+
+ Scale9Wrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.ButtonWrapper = module.exports = ButtonWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/check-box.js b/cocos2d/ToMerge/wrappers/ui/check-box.js
new file mode 100644
index 00000000000..8aa85f4bc07
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/check-box.js
@@ -0,0 +1,140 @@
+
+var WidgetWrapper = require('./widget');
+
+var CheckBoxWrapper = cc.Class({
+ name: 'cc.CheckBoxWrapper',
+ extends: WidgetWrapper,
+
+ properties: {
+ bg_: {
+ get: function () {
+ return this.bg;
+ },
+ set: function ( value ) {
+ this.bg = value;
+ this.targetN.loadTextureBackGround( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Bg'
+ },
+
+ bgPressed_: {
+ get: function () {
+ return this.bgPressed;
+ },
+ set: function ( value ) {
+ this.bgPressed = value;
+ this.targetN.loadTextureBackGroundSelected( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Bg Pressed'
+ },
+
+ bgDisabled_: {
+ get: function () {
+ return this.bgDisabled;
+ },
+ set: function ( value ) {
+ this.bgDisabled = value;
+ this.targetN.loadTextureBackGroundDisabled( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Bg Disabled'
+ },
+
+ fg_: {
+ get: function () {
+ return this.fg;
+ },
+ set: function ( value ) {
+ this.fg = value;
+ this.targetN.loadTextureFrontCross( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Fg'
+ },
+
+ fgDisabled_: {
+ get: function () {
+ return this.fgDisabled;
+ },
+ set: function ( value ) {
+ this.fgDisabled = value;
+ this.targetN.loadTextureFrontCrossDisabled( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Fg Disabled'
+ },
+
+ selected: {
+ get: function () {
+ return this.targetN.selected;
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ this.targetN.selected = value;
+ }
+ else {
+ cc.error('The new selected must be number');
+ }
+ }
+ },
+
+ bg: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ bgPressed: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ bgDisabled: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ fg: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ fgDisabled: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ _selected: {
+ default: null
+ }
+
+ },
+
+ onBeforeSerialize: function () {
+ WidgetWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._selected = this.selected;
+ },
+
+ createNode: function (node) {
+
+ node = node || new ccui.CheckBox();
+ node.loadTextures(this.bg, this.bgPressed, this.fg, this.bgDisabled, this.fgDisabled);
+
+ if (this._selected !== null) {
+ node.selected = this._selected;
+ }
+
+ WidgetWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.CheckBoxWrapper = module.exports = CheckBoxWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/layout.js b/cocos2d/ToMerge/wrappers/ui/layout.js
new file mode 100644
index 00000000000..7a7c20b2709
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/layout.js
@@ -0,0 +1,110 @@
+var NodeWrapper = require('../node');
+var WidgetWrapper = require('./widget');
+
+var LayoutWrapper = cc.Class({
+ name: 'cc.LayoutWrapper',
+ extends: WidgetWrapper,
+
+ properties: {
+ clippingEnabled: {
+ get: function () {
+ return this.targetN.clippingEnabled;
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ this.targetN.clippingEnabled = value;
+
+ cc.renderer.childrenOrderDirty = true;
+ if (CC_EDITOR) {
+ cc.engine.repaintInEditMode();
+ }
+ }
+ else {
+ cc.error('The new clippingEnabled must be boolean');
+ }
+ }
+ },
+
+ layoutType: {
+ get: function () {
+ return this.targetN.layoutType;
+ },
+ set: function (value) {
+ if (typeof value === 'number' && !isNaN(value)) {
+ this.targetN.layoutType = value;
+ this.updateChildLayoutType();
+
+ this.doLayout();
+ }
+ else {
+ cc.error('The new layoutType must be number');
+ }
+ },
+ type: ccui.Layout.Type
+ },
+
+ _layoutType: {
+ default: 0
+ },
+
+ _clippingEnabled: {
+ default: null
+ }
+ },
+
+ updateChildLayoutType: function () {
+ var layoutType = this.layoutType;
+ this.children.forEach( function (child) {
+ child.widgetLayoutType = layoutType;
+ });
+ },
+
+ addChildN: function (child) {
+ var wrapper = cc.getWrapper(child);
+ wrapper.widgetLayoutType = this.layoutType;
+ NodeWrapper.prototype.addChildN.call(this, child);
+ },
+
+ canAddChildN: function (child) {
+ if ( !(child instanceof ccui.Widget) ) {
+ cc.error('Layout can only add ccui.Widget as a child');
+ return false;
+ }
+
+ return true;
+ },
+
+ onChildSiblingIndexChanged: function () {
+ this.doLayout();
+ },
+
+ doLayout: function () {
+ this.targetN.requestDoLayout();
+ cc.renderer.childrenOrderDirty = true;
+ if (CC_EDITOR) {
+ cc.engine.repaintInEditMode();
+ }
+ },
+
+ onBeforeSerialize: function () {
+ WidgetWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._layoutType = this.layoutType;
+ this._clippingEnabled = this.clippingEnabled;
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.Layout();
+
+ WidgetWrapper.prototype.createNode.call(this, node);
+
+ node.layoutType = this._layoutType;
+
+ if (this._clippingEnabled !== null)
+ node.clippingEnabled = this._clippingEnabled;
+
+ return node;
+ }
+});
+
+cc.LayoutWrapper = module.exports = LayoutWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/list-view.js b/cocos2d/ToMerge/wrappers/ui/list-view.js
new file mode 100644
index 00000000000..7baf3a72159
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/list-view.js
@@ -0,0 +1,17 @@
+
+var ScrollViewWrapper = require('./scroll-view');
+
+var ListViewWrapper = cc.Class({
+ name: 'cc.ListViewWrapper',
+ extends: ScrollViewWrapper,
+
+ createNode: function (node) {
+ node = node || new ccui.ListView();
+
+ ScrollViewWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.ListViewWrapper = module.exports = ListViewWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/loading-bar.js b/cocos2d/ToMerge/wrappers/ui/loading-bar.js
new file mode 100644
index 00000000000..2b3293278df
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/loading-bar.js
@@ -0,0 +1,85 @@
+
+var Scale9Wrapper = require('./scale9');
+
+var LoadingBarWrapper = cc.Class({
+ name: 'cc.LoadingBarWrapper',
+ extends: Scale9Wrapper,
+
+ properties: {
+ texture_: {
+ get: function () {
+ return this.texture;
+ },
+ set: function (value) {
+ this.texture = value;
+ this.targetN.loadTexture( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Texture'
+ },
+
+ direction: {
+ get: function () {
+ return this.targetN.direction;
+ },
+ set: function (value) {
+ if ( typeof value === 'number' && !isNaN(value) ) {
+ this.targetN.direction = value;
+ }
+ else {
+ cc.error('The new direction must be number');
+ }
+ },
+
+ type: ccui.LoadingBar.Type
+ },
+
+ percent: {
+ get: function () {
+ return this.targetN.percent;
+ },
+ set: function (value) {
+ if ( typeof value === 'number' && !isNaN(value) ) {
+ this.targetN.percent = value;
+ }
+ else {
+ cc.error('The new percent must be number');
+ }
+ }
+ },
+
+ _direction: {
+ default: ccui.LoadingBar.Type.LEFT
+ },
+
+ _percent: {
+ default: 100
+ },
+
+ texture: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ }
+ },
+
+ onBeforeSerialize: function () {
+ Scale9Wrapper.prototype.onBeforeSerialize.call(this);
+
+ this._direction = this.direction;
+ this._percent = this.percent;
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.LoadingBar();
+ node.loadTexture(this.texture);
+ node.percent = this._percent;
+ node.direction = this._direction;
+
+ Scale9Wrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.LoadingBarWrapper = module.exports = LoadingBarWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/page-view.js b/cocos2d/ToMerge/wrappers/ui/page-view.js
new file mode 100644
index 00000000000..0e7dfe5d87e
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/page-view.js
@@ -0,0 +1,44 @@
+
+var LayoutWrapper = require('./layout');
+
+var PageViewWrapper = cc.Class({
+ name: 'cc.PageViewWrapper',
+ extends: LayoutWrapper,
+
+ onChildSiblingIndexChanged: function () {
+ var pages = this.targetN._pages;
+ pages.sort(function (a, b) {
+ return a.getOrderOfArrival() > b.getOrderOfArrival() ? 1 : -1;
+ });
+
+ LayoutWrapper.prototype.onChildSiblingIndexChanged.call(this);
+ },
+
+ addChildN: function (child) {
+ if (child instanceof ccui.Layout) {
+ this.targetN.addPage(child);
+ }
+ else {
+ this.targetN.addChild(child);
+ }
+ },
+
+ removeChildN: function (child) {
+ if (child instanceof ccui.Layout) {
+ this.targetN.removePage(child);
+ }
+ else {
+ this.targetN.removeChild(child);
+ }
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.PageView();
+
+ LayoutWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.PageViewWrapper = module.exports = PageViewWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/scale9-sprite.js b/cocos2d/ToMerge/wrappers/ui/scale9-sprite.js
new file mode 100644
index 00000000000..b412c00a016
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/scale9-sprite.js
@@ -0,0 +1,58 @@
+
+var Scale9Wrapper = require('./scale9');
+
+var Scale9SpriteWrapper = cc.Class({
+ name: 'cc.Scale9SpriteWrapper',
+ extends: Scale9Wrapper,
+
+ properties: {
+
+ childrenN: {
+ get: function () {
+ var renderer = this.targetN.getVirtualRenderer();
+ var children = this.targetN.children.filter( function (child) {
+ return child !== renderer;
+ });
+ return children;
+ },
+ },
+
+ texture_: {
+ get: function () {
+ return this.texture;
+ },
+ set: function (value) {
+ this.texture = value;
+ this.targetN.loadTexture( value );
+ },
+ url: cc.Texture2D
+ },
+
+ texture: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ }
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.ImageView(this.texture);
+
+ Scale9Wrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+// ccui.ImageView not implement getRotation
+// we implement here
+if (!cc.sys.isNative) {
+ var _p = ccui.ImageView.prototype;
+ _p.getRotation = function() {
+ return this._imageRenderer.getRotation();
+ };
+
+ cc.js.getset(_p, 'rotation', _p.getRotation, _p.setRotation);
+}
+
+cc.Scale9SpriteWrapper = module.exports = Scale9SpriteWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/scale9.js b/cocos2d/ToMerge/wrappers/ui/scale9.js
new file mode 100644
index 00000000000..aee1ca6f30e
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/scale9.js
@@ -0,0 +1,171 @@
+
+var WidgetWrapper = require('./widget');
+
+var Scale9Wrapper = cc.Class({
+ name: 'cc.Scale9Wrapper',
+ extends: WidgetWrapper,
+
+ ctor: function () {
+ this._scale9Size = null;
+ this._updatingCapInsets = false;
+ },
+
+ properties: {
+ enableScale9: {
+ get: function () {
+ return this.targetN.isScale9Enabled();
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ if (!value) this._scale9Size = this.size;
+
+ this.targetN.setScale9Enabled( value );
+
+ if (value && this._scale9Size) this.size = this._scale9Size;
+ }
+ else {
+ cc.error('The new enableScale9 must be boolean');
+ }
+ }
+ },
+
+ left: {
+ default: 0,
+ range: [0, Number.MAX_SAFE_INTEGER],
+
+ notify: function () {
+ this._updateCapInsets('left');
+ }
+ },
+
+ right: {
+ default: 0,
+ range: [0, Number.MAX_SAFE_INTEGER],
+
+ notify: function () {
+ this._updateCapInsets('right');
+ }
+ },
+
+ top: {
+ default: 0,
+ range: [0, Number.MAX_SAFE_INTEGER],
+
+ notify: function () {
+ this._updateCapInsets('top');
+ }
+ },
+
+ bottom: {
+ default: 0,
+ range: [0, Number.MAX_SAFE_INTEGER],
+
+ notify: function () {
+ this._updateCapInsets('bottom');
+ }
+ },
+
+ _enableScale9: {
+ default: false
+ },
+
+ _capInsets: {
+ default: null
+ }
+ },
+
+ getVirtualRendererSize: function () {
+ var renderer = this.targetN.getVirtualRenderer();
+ return renderer ? renderer._spriteRect : cc.size(0,0);
+ },
+
+ _updateCapInsets: function (type) {
+ if (!this.targetN || this._updatingCapInsets) return;
+ this._updatingCapInsets = true;
+
+ var size = this.getVirtualRendererSize();
+
+ var w = size.width - this.left - this.right;
+ var h = size.height - this.top - this.bottom;
+
+ // width and height should be greater than 0
+ if (type === 'left') {
+ if (this.left > size.width-1) {
+ this.left = size.width-1;
+ this.right = 0;
+ w = 1;
+ }
+ else if (w <= 0) {
+ this.right += w;
+ w = 1;
+ }
+ }
+ else if (type === 'right') {
+ if (this.right > size.width-1) {
+ this.right = size.width-1;
+ this.left = 0;
+ w = 1;
+ }
+ else if (w <= 0) {
+ this.left += w;
+ w = 1;
+ }
+ }
+ else if (type === 'top') {
+ if (this.top > size.height-1) {
+ this.top = size.height-1;
+ this.bottom = 0;
+ h = 1;
+ }
+ else if (h <= 0) {
+ this.bottom += h;
+ h = 1;
+ }
+ }
+ else if (type === 'bottom') {
+ if (this.bottom > size.height-1) {
+ this.bottom = size.height-1;
+ this.top = 0;
+ h = 1;
+ }
+ else if (h <= 0) {
+ this.top += h;
+ h = 1;
+ }
+ }
+
+ var x = this.left;
+ var y = this.top;
+
+ this.targetN.setCapInsets( cc.rect(x, y, w, h) );
+ this._capInsets = [x, y, w, h];
+
+ this._updatingCapInsets = false;
+ },
+
+ onBeforeSerialize: function () {
+ WidgetWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._enableScale9 = this.enableScale9;
+ },
+
+ createNode: function (node) {
+ if (!node) {
+ cc.error('Can\'t create a node from Scale9Wrapper');
+ return;
+ }
+
+ node.setScale9Enabled( this._enableScale9 );
+
+ var capInsets = this._capInsets;
+ if ( capInsets && this._enableScale9 ) {
+ node.setCapInsets( cc.rect(capInsets[0], capInsets[1], capInsets[2], capInsets[3]) );
+ }
+
+ WidgetWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+module.exports = Scale9Wrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/scroll-view.js b/cocos2d/ToMerge/wrappers/ui/scroll-view.js
new file mode 100644
index 00000000000..b89fb8d24eb
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/scroll-view.js
@@ -0,0 +1,99 @@
+
+var LayoutWrapper = require('./layout');
+
+var ScrollViewWrapper = cc.Class({
+ name: 'cc.ScrollViewWrapper',
+ extends: LayoutWrapper,
+
+ properties: {
+ direction: {
+ get: function () {
+ return this.targetN.getDirection();
+ },
+ set: function (value) {
+ if (typeof value === 'number' && !isNaN(value)) {
+ this.targetN.setDirection(value);
+
+ this.doLayout();
+ }
+ else {
+ cc.error('The new direction must be number');
+ }
+ },
+ type: ccui.ScrollView.Dir
+ },
+
+ bounce: {
+ get: function () {
+ return this.targetN.isBounceEnabled();
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ this.targetN.setBounceEnabled(value);
+ }
+ else {
+ cc.error('The new bounce must be boolean');
+ }
+ }
+ },
+
+ innerSize: {
+ get: function () {
+ var size = this.targetN.getInnerContainerSize();
+ return new cc.Vec2(size.width, size.height);
+ },
+ set: function (value) {
+ if ( value instanceof cc.Vec2 ) {
+ this.targetN.setInnerContainerSize( cc.size(value.x, value.y) );
+
+ this.doLayout();
+ }
+ else {
+ cc.error('The new innerSize must be cc.Vec2');
+ }
+ }
+ },
+
+ _direction: {
+ default: ccui.ScrollView.Dir.NONE,
+ type: ccui.ScrollView.Dir
+ },
+
+ _bounce: {
+ default: false
+ },
+
+ _innerSize: {
+ default: null
+ }
+ },
+
+ doLayout: function () {
+ this.targetN._innerContainer.requestDoLayout();
+ LayoutWrapper.prototype.doLayout.call(this);
+ },
+
+ onBeforeSerialize: function () {
+ LayoutWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._direction = this.direction;
+ this._bounce = this.bounce;
+ this._innerSize = [this.innerSize.x, this.innerSize.y];
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.ScrollView();
+
+ LayoutWrapper.prototype.createNode.call(this, node);
+
+ node.setDirection( this._direction );
+ node.setBounceEnabled( this._bounce );
+
+ var innerSize = this._innerSize;
+ if (innerSize) node.setInnerContainerSize( cc.size(innerSize[0], innerSize[1]) );
+
+ return node;
+ }
+});
+
+cc.ScrollViewWrapper = module.exports = ScrollViewWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/slider.js b/cocos2d/ToMerge/wrappers/ui/slider.js
new file mode 100644
index 00000000000..48a25d9fc00
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/slider.js
@@ -0,0 +1,139 @@
+
+var Scale9Wrapper = require('./scale9');
+
+var SliderWrapper = cc.Class({
+ name: 'cc.SliderWrapper',
+ extends: Scale9Wrapper,
+
+ properties: {
+ bgBar_: {
+ get: function () {
+ return this.bgBar;
+ },
+ set: function (value) {
+ this.bgBar = value;
+ this.targetN.loadBarTexture( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Bg Bar'
+ },
+
+ fgBar_: {
+ get: function () {
+ return this.fgBar;
+ },
+ set: function (value) {
+ this.fgBar = value;
+ this.targetN.loadProgressBarTexture( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Fg Bar'
+ },
+
+ control_: {
+ get: function () {
+ return this.control;
+ },
+ set: function (value) {
+ this.control = value;
+ this.targetN.loadSlidBallTextureNormal( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Control'
+ },
+
+ controlPressed_: {
+ get: function () {
+ return this.controlPressed;
+ },
+ set: function (value) {
+ this.controlPressed = value;
+ this.targetN.loadSlidBallTexturePressed( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Control Pressed'
+ },
+
+ controlDisabled_: {
+ get: function () {
+ return this.controlDisabled;
+ },
+ set: function (value) {
+ this.controlDisabled = value;
+ this.targetN.loadSlidBallTextureDisabled( value );
+ },
+ url: cc.Texture2D,
+ displayName: 'Control Disabled'
+ },
+
+ percent: {
+ get: function () {
+ return this.targetN.percent;
+ },
+ set: function (value) {
+ if ( typeof value === 'number' && !isNaN(value) ) {
+ this.targetN.percent = value;
+ }
+ else {
+ cc.error('The new percent must be number');
+ }
+ }
+ },
+
+ _percent: {
+ default: 0
+ },
+
+ bgBar: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ fgBar: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ control: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ controlPressed: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+
+ controlDisabled: {
+ default: '',
+ url: cc.Texture2D,
+ visible: false
+ },
+ },
+
+ onBeforeSerialize: function () {
+ Scale9Wrapper.prototype.onBeforeSerialize.call(this);
+
+ this._percent = this.percent;
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.Slider();
+
+ node.loadBarTexture( this.bgBar );
+ node.loadProgressBarTexture( this.fgBar );
+ node.loadSlidBallTextures( this.control, this.controlPressed, this.controlDisabled );
+
+ node.percent = this._percent;
+
+ Scale9Wrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.SliderWrapper = module.exports = SliderWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/text-atlas.js b/cocos2d/ToMerge/wrappers/ui/text-atlas.js
new file mode 100644
index 00000000000..4d451e80fd7
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/text-atlas.js
@@ -0,0 +1,79 @@
+
+var WidgetWrapper = require('./widget');
+
+var TextAtlasWrapper = cc.Class({
+ name: 'cc.TextAtlasWrapper',
+ extends: WidgetWrapper,
+
+ properties: {
+ text: {
+ get: function () {
+ return this.targetN.string;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.string = value;
+ }
+ else {
+ cc.error('The new text must be String');
+ }
+ }
+ },
+
+ texture: {
+ default: '',
+ url: cc.Texture2D,
+
+ notify: function () {
+ this.updateProperties();
+ }
+ },
+
+ itemWidth: {
+ default: 0,
+ notify: function () {
+ this.updateProperties();
+ }
+ },
+
+ itemHeight: {
+ default: 0,
+ notify: function () {
+ this.updateProperties();
+ }
+ },
+
+ startCharMap: {
+ default: '0',
+ notify: function () {
+ this.updateProperties();
+ }
+ },
+
+ _text: {
+ default: 'Label'
+ },
+ },
+
+ updateProperties: function () {
+ if (!this.targetN) return;
+ this.targetN.setProperty(this.text, this.texture, this.itemWidth, this.itemHeight, this.startCharMap);
+ },
+
+ onBeforeSerialize: function () {
+ WidgetWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._text = this.text;
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.TextAtlas();
+ node.setProperty(this._text, this.texture, this.itemWidth, this.itemHeight, this.startCharMap);
+
+ WidgetWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+cc.TextAtlasWrapper = module.exports = TextAtlasWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/text-bitmap-font.js b/cocos2d/ToMerge/wrappers/ui/text-bitmap-font.js
new file mode 100644
index 00000000000..937003c913b
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/text-bitmap-font.js
@@ -0,0 +1,70 @@
+
+var WidgetWrapper = require('./widget');
+
+var TextBMFontWrapper = cc.Class({
+ name: 'cc.TextBMFontWrapper',
+ extends: WidgetWrapper,
+
+ properties: {
+ text: {
+ get: function () {
+ return this.targetN.string;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.string = value;
+ }
+ else {
+ cc.error('The new text must be String');
+ }
+ }
+ },
+
+ bitmapFont_: {
+ get: function () {
+ return this.targetN._file || '';
+ },
+ set: function (value) {
+ cc.loader.load(value, function () {
+ this.targetN.setFntFile(value);
+ }.bind(this) );
+ },
+ url: cc.BitmapFont
+ },
+
+ _text: {
+ default: 'TextBMFont'
+ },
+
+ bitmapFont: {
+ default: '',
+ url: cc.BitmapFont,
+ visible: false
+ }
+ },
+
+ onBeforeSerialize: function () {
+ WidgetWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._text = this.text;
+ this.bitmapFont = this.bitmapFont_;
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.TextBMFont();
+ node.string = this._text;
+ node.setFntFile(this.bitmapFont);
+
+ WidgetWrapper.prototype.createNode.call(this, node);
+
+ return node;
+ }
+});
+
+var originSetFntFile = ccui.TextBMFont.prototype.setFntFile;
+ccui.TextBMFont.prototype.setFntFile = function (value) {
+ this._file = value;
+ originSetFntFile.call(this, value);
+};
+
+cc.TextBMFontWrapper = module.exports = TextBMFontWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/text-field.js b/cocos2d/ToMerge/wrappers/ui/text-field.js
new file mode 100644
index 00000000000..f2378735360
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/text-field.js
@@ -0,0 +1,214 @@
+var Utils = require('../utils');
+
+var WidgetWrapper = require('./widget');
+
+var TextFieldWrapper = cc.Class({
+ name: 'cc.TextFieldWrapper',
+ extends: WidgetWrapper,
+
+ properties: {
+ text: {
+ get: function () {
+ return this.targetN.string;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.string = value;
+
+ this.setDirtyFlag();
+ }
+ else {
+ cc.error('The new text must be String');
+ }
+ }
+ },
+
+ placeHolder: {
+ get: function () {
+ return this.targetN.placeHolder;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.placeHolder = value;
+
+ this.setDirtyFlag();
+ }
+ else {
+ cc.error('The new placeHolder must be String');
+ }
+ }
+ },
+
+ fontSize: {
+ get: function () {
+ return this.targetN.fontSize;
+ },
+ set: function (value) {
+ if ( !isNaN(value) ) {
+ this.targetN.fontSize = value;
+
+ this.setDirtyFlag();
+ }
+ else {
+ cc.error('The new fontSize must not be NaN');
+ }
+ }
+ },
+
+ font: {
+ default: null,
+ type: cc.TTFFont,
+
+ notify: function () {
+ if ( !this.targetN ) return;
+
+ var value = this.font;
+ if (!value || value instanceof cc.TTFFont) {
+ Utils.setFontToNode(value, this.targetN);
+
+ this.setDirtyFlag();
+ }
+ else {
+ cc.error('The new font must be cc.TTFFont');
+ }
+ }
+ },
+
+ fontFamily: {
+ get: function () {
+ return this.targetN.fontName;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.fontName = value;
+
+ this.setDirtyFlag();
+ }
+ else {
+ cc.error('The new fontFamily must be String');
+ }
+ }
+ },
+
+ maxLengthEnabled: {
+ get: function () {
+ return this.targetN.maxLengthEnabled;
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ this.targetN.maxLengthEnabled = value;
+
+ this.setDirtyFlag();
+ }
+ else {
+ cc.error('The new maxLengthEnabled must be boolean');
+ }
+ }
+ },
+
+ maxLength: {
+ get: function () {
+ return this.targetN.maxLength;
+ },
+ set: function (value) {
+ if (typeof value === 'number') {
+ this.targetN.maxLength = value;
+
+ this.setDirtyFlag();
+ }
+ else {
+ cc.error('The new maxLength must be String');
+ }
+ }
+ },
+
+ passwordEnabled: {
+ get: function () {
+ return this.targetN.passwordEnabled;
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ var targetN = this.targetN;
+ targetN.passwordEnabled = value;
+
+ this.text = this.text;
+ }
+ else {
+ cc.error('The new passwordEnabled must be boolean');
+ }
+ }
+ },
+
+ _text: {
+ default: ''
+ },
+
+ _placeHolder: {
+ default: 'Input Something'
+ },
+
+ _fontSize: {
+ default: 16
+ },
+
+ _fontFamily: {
+ default: null
+ },
+
+ _maxLengthEnabled: {
+ default: false
+ },
+
+ _maxLength: {
+ default: 0
+ },
+
+ _passwordEnabled: {
+ default: false
+ }
+ },
+
+ onSizeChanged: function () {
+ WidgetWrapper.prototype.onSizeChanged.call(this);
+ this.setDirtyFlag();
+ },
+
+ setDirtyFlag: function () {
+ cc.renderer.childrenOrderDirty = true;
+ },
+
+ onBeforeSerialize: function () {
+ WidgetWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._text = this.text;
+ this._placeHolder = this.placeHolder;
+ this._fontSize = this.fontSize;
+ this._fontFamily = this.fontFamily;
+ this._maxLengthEnabled = this.maxLengthEnabled;
+ this._passwordEnabled = this.passwordEnabled;
+
+ if (this.maxLengthEnabled) this._maxLength = this.maxLength;
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.TextField();
+ node.ignoreContentAdaptWithSize(false);
+
+ WidgetWrapper.prototype.createNode.call(this, node);
+
+ node.passwordEnabled = this._passwordEnabled;
+ node.string = this._text;
+ node.placeHolder = this._placeHolder;
+ node.fontSize = this._fontSize;
+ node.fontFamily = this._fontFamily;
+ node.maxLengthEnabled = this._maxLengthEnabled;
+
+ if (this._maxLengthEnabled) node.maxLength = this._maxLength;
+
+ Utils.setFontToNode(this.font, node);
+
+ return node;
+ }
+});
+
+cc.TextFieldWrapper = module.exports = TextFieldWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/text.js b/cocos2d/ToMerge/wrappers/ui/text.js
new file mode 100644
index 00000000000..ecc99cf366b
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/text.js
@@ -0,0 +1,178 @@
+var Utils = require('../utils');
+
+var WidgetWrapper = require('./widget');
+
+var TextWrapper = cc.Class({
+ name: 'cc.TextWrapper',
+ extends: WidgetWrapper,
+
+ ctor: function () {
+ this._boundingBox = [100, 100]
+ },
+
+ properties: {
+ text: {
+ get: function () {
+ return this.targetN.string;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.string = value;
+ }
+ else {
+ cc.error('The new text must be String');
+ }
+ }
+ },
+
+ fontSize: {
+ get: function () {
+ return this.targetN.fontSize;
+ },
+ set: function (value) {
+ if ( !isNaN(value) ) {
+ this.targetN.fontSize = value;
+ }
+ else {
+ cc.error('The new fontSize must not be NaN');
+ }
+ }
+ },
+
+ font: {
+ default: null,
+ type: cc.TTFFont,
+
+ notify: function () {
+ if ( !this.targetN ) return;
+
+ var value = this.font;
+ if (!value || value instanceof cc.TTFFont) {
+ Utils.setFontToNode(value, this.targetN);
+ }
+ else {
+ cc.error('The new font must be cc.TTFFont');
+ }
+ }
+ },
+
+ fontFamily: {
+ get: function () {
+ return this.targetN.fontName;
+ },
+ set: function (value) {
+ if (typeof value === 'string') {
+ this.targetN.fontName = value;
+ }
+ else {
+ cc.error('The new fontFamily must be String');
+ }
+ }
+ },
+
+ align: {
+ get: function () {
+ return this.targetN.getTextHorizontalAlignment();
+ },
+ set: function ( value ) {
+ if (typeof value === 'number') {
+ this.targetN.textAlign = value;
+ }
+ else {
+ cc.error('The new textAlign must be number');
+ }
+ },
+ type: cc.TextAlignment
+ },
+
+ verticalAlign: {
+ get: function () {
+ return this.targetN.getTextVerticalAlignment();
+ },
+ set: function ( value ) {
+ if (typeof value === 'number') {
+ this.targetN.verticalAlign = value;
+ }
+ else {
+ cc.error('The new verticalAlign must be number');
+ }
+ },
+ type: cc.VerticalTextAlignment
+ },
+
+ boundingBox: {
+ get: function () {
+ var size = this.targetN.getTextAreaSize();
+ return new cc.Vec2(size.width, size.height);
+ },
+ set: function (value) {
+ if (value instanceof cc.Vec2) {
+ this.targetN.setTextAreaSize( cc.size( value.x, value.y ) );
+ }
+ else {
+ cc.error('The new boundingBox must be Vec2');
+ }
+ },
+ type: cc.Vec2
+ },
+
+ _text: {
+ default: 'Label'
+ },
+
+ _fontSize: {
+ default: 16
+ },
+
+ _fontFamily: {
+ default: null
+ },
+
+ _align: {
+ default: cc.TextAlignment.CENTER
+ },
+
+ _verticalAlign: {
+ default: cc.VerticalTextAlignment.CENTER
+ },
+
+ _boundingBox: {
+ default: null
+ }
+ },
+
+ onBeforeSerialize: function () {
+ WidgetWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._text = this.text;
+ this._fontSize = this.fontSize;
+ this._fontFamily = this.fontFamily;
+ this._align = this.align;
+ this._verticalAlign = this.verticalAlign;
+ this._boundingBox = [this.boundingBox.x, this.boundingBox.y];
+ },
+
+ createNode: function (node) {
+ node = node || new ccui.Text();
+ node.ignoreContentAdaptWithSize(false);
+
+ WidgetWrapper.prototype.createNode.call(this, node);
+
+ node.string = this._text;
+ node.fontSize = this._fontSize;
+ node.fontName = this._fontFamily === null ? node.fontName : this._fontFamily;
+ node.textAlign = this._align;
+ node.verticalAlign = this._verticalAlign;
+
+ var boundingBox = this._boundingBox;
+ if (boundingBox) {
+ node.setTextAreaSize( cc.size( boundingBox[0], boundingBox[1] ) );
+ }
+
+ Utils.setFontToNode(this.font, node);
+
+ return node;
+ }
+});
+
+cc.TextWrapper = module.exports = TextWrapper;
diff --git a/cocos2d/ToMerge/wrappers/ui/widget.js b/cocos2d/ToMerge/wrappers/ui/widget.js
new file mode 100644
index 00000000000..b5899450108
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/ui/widget.js
@@ -0,0 +1,245 @@
+
+var NodeWrapper = require('../node');
+
+var desc = Object.getOwnPropertyDescriptor(NodeWrapper.prototype, 'parentN');
+
+var WidgetWrapper = cc.Class({
+ name: 'cc.WidgetWrapper',
+ extends: NodeWrapper,
+
+ ctor: function () {
+ this._ignoreUpdateLayoutParameter = false;
+ },
+
+ properties: {
+
+ position: {
+ get: function () {
+ return new cc.Vec2(this.targetN.x, this.targetN.y);
+ },
+ set: function (value) {
+ if ( value instanceof cc.Vec2 ) {
+ this.targetN.setPosition(value.x, value.y);
+
+ if (this.canDoAnchor) {
+ this.updateAnchorPositon();
+ }
+ }
+ else {
+ cc.error('The new position must be cc.Vec2');
+ }
+ }
+ },
+
+ parentN: {
+ get: function () {
+ var parent = this.targetN.parent;
+
+ if (parent) {
+ var ancient = parent.parent;
+ if ( ancient && ancient instanceof ccui.ScrollView) {
+ return ancient;
+ }
+ }
+
+ return parent;
+ },
+ set: desc.set
+ },
+
+ enabled: {
+ get: function () {
+ return this.targetN.enabled;
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ this.targetN.enabled = value;
+ this.targetN.bright = value;
+ }
+ else {
+ cc.error('The new enabled must be boolean');
+ }
+ }
+ },
+
+ touchEnabled: {
+ get: function () {
+ return this.targetN.touchEnabled;
+ },
+ set: function (value) {
+ if (typeof value === 'boolean') {
+ this.targetN.touchEnabled = value;
+ }
+ else {
+ cc.error('The new touchEnabled must be boolean');
+ }
+ }
+ },
+
+ canDoAnchor: {
+ get: function () {
+ var parentN = this.parentN;
+ return parentN && parentN instanceof ccui.Layout;
+ }
+ },
+
+ anchorAlign: {
+ default: ccui.RelativeLayoutParameter.Type.PARENT_TOP_LEFT,
+ type: ccui.RelativeLayoutParameter.Type,
+
+ notify: function () {
+ this.updateAnchorPositon();
+ }
+ },
+
+ widgetLayoutType: {
+ default: ccui.Layout.Type.RELATIVE,
+ type: ccui.Layout.Type,
+
+ notify: function (oldValue) {
+ if (oldValue === this.widgetLayoutType) return;
+
+ this._ignoreUpdateLayoutParameter = true;
+ this.anchorLeft = this.anchorTop = this.anchorRight = this.anchorBottom = 0;
+ this._ignoreUpdateLayoutParameter = false;
+
+ this.updateLayoutParameter();
+ }
+ },
+
+ anchorLeft: {
+ default: 0,
+
+ notify: function () {
+ this.updateLayoutParameter();
+ }
+ },
+
+ anchorRight: {
+ default: 0,
+
+ notify: function () {
+ this.updateLayoutParameter();
+ }
+ },
+
+ anchorTop: {
+ default: 0,
+
+ notify: function () {
+ this.updateLayoutParameter();
+ }
+ },
+
+ anchorBottom: {
+ default: 0,
+
+ notify: function () {
+ this.updateLayoutParameter();
+ }
+ },
+
+ _enabled: {
+ default: null
+ },
+
+ _touchEnabled: {
+ default: null
+ },
+ },
+
+ updateLayoutParameter: function (node) {
+ if (this._ignoreUpdateLayoutParameter) return;
+
+ node = node || this.targetN;
+
+ var parameter;
+
+ if (this.widgetLayoutType === ccui.Layout.Type.RELATIVE) {
+ parameter = new ccui.RelativeLayoutParameter();
+ parameter.setAlign(this.anchorAlign);
+ }
+ else {
+ parameter = new ccui.LinearLayoutParameter();
+ }
+ parameter.setMargin(this.anchorLeft, this.anchorTop, this.anchorRight, this.anchorBottom);
+
+ node.setLayoutParameter(parameter);
+
+ if (this.targetN) {
+ this.doParentLayout();
+ }
+ },
+
+ updateAnchorPositon: function () {
+ this._ignoreUpdateLayoutParameter = true;
+
+ var targetN = this.targetN;
+ var cs = targetN.getContentSize();
+ var ap = targetN.getAnchorPointInPoints();
+ var ls = targetN.parent._getLayoutContentSize();
+
+ this.anchorLeft = targetN.x - ap.x;
+ this.anchorRight = ls.width - targetN.x - (cs.width - ap.x);
+ this.anchorTop = ls.height - targetN.y - (cs.height - ap.y);
+ this.anchorBottom = targetN.y - ap.y;
+
+ this._ignoreUpdateLayoutParameter = false;
+ this.updateLayoutParameter();
+ },
+
+ onSizeChanged: function () {
+ this.doParentLayout();
+ },
+
+ _getUrlFromRenderer: function (renderer) {
+ if (!renderer) return '';
+
+ var texture;
+ if ( renderer.texture ) texture = renderer.texture;
+ if ( renderer._scale9Image ) texture = renderer._scale9Image.texture;
+
+ return texture ? texture.url : '';
+ },
+
+ doParentLayout: function () {
+ var parent = this.parent;
+ while (parent) {
+ if (parent instanceof cc.LayoutWrapper) {
+ parent.doLayout();
+ return;
+ }
+ parent = parent.parent;
+ }
+ },
+
+ onBeforeSerialize: function () {
+ NodeWrapper.prototype.onBeforeSerialize.call(this);
+
+ this._enabled = this.enabled;
+ this._touchEnabled = this.touchEnabled;
+ },
+
+ createNode: function (node) {
+ if (!node) {
+ cc.error('Can\'t create a node from WidgetWrapper');
+ return;
+ }
+
+ NodeWrapper.prototype.createNode.call(this, node);
+
+ this.updateLayoutParameter(node);
+
+ if (this._enabled !== null) {
+ node.enabled = this._enabled;
+ node.bright = this._enabled;
+ }
+
+ if (this._touchEnabled !== null)
+ node.setTouchEnabled( this._touchEnabled );
+
+ return node;
+ }
+});
+
+module.exports = WidgetWrapper;
diff --git a/cocos2d/ToMerge/wrappers/utils.js b/cocos2d/ToMerge/wrappers/utils.js
new file mode 100644
index 00000000000..8854e26ae5f
--- /dev/null
+++ b/cocos2d/ToMerge/wrappers/utils.js
@@ -0,0 +1,16 @@
+
+module.exports = {
+ setFontToNode: function(fontAsset, node) {
+ if (fontAsset) {
+ var config = {type:'font', name: fontAsset.fontFamily, srcs:[fontAsset.url]};
+ cc.loader.load(config, function (err, results) {
+ if (err) throw err;
+
+ node.fontName = config.name;
+ });
+ }
+ else {
+ node.fontName = 'Arial';
+ }
+ }
+};
diff --git a/cocos2d/actions/CCAction.js b/cocos2d/actions/CCAction.js
new file mode 100644
index 00000000000..0f63364c2fd
--- /dev/null
+++ b/cocos2d/actions/CCAction.js
@@ -0,0 +1,694 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/** Default Action tag
+ * @constant
+ * @type {Number}
+ * @default
+ */
+cc.ACTION_TAG_INVALID = -1;
+
+/**
+ * Base class for cc.Action objects.
+ * @class
+ *
+ * @extends cc._Class
+ *
+ * @property {cc.Node} target - The target will be set with the 'startWithTarget' method. When the 'stop' method is called, target will be set to nil.
+ * @property {cc.Node} originalTarget - The original target of the action.
+ * @property {Number} tag - The tag of the action, can be used to find the action.
+ */
+cc.Action = cc._Class.extend(/** @lends cc.Action# */{
+ //***********variables*************
+ originalTarget:null,
+ target:null,
+ tag:cc.ACTION_TAG_INVALID,
+
+ //**************Public Functions***********
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ */
+ ctor:function () {
+ this.originalTarget = null;
+ this.target = null;
+ this.tag = cc.ACTION_TAG_INVALID;
+ },
+
+ /**
+ * to copy object with deep copy.
+ *
+ * @deprecated since v3.0 please use .clone
+ *
+ * @return {cc.Action}
+ */
+ copy:function () {
+ cc.log("copy is deprecated. Please use clone instead.");
+ return this.clone();
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.Action}
+ */
+ clone:function () {
+ var action = new cc.Action();
+ action.originalTarget = null;
+ action.target = null;
+ action.tag = this.tag;
+ return action;
+ },
+
+ /**
+ * return true if the action has finished.
+ *
+ * @return {Boolean}
+ */
+ isDone:function () {
+ return true;
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ this.originalTarget = target;
+ this.target = target;
+ },
+
+ /**
+ * called after the action has finished. It will set the 'target' to nil.
+ * IMPORTANT: You should never call "action stop" manually. Instead, use: "target.stopAction(action);"
+ */
+ stop:function () {
+ this.target = null;
+ },
+
+ /**
+ * called every frame with it's delta time.
+ * DON'T override unless you know what you are doing.
+ *
+ * @param {Number} dt
+ */
+ step:function (dt) {
+ cc.log("[Action step]. override me");
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ cc.log("[Action update]. override me");
+ },
+
+ /**
+ * get the target.
+ *
+ * @return {cc.Node}
+ */
+ getTarget:function () {
+ return this.target;
+ },
+
+ /**
+ * The action will modify the target properties.
+ *
+ * @param {cc.Node} target
+ */
+ setTarget:function (target) {
+ this.target = target;
+ },
+
+ /**
+ * get the original target.
+ *
+ * @return {cc.Node}
+ */
+ getOriginalTarget:function () {
+ return this.originalTarget;
+ },
+
+ /**
+ * Set the original target, since target can be nil.
+ * Is the target that were used to run the action.
+ * Unless you are doing something complex, like cc.ActionManager, you should NOT call this method.
+ * The target is 'assigned', it is not 'retained'.
+ * @param {cc.Node} originalTarget
+ */
+ setOriginalTarget:function (originalTarget) {
+ this.originalTarget = originalTarget;
+ },
+
+ /**
+ * get tag number.
+ * @return {Number}
+ */
+ getTag:function () {
+ return this.tag;
+ },
+
+ /**
+ * set tag number.
+ * @param {Number} tag
+ */
+ setTag:function (tag) {
+ this.tag = tag;
+ },
+
+ /**
+ * Currently JavaScript Bindigns (JSB), in some cases, needs to use retain and release. This is a bug in JSB,
+ * and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB.
+ * This is a hack, and should be removed once JSB fixes the retain/release bug.
+ */
+ retain:function () {
+ },
+
+ /**
+ * Currently JavaScript Bindigns (JSB), in some cases, needs to use retain and release. This is a bug in JSB,
+ * and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB.
+ * This is a hack, and should be removed once JSB fixes the retain/release bug.
+ */
+ release:function () {
+ }
+});
+
+/**
+ * Allocates and initializes the action.
+ *
+ * @function cc.action
+ * @static
+ * @return {cc.Action}
+ *
+ * @example
+ * // return {cc.Action}
+ * var action = cc.action();
+ */
+cc.action = function () {
+ return new cc.Action();
+};
+
+/**
+ * Please use cc.action instead.
+ * Allocates and initializes the action.
+ *
+ * @deprecated since v3.0 please use cc.action() instead.
+ * @static
+ * @returns {cc.Action}
+ */
+cc.Action.create = cc.action;
+
+
+/**
+ * Base class actions that do have a finite time duration.
+ * Possible actions:
+ * - An action with a duration of 0 seconds.
+ * - An action with a duration of 35.5 seconds.
+ *
+ * Infinite time actions are valid
+ * @class
+ * @extends cc.Action
+ */
+cc.FiniteTimeAction = cc.Action.extend(/** @lends cc.FiniteTimeAction# */{
+ //! duration in seconds
+ _duration:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ */
+ ctor:function () {
+ cc.Action.prototype.ctor.call(this);
+ this._duration = 0;
+ },
+
+ /**
+ * get duration of the action. (seconds)
+ *
+ * @return {Number}
+ */
+ getDuration:function () {
+ return this._duration * (this._timesForRepeat || 1);
+ },
+
+ /**
+ * set duration of the action. (seconds)
+ *
+ * @param {Number} duration
+ */
+ setDuration:function (duration) {
+ this._duration = duration;
+ },
+
+ /**
+ * Returns a reversed action.
+ * For example:
+ * - The action will be x coordinates of 0 move to 100.
+ * - The reversed action will be x of 100 move to 0.
+ * - Will be rewritten
+ *
+ * @return {Null}
+ */
+ reverse:function () {
+ cc.log("cocos2d: FiniteTimeAction#reverse: Implement me");
+ return null;
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.FiniteTimeAction}
+ */
+ clone:function () {
+ return new cc.FiniteTimeAction();
+ }
+});
+
+/**
+ * Changes the speed of an action, making it take longer (speed > 1)
+ * or less (speed < 1) time.
+ * Useful to simulate 'slow motion' or 'fast forward' effect.
+ *
+ * @warning This action can't be Sequenceable because it is not an cc.IntervalAction
+ * @class
+ * @extends cc.Action
+ * @param {cc.ActionInterval} action
+ * @param {Number} speed
+ */
+cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{
+ _speed:0.0,
+ _innerAction:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {cc.ActionInterval} action
+ * @param {Number} speed
+ */
+ ctor:function (action, speed) {
+ cc.Action.prototype.ctor.call(this);
+ this._speed = 0;
+ this._innerAction = null;
+
+ action && this.initWithAction(action, speed);
+ },
+
+ /**
+ * Gets the current running speed.
+ * Will get a percentage number, compared to the original speed.
+ *
+ * @return {Number}
+ */
+ getSpeed:function () {
+ return this._speed;
+ },
+
+ /**
+ * alter the speed of the inner function in runtime.
+ *
+ * @param {Number} speed
+ */
+ setSpeed:function (speed) {
+ this._speed = speed;
+ },
+
+ /**
+ * initializes the action.
+ *
+ * @param {cc.ActionInterval} action
+ * @param {Number} speed
+ * @return {Boolean}
+ */
+ initWithAction:function (action, speed) {
+ if(!action)
+ throw new Error("cc.Speed.initWithAction(): action must be non nil");
+
+ this._innerAction = action;
+ this._speed = speed;
+ return true;
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.Speed}
+ */
+ clone:function () {
+ var action = new cc.Speed();
+ action.initWithAction(this._innerAction.clone(), this._speed);
+ return action;
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.Action.prototype.startWithTarget.call(this, target);
+ this._innerAction.startWithTarget(target);
+ },
+
+ /**
+ * Stop the action.
+ */
+ stop:function () {
+ this._innerAction.stop();
+ cc.Action.prototype.stop.call(this);
+ },
+
+ /**
+ * called every frame with it's delta time.
+ * DON'T override unless you know what you are doing.
+ *
+ * @param {Number} dt
+ */
+ step:function (dt) {
+ this._innerAction.step(dt * this._speed);
+ },
+
+ /**
+ * return true if the action has finished.
+ *
+ * @return {Boolean}
+ */
+ isDone:function () {
+ return this._innerAction.isDone();
+ },
+
+ /**
+ * returns a reversed action.
+ * For example:
+ * - The action will be x coordinates of 0 move to 100.
+ * - The reversed action will be x of 100 move to 0.
+ * - Will be rewritten
+ *
+ * @return {cc.Speed}
+ */
+ reverse:function () {
+ return new cc.Speed(this._innerAction.reverse(), this._speed);
+ },
+
+ /**
+ * Set inner Action.
+ * @param {cc.ActionInterval} action
+ */
+ setInnerAction:function (action) {
+ if (this._innerAction !== action) {
+ this._innerAction = action;
+ }
+ },
+
+ /**
+ * Get inner Action.
+ *
+ * @return {cc.ActionInterval}
+ */
+ getInnerAction:function () {
+ return this._innerAction;
+ }
+});
+
+/**
+ * creates the speed action.
+ *
+ * @function cc.speed
+ * @param {cc.ActionInterval} action
+ * @param {Number} speed
+ * @return {cc.Speed}
+ */
+cc.speed = function (action, speed) {
+ return new cc.Speed(action, speed);
+};
+
+/**
+ * Please use cc.speed instead.
+ * creates the action.
+ *
+ * @param {cc.ActionInterval} action
+ * @param {Number} speed
+ * @return {cc.Speed}
+ * @static
+ * @deprecated since v3.0 please use cc.speed() instead.
+ */
+cc.Speed.create = cc.speed;
+
+/**
+ * cc.Follow is an action that "follows" a node.
+ *
+ * @example
+ * //example
+ * //Instead of using cc.Camera as a "follower", use this action instead.
+ * layer.runAction(cc.follow(hero));
+ *
+ * @property {Number} leftBoundary - world leftBoundary.
+ * @property {Number} rightBoundary - world rightBoundary.
+ * @property {Number} topBoundary - world topBoundary.
+ * @property {Number} bottomBoundary - world bottomBoundary.
+ *
+ * @param {cc.Node} followedNode
+ * @param {cc.Rect} rect
+ * @example
+ * // creates the action with a set boundary
+ * var sprite = new cc.Sprite("spriteFileName");
+ * var followAction = new cc.Follow(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height));
+ * this.runAction(followAction);
+ *
+ * // creates the action with no boundary set
+ * var sprite = new cc.Sprite("spriteFileName");
+ * var followAction = new cc.Follow(sprite);
+ * this.runAction(followAction);
+ *
+ * @class
+ * @extends cc.Action
+ */
+cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{
+ // node to follow
+ _followedNode:null,
+ // whether camera should be limited to certain area
+ _boundarySet:false,
+ // if screen size is bigger than the boundary - update not needed
+ _boundaryFullyCovered:false,
+ // fast access to the screen dimensions
+ _halfScreenSize:null,
+ _fullScreenSize:null,
+ _worldRect:null,
+
+ leftBoundary:0.0,
+ rightBoundary:0.0,
+ topBoundary:0.0,
+ bottomBoundary:0.0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates the action with a set boundary.
+ * creates the action with no boundary set.
+ * @param {cc.Node} followedNode
+ * @param {cc.Rect} rect
+ */
+ ctor:function (followedNode, rect) {
+ cc.Action.prototype.ctor.call(this);
+ this._followedNode = null;
+ this._boundarySet = false;
+
+ this._boundaryFullyCovered = false;
+ this._halfScreenSize = null;
+ this._fullScreenSize = null;
+
+ this.leftBoundary = 0.0;
+ this.rightBoundary = 0.0;
+ this.topBoundary = 0.0;
+ this.bottomBoundary = 0.0;
+ this._worldRect = cc.rect(0, 0, 0, 0);
+
+ if(followedNode)
+ rect ? this.initWithTarget(followedNode, rect)
+ : this.initWithTarget(followedNode);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.Follow}
+ */
+ clone:function () {
+ var action = new cc.Follow();
+ var locRect = this._worldRect;
+ var rect = new cc.Rect(locRect.x, locRect.y, locRect.width, locRect.height);
+ action.initWithTarget(this._followedNode, rect);
+ return action;
+ },
+
+ /**
+ * Get whether camera should be limited to certain area.
+ *
+ * @return {Boolean}
+ */
+ isBoundarySet:function () {
+ return this._boundarySet;
+ },
+
+ /**
+ * alter behavior - turn on/off boundary.
+ *
+ * @param {Boolean} value
+ */
+ setBoudarySet:function (value) {
+ this._boundarySet = value;
+ },
+
+ /**
+ * initializes the action with a set boundary.
+ *
+ * @param {cc.Node} followedNode
+ * @param {cc.Rect} [rect=]
+ * @return {Boolean}
+ */
+ initWithTarget:function (followedNode, rect) {
+ if(!followedNode)
+ throw new Error("cc.Follow.initWithAction(): followedNode must be non nil");
+
+ var _this = this;
+ rect = rect || cc.rect(0, 0, 0, 0);
+ _this._followedNode = followedNode;
+ _this._worldRect = rect;
+
+ _this._boundarySet = !cc._rectEqualToZero(rect);
+
+ _this._boundaryFullyCovered = false;
+
+ var winSize = cc.director.getWinSize();
+ _this._fullScreenSize = cc.p(winSize.width, winSize.height);
+ _this._halfScreenSize = cc.pMult(_this._fullScreenSize, 0.5);
+
+ if (_this._boundarySet) {
+ _this.leftBoundary = -((rect.x + rect.width) - _this._fullScreenSize.x);
+ _this.rightBoundary = -rect.x;
+ _this.topBoundary = -rect.y;
+ _this.bottomBoundary = -((rect.y + rect.height) - _this._fullScreenSize.y);
+
+ if (_this.rightBoundary < _this.leftBoundary) {
+ // screen width is larger than world's boundary width
+ //set both in the middle of the world
+ _this.rightBoundary = _this.leftBoundary = (_this.leftBoundary + _this.rightBoundary) / 2;
+ }
+ if (_this.topBoundary < _this.bottomBoundary) {
+ // screen width is larger than world's boundary width
+ //set both in the middle of the world
+ _this.topBoundary = _this.bottomBoundary = (_this.topBoundary + _this.bottomBoundary) / 2;
+ }
+
+ if ((_this.topBoundary === _this.bottomBoundary) && (_this.leftBoundary === _this.rightBoundary))
+ _this._boundaryFullyCovered = true;
+ }
+ return true;
+ },
+
+ /**
+ * called every frame with it's delta time.
+ * DON'T override unless you know what you are doing.
+ *
+ * @param {Number} dt
+ */
+ step:function (dt) {
+ var tempPosX = this._followedNode.x;
+ var tempPosY = this._followedNode.y;
+ tempPosX = this._halfScreenSize.x - tempPosX;
+ tempPosY = this._halfScreenSize.y - tempPosY;
+
+ //TODO Temporary treatment - The dirtyFlag symbol error
+ this.target._renderCmd._dirtyFlag = 0;
+
+ if (this._boundarySet) {
+ // whole map fits inside a single screen, no need to modify the position - unless map boundaries are increased
+ if (this._boundaryFullyCovered)
+ return;
+
+ this.target.setPosition(cc.clampf(tempPosX, this.leftBoundary, this.rightBoundary), cc.clampf(tempPosY, this.bottomBoundary, this.topBoundary));
+ } else {
+ this.target.setPosition(tempPosX, tempPosY);
+ }
+ },
+
+ /**
+ * Return true if the action has finished.
+ *
+ * @return {Boolean}
+ */
+ isDone:function () {
+ return ( !this._followedNode.running );
+ },
+
+ /**
+ * Stop the action.
+ */
+ stop:function () {
+ this.target = null;
+ cc.Action.prototype.stop.call(this);
+ }
+});
+
+/**
+ * creates the action with a set boundary.
+ * creates the action with no boundary set.
+ *
+ * @function
+ * @param {cc.Node} followedNode
+ * @param {cc.Rect} rect
+ * @return {cc.Follow|Null} returns the cc.Follow object on success
+ * @example
+ * // example
+ * // creates the action with a set boundary
+ * var sprite = new cc.Sprite("spriteFileName");
+ * var followAction = cc.follow(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height));
+ * this.runAction(followAction);
+ *
+ * // creates the action with no boundary set
+ * var sprite = new cc.Sprite("spriteFileName");
+ * var followAction = cc.follow(sprite);
+ * this.runAction(followAction);
+ */
+cc.follow = function (followedNode, rect) {
+ return new cc.Follow(followedNode, rect);
+};
+
+/**
+ * Please use cc.follow instead.
+ * creates the action with a set boundary.
+ * creates the action with no boundary set.
+ * @param {cc.Node} followedNode
+ * @param {cc.Rect} rect
+ * @return {cc.Follow|Null} returns the cc.Follow object on success
+ * @static
+ * @deprecated since v3.0 please cc.follow() instead.
+ */
+cc.Follow.create = cc.follow;
diff --git a/cocos2d/actions/CCActionCamera.js b/cocos2d/actions/CCActionCamera.js
new file mode 100644
index 00000000000..0ff5786b717
--- /dev/null
+++ b/cocos2d/actions/CCActionCamera.js
@@ -0,0 +1,293 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ * Base class for cc.Camera actions
+ * @class
+ * @extends cc.ActionInterval
+ */
+cc.ActionCamera = cc.ActionInterval.extend(/** @lends cc.ActionCamera# */{
+ _centerXOrig:0,
+ _centerYOrig:0,
+ _centerZOrig:0,
+ _eyeXOrig:0,
+ _eyeYOrig:0,
+ _eyeZOrig:0,
+ _upXOrig:0,
+ _upYOrig:0,
+ _upZOrig:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ */
+ ctor:function(){
+ var _t = this;
+ cc.ActionInterval.prototype.ctor.call(_t);
+
+ _t._centerXOrig=0;
+ _t._centerYOrig=0;
+ _t._centerZOrig=0;
+ _t._eyeXOrig=0;
+ _t._eyeYOrig=0;
+ _t._eyeZOrig=0;
+ _t._upXOrig=0;
+ _t._upYOrig=0;
+ _t._upZOrig=0;
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ var _t = this;
+ cc.ActionInterval.prototype.startWithTarget.call(_t, target);
+
+ var camera = target.getCamera();
+ var centerXYZ = camera.getCenter();
+ _t._centerXOrig = centerXYZ.x;
+ _t._centerYOrig = centerXYZ.y;
+ _t._centerZOrig = centerXYZ.z;
+
+ var eyeXYZ = camera.getEye();
+ _t._eyeXOrig = eyeXYZ.x;
+ _t._eyeYOrig = eyeXYZ.y;
+ _t._eyeZOrig = eyeXYZ.z;
+
+ var upXYZ = camera.getUp();
+ _t._upXOrig = upXYZ.x;
+ _t._upYOrig = upXYZ.y;
+ _t._upZOrig = upXYZ.z;
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a new clone of the action
+ *
+ * @returns {cc.ActionCamera}
+ */
+ clone:function(){
+ return new cc.ActionCamera();
+ },
+
+ /**
+ * returns a reversed action.
+ * For example:
+ * - The action will be x coordinates of 0 move to 100.
+ * - The reversed action will be x of 100 move to 0.
+ * - Will be rewritten
+ *
+ */
+ reverse:function () {
+ return new cc.ReverseTime(this);
+ }
+});
+
+/**
+ * Orbits the camera around the center of the screen using spherical coordinates.
+ *
+ * @param {Number} t time
+ * @param {Number} radius
+ * @param {Number} deltaRadius
+ * @param {Number} angleZ
+ * @param {Number} deltaAngleZ
+ * @param {Number} angleX
+ * @param {Number} deltaAngleX
+ *
+ * @class
+ * @extends cc.ActionCamera
+ */
+cc.OrbitCamera = cc.ActionCamera.extend(/** @lends cc.OrbitCamera# */{
+ _radius: 0.0,
+ _deltaRadius: 0.0,
+ _angleZ: 0.0,
+ _deltaAngleZ: 0.0,
+ _angleX: 0.0,
+ _deltaAngleX: 0.0,
+ _radZ: 0.0,
+ _radDeltaZ: 0.0,
+ _radX: 0.0,
+ _radDeltaX: 0.0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates a cc.OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX.
+ * @param {Number} t time
+ * @param {Number} radius
+ * @param {Number} deltaRadius
+ * @param {Number} angleZ
+ * @param {Number} deltaAngleZ
+ * @param {Number} angleX
+ * @param {Number} deltaAngleX
+ */
+ ctor:function(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX){
+ cc.ActionCamera.prototype.ctor.call(this);
+
+ deltaAngleX !== undefined && this.initWithDuration(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX);
+ },
+
+ /**
+ * initializes a cc.OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX
+ * @param {Number} t time
+ * @param {Number} radius
+ * @param {Number} deltaRadius
+ * @param {Number} angleZ
+ * @param {Number} deltaAngleZ
+ * @param {Number} angleX
+ * @param {Number} deltaAngleX
+ * @return {Boolean}
+ */
+ initWithDuration:function (t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
+ var _t = this;
+ _t._radius = radius;
+ _t._deltaRadius = deltaRadius;
+ _t._angleZ = angleZ;
+ _t._deltaAngleZ = deltaAngleZ;
+ _t._angleX = angleX;
+ _t._deltaAngleX = deltaAngleX;
+
+ _t._radDeltaZ = cc.degreesToRadians(deltaAngleZ);
+ _t._radDeltaX = cc.degreesToRadians(deltaAngleX);
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * positions the camera according to spherical coordinates
+ * @return {Object}
+ */
+ sphericalRadius:function () {
+ var newRadius, zenith, azimuth;
+ var camera = this.target.getCamera();
+ var eyeXYZ = camera.getEye();
+ var centerXYZ = camera.getCenter();
+
+ var x = eyeXYZ.x - centerXYZ.x, y = eyeXYZ.y - centerXYZ.y, z = eyeXYZ.z - centerXYZ.z;
+
+ var r = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));
+ var s = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
+ if (s === 0.0)
+ s = cc.FLT_EPSILON;
+ if (r === 0.0)
+ r = cc.FLT_EPSILON;
+
+ zenith = Math.acos(z / r);
+ if (x < 0)
+ azimuth = Math.PI - Math.asin(y / s);
+ else
+ azimuth = Math.asin(y / s);
+ newRadius = r / cc.Camera.getZEye();
+ return {newRadius:newRadius, zenith:zenith, azimuth:azimuth};
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ var _t = this;
+ cc.ActionInterval.prototype.startWithTarget.call(_t, target);
+ var retValue = _t.sphericalRadius();
+ if (isNaN(_t._radius))
+ _t._radius = retValue.newRadius;
+
+ if (isNaN(_t._angleZ))
+ _t._angleZ = cc.radiansToDegrees(retValue.zenith);
+
+ if (isNaN(_t._angleX))
+ _t._angleX = cc.radiansToDegrees(retValue.azimuth);
+
+ _t._radZ = cc.degreesToRadians(_t._angleZ);
+ _t._radX = cc.degreesToRadians(_t._angleX);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a new clone of the action
+ *
+ * @returns {cc.ActionCamera}
+ */
+ clone:function(){
+ var a = new cc.OrbitCamera(), _t = this;
+ a.initWithDuration(_t._duration, _t._radius, _t._deltaRadius, _t._angleZ, _t._deltaAngleZ, _t._angleX, _t._deltaAngleX);
+ return a;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ var r = (this._radius + this._deltaRadius * dt) * cc.Camera.getZEye();
+ var za = this._radZ + this._radDeltaZ * dt;
+ var xa = this._radX + this._radDeltaX * dt;
+
+ var i = Math.sin(za) * Math.cos(xa) * r + this._centerXOrig;
+ var j = Math.sin(za) * Math.sin(xa) * r + this._centerYOrig;
+ var k = Math.cos(za) * r + this._centerZOrig;
+
+ this.target.getCamera().setEye(i, j, k);
+ this.target.setNodeDirty();
+ }
+});
+
+/**
+ * creates a cc.OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX
+ * @function
+ * @param {Number} t time
+ * @param {Number} radius
+ * @param {Number} deltaRadius
+ * @param {Number} angleZ
+ * @param {Number} deltaAngleZ
+ * @param {Number} angleX
+ * @param {Number} deltaAngleX
+ * @return {cc.OrbitCamera}
+ */
+cc.orbitCamera = function (t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX) {
+ return new cc.OrbitCamera(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX);
+};
+
+/**
+ * Please use cc.orbitCamera instead
+ * creates a cc.OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX
+ * @param {Number} t time
+ * @param {Number} radius
+ * @param {Number} deltaRadius
+ * @param {Number} angleZ
+ * @param {Number} deltaAngleZ
+ * @param {Number} angleX
+ * @param {Number} deltaAngleX
+ * @return {cc.OrbitCamera}
+ * @static
+ * @deprecated since v3.0 please use cc.orbitCamera() instead.
+ */
+cc.OrbitCamera.create = cc.orbitCamera;
diff --git a/cocos2d/actions/CCActionCatmullRom.js b/cocos2d/actions/CCActionCatmullRom.js
new file mode 100644
index 00000000000..2110529c905
--- /dev/null
+++ b/cocos2d/actions/CCActionCatmullRom.js
@@ -0,0 +1,605 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+ Copyright (c) 2008 Radu Gruian
+ Copyright (c) 2011 Vit Valentin
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+
+ Orignal code by Radu Gruian: http://www.codeproject.com/Articles/30838/Overhauser-Catmull-Rom-Splines-for-Camera-Animatio.So
+
+ Adapted to cocos2d-x by Vit Valentin
+
+ Adapted from cocos2d-x to cocos2d-iphone by Ricardo Quesada
+ ****************************************************************************/
+
+/**
+ * Returns the Cardinal Spline position for a given set of control points, tension and time.
+ * CatmullRom Spline formula.
+ * s(-ttt + 2tt - t)P1 + s(-ttt + tt)P2 + (2ttt - 3tt + 1)P2 + s(ttt - 2tt + t)P3 + (-2ttt + 3tt)P3 + s(ttt - tt)P4
+ *
+ * @function
+ * @param {cc.Vec2} p0
+ * @param {cc.Vec2} p1
+ * @param {cc.Vec2} p2
+ * @param {cc.Vec2} p3
+ * @param {Number} tension
+ * @param {Number} t
+ * @return {cc.Vec2}
+ */
+cc.cardinalSplineAt = function (p0, p1, p2, p3, tension, t) {
+ var t2 = t * t;
+ var t3 = t2 * t;
+
+ /*
+ * Formula: s(-ttt + 2tt - t)P1 + s(-ttt + tt)P2 + (2ttt - 3tt + 1)P2 + s(ttt - 2tt + t)P3 + (-2ttt + 3tt)P3 + s(ttt - tt)P4
+ */
+ var s = (1 - tension) / 2;
+
+ var b1 = s * ((-t3 + (2 * t2)) - t); // s(-t3 + 2 t2 - t)P1
+ var b2 = s * (-t3 + t2) + (2 * t3 - 3 * t2 + 1); // s(-t3 + t2)P2 + (2 t3 - 3 t2 + 1)P2
+ var b3 = s * (t3 - 2 * t2 + t) + (-2 * t3 + 3 * t2); // s(t3 - 2 t2 + t)P3 + (-2 t3 + 3 t2)P3
+ var b4 = s * (t3 - t2); // s(t3 - t2)P4
+
+ var x = (p0.x * b1 + p1.x * b2 + p2.x * b3 + p3.x * b4);
+ var y = (p0.y * b1 + p1.y * b2 + p2.y * b3 + p3.y * b4);
+ return cc.p(x, y);
+};
+
+/**
+ * returns a new copy of the array reversed.
+ *
+ * @return {Array}
+ */
+cc.reverseControlPoints = function (controlPoints) {
+ var newArray = [];
+ for (var i = controlPoints.length - 1; i >= 0; i--) {
+ newArray.push(cc.p(controlPoints[i].x, controlPoints[i].y));
+ }
+ return newArray;
+};
+
+
+/**
+ * returns a new clone of the controlPoints
+ *
+ * @param controlPoints
+ * @returns {Array}
+ */
+cc.cloneControlPoints = function (controlPoints) {
+ var newArray = [];
+ for (var i = 0; i < controlPoints.length; i++)
+ newArray.push(cc.p(controlPoints[i].x, controlPoints[i].y));
+ return newArray;
+};
+
+/**
+ * returns a new clone of the controlPoints
+ * @deprecated since v3.0 please use cc.cloneControlPoints() instead.
+ * @param controlPoints
+ * @returns {Array}
+ */
+cc.copyControlPoints = cc.cloneControlPoints;
+
+/**
+ * returns a point from the array
+ *
+ * @param {Array} controlPoints
+ * @param {Number} pos
+ * @return {Array}
+ */
+cc.getControlPointAt = function (controlPoints, pos) {
+ var p = Math.min(controlPoints.length - 1, Math.max(pos, 0));
+ return controlPoints[p];
+};
+
+/**
+ * reverse the current control point array inline, without generating a new one
+ *
+ * @param controlPoints
+ */
+cc.reverseControlPointsInline = function (controlPoints) {
+ var len = controlPoints.length;
+ var mid = 0 | (len / 2);
+ for (var i = 0; i < mid; ++i) {
+ var temp = controlPoints[i];
+ controlPoints[i] = controlPoints[len - i - 1];
+ controlPoints[len - i - 1] = temp;
+ }
+};
+
+
+/**
+ * Cardinal Spline path. {@link http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline}
+ * Absolute coordinates.
+ *
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration
+ * @param {Array} points array of control points
+ * @param {Number} tension
+ *
+ * @example
+ * //create a cc.CardinalSplineTo
+ * var action1 = cc.cardinalSplineTo(3, array, 0);
+ */
+cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# */{
+ /** Array of control points */
+ _points:null,
+ _deltaT:0,
+ _tension:0,
+ _previousPosition:null,
+ _accumulatedDiff:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates an action with a Cardinal Spline array of points and tension.
+ * @param {Number} duration
+ * @param {Array} points array of control points
+ * @param {Number} tension
+ */
+ ctor: function (duration, points, tension) {
+ cc.ActionInterval.prototype.ctor.call(this);
+
+ this._points = [];
+ tension !== undefined && this.initWithDuration(duration, points, tension);
+ },
+
+ /**
+ * initializes the action with a duration and an array of points
+ *
+ * @param {Number} duration
+ * @param {Array} points array of control points
+ * @param {Number} tension
+ *
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, points, tension) {
+ if(!points || points.length === 0)
+ throw new Error("Invalid configuration. It must at least have one control point");
+
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this.setPoints(points);
+ this._tension = tension;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ *
+ * @returns {cc.CardinalSplineTo}
+ */
+ clone:function () {
+ var action = new cc.CardinalSplineTo();
+ action.initWithDuration(this._duration, cc.copyControlPoints(this._points), this._tension);
+ return action;
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ // Issue #1441 from cocos2d-iphone
+ this._deltaT = 1 / (this._points.length - 1);
+ this._previousPosition = cc.p(this.target.getPositionX(), this.target.getPositionY());
+ this._accumulatedDiff = cc.p(0, 0);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ var p, lt;
+ var ps = this._points;
+ // eg.
+ // p..p..p..p..p..p..p
+ // 1..2..3..4..5..6..7
+ // want p to be 1, 2, 3, 4, 5, 6
+ if (dt === 1) {
+ p = ps.length - 1;
+ lt = 1;
+ } else {
+ var locDT = this._deltaT;
+ p = 0 | (dt / locDT);
+ lt = (dt - locDT * p) / locDT;
+ }
+
+ var newPos = cc.cardinalSplineAt(
+ cc.getControlPointAt(ps, p - 1),
+ cc.getControlPointAt(ps, p - 0),
+ cc.getControlPointAt(ps, p + 1),
+ cc.getControlPointAt(ps, p + 2),
+ this._tension, lt);
+
+ if (cc.ENABLE_STACKABLE_ACTIONS) {
+ var tempX, tempY;
+ tempX = this.target.getPositionX() - this._previousPosition.x;
+ tempY = this.target.getPositionY() - this._previousPosition.y;
+ if (tempX !== 0 || tempY !== 0) {
+ var locAccDiff = this._accumulatedDiff;
+ tempX = locAccDiff.x + tempX;
+ tempY = locAccDiff.y + tempY;
+ locAccDiff.x = tempX;
+ locAccDiff.y = tempY;
+ newPos.x += tempX;
+ newPos.y += tempY;
+ }
+ }
+ this.updatePosition(newPos);
+ },
+
+ /**
+ * reverse a new cc.CardinalSplineTo.
+ * Along the track of movement in the opposite.
+ *
+ * @return {cc.CardinalSplineTo}
+ */
+ reverse:function () {
+ var reversePoints = cc.reverseControlPoints(this._points);
+ return cc.cardinalSplineTo(this._duration, reversePoints, this._tension);
+ },
+
+ /**
+ * update position of target
+ *
+ * @param {cc.Vec2} newPos
+ */
+ updatePosition:function (newPos) {
+ this.target.setPosition(newPos);
+ this._previousPosition = newPos;
+ },
+
+ /**
+ * Points getter
+ *
+ * @return {Array}
+ */
+ getPoints:function () {
+ return this._points;
+ },
+
+ /**
+ * Points setter
+ *
+ * @param {Array} points
+ */
+ setPoints:function (points) {
+ this._points = points;
+ }
+});
+
+/**
+ * creates an action with a Cardinal Spline array of points and tension.
+ *
+ * @function
+ * @param {Number} duration
+ * @param {Array} points array of control points
+ * @param {Number} tension
+ * @return {cc.CardinalSplineTo}
+ *
+ * @example
+ * //create a cc.CardinalSplineTo
+ * var action1 = cc.cardinalSplineTo(3, array, 0);
+ */
+cc.cardinalSplineTo = function (duration, points, tension) {
+ return new cc.CardinalSplineTo(duration, points, tension);
+};
+
+/**
+ * Please use cc.cardinalSplineTo instead.
+ * creates an action with a Cardinal Spline array of points and tension
+ *
+ * @function
+ * @param {Number} duration
+ * @param {Array} points array of control points
+ * @param {Number} tension
+ * @return {cc.CardinalSplineTo}
+ * @static
+ * @deprecated since v3.0 please use cc.cardinalSplineTo(duration, points, tension) instead.
+ */
+cc.CardinalSplineTo.create = cc.cardinalSplineTo;
+
+/**
+ * Cardinal Spline path. {@link http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline}
+ * Relative coordinates.
+ *
+ * @class
+ * @extends cc.CardinalSplineTo
+ * @param {Number} duration
+ * @param {Array} points
+ * @param {Number} tension
+ *
+ * @example
+ * //create a cc.CardinalSplineBy
+ * var action1 = cc.cardinalSplineBy(3, array, 0);
+ */
+cc.CardinalSplineBy = cc.CardinalSplineTo.extend(/** @lends cc.CardinalSplineBy# */{
+ _startPosition:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates an action with a Cardinal Spline array of points and tension.
+ * @param {Number} duration
+ * @param {Array} points
+ * @param {Number} tension
+ */
+ ctor:function (duration, points, tension) {
+ cc.CardinalSplineTo.prototype.ctor.call(this);
+ this._startPosition = cc.p(0, 0);
+
+ tension !== undefined && this.initWithDuration(duration, points, tension);
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.CardinalSplineTo.prototype.startWithTarget.call(this, target);
+ this._startPosition.x = target.getPositionX();
+ this._startPosition.y = target.getPositionY();
+ },
+
+ /**
+ * reverse a new cc.CardinalSplineBy
+ *
+ * @return {cc.CardinalSplineBy}
+ */
+ reverse:function () {
+ var copyConfig = this._points.slice();
+ var current;
+ //
+ // convert "absolutes" to "diffs"
+ //
+ var p = copyConfig[0];
+ for (var i = 1; i < copyConfig.length; ++i) {
+ current = copyConfig[i];
+ copyConfig[i] = cc.pSub(current, p);
+ p = current;
+ }
+
+ // convert to "diffs" to "reverse absolute"
+ var reverseArray = cc.reverseControlPoints(copyConfig);
+
+ // 1st element (which should be 0,0) should be here too
+ p = reverseArray[ reverseArray.length - 1 ];
+ reverseArray.pop();
+
+ p.x = -p.x;
+ p.y = -p.y;
+
+ reverseArray.unshift(p);
+ for (var i = 1; i < reverseArray.length; ++i) {
+ current = reverseArray[i];
+ current.x = -current.x;
+ current.y = -current.y;
+ current.x += p.x;
+ current.y += p.y;
+ reverseArray[i] = current;
+ p = current;
+ }
+ return cc.cardinalSplineBy(this._duration, reverseArray, this._tension);
+ },
+
+ /**
+ * update position of target
+ *
+ * @param {cc.Vec2} newPos
+ */
+ updatePosition:function (newPos) {
+ var pos = this._startPosition;
+ var posX = newPos.x + pos.x;
+ var posY = newPos.y + pos.y;
+ this._previousPosition.x = posX;
+ this._previousPosition.y = posY;
+ this.target.setPosition(posX, posY);
+ },
+
+ /**
+ * returns a new clone of the action
+ *
+ * @returns {cc.CardinalSplineBy}
+ */
+ clone:function () {
+ var a = new cc.CardinalSplineBy();
+ a.initWithDuration(this._duration, cc.copyControlPoints(this._points), this._tension);
+ return a;
+ }
+});
+
+/**
+ * creates an action with a Cardinal Spline array of points and tension.
+ *
+ * @function
+ * @param {Number} duration
+ * @param {Array} points
+ * @param {Number} tension
+ *
+ * @return {cc.CardinalSplineBy}
+ */
+cc.cardinalSplineBy = function (duration, points, tension) {
+ return new cc.CardinalSplineBy(duration, points, tension);
+};
+
+/**
+ * Please use cc.cardinalSplineBy instead.
+ * creates an action with a Cardinal Spline array of points and tension.
+ * @function
+ * @param {Number} duration
+ * @param {Array} points
+ * @param {Number} tension
+ * @return {cc.CardinalSplineBy}
+ * @static
+ * @deprecated since v3.0 please use cc.cardinalSplineBy(duration, points, tension);
+ */
+cc.CardinalSplineBy.create = cc.cardinalSplineBy;
+
+/**
+ * An action that moves the target with a CatmullRom curve to a destination point.
+ * A Catmull Rom is a Cardinal Spline with a tension of 0.5.
+ * {@link http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline}
+ * Absolute coordinates.
+ *
+ * @class
+ * @extends cc.CardinalSplineTo
+ * @param {Number} dt
+ * @param {Array} points
+ *
+ * @example
+ * var action1 = cc.catmullRomTo(3, array);
+ */
+cc.CatmullRomTo = cc.CardinalSplineTo.extend(/** @lends cc.CatmullRomTo# */{
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates an action with a Cardinal Spline array of points and tension.
+ * @param {Number} dt
+ * @param {Array} points
+ */
+ ctor: function(dt, points) {
+ points && this.initWithDuration(dt, points);
+ },
+
+ /**
+ * Initializes the action with a duration and an array of points
+ *
+ * @param {Number} dt
+ * @param {Array} points
+ */
+ initWithDuration:function (dt, points) {
+ return cc.CardinalSplineTo.prototype.initWithDuration.call(this, dt, points, 0.5);
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.CatmullRomTo}
+ */
+ clone:function () {
+ var action = new cc.CatmullRomTo();
+ action.initWithDuration(this._duration, cc.copyControlPoints(this._points));
+ return action;
+ }
+});
+
+/**
+ * creates an action with a Cardinal Spline array of points and tension.
+ *
+ * @function
+ * @param {Number} dt
+ * @param {Array} points
+ * @return {cc.CatmullRomTo}
+ *
+ * @example
+ * var action1 = cc.catmullRomTo(3, array);
+ */
+cc.catmullRomTo = function (dt, points) {
+ return new cc.CatmullRomTo(dt, points);
+};
+/**
+ * Please use cc.catmullRomTo instead.
+ * creates an action with a Cardinal Spline array of points and tension.
+ *
+ * @param {Number} dt
+ * @param {Array} points
+ * @return {cc.CatmullRomTo}
+ * @static
+ * @deprecated since v3.0 please use cc.catmullRomTo(dt, points) instead.
+ */
+cc.CatmullRomTo.create = cc.catmullRomTo;
+
+/**
+ * An action that moves the target with a CatmullRom curve by a certain distance.
+ * A Catmull Rom is a Cardinal Spline with a tension of 0.5.
+ * http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
+ * Relative coordinates.
+ *
+ * @class
+ * @extends cc.CardinalSplineBy
+ * @param {Number} dt
+ * @param {Array} points
+ *
+ * @example
+ * var action1 = cc.catmullRomBy(3, array);
+ */
+cc.CatmullRomBy = cc.CardinalSplineBy.extend({
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates an action with a Cardinal Spline array of points and tension.
+ * @param {Number} dt
+ * @param {Array} points
+ */
+ ctor: function(dt, points) {
+ cc.CardinalSplineBy.prototype.ctor.call(this);
+ points && this.initWithDuration(dt, points);
+ },
+
+ /**
+ * initializes the action with a duration and an array of points
+ *
+ * @function
+ * @param {Number} dt
+ * @param {Array} points
+ */
+ initWithDuration:function (dt, points) {
+ return cc.CardinalSplineTo.prototype.initWithDuration.call(this, dt, points, 0.5);
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.CatmullRomBy}
+ */
+ clone:function () {
+ var action = new cc.CatmullRomBy();
+ action.initWithDuration(this._duration, cc.copyControlPoints(this._points));
+ return action;
+ }
+});
+
+/**
+ * Creates an action with a Cardinal Spline array of points and tension
+ * @function
+ * @param {Number} dt
+ * @param {Array} points
+ * @return {cc.CatmullRomBy}
+ * @example
+ * var action1 = cc.catmullRomBy(3, array);
+ */
+cc.catmullRomBy = function (dt, points) {
+ return new cc.CatmullRomBy(dt, points);
+};
+/**
+ * Please use cc.catmullRomBy instead
+ * Creates an action with a Cardinal Spline array of points and tension
+ * @static
+ * @deprecated since v3.0 please cc.catmullRomBy(dt, points) instead.
+ */
+cc.CatmullRomBy.create = cc.catmullRomBy;
diff --git a/cocos2d/actions/CCActionEase.js b/cocos2d/actions/CCActionEase.js
new file mode 100644
index 00000000000..1ec1fb1c715
--- /dev/null
+++ b/cocos2d/actions/CCActionEase.js
@@ -0,0 +1,3681 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ * Base class for Easing actions
+ * @class
+ * @extends cc.ActionInterval
+ * @param {cc.ActionInterval} action
+ *
+ * @deprecated since v3.0 Does not recommend the use of the base object.
+ *
+ * @example
+ * var moveEase = new cc.ActionEase(action);
+ */
+cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{
+ _inner:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates the action of ActionEase.
+ * @param {cc.ActionInterval} action
+ */
+ ctor: function (action) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ action && this.initWithAction(action);
+ },
+
+ /**
+ * initializes the action
+ *
+ * @param {cc.ActionInterval} action
+ * @return {Boolean}
+ */
+ initWithAction:function (action) {
+ if(!action)
+ throw new Error("cc.ActionEase.initWithAction(): action must be non nil");
+
+ if (this.initWithDuration(action.getDuration())) {
+ this._inner = action;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.ActionEase}
+ */
+ clone:function(){
+ var action = new cc.ActionEase();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._inner.startWithTarget(this.target);
+ },
+
+ /**
+ * Stop the action.
+ */
+ stop:function () {
+ this._inner.stop();
+ cc.ActionInterval.prototype.stop.call(this);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this._inner.update(dt);
+ },
+
+ /**
+ * Create new action to original operation effect opposite.
+ * For example:
+ * - The action will be x coordinates of 0 move to 100.
+ * - The reversed action will be x of 100 move to 0.
+ * - Will be rewritten
+ * @return {cc.ActionEase}
+ */
+ reverse:function () {
+ return new cc.ActionEase(this._inner.reverse());
+ },
+
+ /**
+ * Get inner Action.
+ *
+ * @return {cc.ActionInterval}
+ */
+ getInnerAction:function(){
+ return this._inner;
+ }
+});
+
+/**
+ * creates the action of ActionEase
+ *
+ * @param {cc.ActionInterval} action
+ * @return {cc.ActionEase}
+ * @example
+ * // example
+ * var moveEase = cc.actionEase(action);
+ */
+cc.actionEase = function (action) {
+ return new cc.ActionEase(action);
+};
+
+/**
+ * Please use cc.actionEase instead
+ * creates the action of ActionEase
+ *
+ * @param {cc.ActionInterval} action
+ * @return {cc.ActionEase}
+ * @static
+ * @deprecated since v3.0 please use cc.actionEase(action) instead.
+ */
+cc.ActionEase.create = cc.actionEase;
+
+/**
+ * Base class for Easing actions with rate parameters
+ *
+ * @class
+ * @extends cc.ActionEase
+ * @param {cc.ActionInterval} action
+ * @param {Number} rate
+ *
+ * @deprecated since v3.0 please cc.easeRateAction(action, 3.0);
+ *
+ * @example
+ * //The old usage
+ * cc.EaseRateAction.create(action, 3.0);
+ * //The new usage
+ * var moveEaseRateAction = cc.easeRateAction(action, 3.0);
+ */
+cc.EaseRateAction = cc.ActionEase.extend(/** @lends cc.EaseRateAction# */{
+ _rate:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates the action with the inner action and the rate parameter.
+ * @param {cc.ActionInterval} action
+ * @param {Number} rate
+ */
+ ctor: function(action, rate){
+ cc.ActionEase.prototype.ctor.call(this);
+
+ rate !== undefined && this.initWithAction(action, rate);
+ },
+
+ /**
+ * set rate value for the actions
+ * @param {Number} rate
+ */
+ setRate:function (rate) {
+ this._rate = rate;
+ },
+
+ /** get rate value for the actions
+ * @return {Number}
+ */
+ getRate:function () {
+ return this._rate;
+ },
+
+ /**
+ * Initializes the action with the inner action and the rate parameter
+ * @param {cc.ActionInterval} action
+ * @param {Number} rate
+ * @return {Boolean}
+ */
+ initWithAction:function (action, rate) {
+ if (cc.ActionEase.prototype.initWithAction.call(this, action)) {
+ this._rate = rate;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseRateAction}
+ */
+ clone:function(){
+ var action = new cc.EaseRateAction();
+ action.initWithAction(this._inner.clone(), this._rate);
+ return action;
+ },
+
+ /**
+ * Create new action to original operation effect opposite.
+ * For example:
+ * - The action will be x coordinates of 0 move to 100.
+ * - The reversed action will be x of 100 move to 0.
+ * - Will be rewritten
+ * @return {cc.EaseRateAction}
+ */
+ reverse:function () {
+ return new cc.EaseRateAction(this._inner.reverse(), 1 / this._rate);
+ }
+});
+
+/**
+ * Creates the action with the inner action and the rate parameter.
+ *
+ * @param {cc.ActionInterval} action
+ * @param {Number} rate
+ * @return {cc.EaseRateAction}
+ * @example
+ * // example
+ * var moveEaseRateAction = cc.easeRateAction(action, 3.0);
+ */
+cc.easeRateAction = function (action, rate) {
+ return new cc.EaseRateAction(action, rate);
+};
+
+/**
+ * Please use cc.easeRateAction instead.
+ * Creates the action with the inner action and the rate parameter.
+ *
+ * @param {cc.ActionInterval} action
+ * @param {Number} rate
+ * @return {cc.EaseRateAction}
+ * @static
+ * @deprecated since v3.0 please use cc.easeRateAction(action, rate)
+ * @example
+ * //The old usage
+ * cc.EaseRateAction.create(action, 3.0);
+ * //The new usage
+ * var moveEaseRateAction = cc.easeRateAction(action, 3.0);
+ */
+cc.EaseRateAction.create = cc.easeRateAction;
+
+/**
+ * cc.EaseIn action with a rate. From slow to fast.
+ *
+ * @class
+ * @extends cc.EaseRateAction
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeIn(3));
+ *
+ * @example
+ * //The old usage
+ * cc.EaseIn.create(action, 3);
+ * //The new usage
+ * action.easing(cc.easeIn(3.0));
+ */
+cc.EaseIn = cc.EaseRateAction.extend(/** @lends cc.EaseIn# */{
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this._inner.update(Math.pow(dt, this._rate));
+ },
+
+ /**
+ * Create a cc.easeIn action. Opposite with the original motion trajectory.
+ * @return {cc.EaseIn}
+ */
+ reverse:function () {
+ return new cc.EaseIn(this._inner.reverse(), 1 / this._rate);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseIn}
+ */
+ clone:function(){
+ var action = new cc.EaseIn();
+ action.initWithAction(this._inner.clone(), this._rate);
+ return action;
+ }
+});
+
+/**
+ * Creates the action with the inner action and the rate parameter.
+ * From slow to fast.
+ *
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeIn(3))
+ *
+ * @example
+ * //The old usage
+ * cc.EaseIn.create(action, 3);
+ * //The new usage
+ * action.easing(cc.easeIn(3.0));
+ *
+ * @param {cc.ActionInterval} action
+ * @param {Number} rate
+ * @return {cc.EaseIn}
+ */
+cc.EaseIn.create = function (action, rate) {
+ return new cc.EaseIn(action, rate);
+};
+
+/**
+ * Creates the action easing object with the rate parameter.
+ * From slow to fast.
+ *
+ * @function
+ * @param {Number} rate
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeIn(3.0));
+ */
+cc.easeIn = function (rate) {
+ return {
+ _rate: rate,
+ easing: function (dt) {
+ return Math.pow(dt, this._rate);
+ },
+ reverse: function(){
+ return cc.easeIn(1 / this._rate);
+ }
+ };
+};
+
+/**
+ * cc.EaseOut action with a rate. From fast to slow.
+ *
+ * @class
+ * @extends cc.EaseRateAction
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeOut(3))
+ *
+ * @example
+ * //The old usage
+ * cc.EaseOut.create(action, 3);
+ * //The new usage
+ * action.easing(cc.easeOut(3.0));
+ */
+cc.EaseOut = cc.EaseRateAction.extend(/** @lends cc.EaseOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this._inner.update(Math.pow(dt, 1 / this._rate));
+ },
+
+ /**
+ * Create a cc.easeIn action. Opposite with the original motion trajectory.
+ * @return {cc.EaseOut}
+ */
+ reverse:function () {
+ return new cc.EaseOut(this._inner.reverse(), 1 / this._rate);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseOut}
+ */
+ clone:function(){
+ var action = new cc.EaseOut();
+ action.initWithAction(this._inner.clone(),this._rate);
+ return action;
+ }
+});
+
+/**
+ * Creates the action with the inner action and the rate parameter.
+ * From fast to slow.
+ *
+ * @static
+ * @deprecated since v3.0 Please use cc.easeOut instead.
+ *
+ * @example
+ * //The old usage
+ * cc.EaseOut.create(action, 3);
+ * //The new usage
+ * action.easing(cc.easeOut(3.0));
+ *
+ * @param {cc.ActionInterval} action
+ * @param {Number} rate
+ * @return {cc.EaseOut}
+ */
+cc.EaseOut.create = function (action, rate) {
+ return new cc.EaseOut(action, rate);
+};
+
+/**
+ * Creates the action easing object with the rate parameter.
+ * From fast to slow.
+ *
+ * @function
+ * @param {Number} rate
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeOut(3.0));
+ */
+cc.easeOut = function (rate) {
+ return {
+ _rate: rate,
+ easing: function (dt) {
+ return Math.pow(dt, 1 / this._rate);
+ },
+ reverse: function(){
+ return cc.easeOut(1 / this._rate)
+ }
+ };
+};
+
+/**
+ * cc.EaseInOut action with a rate.
+ * Slow to fast then to slow.
+ * @class
+ * @extends cc.EaseRateAction
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeInOut(3.0))
+ *
+ * @example
+ * //The old usage
+ * cc.EaseInOut.create(action, 3);
+ * //The new usage
+ * action.easing(cc.easeInOut(3.0));
+ */
+cc.EaseInOut = cc.EaseRateAction.extend(/** @lends cc.EaseInOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt *= 2;
+ if (dt < 1)
+ this._inner.update(0.5 * Math.pow(dt, this._rate));
+ else
+ this._inner.update(1.0 - 0.5 * Math.pow(2 - dt, this._rate));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseInOut}
+ */
+ clone:function(){
+ var action = new cc.EaseInOut();
+ action.initWithAction(this._inner.clone(), this._rate);
+ return action;
+ },
+
+ /**
+ * Create a cc.EaseInOut action. Opposite with the original motion trajectory.
+ * @return {cc.EaseInOut}
+ */
+ reverse:function () {
+ return new cc.EaseInOut(this._inner.reverse(), this._rate);
+ }
+});
+
+/**
+ * Creates the action with the inner action and the rate parameter.
+ * Slow to fast then to slow.
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeInOut(3.0))
+ *
+ * @example
+ * //The old usage
+ * cc.EaseInOut.create(action, 3);
+ * //The new usage
+ * action.easing(cc.easeInOut(3.0));
+ *
+ * @param {cc.ActionInterval} action
+ * @param {Number} rate
+ * @return {cc.EaseInOut}
+ */
+cc.EaseInOut.create = function (action, rate) {
+ return new cc.EaseInOut(action, rate);
+};
+
+/**
+ * Creates the action easing object with the rate parameter.
+ * Slow to fast then to slow.
+ * @function
+ * @param {Number} rate
+ * @return {Object}
+ *
+ * @example
+ * //The new usage
+ * action.easing(cc.easeInOut(3.0));
+ */
+cc.easeInOut = function (rate) {
+ return {
+ _rate: rate,
+ easing: function (dt) {
+ dt *= 2;
+ if (dt < 1)
+ return 0.5 * Math.pow(dt, this._rate);
+ else
+ return 1.0 - 0.5 * Math.pow(2 - dt, this._rate);
+ },
+ reverse: function(){
+ return cc.easeInOut(this._rate);
+ }
+ };
+};
+
+/**
+ * cc.Ease Exponential In. Slow to Fast.
+ * Reference easeInExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 please action.easing(cc.easeExponentialIn())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseExponentialIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeExponentialIn());
+ */
+cc.EaseExponentialIn = cc.ActionEase.extend(/** @lends cc.EaseExponentialIn# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this._inner.update(dt === 0 ? 0 : Math.pow(2, 10 * (dt - 1)));
+ },
+
+ /**
+ * Create a cc.EaseExponentialOut action. Opposite with the original motion trajectory.
+ * @return {cc.EaseExponentialOut}
+ */
+ reverse:function () {
+ return new cc.EaseExponentialOut(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseExponentialIn}
+ */
+ clone:function(){
+ var action = new cc.EaseExponentialIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+/**
+ * Creates the action easing object with the rate parameter.
+ * Reference easeInExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeExponentialIn())
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseExponentialIn}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseExponentialIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeExponentialIn());
+ */
+cc.EaseExponentialIn.create = function (action) {
+ return new cc.EaseExponentialIn(action);
+};
+
+cc._easeExponentialInObj = {
+ easing: function(dt){
+ return dt === 0 ? 0 : Math.pow(2, 10 * (dt - 1));
+ },
+ reverse: function(){
+ return cc._easeExponentialOutObj;
+ }
+};
+
+/**
+ * Creates the action easing object with the rate parameter.
+ * Reference easeInExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeExponentialIn());
+ */
+cc.easeExponentialIn = function(){
+ return cc._easeExponentialInObj;
+};
+
+/**
+ * Ease Exponential Out.
+ * Reference easeOutExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeExponentialOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseExponentialOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeExponentialOut());
+ */
+cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this._inner.update(dt === 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1));
+ },
+
+ /**
+ * Create a cc.EaseExponentialIn action. Opposite with the original motion trajectory.
+ * @return {cc.EaseExponentialIn}
+ */
+ reverse:function () {
+ return new cc.EaseExponentialIn(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseExponentialOut}
+ */
+ clone:function(){
+ var action = new cc.EaseExponentialOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+/**
+ * Creates the action easing object with the rate parameter.
+ * Reference easeOutExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeExponentialOut())
+ * @param {cc.ActionInterval} action
+ * @return {Object}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseExponentialOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeExponentialOut());
+ */
+cc.EaseExponentialOut.create = function (action) {
+ return new cc.EaseExponentialOut(action);
+};
+
+cc._easeExponentialOutObj = {
+ easing: function(dt){
+ return dt === 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1);
+ },
+ reverse: function(){
+ return cc._easeExponentialInObj;
+ }
+};
+
+/**
+ * creates the action easing object.
+ * Reference easeOutExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ *
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeExponentialOut());
+ */
+cc.easeExponentialOut = function(){
+ return cc._easeExponentialOutObj;
+};
+
+/**
+ * Ease Exponential InOut.
+ * Reference easeInOutExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ *
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeExponentialInOut)
+ *
+ * @example
+ * //The old usage
+ * cc.EaseExponentialInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeExponentialInOut());
+ */
+cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ if( dt !== 1 && dt !== 0) {
+ dt *= 2;
+ if (dt < 1)
+ dt = 0.5 * Math.pow(2, 10 * (dt - 1));
+ else
+ dt = 0.5 * (-Math.pow(2, -10 * (dt - 1)) + 2);
+ }
+ this._inner.update(dt);
+ },
+
+ /**
+ * Create a cc.EaseExponentialInOut action. Opposite with the original motion trajectory.
+ * @return {cc.EaseExponentialInOut}
+ */
+ reverse:function () {
+ return new cc.EaseExponentialInOut(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseExponentialInOut}
+ */
+ clone:function(){
+ var action = new cc.EaseExponentialInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+/**
+ * creates an EaseExponentialInOut action.
+ * Reference easeInOutExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeExponentialInOut)
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseExponentialInOut}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseExponentialInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeExponentialInOut());
+ */
+cc.EaseExponentialInOut.create = function (action) {
+ return new cc.EaseExponentialInOut(action);
+};
+
+cc._easeExponentialInOutObj = {
+ easing: function(dt){
+ if( dt !== 1 && dt !== 0) {
+ dt *= 2;
+ if (dt < 1)
+ return 0.5 * Math.pow(2, 10 * (dt - 1));
+ else
+ return 0.5 * (-Math.pow(2, -10 * (dt - 1)) + 2);
+ }
+ return dt;
+ },
+ reverse: function(){
+ return cc._easeExponentialInOutObj;
+ }
+};
+
+/**
+ * creates an EaseExponentialInOut action easing object.
+ * Reference easeInOutExpo:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeExponentialInOut());
+ */
+cc.easeExponentialInOut = function(){
+ return cc._easeExponentialInOutObj;
+};
+
+/**
+ * Ease Sine In.
+ * Reference easeInSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeSineIn())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseSineIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeSineIn());
+ */
+cc.EaseSineIn = cc.ActionEase.extend(/** @lends cc.EaseSineIn# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = dt===0 || dt===1 ? dt : -1 * Math.cos(dt * Math.PI / 2) + 1;
+ this._inner.update(dt);
+ },
+
+ /**
+ * Create a cc.EaseSineOut action. Opposite with the original motion trajectory.
+ * @return {cc.EaseSineOut}
+ */
+ reverse:function () {
+ return new cc.EaseSineOut(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseSineIn}
+ */
+ clone:function(){
+ var action = new cc.EaseSineIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+/**
+ * creates an EaseSineIn action.
+ * Reference easeInSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeSineIn())
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseSineIn}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseSineIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeSineIn());
+ */
+cc.EaseSineIn.create = function (action) {
+ return new cc.EaseSineIn(action);
+};
+
+cc._easeSineInObj = {
+ easing: function(dt){
+ return (dt===0 || dt===1) ? dt : -1 * Math.cos(dt * Math.PI / 2) + 1;
+ },
+ reverse: function(){
+ return cc._easeSineOutObj;
+ }
+};
+/**
+ * creates an EaseSineIn action.
+ * Reference easeInSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeSineIn());
+ */
+cc.easeSineIn = function(){
+ return cc._easeSineInObj;
+};
+
+/**
+ * Ease Sine Out.
+ * Reference easeOutSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeSineOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseSineOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeSineOut());
+ */
+cc.EaseSineOut = cc.ActionEase.extend(/** @lends cc.EaseSineOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = dt===0 || dt===1 ? dt : Math.sin(dt * Math.PI / 2);
+ this._inner.update(dt);
+ },
+
+ /**
+ * Create a cc.EaseSineIn action. Opposite with the original motion trajectory.
+ * @return {cc.EaseSineIn}
+ */
+ reverse:function () {
+ return new cc.EaseSineIn(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseSineOut}
+ */
+ clone:function(){
+ var action = new cc.EaseSineOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+/**
+ * Creates an EaseSineOut action.
+ * Reference easeOutSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeSineOut())
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseSineOut}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseSineOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeSineOut());
+ */
+cc.EaseSineOut.create = function (action) {
+ return new cc.EaseSineOut(action);
+};
+
+cc._easeSineOutObj = {
+ easing: function(dt){
+ return (dt===0 || dt===1) ? dt : Math.sin(dt * Math.PI / 2);
+ },
+ reverse: function(){
+ return cc._easeSineInObj;
+ }
+};
+
+/**
+ * Creates an EaseSineOut action easing object.
+ * Reference easeOutSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeSineOut());
+ */
+cc.easeSineOut = function(){
+ return cc._easeSineOutObj;
+};
+
+/**
+ * Ease Sine InOut.
+ * Reference easeInOutSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeSineInOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseSineInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeSineInOut());
+ */
+cc.EaseSineInOut = cc.ActionEase.extend(/** @lends cc.EaseSineInOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = dt===0 || dt===1 ? dt : -0.5 * (Math.cos(Math.PI * dt) - 1);
+ this._inner.update(dt);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseSineInOut}
+ */
+ clone:function(){
+ var action = new cc.EaseSineInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a cc.EaseSineInOut action. Opposite with the original motion trajectory.
+ * @return {cc.EaseSineInOut}
+ */
+ reverse:function () {
+ return new cc.EaseSineInOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInOutSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseSineInOut}
+ * @deprecated since v3.0 Please use action.easing(cc.easeSineInOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseSineInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeSineInOut());
+ */
+cc.EaseSineInOut.create = function (action) {
+ return new cc.EaseSineInOut(action);
+};
+
+cc._easeSineInOutObj = {
+ easing: function(dt){
+ return (dt === 0 || dt === 1) ? dt : -0.5 * (Math.cos(Math.PI * dt) - 1);
+ },
+ reverse: function(){
+ return cc._easeSineInOutObj;
+ }
+};
+
+/**
+ * creates the action easing object.
+ * Reference easeInOutSine:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeSineInOut());
+ */
+cc.easeSineInOut = function(){
+ return cc._easeSineInOutObj;
+};
+
+/**
+ * Ease Elastic abstract class.
+ * @class
+ * @extends cc.ActionEase
+ * @param {cc.ActionInterval} action
+ * @param {Number} [period=0.3]
+ *
+ * @deprecated since v3.0 Does not recommend the use of the base object.
+ */
+cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{
+ _period: 0.3,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates the action with the inner action and the period in radians (default is 0.3).
+ * @param {cc.ActionInterval} action
+ * @param {Number} [period=0.3]
+ */
+ ctor:function(action, period){
+ cc.ActionEase.prototype.ctor.call(this);
+
+ action && this.initWithAction(action, period);
+ },
+
+ /**
+ * get period of the wave in radians. default is 0.3
+ * @return {Number}
+ */
+ getPeriod:function () {
+ return this._period;
+ },
+
+ /**
+ * set period of the wave in radians.
+ * @param {Number} period
+ */
+ setPeriod:function (period) {
+ this._period = period;
+ },
+
+ /**
+ * Initializes the action with the inner action and the period in radians (default is 0.3)
+ * @param {cc.ActionInterval} action
+ * @param {Number} [period=0.3]
+ * @return {Boolean}
+ */
+ initWithAction:function (action, period) {
+ cc.ActionEase.prototype.initWithAction.call(this, action);
+ this._period = (period == null) ? 0.3 : period;
+ return true;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * Will be overwrite.
+ * @return {null}
+ */
+ reverse:function () {
+ cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");
+ return null;
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseElastic}
+ */
+ clone:function(){
+ var action = new cc.EaseElastic();
+ action.initWithAction(this._inner.clone(), this._period);
+ return action;
+ }
+});
+
+/**
+ * Creates the action with the inner action and the period in radians (default is 0.3).
+ * @static
+ * @deprecated since v3.0 Does not recommend the use of the base object.
+ * @param {cc.ActionInterval} action
+ * @param {Number} [period=0.3]
+ * @return {cc.EaseElastic}
+ */
+cc.EaseElastic.create = function (action, period) {
+ return new cc.EaseElastic(action, period);
+};
+
+/**
+ * Ease Elastic In action.
+ * Reference easeInElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.EaseElastic
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeElasticIn())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseElasticIn.create(action, period);
+ * //The new usage
+ * action.easing(cc.easeElasticIn(period));
+ */
+cc.EaseElasticIn = cc.EaseElastic.extend(/** @lends cc.EaseElasticIn# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var newT = 0;
+ if (dt === 0 || dt === 1) {
+ newT = dt;
+ } else {
+ var s = this._period / 4;
+ dt = dt - 1;
+ newT = -Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / this._period);
+ }
+ this._inner.update(newT);
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseElasticOut}
+ */
+ reverse:function () {
+ return new cc.EaseElasticOut(this._inner.reverse(), this._period);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseElasticIn}
+ */
+ clone:function(){
+ var action = new cc.EaseElasticIn();
+ action.initWithAction(this._inner.clone(), this._period);
+ return action;
+ }
+});
+
+/**
+ * Creates the action with the inner action and the period in radians (default is 0.3).
+ * Reference easeInElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @deprecated since v3.0 Please use action.easing(cc.easeElasticIn(period))
+ *
+ * @example
+ * //The old usage
+ * cc.EaseElasticIn.create(action, period);
+ * //The new usage
+ * action.easing(cc.easeElasticIn(period));
+ *
+ * @param {cc.ActionInterval} action
+ * @param {Number} [period=0.3]
+ * @return {cc.EaseElasticIn}
+ */
+cc.EaseElasticIn.create = function (action, period) {
+ return new cc.EaseElasticIn(action, period);
+};
+
+//default ease elastic in object (period = 0.3)
+cc._easeElasticInObj = {
+ easing:function(dt){
+ if (dt === 0 || dt === 1)
+ return dt;
+ dt = dt - 1;
+ return -Math.pow(2, 10 * dt) * Math.sin((dt - (0.3 / 4)) * Math.PI * 2 / 0.3);
+ },
+ reverse:function(){
+ return cc._easeElasticOutObj;
+ }
+};
+
+/**
+ * Creates the action easing obejct with the period in radians (default is 0.3).
+ * Reference easeInElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @param {Number} [period=0.3]
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeElasticIn(3.0));
+ */
+cc.easeElasticIn = function (period) {
+ if(period && period !== 0.3){
+ return {
+ _period: period,
+ easing: function (dt) {
+ if (dt === 0 || dt === 1)
+ return dt;
+ dt = dt - 1;
+ return -Math.pow(2, 10 * dt) * Math.sin((dt - (this._period / 4)) * Math.PI * 2 / this._period);
+ },
+ reverse:function () {
+ return cc.easeElasticOut(this._period);
+ }
+ };
+ }
+ return cc._easeElasticInObj;
+};
+
+/**
+ * Ease Elastic Out action.
+ * Reference easeOutElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.EaseElastic
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeElasticOut(period))
+ *
+ * @example
+ * //The old usage
+ * cc.EaseElasticOut.create(action, period);
+ * //The new usage
+ * action.easing(cc.easeElasticOut(period));
+ */
+cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var newT = 0;
+ if (dt === 0 || dt === 1) {
+ newT = dt;
+ } else {
+ var s = this._period / 4;
+ newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / this._period) + 1;
+ }
+
+ this._inner.update(newT);
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseElasticIn}
+ */
+ reverse:function () {
+ return new cc.EaseElasticIn(this._inner.reverse(), this._period);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseElasticOut}
+ */
+ clone:function(){
+ var action = new cc.EaseElasticOut();
+ action.initWithAction(this._inner.clone(), this._period);
+ return action;
+ }
+});
+
+/**
+ * Creates the action with the inner action and the period in radians (default is 0.3).
+ * Reference easeOutElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @deprecated since v3.0 Please use action.easing(cc.easeElasticOut(period))
+ * @param {cc.ActionInterval} action
+ * @param {Number} [period=0.3]
+ * @return {cc.EaseElasticOut}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseElasticOut.create(action, period);
+ * //The new usage
+ * action.easing(cc.easeElasticOut(period));
+ */
+cc.EaseElasticOut.create = function (action, period) {
+ return new cc.EaseElasticOut(action, period);
+};
+
+//default ease elastic out object (period = 0.3)
+cc._easeElasticOutObj = {
+ easing: function (dt) {
+ return (dt === 0 || dt === 1) ? dt : Math.pow(2, -10 * dt) * Math.sin((dt - (0.3 / 4)) * Math.PI * 2 / 0.3) + 1;
+ },
+ reverse:function(){
+ return cc._easeElasticInObj;
+ }
+};
+/**
+ * Creates the action easing object with the period in radians (default is 0.3).
+ * Reference easeOutElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @param {Number} [period=0.3]
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeElasticOut(3.0));
+ */
+cc.easeElasticOut = function (period) {
+ if(period && period !== 0.3){
+ return {
+ _period: period,
+ easing: function (dt) {
+ return (dt === 0 || dt === 1) ? dt : Math.pow(2, -10 * dt) * Math.sin((dt - (this._period / 4)) * Math.PI * 2 / this._period) + 1;
+ },
+ reverse:function(){
+ return cc.easeElasticIn(this._period);
+ }
+ };
+ }
+ return cc._easeElasticOutObj;
+};
+
+/**
+ * Ease Elastic InOut action.
+ * Reference easeInOutElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.EaseElastic
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeElasticInOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseElasticInOut.create(action, period);
+ * //The new usage
+ * action.easing(cc.easeElasticInOut(period));
+ */
+cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var newT = 0;
+ var locPeriod = this._period;
+ if (dt === 0 || dt === 1) {
+ newT = dt;
+ } else {
+ dt = dt * 2;
+ if (!locPeriod)
+ locPeriod = this._period = 0.3 * 1.5;
+
+ var s = locPeriod / 4;
+ dt = dt - 1;
+ if (dt < 0)
+ newT = -0.5 * Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod);
+ else
+ newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod) * 0.5 + 1;
+ }
+ this._inner.update(newT);
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseElasticInOut}
+ */
+ reverse:function () {
+ return new cc.EaseElasticInOut(this._inner.reverse(), this._period);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseElasticInOut}
+ */
+ clone:function(){
+ var action = new cc.EaseElasticInOut();
+ action.initWithAction(this._inner.clone(), this._period);
+ return action;
+ }
+});
+
+/**
+ * Creates the action with the inner action and the period in radians (default is 0.3).
+ * Reference easeInOutElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @deprecated since v3.0 Please use action.easing(cc.easeElasticInOut(period))
+ * @param {cc.ActionInterval} action
+ * @param {Number} [period=0.3]
+ * @return {cc.EaseElasticInOut}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseElasticInOut.create(action, period);
+ * //The new usage
+ * action.easing(cc.easeElasticInOut(period));
+ */
+cc.EaseElasticInOut.create = function (action, period) {
+ return new cc.EaseElasticInOut(action, period);
+};
+
+/**
+ * Creates the action easing object with the period in radians (default is 0.3).
+ * Reference easeInOutElastic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @param {Number} [period=0.3]
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeElasticInOut(3.0));
+ */
+cc.easeElasticInOut = function (period) {
+ period = period || 0.3;
+ return {
+ _period: period,
+ easing: function (dt) {
+ var newT = 0;
+ var locPeriod = this._period;
+ if (dt === 0 || dt === 1) {
+ newT = dt;
+ } else {
+ dt = dt * 2;
+ if (!locPeriod)
+ locPeriod = this._period = 0.3 * 1.5;
+ var s = locPeriod / 4;
+ dt = dt - 1;
+ if (dt < 0)
+ newT = -0.5 * Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod);
+ else
+ newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod) * 0.5 + 1;
+ }
+ return newT;
+ },
+ reverse: function(){
+ return cc.easeElasticInOut(this._period);
+ }
+ };
+};
+
+/**
+ * cc.EaseBounce abstract class.
+ *
+ * @deprecated since v3.0 Does not recommend the use of the base object.
+ *
+ * @class
+ * @extends cc.ActionEase
+ */
+cc.EaseBounce = cc.ActionEase.extend(/** @lends cc.EaseBounce# */{
+ /**
+ * @param {Number} time1
+ * @return {Number}
+ */
+ bounceTime:function (time1) {
+ if (time1 < 1 / 2.75) {
+ return 7.5625 * time1 * time1;
+ } else if (time1 < 2 / 2.75) {
+ time1 -= 1.5 / 2.75;
+ return 7.5625 * time1 * time1 + 0.75;
+ } else if (time1 < 2.5 / 2.75) {
+ time1 -= 2.25 / 2.75;
+ return 7.5625 * time1 * time1 + 0.9375;
+ }
+
+ time1 -= 2.625 / 2.75;
+ return 7.5625 * time1 * time1 + 0.984375;
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseBounce}
+ */
+ clone:function(){
+ var action = new cc.EaseBounce();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseBounce}
+ */
+ reverse:function () {
+ return new cc.EaseBounce(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates an ease bounce action.
+ * @static
+ * @deprecated since v3.0 Does not recommend the use of the base object.
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseBounce}
+ */
+cc.EaseBounce.create = function (action) {
+ return new cc.EaseBounce(action);
+};
+
+/**
+ * cc.EaseBounceIn action.
+ * Eased bounce effect at the beginning.
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.EaseBounce
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeBounceIn())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBounceIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeBounceIn());
+ */
+cc.EaseBounceIn = cc.EaseBounce.extend(/** @lends cc.EaseBounceIn# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var newT = 1 - this.bounceTime(1 - dt);
+ this._inner.update(newT);
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseBounceOut}
+ */
+ reverse:function () {
+ return new cc.EaseBounceOut(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseBounceIn}
+ */
+ clone:function(){
+ var action = new cc.EaseBounceIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+/**
+ * Creates the action.
+ * Eased bounce effect at the beginning.
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeBounceIn())
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseBounceIn}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBounceIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeBounceIn());
+ */
+cc.EaseBounceIn.create = function (action) {
+ return new cc.EaseBounceIn(action);
+};
+
+cc._bounceTime = function (time1) {
+ if (time1 < 1 / 2.75) {
+ return 7.5625 * time1 * time1;
+ } else if (time1 < 2 / 2.75) {
+ time1 -= 1.5 / 2.75;
+ return 7.5625 * time1 * time1 + 0.75;
+ } else if (time1 < 2.5 / 2.75) {
+ time1 -= 2.25 / 2.75;
+ return 7.5625 * time1 * time1 + 0.9375;
+ }
+
+ time1 -= 2.625 / 2.75;
+ return 7.5625 * time1 * time1 + 0.984375;
+};
+
+cc._easeBounceInObj = {
+ easing: function(dt){
+ return 1 - cc._bounceTime(1 - dt);
+ },
+ reverse: function(){
+ return cc._easeBounceOutObj;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Eased bounce effect at the beginning.
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeBounceIn());
+ */
+cc.easeBounceIn = function(){
+ return cc._easeBounceInObj;
+};
+
+/**
+ * cc.EaseBounceOut action.
+ * Eased bounce effect at the ending.
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.EaseBounce
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeBounceOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBounceOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeBounceOut());
+ */
+cc.EaseBounceOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var newT = this.bounceTime(dt);
+ this._inner.update(newT);
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseBounceIn}
+ */
+ reverse:function () {
+ return new cc.EaseBounceIn(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseBounceOut}
+ */
+ clone:function(){
+ var action = new cc.EaseBounceOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+/**
+ * Creates the action.
+ * Eased bounce effect at the ending.
+ * @static
+ * @deprecated since v3.0 please use action.easing(cc.easeBounceOut())
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseBounceOut}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBounceOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeBounceOut());
+ */
+cc.EaseBounceOut.create = function (action) {
+ return new cc.EaseBounceOut(action);
+};
+
+cc._easeBounceOutObj = {
+ easing: function(dt){
+ return cc._bounceTime(dt);
+ },
+ reverse:function () {
+ return cc._easeBounceInObj;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Eased bounce effect at the ending.
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeBounceOut());
+ */
+cc.easeBounceOut = function(){
+ return cc._easeBounceOutObj;
+};
+
+/**
+ * cc.EaseBounceInOut action.
+ * Eased bounce effect at the begining and ending.
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.EaseBounce
+ *
+ * @deprecated since v3.0 Please use acton.easing(cc.easeBounceInOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBounceInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeBounceInOut());
+ */
+cc.EaseBounceInOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceInOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var newT = 0;
+ if (dt < 0.5) {
+ dt = dt * 2;
+ newT = (1 - this.bounceTime(1 - dt)) * 0.5;
+ } else {
+ newT = this.bounceTime(dt * 2 - 1) * 0.5 + 0.5;
+ }
+ this._inner.update(newT);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseBounceInOut}
+ */
+ clone:function(){
+ var action = new cc.EaseBounceInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseBounceInOut}
+ */
+ reverse:function () {
+ return new cc.EaseBounceInOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Eased bounce effect at the begining and ending.
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeBounceInOut())
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseBounceInOut}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBounceInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeBounceInOut());
+ */
+cc.EaseBounceInOut.create = function (action) {
+ return new cc.EaseBounceInOut(action);
+};
+
+cc._easeBounceInOutObj = {
+ easing: function (time1) {
+ var newT;
+ if (time1 < 0.5) {
+ time1 = time1 * 2;
+ newT = (1 - cc._bounceTime(1 - time1)) * 0.5;
+ } else {
+ newT = cc._bounceTime(time1 * 2 - 1) * 0.5 + 0.5;
+ }
+ return newT;
+ },
+ reverse: function(){
+ return cc._easeBounceInOutObj;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Eased bounce effect at the begining and ending.
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeBounceInOut());
+ */
+cc.easeBounceInOut = function(){
+ return cc._easeBounceInOutObj;
+};
+
+/**
+ * cc.EaseBackIn action.
+ * In the opposite direction to move slowly, and then accelerated to the right direction.
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeBackIn())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBackIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeBackIn());
+ */
+cc.EaseBackIn = cc.ActionEase.extend(/** @lends cc.EaseBackIn# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var overshoot = 1.70158;
+ dt = dt===0 || dt===1 ? dt : dt * dt * ((overshoot + 1) * dt - overshoot);
+ this._inner.update(dt);
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseBackOut}
+ */
+ reverse:function () {
+ return new cc.EaseBackOut(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseBackIn}
+ */
+ clone:function(){
+ var action = new cc.EaseBackIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+
+/**
+ * Creates the cc.EaseBackIn.
+ * In the opposite direction to move slowly, and then accelerated to the right direction.
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeBackIn())
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseBackIn}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBackIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeBackIn());
+ */
+cc.EaseBackIn.create = function (action) {
+ return new cc.EaseBackIn(action);
+};
+
+cc._easeBackInObj = {
+ easing: function (time1) {
+ var overshoot = 1.70158;
+ return (time1===0 || time1===1) ? time1 : time1 * time1 * ((overshoot + 1) * time1 - overshoot);
+ },
+ reverse: function(){
+ return cc._easeBackOutObj;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * In the opposite direction to move slowly, and then accelerated to the right direction.
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeBackIn());
+ */
+cc.easeBackIn = function(){
+ return cc._easeBackInObj;
+};
+
+/**
+ * cc.EaseBackOut action.
+ * Fast moving more than the finish, and then slowly back to the finish.
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 please use action.easing(cc.easeBackOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBackOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeBackOut());
+ */
+cc.EaseBackOut = cc.ActionEase.extend(/** @lends cc.EaseBackOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var overshoot = 1.70158;
+ dt = dt - 1;
+ this._inner.update(dt * dt * ((overshoot + 1) * dt + overshoot) + 1);
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseBackIn}
+ */
+ reverse:function () {
+ return new cc.EaseBackIn(this._inner.reverse());
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseBackOut}
+ */
+ clone:function(){
+ var action = new cc.EaseBackOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ }
+});
+
+/**
+ * Creates the action.
+ * Fast moving more than the finish, and then slowly back to the finish.
+ * @static
+ * @deprecated since v3.0 Please use action.easing(cc.easeBackOut());
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseBackOut}
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBackOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeBackOut());
+ */
+cc.EaseBackOut.create = function (action) {
+ return new cc.EaseBackOut(action);
+};
+
+cc._easeBackOutObj = {
+ easing: function (time1) {
+ var overshoot = 1.70158;
+ time1 = time1 - 1;
+ return time1 * time1 * ((overshoot + 1) * time1 + overshoot) + 1;
+ },
+ reverse: function(){
+ return cc._easeBackInObj;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Fast moving more than the finish, and then slowly back to the finish.
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeBackOut());
+ */
+cc.easeBackOut = function(){
+ return cc._easeBackOutObj;
+};
+
+/**
+ * cc.EaseBackInOut action.
+ * Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
+ * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeBackInOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBackInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeBackInOut());
+ */
+cc.EaseBackInOut = cc.ActionEase.extend(/** @lends cc.EaseBackInOut# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var overshoot = 1.70158 * 1.525;
+ dt = dt * 2;
+ if (dt < 1) {
+ this._inner.update((dt * dt * ((overshoot + 1) * dt - overshoot)) / 2);
+ } else {
+ dt = dt - 2;
+ this._inner.update((dt * dt * ((overshoot + 1) * dt + overshoot)) / 2 + 1);
+ }
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseBackInOut}
+ */
+ clone:function(){
+ var action = new cc.EaseBackInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseBackInOut}
+ */
+ reverse:function () {
+ return new cc.EaseBackInOut(this._inner.reverse());
+ }
+});
+
+
+/**
+ * Creates the action.
+ * Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
+ * @static
+ * @param {cc.ActionInterval} action
+ * @return {cc.EaseBackInOut}
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeBackInOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseBackInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeBackInOut());
+ */
+cc.EaseBackInOut.create = function (action) {
+ return new cc.EaseBackInOut(action);
+};
+
+cc._easeBackInOutObj = {
+ easing: function (time1) {
+ var overshoot = 1.70158 * 1.525;
+ time1 = time1 * 2;
+ if (time1 < 1) {
+ return (time1 * time1 * ((overshoot + 1) * time1 - overshoot)) / 2;
+ } else {
+ time1 = time1 - 2;
+ return (time1 * time1 * ((overshoot + 1) * time1 + overshoot)) / 2 + 1;
+ }
+ },
+ reverse: function(){
+ return cc._easeBackInOutObj;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
+ * @function
+ * @return {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeBackInOut());
+ */
+cc.easeBackInOut = function(){
+ return cc._easeBackInOutObj;
+};
+
+/**
+ * cc.EaseBezierAction action.
+ * Manually set a 4 order Bessel curve.
+ * According to the set point, calculate the trajectory.
+ * @class
+ * @extends cc.ActionEase
+ * @param {cc.Action} action
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeBezierAction())
+ *
+ * @example
+ * //The old usage
+ * var action = cc.EaseBezierAction.create(action);
+ * action.setBezierParamer(0.5, 0.5, 1.0, 1.0);
+ * //The new usage
+ * action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
+ */
+cc.EaseBezierAction = cc.ActionEase.extend(/** @lends cc.EaseBezierAction# */{
+
+ _p0: null,
+ _p1: null,
+ _p2: null,
+ _p3: null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Initialization requires the application of Bessel curve of action.
+ * @param {cc.Action} action
+ */
+ ctor: function(action){
+ cc.ActionEase.prototype.ctor.call(this, action);
+ },
+
+ _updateTime: function(a, b, c, d, t){
+ return (Math.pow(1-t,3) * a + 3*t*(Math.pow(1-t,2))*b + 3*Math.pow(t,2)*(1-t)*c + Math.pow(t,3)*d );
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ var t = this._updateTime(this._p0, this._p1, this._p2, this._p3, dt);
+ this._inner.update(t);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseBezierAction}
+ */
+ clone: function(){
+ var action = new cc.EaseBezierAction();
+ action.initWithAction(this._inner.clone());
+ action.setBezierParamer(this._p0, this._p1, this._p2, this._p3);
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseBezierAction}
+ */
+ reverse: function(){
+ var action = new cc.EaseBezierAction(this._inner.reverse());
+ action.setBezierParamer(this._p3, this._p2, this._p1, this._p0);
+ return action;
+ },
+
+ /**
+ * Set of 4 reference point
+ * @param p0
+ * @param p1
+ * @param p2
+ * @param p3
+ */
+ setBezierParamer: function(p0, p1, p2, p3){
+ this._p0 = p0 || 0;
+ this._p1 = p1 || 0;
+ this._p2 = p2 || 0;
+ this._p3 = p3 || 0;
+ }
+});
+
+/**
+ * Creates the action.
+ * After creating the cc.EaseBezierAction, also need to manually call setBezierParamer.
+ * According to the set point, calculate the trajectory.
+ * @static
+ * @param action
+ * @returns {cc.EaseBezierAction}
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeBezierAction())
+ *
+ * @example
+ * //The old usage
+ * var action = cc.EaseBezierAction.create(action);
+ * action.setBezierParamer(0.5, 0.5, 1.0, 1.0);
+ * //The new usage
+ * action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
+ */
+cc.EaseBezierAction.create = function(action){
+ return new cc.EaseBezierAction(action);
+};
+
+/**
+ * Creates the action easing object.
+ * Into the 4 reference point.
+ * To calculate the motion curve.
+ * @param {Number} p0 The first bezier parameter
+ * @param {Number} p1 The second bezier parameter
+ * @param {Number} p2 The third bezier parameter
+ * @param {Number} p3 The fourth bezier parameter
+ * @returns {Object}
+ * @example
+ * // example
+ * action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
+ */
+cc.easeBezierAction = function(p0, p1, p2, p3){
+ return {
+ easing: function(time){
+ return cc.EaseBezierAction.prototype._updateTime(p0, p1, p2, p3, time);
+ },
+ reverse: function(){
+ return cc.easeBezierAction(p3, p2, p1, p0);
+ }
+ };
+};
+
+/**
+ * cc.EaseQuadraticActionIn action.
+ * Reference easeInQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuadraticAction())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuadraticActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuadraticActionIn());
+ */
+cc.EaseQuadraticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionIn# */{
+
+ _updateTime: function(time){
+ return Math.pow(time, 2);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuadraticActionIn}
+ */
+ clone: function(){
+ var action = new cc.EaseQuadraticActionIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuadraticActionIn}
+ */
+ reverse: function(){
+ return new cc.EaseQuadraticActionIn(this._inner.reverse());
+ }
+
+});
+
+/**
+ * Creates the cc.EaseQuadRaticActionIn.
+ * Reference easeInQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ * @param action
+ * @returns {cc.EaseQuadraticActionIn}
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuadraticAction())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuadraticActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuadraticActionIn());
+ */
+cc.EaseQuadraticActionIn.create = function(action){
+ return new cc.EaseQuadraticActionIn(action);
+};
+
+cc._easeQuadraticActionIn = {
+ easing: cc.EaseQuadraticActionIn.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuadraticActionIn;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeInQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeQuadraticActionIn());
+ */
+cc.easeQuadraticActionIn = function(){
+ return cc._easeQuadraticActionIn;
+};
+
+/**
+ * cc.EaseQuadraticActionIn action.
+ * Reference easeOutQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuadraticActionOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuadraticActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuadraticActionOut());
+ */
+cc.EaseQuadraticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionOut# */{
+
+ _updateTime: function(time){
+ return -time*(time-2);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuadraticActionOut}
+ */
+ clone: function(){
+ var action = new cc.EaseQuadraticActionOut();
+ action.initWithAction();
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuadraticActionOut}
+ */
+ reverse: function(){
+ return new cc.EaseQuadraticActionOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeOutQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ * @param action
+ * @returns {cc.EaseQuadraticActionOut}
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuadraticActionOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuadraticActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuadraticActionOut());
+ */
+cc.EaseQuadraticActionOut.create = function(action){
+ return new cc.EaseQuadraticActionOut(action);
+};
+
+cc._easeQuadraticActionOut = {
+ easing: cc.EaseQuadraticActionOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuadraticActionOut;
+ }
+};
+/**
+ * Creates the action easing object.
+ * Reference easeOutQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeQuadraticActionOut());
+ */
+cc.easeQuadraticActionOut = function(){
+ return cc._easeQuadraticActionOut;
+};
+
+/**
+ * cc.EaseQuadraticActionInOut action.
+ * Reference easeInOutQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuadraticActionInOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuadraticActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuadraticActionInOut());
+ */
+cc.EaseQuadraticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionInOut# */{
+ _updateTime: function(time){
+ var resultTime = time;
+ time *= 2;
+ if(time < 1){
+ resultTime = time * time * 0.5;
+ }else{
+ --time;
+ resultTime = -0.5 * ( time * ( time - 2 ) - 1)
+ }
+ return resultTime;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuadraticActionInOut}
+ */
+ clone: function(){
+ var action = new cc.EaseQuadraticActionInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuadraticActionInOut}
+ */
+ reverse: function(){
+ return new cc.EaseQuadraticActionInOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInOutQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuadraticActionInOut())
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuadraticActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuadraticActionInOut());
+ *
+ * @param action
+ * @returns {cc.EaseQuadraticActionInOut}
+ */
+cc.EaseQuadraticActionInOut.create = function(action){
+ return new cc.EaseQuadraticActionInOut(action);
+};
+
+cc._easeQuadraticActionInOut = {
+ easing: cc.EaseQuadraticActionInOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuadraticActionInOut;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeInOutQuad:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeQuadraticActionInOut());
+ */
+cc.easeQuadraticActionInOut = function(){
+ return cc._easeQuadraticActionInOut;
+};
+
+/**
+ * cc.EaseQuarticActionIn action.
+ * Reference easeInQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuarticActionIn());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuarticActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuarticActionIn());
+ */
+cc.EaseQuarticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionIn# */{
+ _updateTime: function(time){
+ return time * time * time * time;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuarticActionIn}
+ */
+ clone: function(){
+ var action = new cc.EaseQuarticActionIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuarticActionIn}
+ */
+ reverse: function(){
+ return new cc.EaseQuarticActionIn(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuarticActionIn());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuarticActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuarticActionIn());
+ *
+ * @param action
+ * @returns {cc.EaseQuarticActionIn}
+ */
+cc.EaseQuarticActionIn.create = function(action){
+ return new cc.EaseQuarticActionIn(action);
+};
+
+cc._easeQuarticActionIn = {
+ easing: cc.EaseQuarticActionIn.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuarticActionIn;
+ }
+};
+/**
+ * Creates the action easing object.
+ * Reference easeIntQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeQuarticActionIn());
+ */
+cc.easeQuarticActionIn = function(){
+ return cc._easeQuarticActionIn;
+};
+
+/**
+ * cc.EaseQuarticActionOut action.
+ * Reference easeOutQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.QuarticActionOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuarticActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.EaseQuarticActionOut());
+ */
+cc.EaseQuarticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionOut# */{
+ _updateTime: function(time){
+ time -= 1;
+ return -(time * time * time * time - 1);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuarticActionOut}
+ */
+ clone: function(){
+ var action = new cc.EaseQuarticActionOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuarticActionOut}
+ */
+ reverse: function(){
+ return new cc.EaseQuarticActionOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeOutQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.QuarticActionOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuarticActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.EaseQuarticActionOut());
+ *
+ * @param action
+ * @returns {cc.EaseQuarticActionOut}
+ */
+cc.EaseQuarticActionOut.create = function(action){
+ return new cc.EaseQuarticActionOut(action);
+};
+
+cc._easeQuarticActionOut = {
+ easing: cc.EaseQuarticActionOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuarticActionOut;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeOutQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.QuarticActionOut());
+ */
+cc.easeQuarticActionOut = function(){
+ return cc._easeQuarticActionOut;
+};
+
+/**
+ * cc.EaseQuarticActionInOut action.
+ * Reference easeInOutQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuarticActionInOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuarticActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuarticActionInOut());
+ */
+cc.EaseQuarticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionInOut# */{
+ _updateTime: function(time){
+ time = time*2;
+ if (time < 1)
+ return 0.5 * time * time * time * time;
+ time -= 2;
+ return -0.5 * (time * time * time * time - 2);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuarticActionInOut}
+ */
+ clone: function(){
+ var action = new cc.EaseQuarticActionInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuarticActionInOut}
+ */
+ reverse: function(){
+ return new cc.EaseQuarticActionInOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInOutQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuarticActionInOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuarticActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuarticActionInOut());
+ *
+ * @param action
+ * @returns {cc.EaseQuarticActionInOut}
+ */
+cc.EaseQuarticActionInOut.create = function(action){
+ return new cc.EaseQuarticActionInOut(action);
+};
+
+cc._easeQuarticActionInOut = {
+ easing: cc.EaseQuarticActionInOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuarticActionInOut;
+ }
+};
+/**
+ * Creates the action easing object.
+ * Reference easeInOutQuart:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ */
+cc.easeQuarticActionInOut = function(){
+ return cc._easeQuarticActionInOut;
+};
+
+/**
+ * cc.EaseQuinticActionIn action.
+ * Reference easeInQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuinticActionIn());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuinticActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuinticActionIn());
+ */
+cc.EaseQuinticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionIn# */{
+ _updateTime: function(time){
+ return time * time * time * time * time;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuinticActionIn}
+ */
+ clone: function(){
+ var action = new cc.EaseQuinticActionIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuinticActionIn}
+ */
+ reverse: function(){
+ return new cc.EaseQuinticActionIn(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuinticActionIn());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuinticActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuinticActionIn());
+ *
+ * @param action
+ * @returns {cc.EaseQuinticActionIn}
+ */
+cc.EaseQuinticActionIn.create = function(action){
+ return new cc.EaseQuinticActionIn(action);
+};
+
+cc._easeQuinticActionIn = {
+ easing: cc.EaseQuinticActionIn.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuinticActionIn;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeInQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeQuinticActionIn());
+ */
+cc.easeQuinticActionIn = function(){
+ return cc._easeQuinticActionIn;
+};
+
+/**
+ * cc.EaseQuinticActionOut action.
+ * Reference easeQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuadraticActionOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuinticActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuadraticActionOut());
+ */
+cc.EaseQuinticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionOut# */{
+ _updateTime: function(time){
+ time -=1;
+ return (time * time * time * time * time + 1);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuinticActionOut}
+ */
+ clone: function(){
+ var action = new cc.EaseQuinticActionOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuinticActionOut}
+ */
+ reverse: function(){
+ return new cc.EaseQuinticActionOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeOutQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuadraticActionOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuinticActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuadraticActionOut());
+ *
+ * @param action
+ * @returns {cc.EaseQuinticActionOut}
+ */
+cc.EaseQuinticActionOut.create = function(action){
+ return new cc.EaseQuinticActionOut(action);
+};
+
+cc._easeQuinticActionOut = {
+ easing: cc.EaseQuinticActionOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuinticActionOut;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeOutQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeQuadraticActionOut());
+ */
+cc.easeQuinticActionOut = function(){
+ return cc._easeQuinticActionOut;
+};
+
+/**
+ * cc.EaseQuinticActionInOut action.
+ * Reference easeInOutQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuinticActionInOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuinticActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuinticActionInOut());
+ */
+cc.EaseQuinticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionInOut# */{
+ _updateTime: function(time){
+ time = time*2;
+ if (time < 1)
+ return 0.5 * time * time * time * time * time;
+ time -= 2;
+ return 0.5 * (time * time * time * time * time + 2);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseQuinticActionInOut}
+ */
+ clone: function(){
+ var action = new cc.EaseQuinticActionInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseQuinticActionInOut}
+ */
+ reverse: function(){
+ return new cc.EaseQuinticActionInOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInOutQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeQuinticActionInOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseQuinticActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeQuinticActionInOut());
+ *
+ * @param action
+ * @returns {cc.EaseQuinticActionInOut}
+ */
+cc.EaseQuinticActionInOut.create = function(action){
+ return new cc.EaseQuinticActionInOut(action);
+};
+
+cc._easeQuinticActionInOut = {
+ easing: cc.EaseQuinticActionInOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeQuinticActionInOut;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeInOutQuint:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeQuinticActionInOut());
+ */
+cc.easeQuinticActionInOut = function(){
+ return cc._easeQuinticActionInOut;
+};
+
+/**
+ * cc.EaseCircleActionIn action.
+ * Reference easeInCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCircleActionIn());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCircleActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeCircleActionIn());
+ */
+cc.EaseCircleActionIn = cc.ActionEase.extend(/** @lends cc.EaseCircleActionIn# */{
+ _updateTime: function(time){
+ return -1 * (Math.sqrt(1 - time * time) - 1);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseCircleActionIn}
+ */
+ clone: function(){
+ var action = new cc.EaseCircleActionIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseCircleActionIn}
+ */
+ reverse: function(){
+ return new cc.EaseCircleActionIn(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCircleActionIn());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCircleActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeCircleActionIn());
+ *
+ * @param action
+ * @returns {cc.EaseCircleActionIn}
+ */
+cc.EaseCircleActionIn.create = function(action){
+ return new cc.EaseCircleActionIn(action);
+};
+
+cc._easeCircleActionIn = {
+ easing: cc.EaseCircleActionIn.prototype._updateTime,
+ reverse: function(){
+ return cc._easeCircleActionIn;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeInCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeCircleActionIn());
+ */
+cc.easeCircleActionIn = function(){
+ return cc._easeCircleActionIn;
+};
+
+/**
+ * cc.EaseCircleActionOut action.
+ * Reference easeOutCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCircleActionOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCircleActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeCircleActionOut());
+ */
+cc.EaseCircleActionOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionOut# */{
+ _updateTime: function(time){
+ time = time - 1;
+ return Math.sqrt(1 - time * time);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseCircleActionOut}
+ */
+ clone: function(){
+ var action = new cc.EaseCircleActionOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseCircleActionOut}
+ */
+ reverse: function(){
+ return new cc.EaseCircleActionOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeOutCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCircleActionOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCircleActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeCircleActionOut());
+ *
+ * @param action
+ * @returns {cc.EaseCircleActionOut}
+ */
+cc.EaseCircleActionOut.create = function(action){
+ return new cc.EaseCircleActionOut(action);
+};
+
+cc._easeCircleActionOut = {
+ easing: cc.EaseCircleActionOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeCircleActionOut;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeOutCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @exampple
+ * //example
+ * actioneasing(cc.easeCircleActionOut());
+ */
+cc.easeCircleActionOut = function(){
+ return cc._easeCircleActionOut;
+};
+
+/**
+ * cc.EaseCircleActionInOut action.
+ * Reference easeInOutCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCircleActionInOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCircleActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeCircleActionInOut());
+ */
+cc.EaseCircleActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionInOut# */{
+ _updateTime: function(time){
+ time = time * 2;
+ if (time < 1)
+ return -0.5 * (Math.sqrt(1 - time * time) - 1);
+ time -= 2;
+ return 0.5 * (Math.sqrt(1 - time * time) + 1);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseCircleActionInOut}
+ */
+ clone: function(){
+ var action = new cc.EaseCircleActionInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseCircleActionInOut}
+ */
+ reverse: function(){
+ return new cc.EaseCircleActionInOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInOutCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCircleActionInOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCircleActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeCircleActionInOut());
+ *
+ * @param action
+ * @returns {cc.EaseCircleActionInOut}
+ */
+cc.EaseCircleActionInOut.create = function(action){
+ return new cc.EaseCircleActionInOut(action);
+};
+
+cc._easeCircleActionInOut = {
+ easing: cc.EaseCircleActionInOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeCircleActionInOut;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeInOutCirc:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeCircleActionInOut());
+ */
+cc.easeCircleActionInOut = function(){
+ return cc._easeCircleActionInOut;
+};
+
+/**
+ * cc.EaseCubicActionIn action.
+ * Reference easeInCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 action.easing(cc.easeCubicActionIn());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCubicActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeCubicActionIn());
+ */
+cc.EaseCubicActionIn = cc.ActionEase.extend(/** @lends cc.EaseCubicActionIn# */{
+ _updateTime: function(time){
+ return time * time * time;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseCubicActionIn}
+ */
+ clone: function(){
+ var action = new cc.EaseCubicActionIn();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseCubicActionIn}
+ */
+ reverse: function(){
+ return new cc.EaseCubicActionIn(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 action.easing(cc.easeCubicActionIn());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCubicActionIn.create(action);
+ * //The new usage
+ * action.easing(cc.easeCubicActionIn());
+ *
+ * @param action
+ * @returns {cc.EaseCubicActionIn}
+ */
+cc.EaseCubicActionIn.create = function(action){
+ return new cc.EaseCubicActionIn(action);
+};
+
+cc._easeCubicActionIn = {
+ easing: cc.EaseCubicActionIn.prototype._updateTime,
+ reverse: function(){
+ return cc._easeCubicActionIn;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeInCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeCubicActionIn());
+ */
+cc.easeCubicActionIn = function(){
+ return cc._easeCubicActionIn;
+};
+
+/**
+ * cc.EaseCubicActionOut action.
+ * Reference easeOutCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCubicActionOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCubicActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeCubicActionOut());
+ */
+cc.EaseCubicActionOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionOut# */{
+ _updateTime: function(time){
+ time -= 1;
+ return (time * time * time + 1);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseCubicActionOut}
+ */
+ clone: function(){
+ var action = new cc.EaseCubicActionOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseCubicActionOut}
+ */
+ reverse: function(){
+ return new cc.EaseCubicActionOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeOutCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCubicActionOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCubicActionOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeCubicActionOut());
+ *
+ * @param action
+ * @returns {cc.EaseCubicActionOut}
+ */
+cc.EaseCubicActionOut.create = function(action){
+ return new cc.EaseCubicActionOut(action);
+};
+
+cc._easeCubicActionOut = {
+ easing: cc.EaseCubicActionOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeCubicActionOut;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeOutCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ * @example
+ * //example
+ * action.easing(cc.easeCubicActionOut());
+ */
+cc.easeCubicActionOut = function(){
+ return cc._easeCubicActionOut;
+};
+
+/**
+ * cc.EaseCubicActionInOut action.
+ * Reference easeInOutCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @class
+ * @extends cc.ActionEase
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCubicActionInOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCubicActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeCubicActionInOut());
+ */
+cc.EaseCubicActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionInOut# */{
+ _updateTime: function(time){
+ time = time*2;
+ if (time < 1)
+ return 0.5 * time * time * time;
+ time -= 2;
+ return 0.5 * (time * time * time + 2);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update: function(dt){
+ this._inner.update(this._updateTime(dt));
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @returns {cc.EaseCubicActionInOut}
+ */
+ clone: function(){
+ var action = new cc.EaseCubicActionInOut();
+ action.initWithAction(this._inner.clone());
+ return action;
+ },
+
+ /**
+ * Create a action. Opposite with the original motion trajectory.
+ * @return {cc.EaseCubicActionInOut}
+ */
+ reverse: function(){
+ return new cc.EaseCubicActionInOut(this._inner.reverse());
+ }
+});
+
+/**
+ * Creates the action.
+ * Reference easeInOutCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @static
+ *
+ * @deprecated since v3.0 Please use action.easing(cc.easeCubicActionInOut());
+ *
+ * @example
+ * //The old usage
+ * cc.EaseCubicActionInOut.create(action);
+ * //The new usage
+ * action.easing(cc.easeCubicActionInOut());
+ *
+ * @param action
+ * @returns {cc.EaseCubicActionInOut}
+ */
+cc.EaseCubicActionInOut.create = function(action){
+ return new cc.EaseCubicActionInOut(action);
+};
+
+cc._easeCubicActionInOut = {
+ easing: cc.EaseCubicActionInOut.prototype._updateTime,
+ reverse: function(){
+ return cc._easeCubicActionInOut;
+ }
+};
+
+/**
+ * Creates the action easing object.
+ * Reference easeInOutCubic:
+ * {@link http://www.zhihu.com/question/21981571/answer/19925418}
+ * @function
+ * @returns {Object}
+ */
+cc.easeCubicActionInOut = function(){
+ return cc._easeCubicActionInOut;
+};
+
diff --git a/cocos2d/actions/CCActionInstant.js b/cocos2d/actions/CCActionInstant.js
new file mode 100644
index 00000000000..821d4016798
--- /dev/null
+++ b/cocos2d/actions/CCActionInstant.js
@@ -0,0 +1,749 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ * Instant actions are immediate actions. They don't have a duration like.
+ * the CCIntervalAction actions.
+ * @class
+ * @extends cc.FiniteTimeAction
+ */
+cc.ActionInstant = cc.FiniteTimeAction.extend(/** @lends cc.ActionInstant# */{
+ /**
+ * return true if the action has finished.
+ * @return {Boolean}
+ */
+ isDone:function () {
+ return true;
+ },
+
+ /**
+ * called every frame with it's delta time.
+ * DON'T override unless you know what you are doing.
+ * @param {Number} dt
+ */
+ step:function (dt) {
+ this.update(1);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ //nothing
+ },
+
+ /**
+ * returns a reversed action.
+ * For example:
+ * - The action will be x coordinates of 0 move to 100.
+ * - The reversed action will be x of 100 move to 0.
+ * - Will be rewritten
+ * @returns {cc.Action}
+ */
+ reverse:function(){
+ return this.clone();
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.FiniteTimeAction}
+ */
+ clone:function(){
+ return new cc.ActionInstant();
+ }
+});
+
+/**
+ * Show the node.
+ * @class
+ * @extends cc.ActionInstant
+ */
+cc.Show = cc.ActionInstant.extend(/** @lends cc.Show# */{
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this.target.visible = true;
+ },
+
+ /**
+ * returns a reversed action.
+ * For example:
+ * - The action will be x coordinates of 0 move to 100.
+ * - The reversed action will be x of 100 move to 0.
+ * - Will be rewritten
+ * @returns {cc.Hide}
+ */
+ reverse:function () {
+ return new cc.Hide();
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.FiniteTimeAction}
+ */
+ clone:function(){
+ return new cc.Show();
+ }
+});
+
+/**
+ * Show the Node.
+ * @function
+ * @return {cc.Show}
+ * @example
+ * // example
+ * var showAction = cc.show();
+ */
+cc.show = function () {
+ return new cc.Show();
+};
+
+/**
+ * Show the Node. Please use cc.show instead.
+ * @static
+ * @deprecated since v3.0 Please use cc.show instead.
+ * @return {cc.Show}
+ */
+cc.Show.create = cc.show;
+
+/**
+ * Hide the node.
+ * @class
+ * @extends cc.ActionInstant
+ */
+cc.Hide = cc.ActionInstant.extend(/** @lends cc.Hide# */{
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this.target.visible = false;
+ },
+
+ /**
+ * returns a reversed action.
+ * For example:
+ * - The action will be x coordinates of 0 move to 100.
+ * - The reversed action will be x of 100 move to 0.
+ * - Will be rewritten
+ * @returns {cc.Show}
+ */
+ reverse:function () {
+ return new cc.Show();
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.Hide}
+ */
+ clone:function(){
+ return new cc.Hide();
+ }
+});
+
+/**
+ * Hide the node.
+ * @function
+ * @return {cc.Hide}
+ * @example
+ * // example
+ * var hideAction = cc.hide();
+ */
+cc.hide = function () {
+ return new cc.Hide();
+};
+
+/**
+ * Hide the node. Please use cc.hide instead.
+ * @static
+ * @deprecated since v3.0 Please use cc.hide instead.
+ * @return {cc.Hide}
+ * @example
+ * // example
+ * var hideAction = cc.hide();
+ */
+cc.Hide.create = cc.hide;
+
+/**
+ * Toggles the visibility of a node.
+ * @class
+ * @extends cc.ActionInstant
+ */
+cc.ToggleVisibility = cc.ActionInstant.extend(/** @lends cc.ToggleVisibility# */{
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this.target.visible = !this.target.visible;
+ },
+
+ /**
+ * returns a reversed action.
+ * @returns {cc.ToggleVisibility}
+ */
+ reverse:function () {
+ return new cc.ToggleVisibility();
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.ToggleVisibility}
+ */
+ clone:function(){
+ return new cc.ToggleVisibility();
+ }
+});
+
+/**
+ * Toggles the visibility of a node.
+ * @function
+ * @return {cc.ToggleVisibility}
+ * @example
+ * // example
+ * var toggleVisibilityAction = cc.toggleVisibility();
+ */
+cc.toggleVisibility = function () {
+ return new cc.ToggleVisibility();
+};
+
+/**
+ * Toggles the visibility of a node. Please use cc.toggleVisibility instead.
+ * @static
+ * @deprecated since v3.0 Please use cc.toggleVisibility instead.
+ * @return {cc.ToggleVisibility}
+ */
+cc.ToggleVisibility.create = cc.toggleVisibility;
+
+/**
+ * Delete self in the next frame.
+ * @class
+ * @extends cc.ActionInstant
+ * @param {Boolean} [isNeedCleanUp=true]
+ *
+ * @example
+ * // example
+ * var removeSelfAction = new cc.RemoveSelf(false);
+ */
+cc.RemoveSelf = cc.ActionInstant.extend({
+ _isNeedCleanUp: true,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.
+ * @param {Boolean} [isNeedCleanUp=true]
+ */
+ ctor:function(isNeedCleanUp){
+ cc.FiniteTimeAction.prototype.ctor.call(this);
+
+ isNeedCleanUp !== undefined && this.init(isNeedCleanUp);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function(dt){
+ this.target.removeFromParent(this._isNeedCleanUp);
+ },
+
+ /**
+ * Initialization of the node, please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
+ * @param isNeedCleanUp
+ * @returns {boolean}
+ */
+ init:function(isNeedCleanUp){
+ this._isNeedCleanUp = isNeedCleanUp;
+ return true;
+ },
+
+ /**
+ * returns a reversed action.
+ */
+ reverse:function(){
+ return new cc.RemoveSelf(this._isNeedCleanUp);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.RemoveSelf}
+ */
+ clone:function(){
+ return new cc.RemoveSelf(this._isNeedCleanUp);
+ }
+});
+
+/**
+ * Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.
+ *
+ * @function
+ * @param {Boolean} [isNeedCleanUp=true]
+ * @return {cc.RemoveSelf}
+ *
+ * @example
+ * // example
+ * var removeSelfAction = cc.removeSelf();
+ */
+cc.removeSelf = function(isNeedCleanUp){
+ return new cc.RemoveSelf(isNeedCleanUp);
+};
+
+/**
+ * Please use cc.removeSelf instead.
+ * Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.
+ *
+ * @static
+ * @deprecated since v3.0 Please use cc.removeSelf instead.
+ * @param {Boolean} [isNeedCleanUp=true]
+ * @return {cc.RemoveSelf}
+ */
+cc.RemoveSelf.create = cc.removeSelf;
+
+/**
+ * Flips the sprite horizontally.
+ * @class
+ * @extends cc.ActionInstant
+ * @param {Boolean} flip Indicate whether the target should be flipped or not
+ *
+ * @example
+ * var flipXAction = new cc.FlipX(true);
+ */
+cc.FlipX = cc.ActionInstant.extend(/** @lends cc.FlipX# */{
+ _flippedX:false,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a FlipX action to flip or unflip the target.
+ * @param {Boolean} flip Indicate whether the target should be flipped or not
+ */
+ ctor:function(flip){
+ cc.FiniteTimeAction.prototype.ctor.call(this);
+ this._flippedX = false;
+ flip !== undefined && this.initWithFlipX(flip);
+ },
+
+ /**
+ * initializes the action with a set flipX.
+ * @param {Boolean} flip
+ * @return {Boolean}
+ */
+ initWithFlipX:function (flip) {
+ this._flippedX = flip;
+ return true;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this.target.flippedX = this._flippedX;
+ },
+
+ /**
+ * returns a reversed action.
+ * @return {cc.FlipX}
+ */
+ reverse:function () {
+ return new cc.FlipX(!this._flippedX);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.FiniteTimeAction}
+ */
+ clone:function(){
+ var action = new cc.FlipX();
+ action.initWithFlipX(this._flippedX);
+ return action;
+ }
+});
+
+/**
+ * Create a FlipX action to flip or unflip the target.
+ *
+ * @function
+ * @param {Boolean} flip Indicate whether the target should be flipped or not
+ * @return {cc.FlipX}
+ * @example
+ * var flipXAction = cc.flipX(true);
+ */
+cc.flipX = function (flip) {
+ return new cc.FlipX(flip);
+};
+
+/**
+ * Plese use cc.flipX instead.
+ * Create a FlipX action to flip or unflip the target
+ *
+ * @static
+ * @deprecated since v3.0 Plese use cc.flipX instead.
+ * @param {Boolean} flip Indicate whether the target should be flipped or not
+ * @return {cc.FlipX}
+ */
+cc.FlipX.create = cc.flipX;
+
+/**
+ * Flips the sprite vertically
+ * @class
+ * @extends cc.ActionInstant
+ * @param {Boolean} flip
+ * @example
+ * var flipYAction = new cc.FlipY(true);
+ */
+cc.FlipY = cc.ActionInstant.extend(/** @lends cc.FlipY# */{
+ _flippedY:false,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a FlipY action to flip or unflip the target.
+ *
+ * @param {Boolean} flip
+ */
+ ctor: function(flip){
+ cc.FiniteTimeAction.prototype.ctor.call(this);
+ this._flippedY = false;
+
+ flip !== undefined && this.initWithFlipY(flip);
+ },
+
+ /**
+ * initializes the action with a set flipY.
+ * @param {Boolean} flip
+ * @return {Boolean}
+ */
+ initWithFlipY:function (flip) {
+ this._flippedY = flip;
+ return true;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this.target.flippedY = this._flippedY;
+ },
+
+ /**
+ * returns a reversed action.
+ * @return {cc.FlipY}
+ */
+ reverse:function () {
+ return new cc.FlipY(!this._flippedY);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.FlipY}
+ */
+ clone:function(){
+ var action = new cc.FlipY();
+ action.initWithFlipY(this._flippedY);
+ return action;
+ }
+});
+
+/**
+ * Create a FlipY action to flip or unflip the target.
+ *
+ * @function
+ * @param {Boolean} flip
+ * @return {cc.FlipY}
+ * @example
+ * var flipYAction = cc.flipY(true);
+ */
+cc.flipY = function (flip) {
+ return new cc.FlipY(flip);
+};
+
+/**
+ * Please use cc.flipY instead
+ * Create a FlipY action to flip or unflip the target
+ *
+ * @static
+ * @deprecated since v3.0 Please use cc.flipY instead.
+ * @param {Boolean} flip
+ * @return {cc.FlipY}
+ */
+cc.FlipY.create = cc.flipY;
+
+/**
+ * Places the node in a certain position
+ * @class
+ * @extends cc.ActionInstant
+ * @param {cc.Vec2|Number} pos
+ * @param {Number} [y]
+ * @example
+ * var placeAction = new cc.Place(cc.p(200, 200));
+ * var placeAction = new cc.Place(200, 200);
+ */
+cc.Place = cc.ActionInstant.extend(/** @lends cc.Place# */{
+ _x: 0,
+ _y: 0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates a Place action with a position.
+ * @param {cc.Vec2|Number} pos
+ * @param {Number} [y]
+ */
+ ctor:function(pos, y){
+ cc.FiniteTimeAction.prototype.ctor.call(this);
+ this._x = 0;
+ this._y = 0;
+
+ if (pos !== undefined) {
+ if (pos.x !== undefined) {
+ y = pos.y;
+ pos = pos.x;
+ }
+ this.initWithPosition(pos, y);
+ }
+ },
+
+ /**
+ * Initializes a Place action with a position
+ * @param {number} x
+ * @param {number} y
+ * @return {Boolean}
+ */
+ initWithPosition: function (x, y) {
+ this._x = x;
+ this._y = y;
+ return true;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this.target.setPosition(this._x, this._y);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.Place}
+ */
+ clone:function(){
+ var action = new cc.Place();
+ action.initWithPosition(this._x, this._y);
+ return action;
+ }
+});
+
+/**
+ * Creates a Place action with a position.
+ * @function
+ * @param {cc.Vec2|Number} pos
+ * @param {Number} [y]
+ * @return {cc.Place}
+ * @example
+ * // example
+ * var placeAction = cc.place(cc.p(200, 200));
+ * var placeAction = cc.place(200, 200);
+ */
+cc.place = function (pos, y) {
+ return new cc.Place(pos, y);
+};
+
+/**
+ * Please use cc.place instead.
+ * Creates a Place action with a position.
+ * @static
+ * @deprecated since v3.0 Please use cc.place instead.
+ * @param {cc.Vec2|Number} pos
+ * @param {Number} [y]
+ * @return {cc.Place}
+ */
+cc.Place.create = cc.place;
+
+
+/**
+ * Calls a 'callback'.
+ * @class
+ * @extends cc.ActionInstant
+ * @param {function} selector
+ * @param {object|null} [selectorTarget]
+ * @param {*|null} [data] data for function, it accepts all data types.
+ * @example
+ * // example
+ * // CallFunc without data
+ * var finish = new cc.CallFunc(this.removeSprite, this);
+ *
+ * // CallFunc with data
+ * var finish = new cc.CallFunc(this.removeFromParentAndCleanup, this, true);
+ */
+cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{
+ _selectorTarget:null,
+ _function:null,
+ _data:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates a CallFunc action with the callback.
+ * @param {function} selector
+ * @param {object|null} [selectorTarget]
+ * @param {*|null} [data] data for function, it accepts all data types.
+ */
+ ctor:function(selector, selectorTarget, data){
+ cc.FiniteTimeAction.prototype.ctor.call(this);
+
+ this.initWithFunction(selector, selectorTarget, data);
+ },
+
+ /**
+ * Initializes the action with a function or function and its target
+ * @param {function} selector
+ * @param {object|Null} selectorTarget
+ * @param {*|Null} [data] data for function, it accepts all data types.
+ * @return {Boolean}
+ */
+ initWithFunction:function (selector, selectorTarget, data) {
+ if (selector) {
+ this._function = selector;
+ }
+ if (selectorTarget) {
+ this._selectorTarget = selectorTarget;
+ }
+ if (data) {
+ this._data = data;
+ }
+ return true;
+ },
+
+ /**
+ * execute the function.
+ */
+ execute:function () {
+ if (this._function) {
+ this._function.call(this._selectorTarget, this.target, this._data);
+ }
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this.execute();
+ },
+
+ /**
+ * Get selectorTarget.
+ * @return {object}
+ */
+ getTargetCallback:function () {
+ return this._selectorTarget;
+ },
+
+ /**
+ * Set selectorTarget.
+ * @param {object} sel
+ */
+ setTargetCallback:function (sel) {
+ if (sel !== this._selectorTarget) {
+ if (this._selectorTarget)
+ this._selectorTarget = null;
+ this._selectorTarget = sel;
+ }
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.CallFunc}
+ */
+ clone:function(){
+ var action = new cc.CallFunc();
+ action.initWithFunction(this._function, this._selectorTarget, this._data);
+ return action;
+ }
+});
+
+/**
+ * Creates the action with the callback
+ * @function
+ * @param {function} selector
+ * @param {object|null} [selectorTarget]
+ * @param {*|null} [data] data for function, it accepts all data types.
+ * @return {cc.CallFunc}
+ * @example
+ * // example
+ * // CallFunc without data
+ * var finish = cc.callFunc(this.removeSprite, this);
+ *
+ * // CallFunc with data
+ * var finish = cc.callFunc(this.removeFromParentAndCleanup, this._grossini, true);
+ */
+cc.callFunc = function (selector, selectorTarget, data) {
+ return new cc.CallFunc(selector, selectorTarget, data);
+};
+
+/**
+ * Please use cc.callFunc instead.
+ * Creates the action with the callback.
+ * @static
+ * @deprecated since v3.0 Please use cc.callFunc instead.
+ * @param {function} selector
+ * @param {object|null} [selectorTarget]
+ * @param {*|null} [data] data for function, it accepts all data types.
+ * @return {cc.CallFunc}
+ */
+cc.CallFunc.create = cc.callFunc;
diff --git a/cocos2d/actions/CCActionInterval.js b/cocos2d/actions/CCActionInterval.js
new file mode 100644
index 00000000000..69cab12331b
--- /dev/null
+++ b/cocos2d/actions/CCActionInterval.js
@@ -0,0 +1,3567 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ *
An interval action is an action that takes place within a certain period of time.
+ * It has an start time, and a finish time. The finish time is the parameter
+ * duration plus the start time.
+ *
+ *
These CCActionInterval actions have some interesting properties, like:
+ * - They can run normally (default)
+ * - They can run reversed with the reverse method
+ * - They can run with the time altered with the Accelerate, AccelDeccel and Speed actions.
+ *
+ *
For example, you can simulate a Ping Pong effect running the action normally and
+ * then running it again in Reverse mode.
+ *
+ * @class
+ * @extends cc.FiniteTimeAction
+ * @param {Number} d duration in seconds
+ * @example
+ * var actionInterval = new cc.ActionInterval(3);
+ */
+cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{
+ _elapsed:0,
+ _firstTick:false,
+ _easeList: null,
+ _timesForRepeat:1,
+ _repeatForever: false,
+ _repeatMethod: false,//Compatible with repeat class, Discard after can be deleted
+ _speed: 1,
+ _speedMethod: false,//Compatible with speed class, Discard after can be deleted
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} d duration in seconds
+ */
+ ctor:function (d) {
+ this._speed = 1;
+ this._timesForRepeat = 1;
+ this._repeatForever = false;
+ this.MAX_VALUE = 2;
+ this._repeatMethod = false;//Compatible with repeat class, Discard after can be deleted
+ this._speedMethod = false;//Compatible with repeat class, Discard after can be deleted
+ cc.FiniteTimeAction.prototype.ctor.call(this);
+ d !== undefined && this.initWithDuration(d);
+ },
+
+ /**
+ * How many seconds had elapsed since the actions started to run.
+ * @return {Number}
+ */
+ getElapsed:function () {
+ return this._elapsed;
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} d duration in seconds
+ * @return {Boolean}
+ */
+ initWithDuration:function (d) {
+ this._duration = (d === 0) ? cc.FLT_EPSILON : d;
+ // prevent division by 0
+ // This comparison could be in step:, but it might decrease the performance
+ // by 3% in heavy based action games.
+ this._elapsed = 0;
+ this._firstTick = true;
+ return true;
+ },
+
+ /**
+ * Returns true if the action has finished.
+ * @return {Boolean}
+ */
+ isDone:function () {
+ return (this._elapsed >= this._duration);
+ },
+
+ /**
+ * Some additional parameters of cloning.
+ * @param {cc.Action} action
+ * @private
+ */
+ _cloneDecoration: function(action){
+ action._repeatForever = this._repeatForever;
+ action._speed = this._speed;
+ action._timesForRepeat = this._timesForRepeat;
+ action._easeList = this._easeList;
+ action._speedMethod = this._speedMethod;
+ action._repeatMethod = this._repeatMethod;
+ },
+
+ _reverseEaseList: function(action){
+ if(this._easeList){
+ action._easeList = [];
+ for(var i=0; i
+ * DON'T override unless you know what you are doing.
+ *
+ * @param {Number} dt
+ */
+ step:function (dt) {
+ if (this._firstTick) {
+ this._firstTick = false;
+ this._elapsed = 0;
+ } else
+ this._elapsed += dt;
+
+ //this.update((1 > (this._elapsed / this._duration)) ? this._elapsed / this._duration : 1);
+ //this.update(Math.max(0, Math.min(1, this._elapsed / Math.max(this._duration, cc.FLT_EPSILON))));
+ var t = this._elapsed / (this._duration > 0.0000001192092896 ? this._duration : 0.0000001192092896);
+ t = (1 > t ? t : 1);
+ this.update(t > 0 ? t : 0);
+
+ //Compatible with repeat class, Discard after can be deleted (this._repeatMethod)
+ if(this._repeatMethod && this._timesForRepeat > 1 && this.isDone()){
+ if(!this._repeatForever){
+ this._timesForRepeat--;
+ }
+ //var diff = locInnerAction.getElapsed() - locInnerAction._duration;
+ this.startWithTarget(this.target);
+ // to prevent jerk. issue #390 ,1247
+ //this._innerAction.step(0);
+ //this._innerAction.step(diff);
+ this.step(this._elapsed - this._duration);
+
+ }
+ },
+
+ /**
+ * Start this action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.Action.prototype.startWithTarget.call(this, target);
+ this._elapsed = 0;
+ this._firstTick = true;
+ },
+
+ /**
+ * returns a reversed action.
+ * Will be overwrite.
+ *
+ * @return {null}
+ */
+ reverse:function () {
+ cc.log("cc.IntervalAction: reverse not implemented.");
+ return null;
+ },
+
+ /**
+ * Set amplitude rate.
+ * @warning It should be overridden in subclass.
+ * @param {Number} amp
+ */
+ setAmplitudeRate:function (amp) {
+ // Abstract class needs implementation
+ cc.log("cc.ActionInterval.setAmplitudeRate(): it should be overridden in subclass.");
+ },
+
+ /**
+ * Get amplitude rate.
+ * @warning It should be overridden in subclass.
+ * @return {Number} 0
+ */
+ getAmplitudeRate:function () {
+ // Abstract class needs implementation
+ cc.log("cc.ActionInterval.getAmplitudeRate(): it should be overridden in subclass.");
+ return 0;
+ },
+
+ /**
+ * Changes the speed of an action, making it take longer (speed>1)
+ * or less (speed<1) time.
+ * Useful to simulate 'slow motion' or 'fast forward' effect.
+ *
+ * @param speed
+ * @returns {cc.Action}
+ */
+ speed: function(speed){
+ if(speed <= 0){
+ cc.log("The speed parameter error");
+ return this;
+ }
+
+ this._speedMethod = true;//Compatible with repeat class, Discard after can be deleted
+ this._speed *= speed;
+ return this;
+ },
+
+ /**
+ * Get this action speed.
+ * @return {Number}
+ */
+ getSpeed: function(){
+ return this._speed;
+ },
+
+ /**
+ * Set this action speed.
+ * @param {Number} speed
+ * @returns {cc.ActionInterval}
+ */
+ setSpeed: function(speed){
+ this._speed = speed;
+ return this;
+ },
+
+ /**
+ * Repeats an action a number of times.
+ * To repeat an action forever use the CCRepeatForever action.
+ * @param times
+ * @returns {cc.ActionInterval}
+ */
+ repeat: function(times){
+ times = Math.round(times);
+ if(isNaN(times) || times < 1){
+ cc.log("The repeat parameter error");
+ return this;
+ }
+ this._repeatMethod = true;//Compatible with repeat class, Discard after can be deleted
+ this._timesForRepeat *= times;
+ return this;
+ },
+
+ /**
+ * Repeats an action for ever.
+ * To repeat the an action for a limited number of times use the Repeat action.
+ * @returns {cc.ActionInterval}
+ */
+ repeatForever: function(){
+ this._repeatMethod = true;//Compatible with repeat class, Discard after can be deleted
+ this._timesForRepeat = this.MAX_VALUE;
+ this._repeatForever = true;
+ return this;
+ }
+});
+
+/**
+ * An interval action is an action that takes place within a certain period of time.
+ * @function
+ * @param {Number} d duration in seconds
+ * @return {cc.ActionInterval}
+ * @example
+ * // example
+ * var actionInterval = cc.actionInterval(3);
+ */
+cc.actionInterval = function (d) {
+ return new cc.ActionInterval(d);
+};
+
+/**
+ * Please use cc.actionInterval instead.
+ * An interval action is an action that takes place within a certain period of time.
+ * @static
+ * @deprecated since v3.0 Please use cc.actionInterval instead.
+ * @param {Number} d duration in seconds
+ * @return {cc.ActionInterval}
+ */
+cc.ActionInterval.create = cc.actionInterval;
+
+/**
+ * Runs actions sequentially, one after another.
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Array|cc.FiniteTimeAction} tempArray
+ * @example
+ * // create sequence with actions
+ * var seq = new cc.Sequence(act1, act2);
+ *
+ * // create sequence with array
+ * var seq = new cc.Sequence(actArray);
+ */
+cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{
+ _actions:null,
+ _split:null,
+ _last:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create an array of sequenceable actions.
+ * @param {Array|cc.FiniteTimeAction} tempArray
+ */
+ ctor:function (tempArray) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._actions = [];
+
+ var paramArray = (tempArray instanceof Array) ? tempArray : arguments;
+ var last = paramArray.length - 1;
+ if ((last >= 0) && (paramArray[last] == null))
+ cc.log("parameters should not be ending with null in Javascript");
+
+ if (last >= 0) {
+ var prev = paramArray[0], action1;
+ for (var i = 1; i < last; i++) {
+ if (paramArray[i]) {
+ action1 = prev;
+ prev = cc.Sequence._actionOneTwo(action1, paramArray[i]);
+ }
+ }
+ this.initWithTwoActions(prev, paramArray[last]);
+ }
+ },
+
+ /**
+ * Initializes the action
+ * @param {cc.FiniteTimeAction} actionOne
+ * @param {cc.FiniteTimeAction} actionTwo
+ * @return {Boolean}
+ */
+ initWithTwoActions:function (actionOne, actionTwo) {
+ if(!actionOne || !actionTwo)
+ throw new Error("cc.Sequence.initWithTwoActions(): arguments must all be non nil");
+
+ var d = actionOne._duration + actionTwo._duration;
+ this.initWithDuration(d);
+
+ this._actions[0] = actionOne;
+ this._actions[1] = actionTwo;
+ return true;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.Sequence}
+ */
+ clone:function () {
+ var action = new cc.Sequence();
+ this._cloneDecoration(action);
+ action.initWithTwoActions(this._actions[0].clone(), this._actions[1].clone());
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._split = this._actions[0]._duration / this._duration;
+ this._last = -1;
+ },
+
+ /**
+ * stop the action.
+ */
+ stop:function () {
+ // Issue #1305
+ if (this._last !== -1)
+ this._actions[this._last].stop();
+ cc.Action.prototype.stop.call(this);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var new_t, found = 0;
+ var locSplit = this._split, locActions = this._actions, locLast = this._last, actionFound;
+
+ dt = this._computeEaseTime(dt);
+ if (dt < locSplit) {
+ // action[0]
+ new_t = (locSplit !== 0) ? dt / locSplit : 1;
+
+ if (found === 0 && locLast === 1) {
+ // Reverse mode ?
+ // XXX: Bug. this case doesn't contemplate when _last==-1, found=0 and in "reverse mode"
+ // since it will require a hack to know if an action is on reverse mode or not.
+ // "step" should be overriden, and the "reverseMode" value propagated to inner Sequences.
+ locActions[1].update(0);
+ locActions[1].stop();
+ }
+ } else {
+ // action[1]
+ found = 1;
+ new_t = (locSplit === 1) ? 1 : (dt - locSplit) / (1 - locSplit);
+
+ if (locLast === -1) {
+ // action[0] was skipped, execute it.
+ locActions[0].startWithTarget(this.target);
+ locActions[0].update(1);
+ locActions[0].stop();
+ }
+ if (!locLast) {
+ // switching to action 1. stop action 0.
+ locActions[0].update(1);
+ locActions[0].stop();
+ }
+ }
+
+ actionFound = locActions[found];
+ // Last action found and it is done.
+ if (locLast === found && actionFound.isDone())
+ return;
+
+ // Last action found and it is done
+ if (locLast !== found)
+ actionFound.startWithTarget(this.target);
+
+ new_t = new_t * actionFound._timesForRepeat;
+ actionFound.update(new_t > 1 ? new_t % 1 : new_t);
+ this._last = found;
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.Sequence}
+ */
+ reverse:function () {
+ var action = cc.Sequence._actionOneTwo(this._actions[1].reverse(), this._actions[0].reverse());
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+
+/** helper constructor to create an array of sequenceable actions
+ * @function
+ * @param {Array|cc.FiniteTimeAction} tempArray
+ * @return {cc.Sequence}
+ * @example
+ * // example
+ * // create sequence with actions
+ * var seq = cc.sequence(act1, act2);
+ *
+ * // create sequence with array
+ * var seq = cc.sequence(actArray);
+ * todo: It should be use new
+ */
+cc.sequence = function (/*Multiple Arguments*/tempArray) {
+ var paramArray = (tempArray instanceof Array) ? tempArray : arguments;
+ if ((paramArray.length > 0) && (paramArray[paramArray.length - 1] == null))
+ cc.log("parameters should not be ending with null in Javascript");
+
+ var result, current, i, repeat;
+ while(paramArray && paramArray.length > 0){
+ current = Array.prototype.shift.call(paramArray);
+ repeat = current._timesForRepeat || 1;
+ current._repeatMethod = false;
+ current._timesForRepeat = 1;
+
+ i = 0;
+ if(!result){
+ result = current;
+ i = 1;
+ }
+
+ for(i; i Please use cc.sequence instead.
+ * @param {Array|cc.FiniteTimeAction} tempArray
+ * @return {cc.Sequence}
+ */
+cc.Sequence.create = cc.sequence;
+
+/** creates the action
+ * @param {cc.FiniteTimeAction} actionOne
+ * @param {cc.FiniteTimeAction} actionTwo
+ * @return {cc.Sequence}
+ * @private
+ */
+cc.Sequence._actionOneTwo = function (actionOne, actionTwo) {
+ var sequence = new cc.Sequence();
+ sequence.initWithTwoActions(actionOne, actionTwo);
+ return sequence;
+};
+
+/**
+ * Repeats an action a number of times.
+ * To repeat an action forever use the CCRepeatForever action.
+ * @class
+ * @extends cc.ActionInterval
+ * @param {cc.FiniteTimeAction} action
+ * @param {Number} times
+ * @example
+ * var rep = new cc.Repeat(cc.sequence(jump2, jump1), 5);
+ */
+cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{
+ _times:0,
+ _total:0,
+ _nextDt:0,
+ _actionInstant:false,
+ _innerAction:null, //CCFiniteTimeAction
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30).
+ * @param {cc.FiniteTimeAction} action
+ * @param {Number} times
+ */
+ ctor: function (action, times) {
+ cc.ActionInterval.prototype.ctor.call(this);
+
+ times !== undefined && this.initWithAction(action, times);
+ },
+
+ /**
+ * @param {cc.FiniteTimeAction} action
+ * @param {Number} times
+ * @return {Boolean}
+ */
+ initWithAction:function (action, times) {
+ var duration = action._duration * times;
+
+ if (this.initWithDuration(duration)) {
+ this._times = times;
+ this._innerAction = action;
+ if (action instanceof cc.ActionInstant){
+ this._actionInstant = true;
+ this._times -= 1;
+ }
+ this._total = 0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.Repeat}
+ */
+ clone:function () {
+ var action = new cc.Repeat();
+ this._cloneDecoration(action);
+ action.initWithAction(this._innerAction.clone(), this._times);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ this._total = 0;
+ this._nextDt = this._innerAction._duration / this._duration;
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._innerAction.startWithTarget(target);
+ },
+
+ /**
+ * stop the action
+ */
+ stop:function () {
+ this._innerAction.stop();
+ cc.Action.prototype.stop.call(this);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ var locInnerAction = this._innerAction;
+ var locDuration = this._duration;
+ var locTimes = this._times;
+ var locNextDt = this._nextDt;
+
+ if (dt >= locNextDt) {
+ while (dt > locNextDt && this._total < locTimes) {
+ locInnerAction.update(1);
+ this._total++;
+ locInnerAction.stop();
+ locInnerAction.startWithTarget(this.target);
+ locNextDt += locInnerAction._duration / locDuration;
+ this._nextDt = locNextDt;
+ }
+
+ // fix for issue #1288, incorrect end value of repeat
+ if (dt >= 1.0 && this._total < locTimes)
+ this._total++;
+
+ // don't set a instant action back or update it, it has no use because it has no duration
+ if (!this._actionInstant) {
+ if (this._total === locTimes) {
+ locInnerAction.update(1);
+ locInnerAction.stop();
+ } else {
+ // issue #390 prevent jerk, use right update
+ locInnerAction.update(dt - (locNextDt - locInnerAction._duration / locDuration));
+ }
+ }
+ } else {
+ locInnerAction.update((dt * locTimes) % 1.0);
+ }
+ },
+
+ /**
+ * Return true if the action has finished.
+ * @return {Boolean}
+ */
+ isDone:function () {
+ return this._total === this._times;
+ },
+
+ /**
+ * returns a reversed action.
+ * @return {cc.Repeat}
+ */
+ reverse:function () {
+ var action = new cc.Repeat(this._innerAction.reverse(), this._times);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ },
+
+ /**
+ * Set inner Action.
+ * @param {cc.FiniteTimeAction} action
+ */
+ setInnerAction:function (action) {
+ if (this._innerAction !== action) {
+ this._innerAction = action;
+ }
+ },
+
+ /**
+ * Get inner Action.
+ * @return {cc.FiniteTimeAction}
+ */
+ getInnerAction:function () {
+ return this._innerAction;
+ }
+});
+
+/**
+ * Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30)
+ * @function
+ * @param {cc.FiniteTimeAction} action
+ * @param {Number} times
+ * @return {cc.Repeat}
+ * @example
+ * // example
+ * var rep = cc.repeat(cc.sequence(jump2, jump1), 5);
+ */
+cc.repeat = function (action, times) {
+ return new cc.Repeat(action, times);
+};
+
+/**
+ * Please use cc.repeat instead
+ * Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30)
+ * @static
+ * @deprecated since v3.0 Please use cc.repeat instead.
+ * @param {cc.FiniteTimeAction} action
+ * @param {Number} times
+ * @return {cc.Repeat}
+ */
+cc.Repeat.create = cc.repeat;
+
+
+/** Repeats an action for ever.
+ * To repeat the an action for a limited number of times use the Repeat action.
+ * @warning This action can't be Sequenceable because it is not an IntervalAction
+ * @class
+ * @extends cc.ActionInterval
+ * @param {cc.FiniteTimeAction} action
+ * @example
+ * var rep = new cc.RepeatForever(cc.sequence(jump2, jump1), 5);
+ */
+cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{
+ _innerAction:null, //CCActionInterval
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a acton which repeat forever.
+ * @param {cc.FiniteTimeAction} action
+ */
+ ctor:function (action) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._innerAction = null;
+
+ action && this.initWithAction(action);
+ },
+
+ /**
+ * @param {cc.ActionInterval} action
+ * @return {Boolean}
+ */
+ initWithAction:function (action) {
+ if(!action)
+ throw new Error("cc.RepeatForever.initWithAction(): action must be non null");
+
+ this._innerAction = action;
+ return true;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.RepeatForever}
+ */
+ clone:function () {
+ var action = new cc.RepeatForever();
+ this._cloneDecoration(action);
+ action.initWithAction(this._innerAction.clone());
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._innerAction.startWithTarget(target);
+ },
+
+ /**
+ * called every frame with it's delta time.
+ * DON'T override unless you know what you are doing.
+ * @param dt delta time in seconds
+ */
+ step:function (dt) {
+ var locInnerAction = this._innerAction;
+ locInnerAction.step(dt);
+ if (locInnerAction.isDone()) {
+ //var diff = locInnerAction.getElapsed() - locInnerAction._duration;
+ locInnerAction.startWithTarget(this.target);
+ // to prevent jerk. issue #390 ,1247
+ //this._innerAction.step(0);
+ //this._innerAction.step(diff);
+ locInnerAction.step(locInnerAction.getElapsed() - locInnerAction._duration);
+ }
+ },
+
+ /**
+ * Return true if the action has finished.
+ * @return {Boolean}
+ */
+ isDone:function () {
+ return false;
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.RepeatForever}
+ */
+ reverse:function () {
+ var action = new cc.RepeatForever(this._innerAction.reverse());
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ },
+
+ /**
+ * Set inner action.
+ * @param {cc.ActionInterval} action
+ */
+ setInnerAction:function (action) {
+ if (this._innerAction !== action) {
+ this._innerAction = action;
+ }
+ },
+
+ /**
+ * Get inner action.
+ * @return {cc.ActionInterval}
+ */
+ getInnerAction:function () {
+ return this._innerAction;
+ }
+});
+
+/**
+ * Create a acton which repeat forever
+ * @function
+ * @param {cc.FiniteTimeAction} action
+ * @return {cc.RepeatForever}
+ * @example
+ * // example
+ * var repeat = cc.repeatForever(cc.rotateBy(1.0, 360));
+ */
+cc.repeatForever = function (action) {
+ return new cc.RepeatForever(action);
+};
+
+/**
+ * Please use cc.repeatForever instead
+ * Create a acton which repeat forever
+ * @static
+ * @deprecated since v3.0 Please use cc.repeatForever instead.
+ * @param {cc.FiniteTimeAction} action
+ * @return {cc.RepeatForever}
+ * @param {Array|cc.FiniteTimeAction} tempArray
+ * @example
+ * var action = new cc.Spawn(cc.jumpBy(2, cc.p(300, 0), 50, 4), cc.rotateBy(2, 720));
+ */
+cc.RepeatForever.create = cc.repeatForever;
+
+
+/** Spawn a new action immediately
+ * @class
+ * @extends cc.ActionInterval
+ */
+cc.Spawn = cc.ActionInterval.extend(/** @lends cc.Spawn# */{
+ _one:null,
+ _two:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Array|cc.FiniteTimeAction} tempArray
+ */
+ ctor:function (tempArray) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._one = null;
+ this._two = null;
+
+ var paramArray = (tempArray instanceof Array) ? tempArray : arguments;
+ var last = paramArray.length - 1;
+ if ((last >= 0) && (paramArray[last] == null))
+ cc.log("parameters should not be ending with null in Javascript");
+
+ if (last >= 0) {
+ var prev = paramArray[0], action1;
+ for (var i = 1; i < last; i++) {
+ if (paramArray[i]) {
+ action1 = prev;
+ prev = cc.Spawn._actionOneTwo(action1, paramArray[i]);
+ }
+ }
+ this.initWithTwoActions(prev, paramArray[last]);
+ }
+ },
+
+ /** initializes the Spawn action with the 2 actions to spawn
+ * @param {cc.FiniteTimeAction} action1
+ * @param {cc.FiniteTimeAction} action2
+ * @return {Boolean}
+ */
+ initWithTwoActions:function (action1, action2) {
+ if(!action1 || !action2)
+ throw new Error("cc.Spawn.initWithTwoActions(): arguments must all be non null");
+
+ var ret = false;
+
+ var d1 = action1._duration;
+ var d2 = action2._duration;
+
+ if (this.initWithDuration(Math.max(d1, d2))) {
+ this._one = action1;
+ this._two = action2;
+
+ if (d1 > d2) {
+ this._two = cc.Sequence._actionOneTwo(action2, cc.delayTime(d1 - d2));
+ } else if (d1 < d2) {
+ this._one = cc.Sequence._actionOneTwo(action1, cc.delayTime(d2 - d1));
+ }
+
+ ret = true;
+ }
+ return ret;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.Spawn}
+ */
+ clone:function () {
+ var action = new cc.Spawn();
+ this._cloneDecoration(action);
+ action.initWithTwoActions(this._one.clone(), this._two.clone());
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._one.startWithTarget(target);
+ this._two.startWithTarget(target);
+ },
+
+ /**
+ * Stop the action
+ */
+ stop:function () {
+ this._one.stop();
+ this._two.stop();
+ cc.Action.prototype.stop.call(this);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this._one)
+ this._one.update(dt);
+ if (this._two)
+ this._two.update(dt);
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.Spawn}
+ */
+ reverse:function () {
+ var action = cc.Spawn._actionOneTwo(this._one.reverse(), this._two.reverse());
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+
+/**
+ * Create a spawn action which runs several actions in parallel.
+ * @function
+ * @param {Array|cc.FiniteTimeAction}tempArray
+ * @return {cc.FiniteTimeAction}
+ * @example
+ * // example
+ * var action = cc.spawn(cc.jumpBy(2, cc.p(300, 0), 50, 4), cc.rotateBy(2, 720));
+ * todo:It should be the direct use new
+ */
+cc.spawn = function (/*Multiple Arguments*/tempArray) {
+ var paramArray = (tempArray instanceof Array) ? tempArray : arguments;
+ if ((paramArray.length > 0) && (paramArray[paramArray.length - 1] == null))
+ cc.log("parameters should not be ending with null in Javascript");
+
+ var prev = paramArray[0];
+ for (var i = 1; i < paramArray.length; i++) {
+ if (paramArray[i] != null)
+ prev = cc.Spawn._actionOneTwo(prev, paramArray[i]);
+ }
+ return prev;
+};
+
+/**
+ * Please use cc.spawn instead.
+ * Create a spawn action which runs several actions in parallel.
+ * @static
+ * @deprecated since v3.0 Please use cc.spawn instead.
+ * @param {Array|cc.FiniteTimeAction}tempArray
+ * @return {cc.FiniteTimeAction}
+ */
+cc.Spawn.create = cc.spawn;
+
+/**
+ * @param {cc.FiniteTimeAction} action1
+ * @param {cc.FiniteTimeAction} action2
+ * @return {cc.Spawn}
+ * @private
+ */
+cc.Spawn._actionOneTwo = function (action1, action2) {
+ var pSpawn = new cc.Spawn();
+ pSpawn.initWithTwoActions(action1, action2);
+ return pSpawn;
+};
+
+
+/**
+ * Rotates a cc.Node object to a certain angle by modifying it's.
+ * rotation attribute.
+ * The direction will be decided by the shortest angle.
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees.
+ * @param {Number} [deltaAngleY] deltaAngleY in degrees.
+ * @example
+ * var rotateTo = new cc.RotateTo(2, 61.0);
+ */
+cc.RotateTo = cc.ActionInterval.extend(/** @lends cc.RotateTo# */{
+ _dstAngleX:0,
+ _startAngleX:0,
+ _diffAngleX:0,
+
+ _dstAngleY:0,
+ _startAngleY:0,
+ _diffAngleY:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates a RotateTo action with x and y rotation angles.
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees.
+ * @param {Number} [deltaAngleY] deltaAngleY in degrees.
+ */
+ ctor:function (duration, deltaAngleX, deltaAngleY) {
+ cc.ActionInterval.prototype.ctor.call(this);
+
+ deltaAngleX !== undefined && this.initWithDuration(duration, deltaAngleX, deltaAngleY);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration
+ * @param {Number} deltaAngleX
+ * @param {Number} deltaAngleY
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, deltaAngleX, deltaAngleY) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this._dstAngleX = deltaAngleX || 0;
+ this._dstAngleY = deltaAngleY || this._dstAngleX;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.RotateTo}
+ */
+ clone:function () {
+ var action = new cc.RotateTo();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._dstAngleX, this._dstAngleY);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+
+ // Calculate X
+ var locStartAngleX = target.rotationX % 360.0;
+ var locDiffAngleX = this._dstAngleX - locStartAngleX;
+ if (locDiffAngleX > 180)
+ locDiffAngleX -= 360;
+ if (locDiffAngleX < -180)
+ locDiffAngleX += 360;
+ this._startAngleX = locStartAngleX;
+ this._diffAngleX = locDiffAngleX;
+
+ // Calculate Y It's duplicated from calculating X since the rotation wrap should be the same
+ this._startAngleY = target.rotationY % 360.0;
+ var locDiffAngleY = this._dstAngleY - this._startAngleY;
+ if (locDiffAngleY > 180)
+ locDiffAngleY -= 360;
+ if (locDiffAngleY < -180)
+ locDiffAngleY += 360;
+ this._diffAngleY = locDiffAngleY;
+ },
+
+ /**
+ * RotateTo reverse not implemented.
+ * Will be overridden.
+ */
+ reverse:function () {
+ cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.");
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this.target) {
+ this.target.rotationX = this._startAngleX + this._diffAngleX * dt;
+ this.target.rotationY = this._startAngleY + this._diffAngleY * dt;
+ }
+ }
+});
+
+/**
+ * Creates a RotateTo action with separate rotation angles.
+ * To specify the angle of rotation.
+ * @function
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees.
+ * @param {Number} [deltaAngleY] deltaAngleY in degrees.
+ * @return {cc.RotateTo}
+ * @example
+ * // example
+ * var rotateTo = cc.rotateTo(2, 61.0);
+ */
+cc.rotateTo = function (duration, deltaAngleX, deltaAngleY) {
+ return new cc.RotateTo(duration, deltaAngleX, deltaAngleY);
+};
+
+/**
+ * Please use cc.rotateTo instead
+ * Creates a RotateTo action with separate rotation angles.
+ * To specify the angle of rotation.
+ * @static
+ * @deprecated since v3.0 Please use cc.rotateTo instead.
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees.
+ * @param {Number} [deltaAngleY] deltaAngleY in degrees.
+ * @return {cc.RotateTo}
+ */
+cc.RotateTo.create = cc.rotateTo;
+
+
+/**
+ * Rotates a cc.Node object clockwise a number of degrees by modifying it's rotation attribute.
+ * Relative to its properties to modify.
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees
+ * @param {Number} [deltaAngleY] deltaAngleY in degrees
+ * @example
+ * var actionBy = new cc.RotateBy(2, 360);
+ */
+cc.RotateBy = cc.ActionInterval.extend(/** @lends cc.RotateBy# */{
+ _angleX:0,
+ _startAngleX:0,
+ _angleY:0,
+ _startAngleY:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees
+ * @param {Number} [deltaAngleY] deltaAngleY in degrees
+ */
+ ctor: function (duration, deltaAngleX, deltaAngleY) {
+ cc.ActionInterval.prototype.ctor.call(this);
+
+ deltaAngleX !== undefined && this.initWithDuration(duration, deltaAngleX, deltaAngleY);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees
+ * @param {Number} [deltaAngleY=] deltaAngleY in degrees
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, deltaAngleX, deltaAngleY) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this._angleX = deltaAngleX || 0;
+ this._angleY = deltaAngleY || this._angleX;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.RotateBy}
+ */
+ clone:function () {
+ var action = new cc.RotateBy();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._angleX, this._angleY);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._startAngleX = target.rotationX;
+ this._startAngleY = target.rotationY;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this.target) {
+ this.target.rotationX = this._startAngleX + this._angleX * dt;
+ this.target.rotationY = this._startAngleY + this._angleY * dt;
+ }
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.RotateBy}
+ */
+ reverse:function () {
+ var action = new cc.RotateBy(this._duration, -this._angleX, -this._angleY);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+
+/**
+ * Rotates a cc.Node object clockwise a number of degrees by modifying it's rotation attribute.
+ * Relative to its properties to modify.
+ * @function
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees
+ * @param {Number} [deltaAngleY] deltaAngleY in degrees
+ * @return {cc.RotateBy}
+ * @example
+ * // example
+ * var actionBy = cc.rotateBy(2, 360);
+ */
+cc.rotateBy = function (duration, deltaAngleX, deltaAngleY) {
+ return new cc.RotateBy(duration, deltaAngleX, deltaAngleY);
+};
+/**
+ * Please use cc.rotateBy instead.
+ * Rotates a cc.Node object clockwise a number of degrees by modifying it's rotation attribute.
+ * Relative to its properties to modify.
+ * @static
+ * @deprecated since v3.0 Please use cc.rotateBy instead.
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaAngleX deltaAngleX in degrees
+ * @param {Number} [deltaAngleY] deltaAngleY in degrees
+ * @return {cc.RotateBy}
+ */
+cc.RotateBy.create = cc.rotateBy;
+
+
+/**
+ *
+ * Moves a CCNode object x,y pixels by modifying it's position attribute.
+ * x and y are relative to the position of the object.
+ * Several CCMoveBy actions can be concurrently called, and the resulting
+ * movement will be the sum of individual movements.
+ *
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2|Number} deltaPos
+ * @param {Number} [deltaY]
+ * @example
+ * var actionTo = cc.moveBy(2, cc.p(windowSize.width - 40, windowSize.height - 40));
+ */
+cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{
+ _positionDelta:null,
+ _startPosition:null,
+ _previousPosition:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2|Number} deltaPos
+ * @param {Number} [deltaY]
+ */
+ ctor:function (duration, deltaPos, deltaY) {
+ cc.ActionInterval.prototype.ctor.call(this);
+
+ this._positionDelta = cc.p(0, 0);
+ this._startPosition = cc.p(0, 0);
+ this._previousPosition = cc.p(0, 0);
+
+ deltaPos !== undefined && this.initWithDuration(duration, deltaPos, deltaY);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2} position
+ * @param {Number} [y]
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, position, y) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ if(position.x !== undefined) {
+ y = position.y;
+ position = position.x;
+ }
+
+ this._positionDelta.x = position;
+ this._positionDelta.y = y;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.MoveBy}
+ */
+ clone:function () {
+ var action = new cc.MoveBy();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._positionDelta);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ var locPosX = target.getPositionX();
+ var locPosY = target.getPositionY();
+ this._previousPosition.x = locPosX;
+ this._previousPosition.y = locPosY;
+ this._startPosition.x = locPosX;
+ this._startPosition.y = locPosY;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this.target) {
+ var x = this._positionDelta.x * dt;
+ var y = this._positionDelta.y * dt;
+ var locStartPosition = this._startPosition;
+ if (cc.ENABLE_STACKABLE_ACTIONS) {
+ var targetX = this.target.getPositionX();
+ var targetY = this.target.getPositionY();
+ var locPreviousPosition = this._previousPosition;
+
+ locStartPosition.x = locStartPosition.x + targetX - locPreviousPosition.x;
+ locStartPosition.y = locStartPosition.y + targetY - locPreviousPosition.y;
+ x = x + locStartPosition.x;
+ y = y + locStartPosition.y;
+ locPreviousPosition.x = x;
+ locPreviousPosition.y = y;
+ this.target.setPosition(x, y);
+ } else {
+ this.target.setPosition(locStartPosition.x + x, locStartPosition.y + y);
+ }
+ }
+ },
+
+ /**
+ * MoveTo reverse is not implemented
+ * @return {cc.MoveBy}
+ */
+ reverse:function () {
+ var action = new cc.MoveBy(this._duration, cc.p(-this._positionDelta.x, -this._positionDelta.y));
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+
+/**
+ * Create the action.
+ * Relative to its coordinate moves a certain distance.
+ * @function
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2|Number} deltaPos
+ * @param {Number} deltaY
+ * @return {cc.MoveBy}
+ * @example
+ * // example
+ * var actionTo = cc.moveBy(2, cc.p(windowSize.width - 40, windowSize.height - 40));
+ */
+cc.moveBy = function (duration, deltaPos, deltaY) {
+ return new cc.MoveBy(duration, deltaPos, deltaY);
+};
+/**
+ * Please use cc.moveBy instead.
+ * Relative to its coordinate moves a certain distance.
+ * @static
+ * @deprecated since v3.0 please use cc.moveBy instead.
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2|Number} deltaPos
+ * @param {Number} deltaY
+ * @return {cc.MoveBy}
+ */
+cc.MoveBy.create = cc.moveBy;
+
+
+/**
+ * Moves a CCNode object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
+ * Several CCMoveTo actions can be concurrently called, and the resulting
+ * movement will be the sum of individual movements.
+ * @class
+ * @extends cc.MoveBy
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2|Number} position
+ * @param {Number} y
+ * @example
+ * var actionBy = new cc.MoveTo(2, cc.p(80, 80));
+ */
+cc.MoveTo = cc.MoveBy.extend(/** @lends cc.MoveTo# */{
+ _endPosition:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2|Number} position
+ * @param {Number} y
+ */
+ ctor:function (duration, position, y) {
+ cc.MoveBy.prototype.ctor.call(this);
+ this._endPosition = cc.p(0, 0);
+
+ position !== undefined && this.initWithDuration(duration, position, y);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2} position
+ * @param {Number} y
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, position, y) {
+ if (cc.MoveBy.prototype.initWithDuration.call(this, duration, position, y)) {
+ if(position.x !== undefined) {
+ y = position.y;
+ position = position.x;
+ }
+
+ this._endPosition.x = position;
+ this._endPosition.y = y;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.MoveTo}
+ */
+ clone:function () {
+ var action = new cc.MoveTo();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._endPosition);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.MoveBy.prototype.startWithTarget.call(this, target);
+ this._positionDelta.x = this._endPosition.x - target.getPositionX();
+ this._positionDelta.y = this._endPosition.y - target.getPositionY();
+ }
+});
+
+/**
+ * Create new action.
+ * Moving to the specified coordinates.
+ * @function
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2} position
+ * @param {Number} y
+ * @return {cc.MoveBy}
+ * @example
+ * // example
+ * var actionBy = cc.moveTo(2, cc.p(80, 80));
+ */
+cc.moveTo = function (duration, position, y) {
+ return new cc.MoveTo(duration, position, y);
+};
+/**
+ * Please use cc.moveTo instead.
+ * Moving to the specified coordinates.
+ * @static
+ * @deprecated since v3.0 Please use cc.moveTo instead.
+ * @param {Number} duration duration in seconds
+ * @param {cc.Vec2} position
+ * @param {Number} y
+ * @return {cc.MoveBy}
+ */
+cc.MoveTo.create = cc.moveTo;
+
+/**
+ * Skews a cc.Node object to given angles by modifying it's skewX and skewY attributes
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} t time in seconds
+ * @param {Number} sx
+ * @param {Number} sy
+ * @example
+ * var actionTo = new cc.SkewTo(2, 37.2, -37.2);
+ */
+cc.SkewTo = cc.ActionInterval.extend(/** @lends cc.SkewTo# */{
+ _skewX:0,
+ _skewY:0,
+ _startSkewX:0,
+ _startSkewY:0,
+ _endSkewX:0,
+ _endSkewY:0,
+ _deltaX:0,
+ _deltaY:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} t time in seconds
+ * @param {Number} sx
+ * @param {Number} sy
+ */
+ ctor: function (t, sx, sy) {
+ cc.ActionInterval.prototype.ctor.call(this);
+
+ sy !== undefined && this.initWithDuration(t, sx, sy);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} t time in seconds
+ * @param {Number} sx
+ * @param {Number} sy
+ * @return {Boolean}
+ */
+ initWithDuration:function (t, sx, sy) {
+ var ret = false;
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
+ this._endSkewX = sx;
+ this._endSkewY = sy;
+ ret = true;
+ }
+ return ret;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.SkewTo}
+ */
+ clone:function () {
+ var action = new cc.SkewTo();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._endSkewX, this._endSkewY);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+
+ this._startSkewX = target.skewX % 180;
+ this._deltaX = this._endSkewX - this._startSkewX;
+ if (this._deltaX > 180)
+ this._deltaX -= 360;
+ if (this._deltaX < -180)
+ this._deltaX += 360;
+
+ this._startSkewY = target.skewY % 360;
+ this._deltaY = this._endSkewY - this._startSkewY;
+ if (this._deltaY > 180)
+ this._deltaY -= 360;
+ if (this._deltaY < -180)
+ this._deltaY += 360;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ this.target.skewX = this._startSkewX + this._deltaX * dt;
+ this.target.skewY = this._startSkewY + this._deltaY * dt;
+ }
+});
+/**
+ * Create new action.
+ * Skews a cc.Node object to given angles by modifying it's skewX and skewY attributes.
+ * Changes to the specified value.
+ * @function
+ * @param {Number} t time in seconds
+ * @param {Number} sx
+ * @param {Number} sy
+ * @return {cc.SkewTo}
+ * @example
+ * // example
+ * var actionTo = cc.skewTo(2, 37.2, -37.2);
+ */
+cc.skewTo = function (t, sx, sy) {
+ return new cc.SkewTo(t, sx, sy);
+};
+/**
+ * Please use cc.skewTo instead.
+ * Skews a cc.Node object to given angles by modifying it's skewX and skewY attributes。
+ * Changes to the specified value.
+ * @static
+ * @deprecated since v3.0 Please use cc.skewTo instead.
+ * @param {Number} t time in seconds
+ * @param {Number} sx
+ * @param {Number} sy
+ * @return {cc.SkewTo}
+ */
+cc.SkewTo.create = cc.skewTo;
+
+/**
+ * Skews a cc.Node object by skewX and skewY degrees.
+ * Relative to its attribute modification.
+ * @class
+ * @extends cc.SkewTo
+ * @param {Number} t time in seconds
+ * @param {Number} sx skew in degrees for X axis
+ * @param {Number} sy skew in degrees for Y axis
+ */
+cc.SkewBy = cc.SkewTo.extend(/** @lends cc.SkewBy# */{
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} t time in seconds
+ * @param {Number} sx skew in degrees for X axis
+ * @param {Number} sy skew in degrees for Y axis
+ */
+ ctor: function(t, sx, sy) {
+ cc.SkewTo.prototype.ctor.call(this);
+ sy !== undefined && this.initWithDuration(t, sx, sy);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} t time in seconds
+ * @param {Number} deltaSkewX skew in degrees for X axis
+ * @param {Number} deltaSkewY skew in degrees for Y axis
+ * @return {Boolean}
+ */
+ initWithDuration:function (t, deltaSkewX, deltaSkewY) {
+ var ret = false;
+ if (cc.SkewTo.prototype.initWithDuration.call(this, t, deltaSkewX, deltaSkewY)) {
+ this._skewX = deltaSkewX;
+ this._skewY = deltaSkewY;
+ ret = true;
+ }
+ return ret;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.SkewBy}
+ */
+ clone:function () {
+ var action = new cc.SkewBy();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._skewX, this._skewY);
+ return action;
+ },
+
+ /**
+ * Start the action width target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.SkewTo.prototype.startWithTarget.call(this, target);
+ this._deltaX = this._skewX;
+ this._deltaY = this._skewY;
+ this._endSkewX = this._startSkewX + this._deltaX;
+ this._endSkewY = this._startSkewY + this._deltaY;
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.SkewBy}
+ */
+ reverse:function () {
+ var action = new cc.SkewBy(this._duration, -this._skewX, -this._skewY);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+
+/**
+ * Skews a cc.Node object by skewX and skewY degrees.
+ * Relative to its attribute modification.
+ * @function
+ * @param {Number} t time in seconds
+ * @param {Number} sx sx skew in degrees for X axis
+ * @param {Number} sy sy skew in degrees for Y axis
+ * @return {cc.SkewBy}
+ * @example
+ * // example
+ * var actionBy = cc.skewBy(2, 0, -90);
+ */
+cc.skewBy = function (t, sx, sy) {
+ return new cc.SkewBy(t, sx, sy);
+};
+/**
+ * Please use cc.skewBy instead.
+ * Skews a cc.Node object by skewX and skewY degrees.
+ * Relative to its attribute modification.
+ * @static
+ * @deprecated since v3.0 please use cc.skewBy instead.
+ * @param {Number} t time in seconds
+ * @param {Number} sx sx skew in degrees for X axis
+ * @param {Number} sy sy skew in degrees for Y axis
+ * @return {cc.SkewBy}
+ */
+cc.SkewBy.create = cc.skewBy;
+
+
+/**
+ * Moves a cc.Node object simulating a parabolic jump movement by modifying it's position attribute.
+ * Relative to its movement.
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ * @example
+ * var actionBy = new cc.JumpBy(2, cc.p(300, 0), 50, 4);
+ * var actionBy = new cc.JumpBy(2, 300, 0, 50, 4);
+ */
+cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{
+ _startPosition:null,
+ _delta:null,
+ _height:0,
+ _jumps:0,
+ _previousPosition:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ */
+ ctor:function (duration, position, y, height, jumps) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._startPosition = cc.p(0, 0);
+ this._previousPosition = cc.p(0, 0);
+ this._delta = cc.p(0, 0);
+
+ height !== undefined && this.initWithDuration(duration, position, y, height, jumps);
+ },
+ /**
+ * Initializes the action.
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ * @return {Boolean}
+ * @example
+ * actionBy.initWithDuration(2, cc.p(300, 0), 50, 4);
+ * actionBy.initWithDuration(2, 300, 0, 50, 4);
+ */
+ initWithDuration:function (duration, position, y, height, jumps) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ if (jumps === undefined) {
+ jumps = height;
+ height = y;
+ y = position.y;
+ position = position.x;
+ }
+ this._delta.x = position;
+ this._delta.y = y;
+ this._height = height;
+ this._jumps = jumps;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.JumpBy}
+ */
+ clone:function () {
+ var action = new cc.JumpBy();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._delta, this._height, this._jumps);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ var locPosX = target.getPositionX();
+ var locPosY = target.getPositionY();
+ this._previousPosition.x = locPosX;
+ this._previousPosition.y = locPosY;
+ this._startPosition.x = locPosX;
+ this._startPosition.y = locPosY;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this.target) {
+ var frac = dt * this._jumps % 1.0;
+ var y = this._height * 4 * frac * (1 - frac);
+ y += this._delta.y * dt;
+
+ var x = this._delta.x * dt;
+ var locStartPosition = this._startPosition;
+ if (cc.ENABLE_STACKABLE_ACTIONS) {
+ var targetX = this.target.getPositionX();
+ var targetY = this.target.getPositionY();
+ var locPreviousPosition = this._previousPosition;
+
+ locStartPosition.x = locStartPosition.x + targetX - locPreviousPosition.x;
+ locStartPosition.y = locStartPosition.y + targetY - locPreviousPosition.y;
+ x = x + locStartPosition.x;
+ y = y + locStartPosition.y;
+ locPreviousPosition.x = x;
+ locPreviousPosition.y = y;
+ this.target.setPosition(x, y);
+ } else {
+ this.target.setPosition(locStartPosition.x + x, locStartPosition.y + y);
+ }
+ }
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.JumpBy}
+ */
+ reverse:function () {
+ var action = new cc.JumpBy(this._duration, cc.p(-this._delta.x, -this._delta.y), this._height, this._jumps);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+
+/**
+ * Moves a cc.Node object simulating a parabolic jump movement by modifying it's position attribute.
+ * Relative to its movement.
+ * @function
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ * @return {cc.JumpBy}
+ * @example
+ * // example
+ * var actionBy = cc.jumpBy(2, cc.p(300, 0), 50, 4);
+ * var actionBy = cc.jumpBy(2, 300, 0, 50, 4);
+ */
+cc.jumpBy = function (duration, position, y, height, jumps) {
+ return new cc.JumpBy(duration, position, y, height, jumps);
+};
+/**
+ * Please use cc.jumpBy instead.
+ * Moves a cc.Node object simulating a parabolic jump movement by modifying it's position attribute.
+ * Relative to its movement.
+ * @static
+ * @deprecated since v3.0 please use cc.jumpBy instead.
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ * @return {cc.JumpBy}
+ */
+cc.JumpBy.create = cc.jumpBy;
+
+/**
+ * Moves a cc.Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
+ * Jump to the specified location.
+ * @class
+ * @extends cc.JumpBy
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ * @example
+ * var actionTo = new cc.JumpTo(2, cc.p(300, 0), 50, 4);
+ * var actionTo = new cc.JumpTo(2, 300, 0, 50, 4);
+ */
+cc.JumpTo = cc.JumpBy.extend(/** @lends cc.JumpTo# */{
+ _endPosition:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ */
+ ctor:function (duration, position, y, height, jumps) {
+ cc.JumpBy.prototype.ctor.call(this);
+ this._endPosition = cc.p(0, 0);
+
+ height !== undefined && this.initWithDuration(duration, position, y, height, jumps);
+ },
+ /**
+ * Initializes the action.
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ * @return {Boolean}
+ * @example
+ * actionTo.initWithDuration(2, cc.p(300, 0), 50, 4);
+ * actionTo.initWithDuration(2, 300, 0, 50, 4);
+ */
+ initWithDuration:function (duration, position, y, height, jumps) {
+ if (cc.JumpBy.prototype.initWithDuration.call(this, duration, position, y, height, jumps)) {
+ if (jumps === undefined) {
+ y = position.y;
+ position = position.x;
+ }
+ this._endPosition.x = position;
+ this._endPosition.y = y;
+ return true;
+ }
+ return false;
+ },
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.JumpBy.prototype.startWithTarget.call(this, target);
+ this._delta.x = this._endPosition.x - this._startPosition.x;
+ this._delta.y = this._endPosition.y - this._startPosition.y;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.JumpTo}
+ */
+ clone:function () {
+ var action = new cc.JumpTo();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._endPosition, this._height, this._jumps);
+ return action;
+ }
+});
+
+/**
+ * Moves a cc.Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
+ * Jump to the specified location.
+ * @function
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ * @return {cc.JumpTo}
+ * @example
+ * // example
+ * var actionTo = cc.jumpTo(2, cc.p(300, 300), 50, 4);
+ * var actionTo = cc.jumpTo(2, 300, 300, 50, 4);
+ */
+cc.jumpTo = function (duration, position, y, height, jumps) {
+ return new cc.JumpTo(duration, position, y, height, jumps);
+};
+/**
+ * Please use cc.jumpTo instead.
+ * Moves a cc.Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
+ * Jump to the specified location.
+ * @static
+ * @deprecated since v3.0 please use cc.jumpTo instead.
+ * @param {Number} duration
+ * @param {cc.Vec2|Number} position
+ * @param {Number} [y]
+ * @param {Number} height
+ * @param {Number} jumps
+ * @return {cc.JumpTo}
+ */
+cc.JumpTo.create = cc.jumpTo;
+
+/**
+ * @function
+ * @param {Number} a
+ * @param {Number} b
+ * @param {Number} c
+ * @param {Number} d
+ * @param {Number} t
+ * @return {Number}
+ */
+cc.bezierAt = function (a, b, c, d, t) {
+ return (Math.pow(1 - t, 3) * a +
+ 3 * t * (Math.pow(1 - t, 2)) * b +
+ 3 * Math.pow(t, 2) * (1 - t) * c +
+ Math.pow(t, 3) * d );
+};
+
+/** An action that moves the target with a cubic Bezier curve by a certain distance.
+ * Relative to its movement.
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} t time in seconds
+ * @param {Array} c Array of points
+ * @example
+ * var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)];
+ * var bezierForward = new cc.BezierBy(3, bezier);
+ */
+cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{
+ _config:null,
+ _startPosition:null,
+ _previousPosition:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} t time in seconds
+ * @param {Array} c Array of points
+ */
+ ctor:function (t, c) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._config = [];
+ this._startPosition = cc.p(0, 0);
+ this._previousPosition = cc.p(0, 0);
+
+ c && this.initWithDuration(t, c);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} t time in seconds
+ * @param {Array} c Array of points
+ * @return {Boolean}
+ */
+ initWithDuration:function (t, c) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
+ this._config = c;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.BezierBy}
+ */
+ clone:function () {
+ var action = new cc.BezierBy();
+ this._cloneDecoration(action);
+ var newConfigs = [];
+ for (var i = 0; i < this._config.length; i++) {
+ var selConf = this._config[i];
+ newConfigs.push(cc.p(selConf.x, selConf.y));
+ }
+ action.initWithDuration(this._duration, newConfigs);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ var locPosX = target.getPositionX();
+ var locPosY = target.getPositionY();
+ this._previousPosition.x = locPosX;
+ this._previousPosition.y = locPosY;
+ this._startPosition.x = locPosX;
+ this._startPosition.y = locPosY;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this.target) {
+ var locConfig = this._config;
+ var xa = 0;
+ var xb = locConfig[0].x;
+ var xc = locConfig[1].x;
+ var xd = locConfig[2].x;
+
+ var ya = 0;
+ var yb = locConfig[0].y;
+ var yc = locConfig[1].y;
+ var yd = locConfig[2].y;
+
+ var x = cc.bezierAt(xa, xb, xc, xd, dt);
+ var y = cc.bezierAt(ya, yb, yc, yd, dt);
+
+ var locStartPosition = this._startPosition;
+ if (cc.ENABLE_STACKABLE_ACTIONS) {
+ var targetX = this.target.getPositionX();
+ var targetY = this.target.getPositionY();
+ var locPreviousPosition = this._previousPosition;
+
+ locStartPosition.x = locStartPosition.x + targetX - locPreviousPosition.x;
+ locStartPosition.y = locStartPosition.y + targetY - locPreviousPosition.y;
+ x = x + locStartPosition.x;
+ y = y + locStartPosition.y;
+ locPreviousPosition.x = x;
+ locPreviousPosition.y = y;
+ this.target.setPosition(x, y);
+ } else {
+ this.target.setPosition(locStartPosition.x + x, locStartPosition.y + y);
+ }
+ }
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.BezierBy}
+ */
+ reverse:function () {
+ var locConfig = this._config;
+ var r = [
+ cc.pAdd(locConfig[1], cc.pNeg(locConfig[2])),
+ cc.pAdd(locConfig[0], cc.pNeg(locConfig[2])),
+ cc.pNeg(locConfig[2]) ];
+ var action = new cc.BezierBy(this._duration, r);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+
+/**
+ * An action that moves the target with a cubic Bezier curve by a certain distance.
+ * Relative to its movement.
+ * @function
+ * @param {Number} t time in seconds
+ * @param {Array} c Array of points
+ * @return {cc.BezierBy}
+ * @example
+ * // example
+ * var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)];
+ * var bezierForward = cc.bezierBy(3, bezier);
+ */
+cc.bezierBy = function (t, c) {
+ return new cc.BezierBy(t, c);
+};
+/**
+ * Please use cc.bezierBy instead.
+ * An action that moves the target with a cubic Bezier curve by a certain distance.
+ * Relative to its movement.
+ * @static
+ * @deprecated since v3.0 please use cc.bezierBy instead.
+ * @param {Number} t time in seconds
+ * @param {Array} c Array of points
+ * @return {cc.BezierBy}
+ */
+cc.BezierBy.create = cc.bezierBy;
+
+
+/** An action that moves the target with a cubic Bezier curve to a destination point.
+ * @class
+ * @extends cc.BezierBy
+ * @param {Number} t
+ * @param {Array} c array of points
+ * @example
+ * var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)];
+ * var bezierTo = new cc.BezierTo(2, bezier);
+ */
+cc.BezierTo = cc.BezierBy.extend(/** @lends cc.BezierTo# */{
+ _toConfig:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} t
+ * @param {Array} c array of points
+ * var bezierTo = new cc.BezierTo(2, bezier);
+ */
+ ctor:function (t, c) {
+ cc.BezierBy.prototype.ctor.call(this);
+ this._toConfig = [];
+ c && this.initWithDuration(t, c);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} t time in seconds
+ * @param {Array} c Array of points
+ * @return {Boolean}
+ */
+ initWithDuration:function (t, c) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, t)) {
+ this._toConfig = c;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.BezierTo}
+ */
+ clone:function () {
+ var action = new cc.BezierTo();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._toConfig);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.BezierBy.prototype.startWithTarget.call(this, target);
+ var locStartPos = this._startPosition;
+ var locToConfig = this._toConfig;
+ var locConfig = this._config;
+
+ locConfig[0] = cc.pSub(locToConfig[0], locStartPos);
+ locConfig[1] = cc.pSub(locToConfig[1], locStartPos);
+ locConfig[2] = cc.pSub(locToConfig[2], locStartPos);
+ }
+});
+/**
+ * An action that moves the target with a cubic Bezier curve to a destination point.
+ * @function
+ * @param {Number} t
+ * @param {Array} c array of points
+ * @return {cc.BezierTo}
+ * @example
+ * // example
+ * var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)];
+ * var bezierTo = cc.bezierTo(2, bezier);
+ */
+cc.bezierTo = function (t, c) {
+ return new cc.BezierTo(t, c);
+};
+/**
+ * Please use cc.bezierTo instead
+ * @static
+ * @deprecated since v3.0 please use cc.bezierTo instead.
+ * @param {Number} t
+ * @param {Array} c array of points
+ * @return {cc.BezierTo}
+ */
+cc.BezierTo.create = cc.bezierTo;
+
+
+/** Scales a cc.Node object to a zoom factor by modifying it's scale attribute.
+ * @warning This action doesn't support "reverse"
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration
+ * @param {Number} sx scale parameter in X
+ * @param {Number} [sy] scale parameter in Y, if Null equal to sx
+ * @example
+ * // It scales to 0.5 in both X and Y.
+ * var actionTo = new cc.ScaleTo(2, 0.5);
+ *
+ * // It scales to 0.5 in x and 2 in Y
+ * var actionTo = new cc.ScaleTo(2, 0.5, 2);
+ */
+cc.ScaleTo = cc.ActionInterval.extend(/** @lends cc.ScaleTo# */{
+ _scaleX:1,
+ _scaleY:1,
+ _startScaleX:1,
+ _startScaleY:1,
+ _endScaleX:0,
+ _endScaleY:0,
+ _deltaX:0,
+ _deltaY:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration
+ * @param {Number} sx scale parameter in X
+ * @param {Number} [sy] scale parameter in Y, if Null equal to sx
+ */
+ ctor:function (duration, sx, sy) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ sx !== undefined && this.initWithDuration(duration, sx, sy);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration
+ * @param {Number} sx
+ * @param {Number} [sy=]
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, sx, sy) { //function overload here
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this._endScaleX = sx;
+ this._endScaleY = (sy != null) ? sy : sx;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.ScaleTo}
+ */
+ clone:function () {
+ var action = new cc.ScaleTo();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._endScaleX, this._endScaleY);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._startScaleX = target.scaleX;
+ this._startScaleY = target.scaleY;
+ this._deltaX = this._endScaleX - this._startScaleX;
+ this._deltaY = this._endScaleY - this._startScaleY;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this.target) {
+ this.target.scaleX = this._startScaleX + this._deltaX * dt;
+ this.target.scaleY = this._startScaleY + this._deltaY * dt;
+ }
+ }
+});
+/**
+ * Scales a cc.Node object to a zoom factor by modifying it's scale attribute.
+ * @function
+ * @param {Number} duration
+ * @param {Number} sx scale parameter in X
+ * @param {Number} [sy] scale parameter in Y, if Null equal to sx
+ * @return {cc.ScaleTo}
+ * @example
+ * // example
+ * // It scales to 0.5 in both X and Y.
+ * var actionTo = cc.scaleTo(2, 0.5);
+ *
+ * // It scales to 0.5 in x and 2 in Y
+ * var actionTo = cc.scaleTo(2, 0.5, 2);
+ */
+cc.scaleTo = function (duration, sx, sy) { //function overload
+ return new cc.ScaleTo(duration, sx, sy);
+};
+/**
+ * Please use cc.scaleTo instead.
+ * Scales a cc.Node object to a zoom factor by modifying it's scale attribute.
+ * @static
+ * @deprecated since v3.0 please use cc.scaleTo instead.
+ * @param {Number} duration
+ * @param {Number} sx scale parameter in X
+ * @param {Number} [sy] scale parameter in Y, if Null equal to sx
+ * @return {cc.ScaleTo}
+ */
+cc.ScaleTo.create = cc.scaleTo;
+
+
+/** Scales a cc.Node object a zoom factor by modifying it's scale attribute.
+ * Relative to its changes.
+ * @class
+ * @extends cc.ScaleTo
+ */
+cc.ScaleBy = cc.ScaleTo.extend(/** @lends cc.ScaleBy# */{
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ScaleTo.prototype.startWithTarget.call(this, target);
+ this._deltaX = this._startScaleX * this._endScaleX - this._startScaleX;
+ this._deltaY = this._startScaleY * this._endScaleY - this._startScaleY;
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.ScaleBy}
+ */
+ reverse:function () {
+ var action = new cc.ScaleBy(this._duration, 1 / this._endScaleX, 1 / this._endScaleY);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.ScaleBy}
+ */
+ clone:function () {
+ var action = new cc.ScaleBy();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._endScaleX, this._endScaleY);
+ return action;
+ }
+});
+/**
+ * Scales a cc.Node object a zoom factor by modifying it's scale attribute.
+ * Relative to its changes.
+ * @function
+ * @param {Number} duration duration in seconds
+ * @param {Number} sx sx scale parameter in X
+ * @param {Number|Null} [sy=] sy scale parameter in Y, if Null equal to sx
+ * @return {cc.ScaleBy}
+ * @example
+ * // example without sy, it scales by 2 both in X and Y
+ * var actionBy = cc.scaleBy(2, 2);
+ *
+ * //example with sy, it scales by 0.25 in X and 4.5 in Y
+ * var actionBy2 = cc.scaleBy(2, 0.25, 4.5);
+ */
+cc.scaleBy = function (duration, sx, sy) {
+ return new cc.ScaleBy(duration, sx, sy);
+};
+/**
+ * Please use cc.scaleBy instead.
+ * Scales a cc.Node object a zoom factor by modifying it's scale attribute.
+ * Relative to its changes.
+ * @static
+ * @deprecated since v3.0 please use cc.scaleBy() instead.
+ * @param {Number} duration duration in seconds
+ * @param {Number} sx sx scale parameter in X
+ * @param {Number|Null} [sy=] sy scale parameter in Y, if Null equal to sx
+ * @return {cc.ScaleBy}
+ */
+cc.ScaleBy.create = cc.scaleBy;
+
+/** Blinks a cc.Node object by modifying it's visible attribute
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration duration in seconds
+ * @param {Number} blinks blinks in times
+ * @example
+ * var action = new cc.Blink(2, 10);
+ */
+cc.Blink = cc.ActionInterval.extend(/** @lends cc.Blink# */{
+ _times:0,
+ _originalState:false,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration duration in seconds
+ * @param {Number} blinks blinks in times
+ */
+ ctor:function (duration, blinks) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ blinks !== undefined && this.initWithDuration(duration, blinks);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration duration in seconds
+ * @param {Number} blinks blinks in times
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, blinks) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this._times = blinks;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.Blink}
+ */
+ clone:function () {
+ var action = new cc.Blink();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._times);
+ return action;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt time in seconds
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this.target && !this.isDone()) {
+ var slice = 1.0 / this._times;
+ var m = dt % slice;
+ this.target.visible = (m > (slice / 2));
+ }
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._originalState = target.visible;
+ },
+
+ /**
+ * stop the action
+ */
+ stop:function () {
+ this.target.visible = this._originalState;
+ cc.ActionInterval.prototype.stop.call(this);
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.Blink}
+ */
+ reverse:function () {
+ var action = new cc.Blink(this._duration, this._times);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+/**
+ * Blinks a cc.Node object by modifying it's visible attribute.
+ * @function
+ * @param {Number} duration duration in seconds
+ * @param blinks blinks in times
+ * @return {cc.Blink}
+ * @example
+ * // example
+ * var action = cc.blink(2, 10);
+ */
+cc.blink = function (duration, blinks) {
+ return new cc.Blink(duration, blinks);
+};
+/**
+ * Please use cc.blink instead.
+ * Blinks a cc.Node object by modifying it's visible attribute.
+ * @static
+ * @deprecated since v3.0 please use cc.blink instead.
+ * @param {Number} duration duration in seconds
+ * @param blinks blinks in times
+ * @return {cc.Blink}
+ */
+cc.Blink.create = cc.blink;
+
+/** Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
+ * @warning This action doesn't support "reverse"
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration
+ * @param {Number} opacity 0-255, 0 is transparent
+ * @example
+ * var action = new cc.FadeTo(1.0, 0);
+ */
+cc.FadeTo = cc.ActionInterval.extend(/** @lends cc.FadeTo# */{
+ _toOpacity:0,
+ _fromOpacity:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration
+ * @param {Number} opacity 0-255, 0 is transparent
+ */
+ ctor:function (duration, opacity) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ opacity !== undefined && this.initWithDuration(duration, opacity);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration duration in seconds
+ * @param {Number} opacity
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, opacity) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this._toOpacity = opacity;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.FadeTo}
+ */
+ clone:function () {
+ var action = new cc.FadeTo();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._toOpacity);
+ return action;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} time time in seconds
+ */
+ update:function (time) {
+ time = this._computeEaseTime(time);
+ var fromOpacity = this._fromOpacity !== undefined ? this._fromOpacity : 255;
+ this.target.opacity = fromOpacity + (this._toOpacity - fromOpacity) * time;
+ },
+
+ /**
+ * Start this action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._fromOpacity = target.opacity;
+ }
+});
+
+/**
+ * Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
+ * @function
+ * @param {Number} duration
+ * @param {Number} opacity 0-255, 0 is transparent
+ * @return {cc.FadeTo}
+ * @example
+ * // example
+ * var action = cc.fadeTo(1.0, 0);
+ */
+cc.fadeTo = function (duration, opacity) {
+ return new cc.FadeTo(duration, opacity);
+};
+/**
+ * Please use cc.fadeTo instead.
+ * Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
+ * @static
+ * @deprecated since v3.0 please use cc.fadeTo instead.
+ * @param {Number} duration
+ * @param {Number} opacity 0-255, 0 is transparent
+ * @return {cc.FadeTo}
+ */
+cc.FadeTo.create = cc.fadeTo;
+
+/** Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
+ * The "reverse" of this action is FadeOut
+ * @class
+ * @extends cc.FadeTo
+ * @param {Number} duration duration in seconds
+ */
+cc.FadeIn = cc.FadeTo.extend(/** @lends cc.FadeIn# */{
+ _reverseAction: null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration duration in seconds
+ */
+ ctor:function (duration) {
+ cc.FadeTo.prototype.ctor.call(this);
+ if (duration == null)
+ duration = 0;
+ this.initWithDuration(duration, 255);
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.FadeOut}
+ */
+ reverse:function () {
+ var action = new cc.FadeOut();
+ action.initWithDuration(this._duration, 0);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.FadeIn}
+ */
+ clone:function () {
+ var action = new cc.FadeIn();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._toOpacity);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ if(this._reverseAction)
+ this._toOpacity = this._reverseAction._fromOpacity;
+ cc.FadeTo.prototype.startWithTarget.call(this, target);
+ }
+});
+
+/**
+ * Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
+ * @function
+ * @param {Number} duration duration in seconds
+ * @return {cc.FadeIn}
+ * @example
+ * //example
+ * var action = cc.fadeIn(1.0);
+ */
+cc.fadeIn = function (duration) {
+ return new cc.FadeIn(duration);
+};
+/**
+ * Please use cc.fadeIn instead.
+ * Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
+ * @static
+ * @deprecated since v3.0 please use cc.fadeIn() instead.
+ * @param {Number} duration duration in seconds
+ * @return {cc.FadeIn}
+ */
+cc.FadeIn.create = cc.fadeIn;
+
+
+/** Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.
+ * The "reverse" of this action is FadeIn
+ * @class
+ * @extends cc.FadeTo
+ * @param {Number} duration duration in seconds
+ */
+cc.FadeOut = cc.FadeTo.extend(/** @lends cc.FadeOut# */{
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration duration in seconds
+ */
+ ctor:function (duration) {
+ cc.FadeTo.prototype.ctor.call(this);
+ if (duration == null)
+ duration = 0;
+ this.initWithDuration(duration, 0);
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.FadeIn}
+ */
+ reverse:function () {
+ var action = new cc.FadeIn();
+ action._reverseAction = this;
+ action.initWithDuration(this._duration, 255);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.FadeOut}
+ */
+ clone:function () {
+ var action = new cc.FadeOut();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._toOpacity);
+ return action;
+ }
+});
+
+/**
+ * Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.
+ * @function
+ * @param {Number} d duration in seconds
+ * @return {cc.FadeOut}
+ * @example
+ * // example
+ * var action = cc.fadeOut(1.0);
+ */
+cc.fadeOut = function (d) {
+ return new cc.FadeOut(d);
+};
+/**
+ * Please use cc.fadeOut instead.
+ * Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.
+ * @static
+ * @deprecated since v3.0 please use cc.fadeOut instead.
+ * @param {Number} d duration in seconds
+ * @return {cc.FadeOut}
+ */
+cc.FadeOut.create = cc.fadeOut;
+
+/** Tints a cc.Node that implements the cc.NodeRGB protocol from current tint to a custom one.
+ * @warning This action doesn't support "reverse"
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration
+ * @param {Number} red 0-255
+ * @param {Number} green 0-255
+ * @param {Number} blue 0-255
+ * @example
+ * var action = new cc.TintTo(2, 255, 0, 255);
+ */
+cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{
+ _to:null,
+ _from:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration
+ * @param {Number} red 0-255
+ * @param {Number} green 0-255
+ * @param {Number} blue 0-255
+ */
+ ctor:function (duration, red, green, blue) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._to = cc.color(0, 0, 0);
+ this._from = cc.color(0, 0, 0);
+
+ blue !== undefined && this.initWithDuration(duration, red, green, blue);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration
+ * @param {Number} red 0-255
+ * @param {Number} green 0-255
+ * @param {Number} blue 0-255
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, red, green, blue) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this._to = cc.color(red, green, blue);
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.TintTo}
+ */
+ clone:function () {
+ var action = new cc.TintTo();
+ this._cloneDecoration(action);
+ var locTo = this._to;
+ action.initWithDuration(this._duration, locTo.r, locTo.g, locTo.b);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+
+ this._from = this.target.color;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt time in seconds
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ var locFrom = this._from, locTo = this._to;
+ if (locFrom) {
+ this.target.setColor(
+ cc.color(
+ locFrom.r + (locTo.r - locFrom.r) * dt,
+ locFrom.g + (locTo.g - locFrom.g) * dt,
+ locFrom.b + (locTo.b - locFrom.b) * dt)
+ );
+ }
+ }
+});
+
+/**
+ * Tints a cc.Node that implements the cc.NodeRGB protocol from current tint to a custom one.
+ * @function
+ * @param {Number} duration
+ * @param {Number} red 0-255
+ * @param {Number} green 0-255
+ * @param {Number} blue 0-255
+ * @return {cc.TintTo}
+ * @example
+ * // example
+ * var action = cc.tintTo(2, 255, 0, 255);
+ */
+cc.tintTo = function (duration, red, green, blue) {
+ return new cc.TintTo(duration, red, green, blue);
+};
+/**
+ * Please use cc.tintTo instead.
+ * Tints a cc.Node that implements the cc.NodeRGB protocol from current tint to a custom one.
+ * @static
+ * @deprecated since v3.0 please use cc.tintTo instead.
+ * @param {Number} duration
+ * @param {Number} red 0-255
+ * @param {Number} green 0-255
+ * @param {Number} blue 0-255
+ * @return {cc.TintTo}
+ */
+cc.TintTo.create = cc.tintTo;
+
+
+/** Tints a cc.Node that implements the cc.NodeRGB protocol from current tint to a custom one.
+ * Relative to their own color change.
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaRed
+ * @param {Number} deltaGreen
+ * @param {Number} deltaBlue
+ * @example
+ * var action = new cc.TintBy(2, -127, -255, -127);
+ */
+cc.TintBy = cc.ActionInterval.extend(/** @lends cc.TintBy# */{
+ _deltaR:0,
+ _deltaG:0,
+ _deltaB:0,
+
+ _fromR:0,
+ _fromG:0,
+ _fromB:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaRed
+ * @param {Number} deltaGreen
+ * @param {Number} deltaBlue
+ */
+ ctor:function (duration, deltaRed, deltaGreen, deltaBlue) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ deltaBlue !== undefined && this.initWithDuration(duration, deltaRed, deltaGreen, deltaBlue);
+ },
+
+ /**
+ * Initializes the action.
+ * @param {Number} duration
+ * @param {Number} deltaRed 0-255
+ * @param {Number} deltaGreen 0-255
+ * @param {Number} deltaBlue 0-255
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, deltaRed, deltaGreen, deltaBlue) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this._deltaR = deltaRed;
+ this._deltaG = deltaGreen;
+ this._deltaB = deltaBlue;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.TintBy}
+ */
+ clone:function () {
+ var action = new cc.TintBy();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration, this._deltaR, this._deltaG, this._deltaB);
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+
+ var color = target.color;
+ this._fromR = color.r;
+ this._fromG = color.g;
+ this._fromB = color.b;
+
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt time in seconds
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+
+ this.target.color = cc.color(this._fromR + this._deltaR * dt,
+ this._fromG + this._deltaG * dt,
+ this._fromB + this._deltaB * dt);
+
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.TintBy}
+ */
+ reverse:function () {
+ var action = new cc.TintBy(this._duration, -this._deltaR, -this._deltaG, -this._deltaB);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ }
+});
+
+/**
+ * Tints a cc.Node that implements the cc.NodeRGB protocol from current tint to a custom one.
+ * Relative to their own color change.
+ * @function
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaRed
+ * @param {Number} deltaGreen
+ * @param {Number} deltaBlue
+ * @return {cc.TintBy}
+ * @example
+ * // example
+ * var action = cc.tintBy(2, -127, -255, -127);
+ */
+cc.tintBy = function (duration, deltaRed, deltaGreen, deltaBlue) {
+ return new cc.TintBy(duration, deltaRed, deltaGreen, deltaBlue);
+};
+/**
+ * Please use cc.tintBy instead.
+ * Tints a cc.Node that implements the cc.NodeRGB protocol from current tint to a custom one.
+ * Relative to their own color change.
+ * @static
+ * @deprecated since v3.0 please use cc.tintBy instead.
+ * @param {Number} duration duration in seconds
+ * @param {Number} deltaRed
+ * @param {Number} deltaGreen
+ * @param {Number} deltaBlue
+ * @return {cc.TintBy}
+ */
+cc.TintBy.create = cc.tintBy;
+
+/** Delays the action a certain amount of seconds
+ * @class
+ * @extends cc.ActionInterval
+ */
+cc.DelayTime = cc.ActionInterval.extend(/** @lends cc.DelayTime# */{
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * Will be overwrite.
+ * @param {Number} dt time in seconds
+ */
+ update:function (dt) {},
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.DelayTime}
+ */
+ reverse:function () {
+ var action = new cc.DelayTime(this._duration);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+ return action;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.DelayTime}
+ */
+ clone:function () {
+ var action = new cc.DelayTime();
+ this._cloneDecoration(action);
+ action.initWithDuration(this._duration);
+ return action;
+ }
+});
+
+/**
+ * Delays the action a certain amount of seconds
+ * @function
+ * @param {Number} d duration in seconds
+ * @return {cc.DelayTime}
+ * @example
+ * // example
+ * var delay = cc.delayTime(1);
+ */
+cc.delayTime = function (d) {
+ return new cc.DelayTime(d);
+};
+/**
+ * Please use cc.delayTime instead.
+ * Delays the action a certain amount of seconds
+ * @static
+ * @deprecated since v3.0 please use cc.delaTime instead.
+ * @param {Number} d duration in seconds
+ * @return {cc.DelayTime}
+ */
+cc.DelayTime.create = cc.delayTime;
+
+/**
+ *
+ * Executes an action in reverse order, from time=duration to time=0
+ * @warning Use this action carefully. This action is not sequenceable.
+ * Use it as the default "reversed" method of your own actions, but using it outside the "reversed"
+ * scope is not recommended.
+ *
+ * @class
+ * @extends cc.ActionInterval
+ * @param {cc.FiniteTimeAction} action
+ * @example
+ * var reverse = new cc.ReverseTime(this);
+ */
+cc.ReverseTime = cc.ActionInterval.extend(/** @lends cc.ReverseTime# */{
+ _other:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {cc.FiniteTimeAction} action
+ */
+ ctor:function (action) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._other = null;
+
+ action && this.initWithAction(action);
+ },
+
+ /**
+ * @param {cc.FiniteTimeAction} action
+ * @return {Boolean}
+ */
+ initWithAction:function (action) {
+ if(!action)
+ throw new Error("cc.ReverseTime.initWithAction(): action must be non null");
+ if(action === this._other)
+ throw new Error("cc.ReverseTime.initWithAction(): the action was already passed in.");
+
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, action._duration)) {
+ // Don't leak if action is reused
+ this._other = action;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.ReverseTime}
+ */
+ clone:function () {
+ var action = new cc.ReverseTime();
+ this._cloneDecoration(action);
+ action.initWithAction(this._other.clone());
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._other.startWithTarget(target);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt time in seconds
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ if (this._other)
+ this._other.update(1 - dt);
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.ActionInterval}
+ */
+ reverse:function () {
+ return this._other.clone();
+ },
+
+ /**
+ * Stop the action
+ */
+ stop:function () {
+ this._other.stop();
+ cc.Action.prototype.stop.call(this);
+ }
+});
+
+/**
+ * Executes an action in reverse order, from time=duration to time=0.
+ * @function
+ * @param {cc.FiniteTimeAction} action
+ * @return {cc.ReverseTime}
+ * @example
+ * // example
+ * var reverse = cc.reverseTime(this);
+ */
+cc.reverseTime = function (action) {
+ return new cc.ReverseTime(action);
+};
+/**
+ * Please use cc.reverseTime instead.
+ * Executes an action in reverse order, from time=duration to time=0.
+ * @static
+ * @deprecated since v3.0 please use cc.reverseTime instead.
+ * @param {cc.FiniteTimeAction} action
+ * @return {cc.ReverseTime}
+ */
+cc.ReverseTime.create = cc.reverseTime;
+
+
+/** Animates a sprite given the name of an Animation
+ * @class
+ * @extends cc.ActionInterval
+ * @param {cc.Animation} animation
+ * @example
+ * // create the animation with animation
+ * var anim = new cc.Animate(dance_grey);
+ */
+cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
+ _animation:null,
+ _nextFrame:0,
+ _origFrame:null,
+ _executedLoops:0,
+ _splitTimes: null,
+ _currFrameIndex:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * create the animate with animation.
+ * @param {cc.Animation} animation
+ */
+ ctor:function (animation) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._splitTimes = [];
+
+ animation && this.initWithAnimation(animation);
+ },
+
+ /**
+ * @return {cc.Animation}
+ */
+ getAnimation:function () {
+ return this._animation;
+ },
+
+ /**
+ * @param {cc.Animation} animation
+ */
+ setAnimation:function (animation) {
+ this._animation = animation;
+ },
+
+ /**
+ * Gets the index of sprite frame currently displayed.
+ * @return {Number}
+ */
+ getCurrentFrameIndex: function () {
+ return this._currFrameIndex;
+ },
+
+ /**
+ * @param {cc.Animation} animation
+ * @return {Boolean}
+ */
+ initWithAnimation:function (animation) {
+ if(!animation)
+ throw new Error("cc.Animate.initWithAnimation(): animation must be non-NULL");
+ var singleDuration = animation.getDuration();
+ if (this.initWithDuration(singleDuration * animation.getLoops())) {
+ this._nextFrame = 0;
+ this.setAnimation(animation);
+
+ this._origFrame = null;
+ this._executedLoops = 0;
+ var locTimes = this._splitTimes;
+ locTimes.length = 0;
+
+ var accumUnitsOfTime = 0;
+ var newUnitOfTimeValue = singleDuration / animation.getTotalDelayUnits();
+
+ var frames = animation.getFrames();
+ cc.js.array.verifyType(frames, cc.AnimationFrame);
+
+ for (var i = 0; i < frames.length; i++) {
+ var frame = frames[i];
+ var value = (accumUnitsOfTime * newUnitOfTimeValue) / singleDuration;
+ accumUnitsOfTime += frame.getDelayUnits();
+ locTimes.push(value);
+ }
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.Animate}
+ */
+ clone:function () {
+ var action = new cc.Animate();
+ this._cloneDecoration(action);
+ action.initWithAnimation(this._animation.clone());
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Sprite} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ if (this._animation.getRestoreOriginalFrame())
+ this._origFrame = target.displayFrame();
+ this._nextFrame = 0;
+ this._executedLoops = 0;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ // if t==1, ignore. Animation should finish with t==1
+ if (dt < 1.0) {
+ dt *= this._animation.getLoops();
+
+ // new loop? If so, reset frame counter
+ var loopNumber = 0 | dt;
+ if (loopNumber > this._executedLoops) {
+ this._nextFrame = 0;
+ this._executedLoops++;
+ }
+
+ // new t for animations
+ dt = dt % 1.0;
+ }
+
+ var frames = this._animation.getFrames();
+ var numberOfFrames = frames.length, locSplitTimes = this._splitTimes;
+ for (var i = this._nextFrame; i < numberOfFrames; i++) {
+ if (locSplitTimes[i] <= dt) {
+ _currFrameIndex = i;
+ this.target.setSpriteFrame(frames[_currFrameIndex].getSpriteFrame());
+ this._nextFrame = i + 1;
+ } else {
+ // Issue 1438. Could be more than one frame per tick, due to low frame rate or frame delta < 1/FPS
+ break;
+ }
+ }
+ },
+
+ /**
+ * Returns a reversed action.
+ * @return {cc.Animate}
+ */
+ reverse:function () {
+ var locAnimation = this._animation;
+ var oldArray = locAnimation.getFrames();
+ var newArray = [];
+ cc.js.array.verifyType(oldArray, cc.AnimationFrame);
+ if (oldArray.length > 0) {
+ for (var i = oldArray.length - 1; i >= 0; i--) {
+ var element = oldArray[i];
+ if (!element)
+ break;
+ newArray.push(element.clone());
+ }
+ }
+ var newAnim = new cc.Animation(newArray, locAnimation.getDelayPerUnit(), locAnimation.getLoops());
+ newAnim.setRestoreOriginalFrame(locAnimation.getRestoreOriginalFrame());
+ var action = new cc.Animate(newAnim);
+ this._cloneDecoration(action);
+ this._reverseEaseList(action);
+
+ return action;
+ },
+
+ /**
+ * stop the action
+ */
+ stop:function () {
+ if (this._animation.getRestoreOriginalFrame() && this.target)
+ this.target.setSpriteFrame(this._origFrame);
+ cc.Action.prototype.stop.call(this);
+ }
+});
+
+/**
+ * create the animate with animation
+ * @function
+ * @param {cc.Animation} animation
+ * @return {cc.Animate}
+ * @example
+ * // example
+ * // create the animation with animation
+ * var anim = cc.animate(dance_grey);
+ */
+cc.animate = function (animation) {
+ return new cc.Animate(animation);
+};
+/**
+ * Please use cc.animate instead
+ * create the animate with animation
+ * @static
+ * @deprecated since v3.0 please use cc.animate instead.
+ * @param {cc.Animation} animation
+ * @return {cc.Animate}
+ */
+cc.Animate.create = cc.animate;
+
+/**
+ *
+ * Overrides the target of an action so that it always runs on the target
+ * specified at action creation rather than the one specified by runAction.
+ *
+ * @class
+ * @extends cc.ActionInterval
+ * @param {cc.Node} target
+ * @param {cc.FiniteTimeAction} action
+ */
+cc.TargetedAction = cc.ActionInterval.extend(/** @lends cc.TargetedAction# */{
+ _action:null,
+ _forcedTarget:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create an action with the specified action and forced target.
+ * @param {cc.Node} target
+ * @param {cc.FiniteTimeAction} action
+ */
+ ctor: function (target, action) {
+ cc.ActionInterval.prototype.ctor.call(this);
+ action && this.initWithTarget(target, action);
+ },
+
+ /**
+ * Init an action with the specified action and forced target
+ * @param {cc.Node} target
+ * @param {cc.FiniteTimeAction} action
+ * @return {Boolean}
+ */
+ initWithTarget:function (target, action) {
+ if (this.initWithDuration(action._duration)) {
+ this._forcedTarget = target;
+ this._action = action;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * returns a new clone of the action
+ * @returns {cc.TargetedAction}
+ */
+ clone:function () {
+ var action = new cc.TargetedAction();
+ this._cloneDecoration(action);
+ action.initWithTarget(this._forcedTarget, this._action.clone());
+ return action;
+ },
+
+ /**
+ * Start the action with target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._action.startWithTarget(this._forcedTarget);
+ },
+
+ /**
+ * stop the action
+ */
+ stop:function () {
+ this._action.stop();
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ dt = this._computeEaseTime(dt);
+ this._action.update(dt);
+ },
+
+ /**
+ * return the target that the action will be forced to run with
+ * @return {cc.Node}
+ */
+ getForcedTarget:function () {
+ return this._forcedTarget;
+ },
+
+ /**
+ * set the target that the action will be forced to run with
+ * @param {cc.Node} forcedTarget
+ */
+ setForcedTarget:function (forcedTarget) {
+ if (this._forcedTarget !== forcedTarget)
+ this._forcedTarget = forcedTarget;
+ }
+});
+
+/**
+ * Create an action with the specified action and forced target
+ * @function
+ * @param {cc.Node} target
+ * @param {cc.FiniteTimeAction} action
+ * @return {cc.TargetedAction}
+ */
+cc.targetedAction = function (target, action) {
+ return new cc.TargetedAction(target, action);
+};
+/**
+ * Please use cc.targetedAction instead
+ * Create an action with the specified action and forced target
+ * @static
+ * @deprecated since v3.0 please use cc.targetedAction instead.
+ * @param {cc.Node} target
+ * @param {cc.FiniteTimeAction} action
+ * @return {cc.TargetedAction}
+ */
+cc.TargetedAction.create = cc.targetedAction;
diff --git a/cocos2d/actions/CCActionTween.js b/cocos2d/actions/CCActionTween.js
new file mode 100644
index 00000000000..1e5fb82be71
--- /dev/null
+++ b/cocos2d/actions/CCActionTween.js
@@ -0,0 +1,166 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ *
+ * @class
+ * @extends cc._Class
+ */
+cc.ActionTweenDelegate = cc._Class.extend(/** @lends cc.ActionTweenDelegate */{
+
+ /**
+ * Update Tween Action.
+ * @param value
+ * @param key
+ */
+ updateTweenAction:function(value, key){}
+});
+
+/**
+ * cc.ActionTween
+ * cc.ActionTween is an action that lets you update any property of an object.
+ *
+ * @class
+ * @extends cc.ActionInterval
+ * @example
+ * //For example, if you want to modify the "width" property of a target from 200 to 300 in 2 seconds, then:
+ * var modifyWidth = cc.actionTween(2,"width",200,300)
+ * target.runAction(modifyWidth);
+ *
+ * //Another example: cc.ScaleTo action could be rewriten using cc.PropertyAction:
+ * // scaleA and scaleB are equivalents
+ * var scaleA = cc.scaleTo(2,3);
+ * var scaleB = cc.actionTween(2,"scale",1,3);
+ * @param {Number} duration
+ * @param {String} key
+ * @param {Number} from
+ * @param {Number} to
+ */
+cc.ActionTween = cc.ActionInterval.extend(/** @lends cc.ActionTween */{
+ key:"",
+ from:0,
+ to:0,
+ delta:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates an initializes the action with the property name (key), and the from and to parameters.
+ * @param {Number} duration
+ * @param {String} key
+ * @param {Number} from
+ * @param {Number} to
+ */
+ ctor:function(duration, key, from, to){
+ cc.ActionInterval.prototype.ctor.call(this);
+ this.key = "";
+
+ to !== undefined && this.initWithDuration(duration, key, from, to);
+ },
+
+ /**
+ * initializes the action with the property name (key), and the from and to parameters.
+ * @param {Number} duration
+ * @param {String} key
+ * @param {Number} from
+ * @param {Number} to
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, key, from, to) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this.key = key;
+ this.to = to;
+ this.from = from;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Start this tween with target.
+ * @param {cc.ActionTweenDelegate} target
+ */
+ startWithTarget:function (target) {
+ if(!target || !target.updateTweenAction)
+ throw new Error("cc.ActionTween.startWithTarget(): target must be non-null, and target must implement updateTweenAction function");
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this.delta = this.to - this.from;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ this.target.updateTweenAction(this.to - this.delta * (1 - dt), this.key);
+ },
+
+ /**
+ * returns a reversed action.
+ * @return {cc.ActionTween}
+ */
+ reverse:function () {
+ return new cc.ActionTween(this.duration, this.key, this.to, this.from);
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.ActionTween}
+ */
+ clone:function(){
+ var action = new cc.ActionTween();
+ action.initWithDuration(this._duration, this.key, this.from, this.to);
+ return action;
+ }
+});
+
+/**
+ * Creates an initializes the action with the property name (key), and the from and to parameters.
+ * @function
+ * @param {Number} duration
+ * @param {String} key
+ * @param {Number} from
+ * @param {Number} to
+ * @return {cc.ActionTween}
+ */
+cc.actionTween = function (duration, key, from, to) {
+ return new cc.ActionTween(duration, key, from, to);
+};
+
+/**
+ * Please use cc.actionTween instead.
+ * Creates an initializes the action with the property name (key), and the from and to parameters.
+ * @static
+ * @deprecated since v3.0 Please use cc.actionTween instead.
+ * @param {Number} duration
+ * @param {String} key
+ * @param {Number} from
+ * @param {Number} to
+ * @return {cc.ActionTween}
+ */
+cc.ActionTween.create = cc.actionTween;
\ No newline at end of file
diff --git a/cocos2d/actions3d/CCActionGrid.js b/cocos2d/actions3d/CCActionGrid.js
new file mode 100644
index 00000000000..a52024d3d2f
--- /dev/null
+++ b/cocos2d/actions3d/CCActionGrid.js
@@ -0,0 +1,427 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ * Base class for Grid actions
+ * @class
+ * @extends cc.ActionInterval
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ */
+cc.GridAction = cc.ActionInterval.extend(/** @lends cc.GridAction# */{
+ _gridSize:null,
+ _gridNodeTarget:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ */
+ ctor:function(duration, gridSize){
+ cc.sys._checkWebGLRenderMode();
+ cc.ActionInterval.prototype.ctor.call(this);
+ this._gridSize = cc.size(0,0);
+
+ gridSize && this.initWithDuration(duration, gridSize);
+ },
+
+ _cacheTargetAsGridNode:function (target) {
+ this._gridNodeTarget = target;
+ },
+
+ /**
+ * to copy object with deep copy.
+ * returns a clone of action.
+ *
+ * @return {cc.Action}
+ */
+ clone:function(){
+ var action = new cc.GridAction();
+ var locGridSize = this._gridSize;
+ action.initWithDuration(this._duration, cc.size(locGridSize.width, locGridSize.height));
+ return action;
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ cc.renderer.childrenOrderDirty = true;
+ this._cacheTargetAsGridNode(target);
+
+ var newGrid = this.getGrid();
+
+ var targetGrid = this._gridNodeTarget.getGrid();
+ if (targetGrid && targetGrid.getReuseGrid() > 0) {
+ var locGridSize = targetGrid.getGridSize();
+ if (targetGrid.isActive() && (locGridSize.width === this._gridSize.width) && (locGridSize.height === this._gridSize.height))
+ targetGrid.reuse();
+ } else {
+ if (targetGrid && targetGrid.isActive())
+ targetGrid.setActive(false);
+ this._gridNodeTarget.setGrid(newGrid);
+ this._gridNodeTarget.getGrid().setActive(true);
+ }
+ },
+
+ /**
+ * Create a cc.ReverseTime action. Opposite with the original motion trajectory.
+ * @return {cc.ReverseTime}
+ */
+ reverse:function () {
+ return new cc.ReverseTime(this);
+ },
+
+ /**
+ * Initializes the action with size and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize) {
+ if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
+ this._gridSize.width = gridSize.width;
+ this._gridSize.height = gridSize.height;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Returns the grid.
+ * @return {cc.GridBase}
+ */
+ getGrid:function () {
+ // Abstract class needs implementation
+ cc.log("cc.GridAction.getGrid(): it should be overridden in subclass.");
+ }
+});
+
+/**
+ * creates the action with size and duration
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.GridAction}
+ */
+cc.gridAction = function (duration, gridSize) {
+ return new cc.GridAction(duration, gridSize);
+};
+
+/**
+ * Please use cc.gridAction instead.
+ * Creates the action with size and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.GridAction}
+ * @static
+ * @deprecated since v3.0 Please use cc.gridAction instead.
+ */
+cc.GridAction.create = cc.gridAction;
+
+/**
+ * Base class for cc.Grid3D actions.
+ * Grid3D actions can modify a non-tiled grid.
+ * @class
+ * @extends cc.GridAction
+ */
+cc.Grid3DAction = cc.GridAction.extend(/** @lends cc.Grid3DAction# */{
+
+ /**
+ * returns the grid
+ * @return {cc.Grid3D}
+ */
+ getGrid:function () {
+ return new cc.Grid3D(this._gridSize, undefined, undefined, this._gridNodeTarget.getGridRect());
+ },
+
+ /**
+ * get rect of the grid
+ * @return {cc.Rect} rect
+ */
+ getGridRect:function () {
+ return this._gridNodeTarget.getGridRect();
+ },
+
+ /**
+ * returns the vertex than belongs to certain position in the grid.
+ * It will be deprecated in future, please use getVertex instead.
+ * @param {cc.Vec2} position
+ * @return {cc.Vertex3F}
+ */
+ vertex:function (position) {
+ return this.getVertex(position);
+ },
+
+ /**
+ * returns the vertex than belongs to certain position in the grid
+ * @param {cc.Vec2} position
+ * @return {cc.Vertex3F}
+ */
+ getVertex: function(position){
+ return this.target.grid.getVertex(position);
+ },
+
+ /**
+ * returns the non-transformed vertex than belongs to certain position in the grid
+ * It will be deprecated in future, please use getVertex instead.
+ * @param {cc.Vec2} position
+ * @return {cc.Vertex3F}
+ */
+ originalVertex:function (position) {
+ return this.getOriginalVertex(position);
+ },
+
+ /**
+ * returns the non-transformed vertex that belongs to certain position in the grid
+ * @param {cc.Vec2} position
+ * @return {cc.Vertex3F}
+ */
+ getOriginalVertex:function (position) {
+ return this.target.grid.originalVertex(position);
+ },
+
+ /**
+ * sets a new vertex to a certain position of the grid
+ * @param {cc.Vec2} position
+ * @param {cc.Vertex3F} vertex
+ */
+ setVertex:function (position, vertex) {
+ this.target.grid.setVertex(position, vertex);
+ }
+});
+
+/**
+ * creates the action with size and duration
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.Grid3DAction}
+ */
+cc.grid3DAction = function (duration, gridSize) {
+ return new cc.Grid3DAction(duration, gridSize);
+};
+/**
+ * Please use cc.grid3DAction instead.
+ * creates the action with size and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.Grid3DAction}
+ * @static
+ * @deprecated since v3.0 Please use cc.grid3DAction instead.
+ */
+cc.Grid3DAction.create = cc.grid3DAction;
+
+/**
+ * Base class for cc.TiledGrid3D actions.
+ * @class
+ * @extends cc.GridAction
+ */
+cc.TiledGrid3DAction = cc.GridAction.extend(/** @lends cc.TiledGrid3DAction# */{
+
+ /**
+ * returns the tile that belongs to a certain position of the grid
+ * It will be deprecated in future, please use getTile instead.
+ * @param {cc.Vec2} position
+ * @return {cc.Quad3}
+ */
+ tile:function (position) {
+ return this.getTile(position);
+ },
+
+ /**
+ * returns the tile that belongs to a certain position of the grid
+ * @param {cc.Vec2} position
+ * @return {cc.Quad3}
+ */
+ getTile:function (position) {
+ return this.target.grid.tile(position);
+ },
+
+ /**
+ * returns the non-transformed tile that belongs to a certain position of the grid
+ * It will be deprecated in future, please use getOriginalTile instead.
+ * @param {cc.Vec2} position
+ * @return {cc.Quad3}
+ */
+ originalTile:function (position) {
+ return this.getOriginalTile(position);
+ },
+
+ /**
+ * returns the non-transformed tile that belongs to a certain position of the grid
+ * @param {cc.Vec2} position
+ * @return {cc.Quad3}
+ */
+ getOriginalTile:function (position) {
+ return this.target.grid.originalTile(position);
+ },
+
+ /**
+ * sets a new tile to a certain position of the grid
+ * @param {cc.Vec2} position
+ * @param {cc.Quad3} coords
+ */
+ setTile:function (position, coords) {
+ this.target.grid.setTile(position, coords);
+ },
+
+ /**
+ * returns the grid
+ * @return {cc.TiledGrid3D}
+ */
+ getGrid:function () {
+ return new cc.TiledGrid3D(this._gridSize, undefined, undefined, this._gridNodeTarget.getGridRect());
+ }
+});
+
+/**
+ * Creates the action with duration and grid size
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.TiledGrid3DAction}
+ */
+cc.tiledGrid3DAction = function (duration, gridSize) {
+ return new cc.TiledGrid3DAction(duration, gridSize);
+};
+
+/**
+ * Please use cc.tiledGrid3DAction instead
+ * Creates the action with duration and grid size
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.TiledGrid3DAction}
+ * @static
+ * @deprecated since v3.0 Please use cc.tiledGrid3DAction instead.
+ */
+cc.TiledGrid3DAction.create = cc.tiledGrid3DAction;
+
+/**
+ *
+ * cc.StopGrid action.
+ * @warning Don't call this action if another grid action is active.
+ * Call if you want to remove the the grid effect. Example:
+ * cc.sequence(Lens.action(...), cc.stopGrid(...), null);
+ *
+ * @class
+ * @extends cc.ActionInstant
+ */
+cc.StopGrid = cc.ActionInstant.extend(/** @lends cc.StopGrid# */{
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInstant.prototype.startWithTarget.call(this, target);
+ cc.renderer.childrenOrderDirty = true;
+ var grid = this.target.grid;
+ if (grid && grid.isActive())
+ grid.setActive(false);
+ }
+});
+
+/**
+ * Allocates and initializes the action
+ * @function
+ * @return {cc.StopGrid}
+ */
+cc.stopGrid = function () {
+ return new cc.StopGrid();
+};
+/**
+ * Please use cc.stopGrid instead
+ * Allocates and initializes the action
+ * @return {cc.StopGrid}
+ * @static
+ * @deprecated since v3.0 Please use cc.stopGrid instead.
+ */
+cc.StopGrid.create = cc.stopGrid;
+
+/**
+ * cc.ReuseGrid action
+ * @class
+ * @extends cc.ActionInstant
+ * @param {Number} times
+ */
+cc.ReuseGrid = cc.ActionInstant.extend(/** @lends cc.ReuseGrid# */{
+ _times:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {Number} times
+ */
+ ctor: function(times) {
+ cc.ActionInstant.prototype.ctor.call(this);
+ times !== undefined && this.initWithTimes(times);
+ },
+
+ /**
+ * initializes an action with the number of times that the current grid will be reused
+ * @param {Number} times
+ * @return {Boolean}
+ */
+ initWithTimes:function (times) {
+ this._times = times;
+ return true;
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ *
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.ActionInstant.prototype.startWithTarget.call(this, target);
+ cc.renderer.childrenOrderDirty = true;
+ if (this.target.grid && this.target.grid.isActive())
+ this.target.grid.setReuseGrid(this.target.grid.getReuseGrid() + this._times);
+ }
+});
+
+/**
+ * creates an action with the number of times that the current grid will be reused
+ * @function
+ * @param {Number} times
+ * @return {cc.ReuseGrid}
+ */
+cc.reuseGrid = function (times) {
+ return new cc.ReuseGrid(times);
+};
+/**
+ * Please use cc.reuseGrid instead
+ * creates an action with the number of times that the current grid will be reused
+ * @param {Number} times
+ * @return {cc.ReuseGrid}
+ * @static
+ * @deprecated since v3.0 Please use cc.reuseGrid instead.
+ */
+cc.ReuseGrid.create = cc.reuseGrid;
diff --git a/cocos2d/actions3d/CCActionGrid3D.js b/cocos2d/actions3d/CCActionGrid3D.js
new file mode 100644
index 00000000000..ca72abc6b16
--- /dev/null
+++ b/cocos2d/actions3d/CCActionGrid3D.js
@@ -0,0 +1,1257 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ * cc.Waves3D action.
+ * Reference the test cases (Effects Advanced Test)
+ * @class
+ * @extends cc.Grid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+cc.Waves3D = cc.Grid3DAction.extend(/** @lends cc.Waves3D# */{
+ _waves: 0,
+ _amplitude: 0,
+ _amplitudeRate: 0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a wave 3d action with duration, grid size, waves and amplitude.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+ ctor:function (duration, gridSize, waves, amplitude) {
+ cc.GridAction.prototype.ctor.call(this);
+ amplitude !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude);
+ },
+
+ /**
+ * get Amplitude
+ * @return {Number}
+ */
+ getAmplitude:function () {
+ return this._amplitude;
+ },
+
+ /**
+ * set Amplitude
+ * @param {Number} amplitude
+ */
+ setAmplitude:function (amplitude) {
+ this._amplitude = amplitude;
+ },
+
+ /**
+ * get Amplitude Rate
+ * @return {Number}
+ */
+ getAmplitudeRate:function () {
+ return this._amplitudeRate;
+ },
+
+ /**
+ * set Amplitude Rate
+ * @param {Number} amplitudeRate
+ */
+ setAmplitudeRate:function (amplitudeRate) {
+ this._amplitudeRate = amplitudeRate;
+ },
+
+ /**
+ * initializes an action with duration, grid size, waves and amplitude
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, waves, amplitude) {
+ if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._waves = waves;
+ this._amplitude = amplitude;
+ this._amplitudeRate = 1.0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locGridSize = this._gridSize;
+ var locAmplitude = this._amplitude, locPos = cc.p(0, 0);
+ var locAmplitudeRate = this._amplitudeRate, locWaves = this._waves;
+ for (var i = 0; i < locGridSize.width + 1; ++i) {
+ for (var j = 0; j < locGridSize.height + 1; ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ var v = this.originalVertex(locPos);
+ v.z += (Math.sin(Math.PI * dt * locWaves * 2 + (v.y + v.x) * 0.01) * locAmplitude * locAmplitudeRate);
+ //cc.log("v.z offset is" + (Math.sin(Math.PI * dt * this._waves * 2 + (v.y + v.x) * 0.01) * this._amplitude * this._amplitudeRate));
+ this.setVertex(locPos, v);
+ }
+ }
+ }
+});
+
+/**
+ * Create a wave 3d action with duration, grid size, waves and amplitude.
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+cc.waves3D = function (duration, gridSize, waves, amplitude) {
+ return new cc.Waves3D(duration, gridSize, waves, amplitude);
+};
+/**
+ * Please use cc.waves3D instead.
+ * Create a wave 3d action with duration, grid size, waves and amplitude.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @static
+ * @deprecated since v3.0 Please use cc.waves3D instead.
+ */
+cc.Waves3D.create = cc.waves3D;
+
+/**
+ * cc.FlipX3D action.
+ * Flip around.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.Grid3DAction
+ * @param {Number} duration
+ */
+cc.FlipX3D = cc.Grid3DAction.extend(/** @lends cc.FlipX3D# */{
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a Flip X 3D action with duration.
+ * @param {Number} duration
+ */
+ ctor: function(duration) {
+ if (duration !== undefined)
+ cc.GridAction.prototype.ctor.call(this, duration, cc.size(1, 1));
+ else cc.GridAction.prototype.ctor.call(this);
+ },
+
+ /**
+ * initializes the action with duration
+ * @param {Number} duration
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration) {
+ return cc.Grid3DAction.prototype.initWithDuration.call(this, duration, cc.size(1, 1));
+ },
+
+ /**
+ * initializes the action with gridSize and duration
+ * @param {cc.Size} gridSize
+ * @param {Number} duration
+ * @return {Boolean}
+ */
+ initWithSize:function (gridSize, duration) {
+ if (gridSize.width !== 1 || gridSize.height !== 1) {
+ // Grid size must be (1,1)
+ cc.log("Grid size must be (1,1)");
+ return false;
+ }
+ return cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var angle = Math.PI * dt; // 180 degrees
+ var mz = Math.sin(angle);
+ angle = angle / 2.0; // x calculates degrees from 0 to 90
+ var mx = Math.cos(angle);
+
+ var diff = new cc.Vertex3F();
+ var tempVer = cc.p(0, 0);
+ tempVer.x = tempVer.y = 1;
+ var v0 = this.originalVertex(tempVer);
+ tempVer.x = tempVer.y = 0;
+ var v1 = this.originalVertex(tempVer);
+
+ var x0 = v0.x;
+ var x1 = v1.x;
+ var x;
+ var a, b, c, d;
+
+ if (x0 > x1) {
+ // Normal Grid
+ a = cc.p(0, 0);
+ b = cc.p(0, 1);
+ c = cc.p(1, 0);
+ d = cc.p(1, 1);
+ x = x0;
+ } else {
+ // Reversed Grid
+ c = cc.p(0, 0);
+ d = cc.p(0, 1);
+ a = cc.p(1, 0);
+ b = cc.p(1, 1);
+ x = x1;
+ }
+
+ diff.x = ( x - x * mx );
+ diff.z = Math.abs(parseFloat((x * mz) / 4.0));
+
+ // bottom-left
+ var v = this.originalVertex(a);
+ v.x = diff.x;
+ v.z += diff.z;
+ this.setVertex(a, v);
+
+ // upper-left
+ v = this.originalVertex(b);
+ v.x = diff.x;
+ v.z += diff.z;
+ this.setVertex(b, v);
+
+ // bottom-right
+ v = this.originalVertex(c);
+ v.x -= diff.x;
+ v.z -= diff.z;
+ this.setVertex(c, v);
+
+ // upper-right
+ v = this.originalVertex(d);
+ v.x -= diff.x;
+ v.z -= diff.z;
+ this.setVertex(d, v);
+ }
+});
+
+/**
+ * Create a Flip X 3D action with duration.
+ * Flip around.
+ * @function
+ * @param {Number} duration
+ * @return {cc.FlipX3D}
+ */
+cc.flipX3D = function (duration) {
+ return new cc.FlipX3D(duration);
+};
+
+/**
+ * Please use cc.flipX3D instead.
+ * Create a Flip X 3D action with duration.
+ * Flip around.
+ * @param {Number} duration
+ * @return {cc.FlipX3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.flipX3D instead.
+ */
+cc.FlipX3D.create = cc.flipX3D;
+
+/**
+ * cc.FlipY3D action.
+ * Upside down.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.FlipX3D
+ * @param {Number} duration
+ */
+cc.FlipY3D = cc.FlipX3D.extend(/** @lends cc.FlipY3D# */{
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a flip Y 3d action with duration.
+ * @param {Number} duration
+ */
+ ctor: function(duration) {
+ if (duration !== undefined)
+ cc.GridAction.prototype.ctor.call(this, duration, cc.size(1, 1));
+ else cc.GridAction.prototype.ctor.call(this);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var angle = Math.PI * dt; // 180 degrees
+ var mz = Math.sin(angle);
+ angle = angle / 2.0; // x calculates degrees from 0 to 90
+ var my = Math.cos(angle);
+
+ var diff = new cc.Vertex3F();
+
+ var tempP = cc.p(0, 0);
+ tempP.x = tempP.y = 1;
+ var v0 = this.originalVertex(tempP);
+ tempP.x = tempP.y = 0;
+ var v1 = this.originalVertex(tempP);
+
+ var y0 = v0.y;
+ var y1 = v1.y;
+ var y;
+ var a, b, c, d;
+
+ if (y0 > y1) {
+ // Normal Grid
+ a = cc.p(0, 0);
+ b = cc.p(0, 1);
+ c = cc.p(1, 0);
+ d = cc.p(1, 1);
+ y = y0;
+ } else {
+ // Reversed Grid
+ b = cc.p(0, 0);
+ a = cc.p(0, 1);
+ d = cc.p(1, 0);
+ c = cc.p(1, 1);
+ y = y1;
+ }
+
+ diff.y = y - y * my;
+ diff.z = Math.abs(parseFloat(y * mz) / 4.0);
+
+ // bottom-left
+ var v = this.originalVertex(a);
+ v.y = diff.y;
+ v.z += diff.z;
+ this.setVertex(a, v);
+
+ // upper-left
+ v = this.originalVertex(b);
+ v.y -= diff.y;
+ v.z -= diff.z;
+ this.setVertex(b, v);
+
+ // bottom-right
+ v = this.originalVertex(c);
+ v.y = diff.y;
+ v.z += diff.z;
+ this.setVertex(c, v);
+
+ // upper-right
+ v = this.originalVertex(d);
+ v.y -= diff.y;
+ v.z -= diff.z;
+ this.setVertex(d, v);
+ }
+});
+
+/**
+ * Create a flip Y 3d action with duration.
+ * Upside down.
+ * @function
+ * @param {Number} duration
+ * @return {cc.FlipY3D}
+ */
+cc.flipY3D = function (duration) {
+ return new cc.FlipY3D(duration);
+};
+
+/**
+ * Please use cc.flipY3D instead.
+ * Create a flip Y 3d action with duration.
+ * @param {Number} duration
+ * @return {cc.FlipY3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.flipY3D instead.
+ */
+cc.FlipY3D.create = cc.flipY3D;
+
+/**
+ * cc.Lens3D action.
+ * Upside down.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.Grid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ */
+cc.Lens3D = cc.Grid3DAction.extend(/** @lends cc.Lens3D# */{
+ //lens center position
+ _position:null,
+ _radius:0,
+ //lens effect. Defaults to 0.7 - 0 means no effect, 1 is very strong effect
+ _lensEffect:0,
+ //lens is concave. (true = concave, false = convex) default is convex i.e. false
+ _concave:false,
+ _dirty:false,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates a lens 3d action with center position, radius.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ */
+ ctor:function (duration, gridSize, position, radius) {
+ cc.GridAction.prototype.ctor.call(this);
+
+ this._position = cc.p(0, 0);
+ radius !== undefined && this.initWithDuration(duration, gridSize, position, radius);
+ },
+
+ /**
+ * Get lens center position
+ * @return {Number}
+ */
+ getLensEffect:function () {
+ return this._lensEffect;
+ },
+
+ /**
+ * Set lens center position
+ * @param {Number} lensEffect
+ */
+ setLensEffect:function (lensEffect) {
+ this._lensEffect = lensEffect;
+ },
+
+ /**
+ * Set whether lens is concave
+ * @param {Boolean} concave
+ */
+ setConcave:function (concave) {
+ this._concave = concave;
+ },
+
+ /**
+ * get Position
+ * @return {cc.Vec2}
+ */
+ getPosition:function () {
+ return this._position;
+ },
+
+ /**
+ * set Position
+ * @param {cc.Vec2} position
+ */
+ setPosition:function (position) {
+ if (!cc.pointEqualToPoint(position, this._position)) {
+ this._position.x = position.x;
+ this._position.y = position.y;
+ this._dirty = true;
+ }
+ },
+
+ /**
+ * initializes the action with center position, radius, a grid size and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, position, radius) {
+ if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this.setPosition(position);
+ this._radius = radius;
+ this._lensEffect = 0.7;
+ this._dirty = true;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ if (this._dirty) {
+ var locGridSizeWidth = this._gridSize.width, locGridSizeHeight = this._gridSize.height;
+ var locRadius = this._radius, locLensEffect = this._lensEffect;
+ var locPos = cc.p(0, 0);
+ var vect = cc.p(0, 0);
+ var v, r, l, new_r, pre_log;
+ for (var i = 0; i < locGridSizeWidth + 1; ++i) {
+ for (var j = 0; j < locGridSizeHeight + 1; ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ v = this.originalVertex(locPos);
+ vect.x = this._position.x - v.x;
+ vect.y = this._position.y - v.y;
+ r = cc.pLength(vect);
+
+ if (r < locRadius) {
+ r = locRadius - r;
+ pre_log = r / locRadius;
+ if (pre_log === 0)
+ pre_log = 0.001;
+
+ l = Math.log(pre_log) * locLensEffect;
+ new_r = Math.exp(l) * locRadius;
+
+ r = cc.pLength(vect);
+ if (r > 0) {
+ vect.x = vect.x / r;
+ vect.y = vect.y / r;
+
+ vect.x = vect.x * new_r;
+ vect.y = vect.y * new_r;
+ v.z += cc.pLength(vect) * locLensEffect;
+ }
+ }
+ this.setVertex(locPos, v);
+ }
+ }
+ this._dirty = false;
+ }
+ }
+});
+
+/**
+ * creates a lens 3d action with center position, radius
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ * @return {cc.Lens3D}
+ */
+cc.lens3D = function (duration, gridSize, position, radius) {
+ return new cc.Lens3D(duration, gridSize, position, radius);
+};
+
+/**
+ * Please use cc.lens3D instead
+ * creates a lens 3d action with center position, radius
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ * @return {cc.Lens3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.lens3D instead.
+ */
+cc.Lens3D.create = cc.lens3D;
+
+/**
+ * cc.Ripple3D action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.Grid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+cc.Ripple3D = cc.Grid3DAction.extend(/** @lends cc.Ripple3D# */{
+ /* center position */
+ _position: null,
+ _radius: 0,
+ _waves: 0,
+ _amplitude: 0,
+ _amplitudeRate: 0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates a ripple 3d action with radius, number of waves, amplitude.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+ ctor:function (duration, gridSize, position, radius, waves, amplitude) {
+ cc.GridAction.prototype.ctor.call(this);
+
+ this._position = cc.p(0, 0);
+ amplitude !== undefined && this.initWithDuration(duration, gridSize, position, radius, waves, amplitude);
+ },
+
+ /**
+ * get center position
+ * @return {cc.Vec2}
+ */
+ getPosition:function () {
+ return this._position;
+ },
+
+ /**
+ * set center position
+ * @param {cc.Vec2} position
+ */
+ setPosition:function (position) {
+ this._position.x = position.x;
+ this._position.y = position.y;
+ },
+
+ /**
+ * get Amplitude
+ * @return {Number}
+ */
+ getAmplitude:function () {
+ return this._amplitude;
+ },
+
+ /**
+ * set Amplitude
+ * @param {Number} amplitude
+ */
+ setAmplitude:function (amplitude) {
+ this._amplitude = amplitude;
+ },
+
+ /**
+ * get Amplitude rate
+ * @return {*}
+ */
+ getAmplitudeRate:function () {
+ return this._amplitudeRate;
+ },
+
+ /**
+ * get amplitude rate
+ * @param {Number} amplitudeRate
+ */
+ setAmplitudeRate:function (amplitudeRate) {
+ this._amplitudeRate = amplitudeRate;
+ },
+
+ /**
+ * initializes the action with radius, number of waves, amplitude, a grid size and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, position, radius, waves, amplitude) {
+ if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this.setPosition(position);
+ this._radius = radius;
+ this._waves = waves;
+ this._amplitude = amplitude;
+ this._amplitudeRate = 1.0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locGridSizeWidth = this._gridSize.width, locGridSizeHeight = this._gridSize.height;
+ var locPos = cc.p(0, 0), locRadius = this._radius;
+ var locWaves = this._waves, locAmplitude = this._amplitude, locAmplitudeRate = this._amplitudeRate;
+ var v, r, tempPos = cc.p(0, 0);
+ for (var i = 0; i < (locGridSizeWidth + 1); ++i) {
+ for (var j = 0; j < (locGridSizeHeight + 1); ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ v = this.originalVertex(locPos);
+
+ tempPos.x = this._position.x - v.x;
+ tempPos.y = this._position.y - v.y;
+ r = cc.pLength(tempPos);
+
+ if (r < locRadius) {
+ r = locRadius - r;
+ var rate = Math.pow(r / locRadius, 2);
+ v.z += (Math.sin(dt * Math.PI * locWaves * 2 + r * 0.1) * locAmplitude * locAmplitudeRate * rate);
+ }
+ this.setVertex(locPos, v);
+ }
+ }
+ }
+});
+
+/**
+ * creates a ripple 3d action with radius, number of waves, amplitude
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {cc.Ripple3D}
+ */
+cc.ripple3D = function (duration, gridSize, position, radius, waves, amplitude) {
+ return new cc.Ripple3D(duration, gridSize, position, radius, waves, amplitude);
+};
+
+/**
+ * Please use cc.ripple3D instead
+ * creates a ripple 3d action with radius, number of waves, amplitude
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} radius
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {cc.Ripple3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.ripple3D instead.
+ */
+cc.Ripple3D.create = cc.ripple3D;
+
+/**
+ * cc.Shaky3D action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.Grid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ */
+cc.Shaky3D = cc.Grid3DAction.extend(/** @lends cc.Shaky3D# */{
+ _randRange: 0,
+ _shakeZ: false,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a shaky3d action with a range, shake Z vertices.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ */
+ ctor:function (duration, gridSize, range, shakeZ) {
+ cc.GridAction.prototype.ctor.call(this);
+ shakeZ !== undefined && this.initWithDuration(duration, gridSize, range, shakeZ);
+ },
+
+ /**
+ * initializes the action with a range, shake Z vertices, a grid and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, range, shakeZ) {
+ if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._randRange = range;
+ this._shakeZ = shakeZ;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locGridSizeWidth = this._gridSize.width, locGridSizeHeight = this._gridSize.height;
+ var locRandRange = this._randRange, locShakeZ = this._shakeZ, locP = cc.p(0, 0);
+ var v;
+ for (var i = 0; i < (locGridSizeWidth + 1); ++i) {
+ for (var j = 0; j < (locGridSizeHeight + 1); ++j) {
+ locP.x = i;
+ locP.y = j;
+ v = this.originalVertex(locP);
+ v.x += (cc.rand() % (locRandRange * 2)) - locRandRange;
+ v.y += (cc.rand() % (locRandRange * 2)) - locRandRange;
+ if (locShakeZ)
+ v.z += (cc.rand() % (locRandRange * 2)) - locRandRange;
+ this.setVertex(locP, v);
+ }
+ }
+ }
+});
+
+/**
+ * creates the action with a range, shake Z vertices, a grid and duration
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ * @return {cc.Shaky3D}
+ */
+cc.shaky3D = function (duration, gridSize, range, shakeZ) {
+ return new cc.Shaky3D(duration, gridSize, range, shakeZ);
+};
+
+/**
+ * Please use cc.shaky3D instead
+ * creates the action with a range, shake Z vertices, a grid and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ * @return {cc.Shaky3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.shaky3D instead.
+ */
+cc.Shaky3D.create = cc.shaky3D;
+
+/**
+ * cc.Liquid action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.Grid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+cc.Liquid = cc.Grid3DAction.extend(/** @lends cc.Liquid# */{
+ _waves: 0,
+ _amplitude: 0,
+ _amplitudeRate: 0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a liquid action with amplitude, a grid and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+ ctor: function (duration, gridSize, waves, amplitude) {
+ cc.GridAction.prototype.ctor.call(this);
+ amplitude !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude);
+ },
+
+ /**
+ * get amplitude
+ * @return {Number}
+ */
+ getAmplitude:function () {
+ return this._amplitude;
+ },
+
+ /**
+ * set amplitude
+ * @param {Number} amplitude
+ */
+ setAmplitude:function (amplitude) {
+ this._amplitude = amplitude;
+ },
+
+ /**
+ * get amplitude rate
+ * @return {Number}
+ */
+ getAmplitudeRate:function () {
+ return this._amplitudeRate;
+ },
+
+ /**
+ * set amplitude rate
+ * @param {Number} amplitudeRate
+ */
+ setAmplitudeRate:function (amplitudeRate) {
+ this._amplitudeRate = amplitudeRate;
+ },
+
+ /**
+ * initializes the action with amplitude, a grid and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, waves, amplitude) {
+ if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._waves = waves;
+ this._amplitude = amplitude;
+ this._amplitudeRate = 1.0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locSizeWidth = this._gridSize.width, locSizeHeight = this._gridSize.height, locPos = cc.p(0, 0);
+ var locWaves = this._waves, locAmplitude = this._amplitude, locAmplitudeRate = this._amplitudeRate;
+ var v;
+ for (var i = 1; i < locSizeWidth; ++i) {
+ for (var j = 1; j < locSizeHeight; ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ v = this.originalVertex(locPos);
+ v.x = (v.x + (Math.sin(dt * Math.PI * locWaves * 2 + v.x * .01) * locAmplitude * locAmplitudeRate));
+ v.y = (v.y + (Math.sin(dt * Math.PI * locWaves * 2 + v.y * .01) * locAmplitude * locAmplitudeRate));
+ this.setVertex(locPos, v);
+ }
+ }
+ }
+});
+
+/**
+ * creates the action with amplitude, a grid and duration
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {cc.Liquid}
+ */
+cc.liquid = function (duration, gridSize, waves, amplitude) {
+ return new cc.Liquid(duration, gridSize, waves, amplitude);
+};
+
+/**
+ * Please use cc.liquid instead
+ * creates the action with amplitude, a grid and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {cc.Liquid}
+ * @static
+ * @deprecated since v3.0 Please use cc.liquid instead.
+ */
+cc.Liquid.create = cc.liquid;
+
+/**
+ * cc.Waves action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.Grid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @param {Boolean} horizontal
+ * @param {Boolean} vertical
+ */
+cc.Waves = cc.Grid3DAction.extend(/** @lends cc.Waves# */{
+ _waves: 0,
+ _amplitude: 0,
+ _amplitudeRate: 0,
+ _vertical: false,
+ _horizontal: false,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a wave action with amplitude, horizontal sin, vertical sin, a grid and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @param {Boolean} horizontal
+ * @param {Boolean} vertical
+ */
+ ctor: function (duration, gridSize, waves, amplitude, horizontal, vertical) {
+ cc.GridAction.prototype.ctor.call(this);
+ vertical !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude, horizontal, vertical);
+ },
+
+ /**
+ * get amplitude
+ * @return {Number}
+ */
+ getAmplitude:function () {
+ return this._amplitude;
+ },
+
+ /**
+ * set amplitude
+ * @param {Number} amplitude
+ */
+ setAmplitude:function (amplitude) {
+ this._amplitude = amplitude;
+ },
+
+ /**
+ * get amplitude rate
+ * @return {Number}
+ */
+ getAmplitudeRate:function () {
+ return this._amplitudeRate;
+ },
+
+ /**
+ * set amplitude rate
+ * @param {Number} amplitudeRate
+ */
+ setAmplitudeRate:function (amplitudeRate) {
+ this._amplitudeRate = amplitudeRate;
+ },
+
+ /**
+ * initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @param {Boolean} horizontal
+ * @param {Boolean} vertical
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, waves, amplitude, horizontal, vertical) {
+ if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._waves = waves;
+ this._amplitude = amplitude;
+ this._amplitudeRate = 1.0;
+ this._horizontal = horizontal;
+ this._vertical = vertical;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locSizeWidth = this._gridSize.width, locSizeHeight = this._gridSize.height, locPos = cc.p(0, 0);
+ var locVertical = this._vertical, locHorizontal = this._horizontal;
+ var locWaves = this._waves, locAmplitude = this._amplitude, locAmplitudeRate = this._amplitudeRate;
+ var v;
+ for (var i = 0; i < locSizeWidth + 1; ++i) {
+ for (var j = 0; j < locSizeHeight + 1; ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ v = this.originalVertex(locPos);
+ if (locVertical)
+ v.x = (v.x + (Math.sin(dt * Math.PI * locWaves * 2 + v.y * .01) * locAmplitude * locAmplitudeRate));
+ if (locHorizontal)
+ v.y = (v.y + (Math.sin(dt * Math.PI * locWaves * 2 + v.x * .01) * locAmplitude * locAmplitudeRate));
+ this.setVertex(locPos, v);
+ }
+ }
+ }
+});
+
+/**
+ * initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @param {Boolean} horizontal
+ * @param {Boolean} vertical
+ * @return {cc.Waves}
+ */
+cc.waves = function (duration, gridSize, waves, amplitude, horizontal, vertical) {
+ return new cc.Waves(duration, gridSize, waves, amplitude, horizontal, vertical);
+};
+
+/**
+ * Please use cc.waves instead
+ * initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @param {Boolean} horizontal
+ * @param {Boolean} vertical
+ * @return {cc.Waves}
+ * @static
+ * @deprecated since v3.0 Please use cc.waves instead.
+ */
+cc.Waves.create = cc.waves;
+
+/** @brief */
+/**
+ * cc.Twirl action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.Grid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} twirls
+ * @param {Number} amplitude
+ */
+cc.Twirl = cc.Grid3DAction.extend(/** @lends cc.Twirl# */{
+ /* twirl center */
+ _position: null,
+ _twirls: 0,
+ _amplitude: 0,
+ _amplitudeRate: 0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Create a grid 3d action with center position, number of twirls, amplitude, a grid size and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} twirls
+ * @param {Number} amplitude
+ */
+ ctor:function (duration, gridSize, position, twirls, amplitude) {
+ cc.GridAction.prototype.ctor.call(this);
+
+ this._position = cc.p(0, 0);
+ amplitude !== undefined && this.initWithDuration(duration, gridSize, position, twirls, amplitude);
+ },
+
+ /**
+ * get twirl center
+ * @return {cc.Vec2}
+ */
+ getPosition:function () {
+ return this._position;
+ },
+
+ /**
+ * set twirl center
+ * @param {cc.Vec2} position
+ */
+ setPosition:function (position) {
+ this._position.x = position.x;
+ this._position.y = position.y;
+ },
+
+ /**
+ * get amplitude
+ * @return {Number}
+ */
+ getAmplitude:function () {
+ return this._amplitude;
+ },
+
+ /**
+ * set amplitude
+ * @param {Number} amplitude
+ */
+ setAmplitude:function (amplitude) {
+ this._amplitude = amplitude;
+ },
+
+ /**
+ * get amplitude rate
+ * @return {Number}
+ */
+ getAmplitudeRate:function () {
+ return this._amplitudeRate;
+ },
+
+ /**
+ * set amplitude rate
+ * @param {Number} amplitudeRate
+ */
+ setAmplitudeRate:function (amplitudeRate) {
+ this._amplitudeRate = amplitudeRate;
+ },
+
+ /** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
+ initWithDuration:function (duration, gridSize, position, twirls, amplitude) {
+ if (cc.Grid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this.setPosition(position);
+ this._twirls = twirls;
+ this._amplitude = amplitude;
+ this._amplitudeRate = 1.0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ *
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var c = this._position;
+ var locSizeWidth = this._gridSize.width, locSizeHeight = this._gridSize.height, locPos = cc.p(0, 0);
+ var amp = 0.1 * this._amplitude * this._amplitudeRate;
+ var locTwirls = this._twirls;
+ var v, a, dX, dY, avg = cc.p(0, 0);
+ for (var i = 0; i < (locSizeWidth + 1); ++i) {
+ for (var j = 0; j < (locSizeHeight + 1); ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ v = this.originalVertex(locPos);
+
+ avg.x = i - (locSizeWidth / 2.0);
+ avg.y = j - (locSizeHeight / 2.0);
+
+ a = cc.pLength(avg) * Math.cos(Math.PI / 2.0 + dt * Math.PI * locTwirls * 2) * amp;
+
+ dX = Math.sin(a) * (v.y - c.y) + Math.cos(a) * (v.x - c.x);
+ dY = Math.cos(a) * (v.y - c.y) - Math.sin(a) * (v.x - c.x);
+
+ v.x = c.x + dX;
+ v.y = c.y + dY;
+
+ this.setVertex(locPos, v);
+ }
+ }
+ }
+});
+
+/**
+ * creates the action with center position, number of twirls, amplitude, a grid size and duration
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} twirls
+ * @param {Number} amplitude
+ * @return {cc.Twirl}
+ */
+cc.twirl = function (duration, gridSize, position, twirls, amplitude) {
+ return new cc.Twirl(duration, gridSize, position, twirls, amplitude);
+};
+
+/**
+ * Please use cc.twirl instead
+ * creates the action with center position, number of twirls, amplitude, a grid size and duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {cc.Vec2} position
+ * @param {Number} twirls
+ * @param {Number} amplitude
+ * @return {cc.Twirl}
+ * @static
+ * @deprecated since v3.0 Please use cc.twirl instead.
+ */
+cc.Twirl.create = cc.twirl;
\ No newline at end of file
diff --git a/cocos2d/actions3d/CCActionPageTurn3D.js b/cocos2d/actions3d/CCActionPageTurn3D.js
new file mode 100644
index 00000000000..ae7313b2dd4
--- /dev/null
+++ b/cocos2d/actions3d/CCActionPageTurn3D.js
@@ -0,0 +1,130 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ *
+ * This action simulates a page turn from the bottom right hand corner of the screen.
+ * It's not much use by itself but is used by the PageTurnTransition.
+ *
+ * Based on an original paper by L Hong et al.
+ * http://www.parc.com/publication/1638/turning-pages-of-3d-electronic-books.html
+ *
+ * @class
+ * @extends cc.Grid3DAction
+ */
+cc.PageTurn3D = cc.Grid3DAction.extend(/** @lends cc.PageTurn3D# */{
+ getGrid: function(){
+ var result = new cc.Grid3D(this._gridSize, undefined, undefined, this._gridNodeTarget.getGridRect());
+ result.setNeedDepthTestForBlit(true);
+ return result;
+ },
+
+ clone: function(){
+ var ret = new cc.PageTurn3D();
+ ret.initWithDuration(this._duration, this._gridSize);
+ return ret;
+ },
+
+ /**
+ * Update each tick
+ * Time is the percentage of the way through the duration
+ */
+ update:function (time) {
+ var tt = Math.max(0, time - 0.25);
+ var deltaAy = (tt * tt * 500);
+ var ay = -100 - deltaAy;
+
+ var deltaTheta = Math.sqrt(time);
+ var theta = deltaTheta>0.5?Math.PI/2 *deltaTheta : Math.PI/2*(1-deltaTheta);
+ var rotateByYAxis = (2-time)*Math.PI;
+
+ var sinTheta = Math.sin(theta);
+ var cosTheta = Math.cos(theta);
+
+ var locGridSize = this._gridSize;
+ var locVer = cc.p(0, 0);
+ for (var i = 0; i <= locGridSize.width; ++i) {
+ for (var j = 0; j <= locGridSize.height; ++j) {
+ locVer.x = i;
+ locVer.y = j;
+ // Get original vertex
+ var p = this.getOriginalVertex(locVer);
+
+ p.x -= this.getGridRect().x;
+ var R = Math.sqrt((p.x * p.x) + ((p.y - ay) * (p.y - ay)));
+ var r = R * sinTheta;
+ var alpha = Math.asin(p.x / R);
+ var beta = alpha / sinTheta;
+ var cosBeta = Math.cos(beta);
+
+ // If beta > PI then we've wrapped around the cone
+ // Reduce the radius to stop these points interfering with others
+ if (beta <= Math.PI)
+ p.x = ( r * Math.sin(beta));
+ else
+ p.x = 0; //Force X = 0 to stop wrapped points
+
+ p.y = ( R + ay - ( r * (1 - cosBeta) * sinTheta));
+
+ // We scale z here to avoid the animation being
+ // too much bigger than the screen due to perspectve transform
+ p.z = (r * ( 1 - cosBeta ) * cosTheta);// "100" didn't work for
+ p.x = p.z * Math.sin(rotateByYAxis) + p.x * Math.cos(rotateByYAxis);
+ p.z = p.z * Math.cos(rotateByYAxis) - p.x * Math.cos(rotateByYAxis);
+ p.z/= 7;
+ // Stop z coord from dropping beneath underlying page in a transition
+ // issue #751
+ if (p.z < 0.5)
+ p.z = 0.5;
+
+ // Set new coords
+ p.x+= this.getGridRect().x;
+ this.setVertex(locVer, p);
+ }
+ }
+ }
+});
+
+/**
+ * create PageTurn3D action
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.PageTurn3D}
+ */
+cc.pageTurn3D = function (duration, gridSize) {
+ return new cc.PageTurn3D(duration, gridSize);
+};
+/**
+ * Please use cc.pageTurn3D instead
+ * create PageTurn3D action
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.PageTurn3D}
+ * @static
+ * @deprecated since v3.0 please use cc.pageTurn3D instead.
+ */
+cc.PageTurn3D.create = cc.pageTurn3D;
\ No newline at end of file
diff --git a/cocos2d/actions3d/CCActionTiledGrid.js b/cocos2d/actions3d/CCActionTiledGrid.js
new file mode 100644
index 00000000000..3210f3331f9
--- /dev/null
+++ b/cocos2d/actions3d/CCActionTiledGrid.js
@@ -0,0 +1,1300 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ * cc.ShakyTiles3D action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ */
+cc.ShakyTiles3D = cc.TiledGrid3DAction.extend(/** @lends cc.ShakyTiles3D# */{
+ _randRange:0,
+ _shakeZ:false,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates the action with a range, whether or not to shake Z vertices, a grid size, and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ */
+ ctor:function (duration, gridSize, range, shakeZ) {
+ cc.GridAction.prototype.ctor.call(this);
+ shakeZ !== undefined && this.initWithDuration(duration, gridSize, range, shakeZ);
+ },
+
+ /**
+ * Initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, range, shakeZ) {
+ if (cc.TiledGrid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._randRange = range;
+ this._shakeZ = shakeZ;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locGridSize = this._gridSize, locRandRange = this._randRange;
+ var locPos = cc.p(0, 0);
+ for (var i = 0; i < locGridSize.width; ++i) {
+ for (var j = 0; j < locGridSize.height; ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ var coords = this.originalTile(locPos);
+
+ // X
+ coords.bl.x += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.br.x += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tl.x += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tr.x += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+
+ // Y
+ coords.bl.y += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.br.y += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tl.y += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tr.y += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+
+ if (this._shakeZ) {
+ coords.bl.z += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.br.z += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tl.z += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tr.z += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ }
+
+ this.setTile(locPos, coords);
+ }
+ }
+ }
+});
+
+/**
+ * Creates the action with a range, whether or not to shake Z vertices, a grid size, and duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ * @return {cc.ShakyTiles3D}
+ */
+cc.shakyTiles3D = function (duration, gridSize, range, shakeZ) {
+ return new cc.ShakyTiles3D(duration, gridSize, range, shakeZ);
+};
+
+/**
+ * Please use cc.shakyTiles3D instead.
+ * creates the action with a range, whether or not to shake Z vertices, a grid size, and duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shakeZ
+ * @return {cc.ShakyTiles3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.shakyTiles3D instead.
+ */
+cc.ShakyTiles3D.create = cc.shakyTiles3D;
+
+/**
+ * cc.ShatteredTiles3D action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shatterZ
+ */
+cc.ShatteredTiles3D = cc.TiledGrid3DAction.extend(/** @lends cc.ShatteredTiles3D# */{
+ _randRange:0,
+ _once:false,
+ _shatterZ:false,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates the action with a range, whether of not to shatter Z vertices, a grid size and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shatterZ
+ */
+ ctor:function (duration, gridSize, range, shatterZ) {
+ cc.GridAction.prototype.ctor.call(this);
+ shatterZ !== undefined && this.initWithDuration(duration, gridSize, range, shatterZ);
+ },
+
+ /**
+ * Initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shatterZ
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, range, shatterZ) {
+ if (cc.TiledGrid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._once = false;
+ this._randRange = range;
+ this._shatterZ = shatterZ;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ if (this._once === false) {
+ var locGridSize = this._gridSize, locRandRange = this._randRange;
+ var coords, locPos = cc.p(0, 0);
+ for (var i = 0; i < locGridSize.width; ++i) {
+ for (var j = 0; j < locGridSize.height; ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ coords = this.originalTile(locPos);
+
+ // X
+ coords.bl.x += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.br.x += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tl.x += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tr.x += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+
+ // Y
+ coords.bl.y += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.br.y += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tl.y += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tr.y += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+
+ if (this._shatterZ) {
+ coords.bl.z += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.br.z += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tl.z += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ coords.tr.z += ( cc.rand() % (locRandRange * 2) ) - locRandRange;
+ }
+ this.setTile(locPos, coords);
+ }
+ }
+ this._once = true;
+ }
+ }
+});
+
+/**
+ * Creates the action with a range, whether of not to shatter Z vertices, a grid size and duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shatterZ
+ * @return {cc.ShatteredTiles3D}
+ */
+cc.shatteredTiles3D = function (duration, gridSize, range, shatterZ) {
+ return new cc.ShatteredTiles3D(duration, gridSize, range, shatterZ);
+};
+
+/**
+ * Please use cc.shatteredTiles3D instead.
+ * Creates the action with a range, whether of not to shatter Z vertices, a grid size and duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} range
+ * @param {Boolean} shatterZ
+ * @return {cc.ShatteredTiles3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.shatteredTiles3D instead.
+ */
+cc.ShatteredTiles3D.create = cc.shatteredTiles3D;
+
+/**
+ * A Tile composed of position, startPosition and delta.
+ * @Class
+ * @constructor
+ * @param {cc.Vec2} [position=cc.p(0,0)]
+ * @param {cc.Vec2} [startPosition=cc.p(0,0)]
+ * @param {cc.Size} [delta=cc.p(0,0)]
+ */
+cc.Tile = function (position, startPosition, delta) {
+ this.position = position || cc.p(0,0);
+ this.startPosition = startPosition || cc.p(0,0);
+ this.delta = delta || cc.p(0,0);
+};
+
+/**
+ * cc.ShuffleTiles action, Shuffle the tiles in random order.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} seed
+ */
+cc.ShuffleTiles = cc.TiledGrid3DAction.extend(/** @lends cc.ShuffleTiles# */{
+ _seed:0,
+ _tilesCount:0,
+ _tilesOrder:null,
+ _tiles:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates the action with a random seed, the grid size and the duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} seed
+ */
+ ctor:function (duration, gridSize, seed) {
+ cc.GridAction.prototype.ctor.call(this);
+ this._tilesOrder = [];
+ this._tiles = [];
+
+ seed !== undefined && this.initWithDuration(duration, gridSize, seed);
+ },
+
+ /**
+ * Initializes the action with a random seed, the grid size and the duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} seed
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, seed) {
+ if (cc.TiledGrid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._seed = seed;
+ this._tilesOrder.length = 0;
+ this._tiles.length = 0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Shuffle
+ * @param {Array} array
+ * @param {Number} len
+ */
+ shuffle:function (array, len) {
+ for (var i = len - 1; i >= 0; i--) {
+ var j = 0 | (cc.rand() % (i + 1));
+ var v = array[i];
+ array[i] = array[j];
+ array[j] = v;
+ }
+ },
+
+ /**
+ * Get Delta
+ * @param {cc.Size} pos
+ */
+ getDelta:function (pos) {
+ var locGridSize = this._gridSize;
+ var idx = pos.width * locGridSize.height + pos.height;
+ return cc.size(((this._tilesOrder[idx] / locGridSize.height) - pos.width),
+ ((this._tilesOrder[idx] % locGridSize.height) - pos.height));
+ },
+
+ /**
+ * Place Tile
+ * @param {cc.Vec2} pos
+ * @param {cc.Tile} tile
+ */
+ placeTile:function (pos, tile) {
+ var coords = this.originalTile(pos);
+
+ var step = this.target.grid.getStep();
+ var locPosition = tile.position;
+ coords.bl.x += (locPosition.x * step.x);
+ coords.bl.y += (locPosition.y * step.y);
+
+ coords.br.x += (locPosition.x * step.x);
+ coords.br.y += (locPosition.y * step.y);
+
+ coords.tl.x += (locPosition.x * step.x);
+ coords.tl.y += (locPosition.y * step.y);
+
+ coords.tr.x += (locPosition.x * step.x);
+ coords.tr.y += (locPosition.y * step.y);
+
+ this.setTile(pos, coords);
+ },
+
+ /**
+ * Start with target
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.TiledGrid3DAction.prototype.startWithTarget.call(this, target);
+ var locGridSize = this._gridSize;
+
+ this._tilesCount = locGridSize.width * locGridSize.height;
+ var locTilesOrder = this._tilesOrder;
+ locTilesOrder.length = 0;
+
+ /**
+ * Use k to loop. Because m_nTilesCount is unsigned int,
+ * and i is used later for int.
+ */
+ for (var k = 0; k < this._tilesCount; ++k)
+ locTilesOrder[k] = k;
+ this.shuffle(locTilesOrder, this._tilesCount);
+
+ var locTiles = this._tiles ;
+ locTiles.length = 0;
+ var tileIndex = 0, tempSize = cc.size(0,0);
+ for (var i = 0; i < locGridSize.width; ++i) {
+ for (var j = 0; j < locGridSize.height; ++j) {
+ locTiles[tileIndex] = new cc.Tile();
+ locTiles[tileIndex].position = cc.p(i, j);
+ locTiles[tileIndex].startPosition = cc.p(i, j);
+ tempSize.width = i;
+ tempSize.height = j;
+ locTiles[tileIndex].delta = this.getDelta(tempSize);
+ ++tileIndex;
+ }
+ }
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var tileIndex = 0, locGridSize = this._gridSize, locTiles = this._tiles;
+ var selTile, locPos = cc.p(0, 0);
+ for (var i = 0; i < locGridSize.width; ++i) {
+ for (var j = 0; j < locGridSize.height; ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ selTile = locTiles[tileIndex];
+ selTile.position.x = selTile.delta.width * dt;
+ selTile.position.y = selTile.delta.height * dt;
+ this.placeTile(locPos, selTile);
+ ++tileIndex;
+ }
+ }
+ }
+});
+
+/**
+ * Creates the action with a random seed, the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} seed
+ * @return {cc.ShuffleTiles}
+ */
+cc.shuffleTiles = function (duration, gridSize, seed) {
+ return new cc.ShuffleTiles(duration, gridSize, seed);
+};
+
+/**
+ * Please use cc.shuffleTiles instead.
+ * Creates the action with a random seed, the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} seed
+ * @return {cc.ShuffleTiles}
+ * @static
+ * @deprecated since v3.0 Please use cc.shuffleTiles instead.
+ */
+cc.ShuffleTiles.create = cc.shuffleTiles;
+
+/**
+ * cc.FadeOutTRTiles action. Fades out the tiles in a Top-Right direction.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ */
+cc.FadeOutTRTiles = cc.TiledGrid3DAction.extend(/** @lends cc.FadeOutTRTiles# */{
+ /**
+ * Test function
+ * @param {cc.Vec2} pos
+ * @param {Number} time
+ */
+ testFunc:function (pos, time) {
+ var locX = this._gridSize.width * time;
+ var locY = this._gridSize.height * time;
+ if (locX === this._gridSize.width && locY === this._gridSize.height) return 0.0;
+ if ((locX + locY) === 0.0)
+ return 1.0;
+ return Math.pow((pos.x + pos.y) / (locX + locY), 6);
+ },
+
+ /**
+ * Turn on Tile
+ * @param {cc.Vec2} pos
+ */
+ turnOnTile:function (pos) {
+ this.setTile(pos, this.originalTile(pos));
+ },
+
+ /**
+ * Turn Off Tile
+ * @param {cc.Vec2} pos
+ */
+ turnOffTile:function (pos) {
+ this.setTile(pos, new cc.Quad3());
+ },
+
+ /**
+ * Transform tile
+ * @param {cc.Vec2} pos
+ * @param {Number} distance
+ */
+ transformTile:function (pos, distance) {
+ var coords = this.originalTile(pos);
+ var step = this.target.grid.getStep();
+
+ coords.bl.x += (step.x / 2) * (1.0 - distance);
+ coords.bl.y += (step.y / 2) * (1.0 - distance);
+
+ coords.br.x -= (step.x / 2) * (1.0 - distance);
+ coords.br.y += (step.y / 2) * (1.0 - distance);
+
+ coords.tl.x += (step.x / 2) * (1.0 - distance);
+ coords.tl.y -= (step.y / 2) * (1.0 - distance);
+
+ coords.tr.x -= (step.x / 2) * (1.0 - distance);
+ coords.tr.y -= (step.y / 2) * (1.0 - distance);
+
+ this.setTile(pos, coords);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locGridSize = this._gridSize;
+ var locPos = cc.p(0, 0), distance;
+ for (var i = 0; i < locGridSize.width; ++i) {
+ for (var j = 0; j < locGridSize.height; ++j) {
+ locPos.x = i;
+ locPos.y = j;
+ distance = this.testFunc(locPos, dt);
+ if (distance === 0)
+ this.turnOffTile(locPos);
+ else if (distance < 1)
+ this.transformTile(locPos, distance);
+ else
+ this.turnOnTile(locPos);
+ }
+ }
+ }
+});
+
+/**
+ * Creates the action with the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param duration
+ * @param gridSize
+ * @return {cc.FadeOutTRTiles}
+ */
+cc.fadeOutTRTiles = function (duration, gridSize) {
+ return new cc.FadeOutTRTiles(duration, gridSize);
+};
+
+/**
+ * Please use cc.fadeOutTRTiles instead.
+ * Creates the action with the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @param duration
+ * @param gridSize
+ * @return {cc.FadeOutTRTiles}
+ * @static
+ * @deprecated since v3.0 Please use cc.fadeOutTRTiles instead.
+ */
+cc.FadeOutTRTiles.create = cc.fadeOutTRTiles;
+
+/**
+ * cc.FadeOutBLTiles action. Fades out the tiles in a Bottom-Left direction.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.FadeOutTRTiles
+ */
+cc.FadeOutBLTiles = cc.FadeOutTRTiles.extend(/** @lends cc.FadeOutBLTiles# */{
+ /**
+ * Test function
+ * @param {cc.Vec2} pos
+ * @param {Number} time
+ */
+ testFunc:function (pos, time) {
+ var locX = this._gridSize.width * (1.0 - time);
+ var locY = this._gridSize.height * (1.0 - time);
+ if ((locX + locY) === 0)
+ return 0.0;
+ if ((pos.x + pos.y) === 0)
+ return 1.0;
+
+ return Math.pow((locX + locY) / (pos.x + pos.y), 6);
+ }
+});
+
+/**
+ * Creates the action with the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param duration
+ * @param gridSize
+ * @return {cc.FadeOutBLTiles}
+ */
+cc.fadeOutBLTiles = function (duration, gridSize) {
+ return new cc.FadeOutBLTiles(duration, gridSize);
+};
+
+/**
+ * Please use cc.fadeOutBLTiles instead.
+ * Creates the action with the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @param duration
+ * @param gridSize
+ * @return {cc.FadeOutBLTiles}
+ * @static
+ * @deprecated since v3.0 Please use cc.fadeOutBLTiles instead.
+ */
+cc.FadeOutBLTiles.create = cc.fadeOutBLTiles;
+
+/**
+ * cc.FadeOutUpTiles action. Fades out the tiles in upwards direction.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.FadeOutTRTiles
+ */
+cc.FadeOutUpTiles = cc.FadeOutTRTiles.extend(/** @lends cc.FadeOutUpTiles# */{
+ /**
+ * Test function
+ * @param {cc.Vec2} pos
+ * @param {Number} time
+ */
+ testFunc:function (pos, time) {
+ var locY = this._gridSize.height * time;
+ if( locY === this._gridSize.height) return 0.0;
+ if (locY === 0.0) return 1.0;
+ return Math.pow(pos.y / locY, 6);
+ },
+
+ transformTile:function (pos, distance) {
+ var coords = this.originalTile(pos);
+ var step = this.target.grid.getStep();
+
+ coords.bl.y += (step.y / 2) * (1.0 - distance);
+ coords.br.y += (step.y / 2) * (1.0 - distance);
+ coords.tl.y -= (step.y / 2) * (1.0 - distance);
+ coords.tr.y -= (step.y / 2) * (1.0 - distance);
+
+ this.setTile(pos, coords);
+ }
+});
+
+/**
+ * Creates the action with the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.FadeOutUpTiles}
+ */
+cc.fadeOutUpTiles = function (duration, gridSize) {
+ return new cc.FadeOutUpTiles(duration, gridSize);
+};
+
+/**
+ * Please use cc.fadeOutUpTiles instead.
+ * Creates the action with the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.FadeOutUpTiles}
+ * @static
+ * @deprecated since v3.0 Please use cc.fadeOutUpTiles instead.
+ */
+cc.FadeOutUpTiles.create = cc.fadeOutUpTiles;
+
+/**
+ * cc.FadeOutDownTiles action. Fades out the tiles in downwards direction.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.FadeOutUpTiles
+ */
+cc.FadeOutDownTiles = cc.FadeOutUpTiles.extend(/** @lends cc.FadeOutDownTiles# */{
+ /**
+ * Test function
+ * @param {cc.Vec2} pos
+ * @param {Number} time
+ */
+ testFunc:function (pos, time) {
+ var locY = this._gridSize.height * (1.0 - time);
+ if( locY === 0.0 ) return 0.0;
+ if (pos.y === 0) return 1.0;
+ return Math.pow(locY / pos.y, 6);
+ }
+});
+
+/**
+ * Creates the action with the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.FadeOutDownTiles}
+ */
+cc.fadeOutDownTiles = function (duration, gridSize) {
+ return new cc.FadeOutDownTiles(duration, gridSize);
+};
+/**
+ * Please use cc.fadeOutDownTiles instead.
+ * Creates the action with the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @return {cc.FadeOutDownTiles}
+ * @static
+ * @deprecated since v3.0 Please use cc.fadeOutDownTiles instead.
+ */
+cc.FadeOutDownTiles.create = cc.fadeOutDownTiles;
+
+/**
+ * cc.TurnOffTiles action.
+ * Turn off the files in random order.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number|Null} [seed=0]
+ * @example
+ * // turnOffTiles without seed
+ * var toff = new cc.TurnOffTiles(this._duration, cc.size(x, y));
+ *
+ * // turnOffTiles with seed
+ * var toff = new cc.TurnOffTiles(this._duration, cc.size(x, y), 0);
+ */
+cc.TurnOffTiles = cc.TiledGrid3DAction.extend(/** @lends cc.TurnOffTiles# */{
+ _seed:null,
+ _tilesCount:0,
+ _tilesOrder:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates the action with a random seed, the grid size and the duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number|Null} [seed=0]
+ */
+ ctor:function (duration, gridSize, seed) {
+ cc.GridAction.prototype.ctor.call(this);
+ this._tilesOrder = [];
+
+ gridSize !== undefined && this.initWithDuration(duration, gridSize, seed);
+ },
+
+ /**
+ * Initializes the action with a random seed, the grid size and the duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number|Null} [seed=0]
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, seed) {
+ if (cc.TiledGrid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._seed = seed || 0;
+ this._tilesOrder.length = 0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Shuffle
+ * @param {Array} array
+ * @param {Number} len
+ */
+ shuffle:function (array, len) {
+ for (var i = len - 1; i >= 0; i--) {
+ var j = 0 | (cc.rand() % (i + 1));
+ var v = array[i];
+ array[i] = array[j];
+ array[j] = v;
+ }
+ },
+
+ /**
+ * Turn on tile.
+ * @param {cc.Vec2} pos
+ */
+ turnOnTile:function (pos) {
+ this.setTile(pos, this.originalTile(pos));
+ },
+
+ /**
+ * Turn off title.
+ * @param {cc.Vec2} pos
+ */
+ turnOffTile:function (pos) {
+ this.setTile(pos, new cc.Quad3());
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.TiledGrid3DAction.prototype.startWithTarget.call(this, target);
+
+ this._tilesCount = this._gridSize.width * this._gridSize.height;
+ var locTilesOrder = this._tilesOrder;
+ locTilesOrder.length = 0;
+ for (var i = 0; i < this._tilesCount; ++i)
+ locTilesOrder[i] = i;
+ this.shuffle(locTilesOrder, this._tilesCount);
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var l = 0 | (dt * this._tilesCount), locGridSize = this._gridSize;
+ var t,tilePos = cc.p(0,0), locTilesOrder = this._tilesOrder;
+ for (var i = 0; i < this._tilesCount; i++) {
+ t = locTilesOrder[i];
+ tilePos.x = 0 | (t / locGridSize.height);
+ tilePos.y = t % (0 | locGridSize.height);
+ if (i < l)
+ this.turnOffTile(tilePos);
+ else
+ this.turnOnTile(tilePos);
+ }
+ }
+});
+
+/**
+ * Creates the action with a random seed, the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number|Null} [seed=0]
+ * @return {cc.TurnOffTiles}
+ * @example
+ * // example
+ * // turnOffTiles without seed
+ * var toff = cc.turnOffTiles(this._duration, cc.size(x, y));
+ *
+ * // turnOffTiles with seed
+ * var toff = cc.turnOffTiles(this._duration, cc.size(x, y), 0);
+ */
+cc.turnOffTiles = function (duration, gridSize, seed) {
+ return new cc.TurnOffTiles(duration, gridSize, seed);
+};
+/**
+ * Please use cc.turnOffTiles instead.
+ * Creates the action with a random seed, the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number|Null} [seed=0]
+ * @return {cc.TurnOffTiles}
+ * @static
+ * @deprecated since v3.0 Please use cc.turnOffTiles instead.
+ */
+cc.TurnOffTiles.create = cc.turnOffTiles;
+
+/**
+ * cc.WavesTiles3D action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+cc.WavesTiles3D = cc.TiledGrid3DAction.extend(/** @lends cc.WavesTiles3D# */{
+ _waves:0,
+ _amplitude:0,
+ _amplitudeRate:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates the action with a number of waves, the waves amplitude, the grid size and the duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ */
+ ctor:function (duration, gridSize, waves, amplitude) {
+ cc.GridAction.prototype.ctor.call(this);
+ amplitude !== undefined && this.initWithDuration(duration, gridSize, waves, amplitude);
+ },
+
+ /**
+ * get amplitude of waves
+ * @return {Number}
+ */
+ getAmplitude:function () {
+ return this._amplitude;
+ },
+
+ /**
+ * set amplitude of waves
+ * @param {Number} amplitude
+ */
+ setAmplitude:function (amplitude) {
+ this._amplitude = amplitude;
+ },
+
+ /**
+ * get amplitude rate of waves
+ * @return {Number}
+ */
+ getAmplitudeRate:function () {
+ return this._amplitudeRate;
+ },
+
+ /**
+ * set amplitude rate of waves
+ * @param {Number} amplitudeRate
+ */
+ setAmplitudeRate:function (amplitudeRate) {
+ this._amplitudeRate = amplitudeRate;
+ },
+
+ /**
+ * initializes the action with a number of waves, the waves amplitude, the grid size and the duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, gridSize, waves, amplitude) {
+ if (cc.TiledGrid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._waves = waves;
+ this._amplitude = amplitude;
+ this._amplitudeRate = 1.0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locGridSize = this._gridSize, locWaves = this._waves, locAmplitude = this._amplitude, locAmplitudeRate = this._amplitudeRate;
+ var locPos = cc.p(0, 0), coords;
+ for (var i = 0; i < locGridSize.width; i++) {
+ for (var j = 0; j < locGridSize.height; j++) {
+ locPos.x = i;
+ locPos.y = j;
+ coords = this.originalTile(locPos);
+ coords.bl.z = (Math.sin(dt * Math.PI * locWaves * 2 +
+ (coords.bl.y + coords.bl.x) * 0.01) * locAmplitude * locAmplitudeRate);
+ coords.br.z = coords.bl.z;
+ coords.tl.z = coords.bl.z;
+ coords.tr.z = coords.bl.z;
+ this.setTile(locPos, coords);
+ }
+ }
+ }
+});
+
+/**
+ * creates the action with a number of waves, the waves amplitude, the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {cc.WavesTiles3D}
+ */
+cc.wavesTiles3D = function (duration, gridSize, waves, amplitude) {
+ return new cc.WavesTiles3D(duration, gridSize, waves, amplitude);
+};
+/**
+ * Please use cc.wavesTiles3D instead
+ * creates the action with a number of waves, the waves amplitude, the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} waves
+ * @param {Number} amplitude
+ * @return {cc.WavesTiles3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.wavesTiles3D instead.
+ */
+cc.WavesTiles3D.create = cc.wavesTiles3D;
+
+/**
+ * cc.JumpTiles3D action. A sin function is executed to move the tiles across the Z axis.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} numberOfJumps
+ * @param {Number} amplitude
+ */
+cc.JumpTiles3D = cc.TiledGrid3DAction.extend(/** @lends cc.JumpTiles3D# */{
+ _jumps:0,
+ _amplitude:0,
+ _amplitudeRate:0,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates the action with the number of jumps, the sin amplitude, the grid size and the duration.
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} numberOfJumps
+ * @param {Number} amplitude
+ */
+ ctor:function (duration, gridSize, numberOfJumps, amplitude) {
+ cc.GridAction.prototype.ctor.call(this);
+ amplitude !== undefined && this.initWithDuration(duration, gridSize, numberOfJumps, amplitude);
+ },
+
+ /**
+ * get amplitude of the sin
+ * @return {Number}
+ */
+ getAmplitude:function () {
+ return this._amplitude;
+ },
+
+ /**
+ * set amplitude of the sin
+ * @param {Number} amplitude
+ */
+ setAmplitude:function (amplitude) {
+ this._amplitude = amplitude;
+ },
+
+ /**
+ * get amplitude rate
+ * @return {Number}
+ */
+ getAmplitudeRate:function () {
+ return this._amplitudeRate;
+ },
+
+ /**
+ * set amplitude rate
+ * @param amplitudeRate
+ */
+ setAmplitudeRate:function (amplitudeRate) {
+ this._amplitudeRate = amplitudeRate;
+ },
+
+ /**
+ * initializes the action with the number of jumps, the sin amplitude, the grid size and the duration
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} numberOfJumps
+ * @param {Number} amplitude
+ */
+ initWithDuration:function (duration, gridSize, numberOfJumps, amplitude) {
+ if (cc.TiledGrid3DAction.prototype.initWithDuration.call(this, duration, gridSize)) {
+ this._jumps = numberOfJumps;
+ this._amplitude = amplitude;
+ this._amplitudeRate = 1.0;
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var sinz = (Math.sin(Math.PI * dt * this._jumps * 2) * this._amplitude * this._amplitudeRate );
+ var sinz2 = (Math.sin(Math.PI * (dt * this._jumps * 2 + 1)) * this._amplitude * this._amplitudeRate );
+
+ var locGridSize = this._gridSize;
+ var locGrid = this.target.grid;
+ var coords, locPos = cc.p(0, 0);
+ for (var i = 0; i < locGridSize.width; i++) {
+ for (var j = 0; j < locGridSize.height; j++) {
+ locPos.x = i;
+ locPos.y = j;
+ //hack for html5
+ //var coords = this.originalTile(cc.p(i, j));
+ coords = locGrid.originalTile(locPos);
+
+ if (((i + j) % 2) === 0) {
+ coords.bl.z += sinz;
+ coords.br.z += sinz;
+ coords.tl.z += sinz;
+ coords.tr.z += sinz;
+ } else {
+ coords.bl.z += sinz2;
+ coords.br.z += sinz2;
+ coords.tl.z += sinz2;
+ coords.tr.z += sinz2;
+ }
+ //hack for html5
+ //this.setTile(cc.p(i, j), coords);
+ locGrid.setTile(locPos, coords);
+ }
+ }
+ }
+});
+
+/**
+ * creates the action with the number of jumps, the sin amplitude, the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} numberOfJumps
+ * @param {Number} amplitude
+ * @return {cc.JumpTiles3D}
+ */
+cc.jumpTiles3D = function (duration, gridSize, numberOfJumps, amplitude) {
+ return new cc.JumpTiles3D(duration, gridSize, numberOfJumps, amplitude);
+};
+
+/**
+ * Please use cc.jumpTiles3D instead
+ * creates the action with the number of jumps, the sin amplitude, the grid size and the duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {cc.Size} gridSize
+ * @param {Number} numberOfJumps
+ * @param {Number} amplitude
+ * @return {cc.JumpTiles3D}
+ * @static
+ * @deprecated since v3.0 Please use cc.jumpTiles3D instead.
+ */
+cc.JumpTiles3D.create = cc.jumpTiles3D;
+
+/**
+ * cc.SplitRows action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ * @param {Number} duration
+ * @param {Number} rows
+ */
+cc.SplitRows = cc.TiledGrid3DAction.extend(/** @lends cc.SplitRows# */{
+ _rows:0,
+ _winSize:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * creates the action with the number of rows to split and the duration.
+ * @param {Number} duration
+ * @param {Number} rows
+ */
+ ctor:function (duration, rows) {
+ cc.GridAction.prototype.ctor.call(this);
+ rows !== undefined && this.initWithDuration(duration, rows);
+ },
+
+ /**
+ * initializes the action with the number of rows to split and the duration
+ * @param {Number} duration
+ * @param {Number} rows
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, rows) {
+ this._rows = rows;
+ return cc.TiledGrid3DAction.prototype.initWithDuration.call(this, duration, cc.size(1, rows));
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locGridSize = this._gridSize, locWinSizeWidth = this._winSize.width;
+ var coords, direction, locPos = cc.p(0, 0);
+ for (var j = 0; j < locGridSize.height; ++j) {
+ locPos.y = j;
+ coords = this.originalTile(locPos);
+ direction = 1;
+
+ if ((j % 2 ) === 0)
+ direction = -1;
+
+ coords.bl.x += direction * locWinSizeWidth * dt;
+ coords.br.x += direction * locWinSizeWidth * dt;
+ coords.tl.x += direction * locWinSizeWidth * dt;
+ coords.tr.x += direction * locWinSizeWidth * dt;
+
+ this.setTile(locPos, coords);
+ }
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.TiledGrid3DAction.prototype.startWithTarget.call(this, target);
+ this._winSize = cc.director.getWinSizeInPixels();
+ }
+});
+
+/**
+ * creates the action with the number of rows to split and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {Number} rows
+ * @return {cc.SplitRows}
+ */
+cc.splitRows = function (duration, rows) {
+ return new cc.SplitRows(duration, rows);
+};
+
+/**
+ * Please use cc.splitRows instead
+ * creates the action with the number of rows to split and the duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {Number} rows
+ * @return {cc.SplitRows}
+ * @static
+ * @deprecated since v3.0 Please use cc.splitRows instead.
+ */
+cc.SplitRows.create = cc.splitRows;
+
+/**
+ * cc.SplitCols action.
+ * Reference the test cases (Effects Test)
+ * @class
+ * @extends cc.TiledGrid3DAction
+ * @param {Number} duration
+ * @param {Number} cols
+ */
+cc.SplitCols = cc.TiledGrid3DAction.extend(/** @lends cc.SplitCols# */{
+ _cols:0,
+ _winSize:null,
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * Creates the action with the number of columns to split and the duration.
+ * @param {Number} duration
+ * @param {Number} cols
+ */
+ ctor:function (duration, cols) {
+ cc.GridAction.prototype.ctor.call(this);
+ cols !== undefined && this.initWithDuration(duration, cols);
+ },
+ /**
+ * initializes the action with the number of columns to split and the duration
+ * @param {Number} duration
+ * @param {Number} cols
+ * @return {Boolean}
+ */
+ initWithDuration:function (duration, cols) {
+ this._cols = cols;
+ return cc.TiledGrid3DAction.prototype.initWithDuration.call(this, duration, cc.size(cols, 1));
+ },
+
+ /**
+ * Called once per frame. Time is the number of seconds of a frame interval.
+ * @param {Number} dt
+ */
+ update:function (dt) {
+ var locGridSizeWidth = this._gridSize.width, locWinSizeHeight = this._winSize.height;
+ var coords, direction, locPos = cc.p(0, 0);
+ for (var i = 0; i < locGridSizeWidth; ++i) {
+ locPos.x = i;
+ coords = this.originalTile(locPos);
+ direction = 1;
+
+ if ((i % 2 ) === 0)
+ direction = -1;
+
+ coords.bl.y += direction * locWinSizeHeight * dt;
+ coords.br.y += direction * locWinSizeHeight * dt;
+ coords.tl.y += direction * locWinSizeHeight * dt;
+ coords.tr.y += direction * locWinSizeHeight * dt;
+
+ this.setTile(locPos, coords);
+ }
+ cc.renderer.childrenOrderDirty = true;
+ },
+
+ /**
+ * called before the action start. It will also set the target.
+ * @param {cc.Node} target
+ */
+ startWithTarget:function (target) {
+ cc.TiledGrid3DAction.prototype.startWithTarget.call(this, target);
+ this._winSize = cc.director.getWinSizeInPixels();
+ }
+});
+
+/**
+ * creates the action with the number of columns to split and the duration.
+ * Reference the test cases (Effects Test)
+ * @function
+ * @param {Number} duration
+ * @param {Number} cols
+ * @return {cc.SplitCols}
+ */
+cc.splitCols = function (duration, cols) {
+ return new cc.SplitCols(duration, cols);
+};
+
+/**
+ * Please use cc.splitCols instead.
+ * creates the action with the number of columns to split and the duration.
+ * Reference the test cases (Effects Test)
+ * @param {Number} duration
+ * @param {Number} cols
+ * @return {cc.SplitCols}
+ * @static
+ * @deprecated since v3.0 Please use cc.splitCols instead.
+ */
+cc.SplitCols.create = cc.splitCols;
\ No newline at end of file
diff --git a/cocos2d/animation/animation-animator.js b/cocos2d/animation/animation-animator.js
new file mode 100644
index 00000000000..3cca6baf8a3
--- /dev/null
+++ b/cocos2d/animation/animation-animator.js
@@ -0,0 +1,315 @@
+var JS = cc.js;
+var Animator = require('./animators').Animator;
+var DynamicAnimCurve = require('./animation-curves').DynamicAnimCurve;
+var SampledAnimCurve = require('./animation-curves').SampledAnimCurve;
+var sampleMotionPaths = require('./motion-path-helper').sampleMotionPaths;
+var EventAnimCurve = require('./animation-curves').EventAnimCurve;
+var EventInfo = require('./animation-curves').EventInfo;
+var WrapModeMask = require('./types').WrapModeMask;
+var binarySearch = require('./binary-search');
+
+// The actual animator for Animation Component
+
+function AnimationAnimator (target, animation) {
+ Animator.call(this, target);
+ this.animation = animation;
+}
+JS.extend(AnimationAnimator, Animator);
+var p = AnimationAnimator.prototype;
+
+p.playState = function (state, startTime) {
+ var clip = state.clip;
+ if (!clip) {
+ return;
+ }
+ var curves = state.curves;
+ if (!state.curveLoaded) {
+ initClipData(this.target, state);
+ }
+ this.playingAnims.push(state);
+ state.play();
+ state.time = startTime || 0;
+ this.play();
+};
+
+p.sample = function () {
+ var anims = this.playingAnims;
+ for (var i = 0; i < anims.length; i++) {
+ var anim = anims[i];
+ anim.sample();
+ }
+};
+
+p.stopState = function (state) {
+ if (JS.array.remove(this.playingAnims, state)) {
+ state.stop();
+ }
+};
+
+p.pauseState = function (state) {
+ if (state) {
+ state.pause();
+ }
+};
+
+p.resumeState = function (state) {
+ if (state) {
+ state.resume();
+ }
+};
+
+p.setStateTime = function (state, time) {
+ if (state) {
+ state.setTime(time);
+ }
+}
+
+if (CC_EDITOR || CC_TEST) {
+ p.reloadClip = function (state) {
+ if (state.isPlaying) {
+ initClipData(this.target, state);
+ }
+ else {
+ state.curveLoaded = false;
+ }
+ };
+}
+
+// 这个方法应该是 SampledAnimCurve æ‰èƒ½ç”¨
+function createBatchedProperty (propPath, firstDotIndex, mainValue, animValue) {
+ mainValue = mainValue.clone();
+ var nextValue = mainValue;
+ var leftIndex = firstDotIndex + 1;
+ var rightIndex = propPath.indexOf('.', leftIndex);
+
+ // scan property path
+ while (rightIndex !== -1) {
+ var nextName = propPath.slice(leftIndex, rightIndex);
+ nextValue = nextValue[nextName];
+ leftIndex = rightIndex + 1;
+ rightIndex = propPath.indexOf('.', leftIndex);
+ }
+ var lastPropName = propPath.slice(leftIndex);
+ nextValue[lastPropName] = animValue;
+
+ return mainValue;
+}
+
+if (CC_TEST) {
+ cc._Test.createBatchedProperty = createBatchedProperty;
+}
+
+function splitPropPath (propPath) {
+ var array = propPath.split('.');
+ array.shift();
+ //array = array.filter(function (item) { return !!item; });
+ return array.length > 0 ? array : null;
+}
+
+
+function initClipData (root, state) {
+ var clip = state.clip;
+
+ var curves = state.curves;
+ curves.length = 0;
+
+ state.duration = clip.duration;
+ state.speed = clip.speed;
+ state.wrapMode = clip.wrapMode;
+ state.frameRate = clip.sample;
+
+ if ((state.wrapMode & WrapModeMask.Loop) === WrapModeMask.Loop) {
+ state.repeatCount = Infinity;
+ }
+ else {
+ state.repeatCount = 1;
+ }
+
+ // create curves
+
+ function checkMotionPath(motionPath) {
+ if (!Array.isArray(motionPath)) return false;
+
+ for (var i = 0, l = motionPath.length; i < l; i++) {
+ var controls = motionPath[i];
+
+ if (!Array.isArray(controls) || controls.length !== 6) return false;
+ }
+
+ return true;
+ }
+
+ function createPropCurve (target, propPath, keyframes) {
+ var curve;
+
+ var isMotionPathProp = (target instanceof cc.ENode) && (propPath === 'position');
+ var motionPaths = [];
+ var curve;
+
+ if (isMotionPathProp)
+ curve = new SampledAnimCurve();
+ else
+ curve = new DynamicAnimCurve();
+
+ // 缓å˜ç›®æ ‡å¯¹è±¡ï¼Œæ‰€ä»¥ Component 必须一开始都创建好并且ä¸èƒ½è¿è¡Œæ—¶åŠ¨æ€æ›¿æ¢â€¦â€¦
+ curve.target = target;
+
+ var propName, propValue;
+ var dotIndex = propPath.indexOf('.');
+ var hasSubProp = dotIndex !== -1;
+ if (hasSubProp) {
+ propName = propPath.slice(0, dotIndex);
+ propValue = target[propName];
+
+ // if (!(propValue instanceof cc.ValueType)) {
+ // cc.error('Only support sub animation property which is type cc.ValueType');
+ // continue;
+ // }
+ }
+ else {
+ propName = propPath;
+ }
+
+ curve.prop = propName;
+
+ curve.subProps = splitPropPath(propPath);
+
+ // for each keyframes
+ for (var j = 0, l = keyframes.length; j < l; j++) {
+ var keyframe = keyframes[j];
+ var ratio = keyframe.frame / state.duration;
+ curve.ratios.push(ratio);
+
+ if (isMotionPathProp) {
+ var motionPath = keyframe.motionPath;
+
+ if (motionPath && !checkMotionPath(motionPath)) {
+ cc.error('motion path of target [' + target.name + '] in prop [' + propPath + '] frame [' + j +'] is not valid');
+ motionPath = null;
+ }
+
+ motionPaths.push(motionPath);
+ }
+
+ var curveValue = keyframe.value;
+ //if (hasSubProp) {
+ // curveValue = createBatchedProperty(propPath, dotIndex, propValue, curveValue);
+ //}
+ curve.values.push(curveValue);
+
+ var curveTypes = keyframe.curve;
+ if (curveTypes) {
+ if (typeof curveTypes === 'string') {
+ curve.types.push(curveTypes);
+ continue;
+ }
+ else if (Array.isArray(curveTypes)) {
+ if (curveTypes[0] === curveTypes[1] &&
+ curveTypes[2] === curveTypes[3]) {
+ curve.types.push(DynamicAnimCurve.Linear);
+ }
+ else {
+ curve.types.push(DynamicAnimCurve.Bezier(curveTypes));
+ }
+ continue;
+ }
+ }
+ curve.types.push(DynamicAnimCurve.Linear);
+ }
+
+ if (isMotionPathProp) {
+ sampleMotionPaths(motionPaths, curve, clip.duration, clip.sample);
+ }
+
+ return curve;
+ }
+
+ function createTargetCurves (target, curveData) {
+ var propsData = curveData.props;
+ var compsData = curveData.comps;
+
+ if (propsData) {
+ for (var propPath in propsData) {
+ var data = propsData[propPath];
+ var curve = createPropCurve(target, propPath, data);
+
+ curves.push(curve);
+ }
+ }
+
+ if (compsData) {
+ for (var compName in compsData) {
+ var comp = target.getComponent(compName);
+
+ if (!comp) {
+ continue;
+ }
+
+ var compData = compsData[compName];
+ for (var propPath in compData) {
+ var data = compData[propPath];
+ var curve = createPropCurve(comp, propPath, data);
+
+ curves.push(curve);
+ }
+ }
+ }
+ }
+
+ // events curve
+
+ var events = clip.events;
+
+ if (!CC_EDITOR && events) {
+ var curve;
+
+ for (var i = 0, l = events.length; i < l; i++) {
+ if (!curve) {
+ curve = new EventAnimCurve();
+ curve.target = root;
+ curves.push(curve);
+ }
+
+ var eventData = events[i];
+ var ratio = eventData.frame / state.duration;
+
+ var eventInfo;
+ var index = binarySearch(curve.ratios, ratio);
+ if (index >= 0) {
+ eventInfo = curve.events[index];
+ }
+ else {
+ eventInfo = new EventInfo();
+ curve.ratios.push(ratio);
+ curve.events.push(eventInfo);
+ }
+
+ eventInfo.add(eventData.func, eventData.params);
+ }
+ }
+
+ // property curves
+
+ var curveData = clip.curveData;
+ var childrenCurveDatas = curveData.paths;
+
+ createTargetCurves(root, curveData);
+
+ for (var namePath in childrenCurveDatas) {
+ var target = cc.find(namePath, root);
+
+ if (!target) {
+ continue;
+ }
+
+ var childCurveDatas = childrenCurveDatas[namePath];
+ createTargetCurves(target, childCurveDatas);
+ }
+}
+
+if (CC_TEST) {
+ cc._Test.initClipData = initClipData;
+}
+
+
+module.exports = AnimationAnimator;
diff --git a/cocos2d/animation/animation-clip.js b/cocos2d/animation/animation-clip.js
new file mode 100644
index 00000000000..6b198923028
--- /dev/null
+++ b/cocos2d/animation/animation-clip.js
@@ -0,0 +1,134 @@
+
+var AnimationClip = cc.Class({
+ name: 'cc.AnimationClip',
+ extends: cc.Asset,
+
+ properties: {
+ _duration: {
+ default: 0,
+ type: 'Float',
+ },
+
+ /**
+ * Duration of this animation
+ * @type {Number}
+ */
+ duration: {
+ get: function () { return this._duration; },
+ },
+
+ /**
+ * FrameRate of this animation
+ * @type {Number}
+ */
+ sample: {
+ default: 60,
+ },
+
+ /**
+ * Speed of this animation
+ * @type {Number}
+ */
+ speed: {
+ default: 1
+ },
+
+ /**
+ * WrapMode of this animation
+ * @type {cc.WrapMode}
+ */
+ wrapMode: {
+ default: cc.WrapMode.Normal
+ },
+
+ /**
+ * Curve data
+ * @property curveData
+ * @type {Object}
+ * @example
+ * {
+ * // æ ¹èŠ‚ç‚¹ä¸ç”¨æŸ¥æ‰¾è·¯å¾„
+ * // root properties
+ * props: {
+ * x: [
+ * { frame: 0, value: 0, curve: [0,0.5,0.5,1] },
+ * { frame: 1, value: 200, curve: null }
+ * ]
+ * },
+ * comps: {
+ * // component
+ * 'comp-1': {
+ * // component properties
+ * 'prop-1': [
+ * { frame: 0, value: 10, curve: [0,0.5,0.5,1] },
+ * { frame: 1, value: 20, curve: null }
+ * ]
+ * }
+ * },
+ * paths: {
+ * // key 为节点到root的路径å, 通过cc.find找到
+ * 'foo/bar': {
+ * // node properties
+ * props: {
+ * x: [
+ * { frame: 0, value: 0, curve: [0,0.5,0.5,1] },
+ * { frame: 1, value: 200, curve: null }
+ * ]
+ * },
+ * comps: {
+ * // component
+ * 'comp-1': {
+ * // component property
+ * 'prop-1': [
+ * { frame: 0, value: 10, curve: [0,0.5,0.5,1] },
+ * { frame: 1, value: 20, curve: null }
+ * ]
+ * }
+ * }
+ * },
+ * 'hello': {
+ * props: {
+ * position: [
+ * {
+ * frame: 0,
+ * value: [0,0],
+ * motionPath: [
+ * [320, 240, 0, 240, 640, 240],
+ * [640, 0, 400, 0, 1000, 0]
+ * ]
+ * },
+ * { frame: 5, value: [640, 480] }
+ * ]
+ * }
+ * }
+ * }
+ * }
+ */
+ curveData: {
+ default: {},
+ visible: false,
+ },
+
+ /**
+ * Event data
+ * @property events
+ * @type {Array}
+ * @example
+ * [
+ * frame: 0, func: 'onAnimationEvent1', params:['param-1', 'param-2']
+ * frame: 2, func: 'onAnimationEvent3', params:['param-1', 'param-2']
+ * frame: 3, func: 'onAnimationEvent2', params:['param-1']
+ * // The second event at frame 3
+ * frame: 3, func: 'onAnimationEvent4', params:['param-1']
+ * frame: 4, func: 'onAnimationEvent4', params:['param-1']
+ * ]
+ */
+ events: {
+ default: [],
+ visible: false,
+ }
+ },
+
+});
+
+cc.AnimationClip = module.exports = AnimationClip;
diff --git a/cocos2d/animation/animation-curves.js b/cocos2d/animation/animation-curves.js
new file mode 100644
index 00000000000..b7b229baf0a
--- /dev/null
+++ b/cocos2d/animation/animation-curves.js
@@ -0,0 +1,397 @@
+
+var bezier = require('./bezier').bezier;
+var bezierByTime = require('./bezier').bezierByTime;
+
+var binarySearch = require('./binary-search');
+var WrapMode = require('./types').WrapMode;
+var WrapModeMask = require('./types').WrapModeMask;
+
+/**
+ * Compute a new ratio by curve type
+ * @param {Number} ratio - The origin ratio
+ * @param {any}
+ * - If it's Array, then ratio will be computed with bezierByTime
+ * - If it's string, then ratio will be computed with cc.Easing function
+ */
+function computeRatioByType (ratio, type) {
+ if (typeof type === 'string') {
+ var func = cc.Easing[type];
+ if (func) {
+ ratio = func(ratio);
+ }
+ else {
+ cc.error('Can\'t find easing type [' + type + ']');
+ }
+ }
+ else if (Array.isArray(type)) {
+ // bezier curve
+ ratio = bezierByTime(type, ratio);
+ }
+
+ return ratio;
+}
+
+//
+// 动画数æ®ç±»ï¼Œç›¸å½“于 AnimationClip。
+// 虽然å«åš AnimCurve,但除了曲线,å¯ä»¥ä¿å˜ä»»ä½•ç±»åž‹çš„值。
+//
+// @class AnimCurve
+// @constructor
+//
+var AnimCurve = cc.Class({
+ name: 'cc.AnimCurve',
+
+ //
+ // @method sample
+ // @param {number} time
+ // @param {number} ratio - The normalized time specified as a number between 0.0 and 1.0 inclusive.
+ // @param {AnimationNode} animationNode
+ //
+ sample: function (time, ratio, animationNode) {},
+
+ onTimeChangedManually: function () {}
+});
+
+
+//
+// 区别于 SampledAnimCurve。
+//
+// @class DynamicAnimCurve
+// @constructor
+// @extends AnimCurve
+//
+var DynamicAnimCurve = cc.Class({
+ name: 'cc.DynamicAnimCurve',
+ extends: AnimCurve,
+
+ properties: {
+
+ // The object being animated.
+ // @property target
+ // @type {object}
+ target: null,
+
+ // The name of the property being animated.
+ // @property prop
+ // @type {string}
+ prop: "",
+
+ // The values of the keyframes. (y)
+ // @property values
+ // @type {any[]}
+ values: [],
+
+ // The keyframe ratio of the keyframe specified as a number between 0.0 and 1.0 inclusive. (x)
+ // @property ratios
+ // @type {number[]}
+ ratios: [],
+
+ // @property types
+ // @param {object[]}
+ // Each array item maybe type:
+ // - [x, x, x, x]: Four control points for bezier
+ // - null: linear
+ types: [],
+
+ // @property {string[]} subProps - The path of sub property being animated.
+ subProps: null
+ },
+
+ _calcValue: function (frameIndex, ratio) {
+ var values = this.values;
+ var fromVal = values[frameIndex - 1];
+ var toVal = values[frameIndex];
+
+ // lerp
+ if (typeof fromVal === 'number') {
+ value = fromVal + (toVal - fromVal) * ratio;
+ }
+ else {
+ var lerp = fromVal.lerp;
+ if (lerp) {
+ value = fromVal.lerp(toVal, ratio);
+ }
+ else {
+ // no linear lerp function, just return last frame
+ value = fromVal;
+ }
+ }
+
+ return value;
+ },
+
+ _applyValue: function (target, prop, value) {
+ target[prop] = value;
+ },
+
+ _findFrameIndex: binarySearch,
+
+ sample: function (time, ratio, animationNode) {
+ var values = this.values;
+ var ratios = this.ratios;
+ var frameCount = ratios.length;
+
+ if (frameCount === 0) {
+ return;
+ }
+
+ // evaluate value
+ var value;
+ var index = this._findFrameIndex(ratios, ratio);
+
+ if (index < 0) {
+ index = ~index;
+
+ if (index <= 0) {
+ value = values[0];
+ }
+ else if (index >= frameCount) {
+ value = values[frameCount - 1];
+ }
+ else {
+ var fromRatio = ratios[index - 1];
+ var toRatio = ratios[index];
+ var type = this.types[index - 1];
+ var ratioBetweenFrames = (ratio - fromRatio) / (toRatio - fromRatio);
+
+ ratioBetweenFrames = computeRatioByType(ratioBetweenFrames, type);
+
+ value = this._calcValue(index, ratioBetweenFrames);
+ }
+ }
+ else {
+ value = values[index];
+ }
+
+ var subProps = this.subProps;
+ if (subProps) {
+ // create batched value dynamically
+ var mainProp = this.target[this.prop];
+ var subProp = mainProp;
+
+ for (var i = 0; i < subProps.length - 1; i++) {
+ var subPropName = subProps[i];
+ if (subProp) {
+ subProp = subProp[subPropName];
+ }
+ else {
+ return;
+ }
+ }
+
+ var propName = subProps[subProps.length - 1];
+
+ if (subProp) {
+ this._applyValue(subProp, propName, value);
+ }
+ else {
+ return;
+ }
+
+ value = mainProp;
+ }
+
+ // apply value
+ this._applyValue(this.target, this.prop, value);
+ }
+});
+
+DynamicAnimCurve.Linear = null;
+DynamicAnimCurve.Bezier = function (controlPoints) {
+ return controlPoints;
+};
+
+
+
+/**
+ * SampledAnimCurve, 这里é¢çš„数值需è¦æ˜¯å·²ç»éƒ½é¢„å…ˆsample好了的,
+ * 所以 SampledAnimCurve ä¸æŸ¥æ‰¾ frame index 的速度会éžå¸¸å¿«
+ *
+ * @class SampledAnimCurve
+ * @constructor
+ * @extends DynamicAnimCurve
+ */
+var SampledAnimCurve = cc.Class({
+ name: 'cc.SampledAnimCurve',
+ extends: DynamicAnimCurve,
+
+ _findFrameIndex: function (ratios, ratio) {
+ var length = ratios.length - 1;
+ var eachLength = 1 / length;
+
+ var index = (ratio / eachLength) | 0;
+ return index;
+ }
+});
+
+
+
+/**
+ * Event information,
+ * @class EventInfo
+ * @constructor
+ */
+var EventInfo = function () {
+ this.events = [];
+};
+
+/**
+ * @param {Function} [func] event function
+ * @param {Object[]} [params] event params
+ */
+EventInfo.prototype.add = function (func, params) {
+ this.events.push({
+ func: func || '',
+ params: params || []
+ });
+};
+
+
+/**
+ *
+ * @class EventAnimCurve
+ * @constructor
+ * @extends AnimCurve
+ */
+var EventAnimCurve = cc.Class({
+ name: 'cc.EventAnimCurve',
+ extends: AnimCurve,
+
+ properties: {
+ /**
+ * The object being animated.
+ * @property target
+ * @type {object}
+ */
+ target: null,
+
+ /** The keyframe ratio of the keyframe specified as a number between 0.0 and 1.0 inclusive. (x)
+ * @property ratios
+ * @type {number[]}
+ */
+ ratios: [],
+
+ /**
+ * @property events
+ * @type {EventInfo[]}
+ */
+ events: [],
+
+ /**
+ * Last wrapped info
+ * @property _lastWrappedInfo
+ * @type {Object}
+ * @default null
+ */
+ _lastWrappedInfo: null
+ },
+
+ _wrapIterations: function (iterations) {
+ if (iterations - (iterations | 0) === 0) iterations -= 1;
+ return iterations | 0;
+ },
+
+ sample: function (time, ratio, animationNode) {
+ var length = this.ratios.length;
+
+ var currentWrappedInfo = animationNode.getWrappedInfo(animationNode.time);
+ var direction = currentWrappedInfo.direction;
+ var currentIndex = binarySearch(this.ratios, currentWrappedInfo.ratio);
+ if (currentIndex < 0) {
+ currentIndex = ~currentIndex - 1;
+
+ // if direction is inverse, then increase index
+ if (direction < 0) currentIndex += 1;
+ }
+
+ var lastWrappedInfo = this._lastWrappedInfo;
+ var lastIndex = lastWrappedInfo ? lastWrappedInfo.frameIndex : currentWrappedInfo.frameIndex;
+
+ if (!lastWrappedInfo) {
+ this._fireEvent(currentIndex);
+ }
+ else if (lastIndex !== currentIndex) {
+
+ var wrapMode = animationNode.wrapMode;
+
+ var currentIterations = this._wrapIterations(currentWrappedInfo.iterations);
+ var lastIntIterations = this._wrapIterations(lastWrappedInfo.iterations);
+
+ direction = lastWrappedInfo.direction;
+
+ do {
+ if (lastIntIterations <= currentIterations) {
+ if (direction === -1 && lastIndex === 0) {
+ if ((wrapMode & WrapModeMask.PingPong) === WrapModeMask.PingPong) {
+ direction *= -1;
+ }
+ else {
+ lastIndex = length;
+ }
+
+ lastIntIterations ++;
+ }
+ else if (direction === 1 && lastIndex === length - 1) {
+ if ((wrapMode & WrapModeMask.PingPong) === WrapModeMask.PingPong) {
+ direction *= -1;
+ }
+ else {
+ lastIndex = -1;
+ }
+
+ lastIntIterations ++;
+ }
+
+ if (lastIndex === currentIndex) break;
+ }
+
+ lastIndex += direction;
+
+ this._fireEvent(lastIndex);
+ } while (lastIndex !== currentIndex);
+ }
+
+ currentWrappedInfo.frameIndex = currentIndex;
+ this._lastWrappedInfo = currentWrappedInfo;
+ },
+
+ _fireEvent: function (index) {
+ if (index < 0 || index >= this.events.length) return;
+
+ var eventInfo = this.events[index];
+ var events = eventInfo.events;
+ var components = this.target._components;
+
+ for (var i = 0; i < events.length; i++) {
+ var event = events[i];
+ var funcName = event.func;
+
+ for (var j = 0; j < components.length; j++) {
+ var component = components[j];
+ var func = component[funcName];
+
+ if (func) func.apply(component, event.params);
+ }
+ }
+ },
+
+ onTimeChangedManually: function () {
+ this._lastWrappedInfo = null;
+ }
+});
+
+
+if (CC_TEST) {
+ cc._Test.DynamicAnimCurve = DynamicAnimCurve;
+ cc._Test.SampledAnimCurve = SampledAnimCurve;
+ cc._Test.EventAnimCurve = EventAnimCurve;
+}
+
+module.exports = {
+ AnimCurve: AnimCurve,
+ DynamicAnimCurve: DynamicAnimCurve,
+ SampledAnimCurve: SampledAnimCurve,
+ EventAnimCurve: EventAnimCurve,
+ EventInfo: EventInfo,
+ computeRatioByType: computeRatioByType
+};
diff --git a/cocos2d/animation/animation-manager.js b/cocos2d/animation/animation-manager.js
new file mode 100644
index 00000000000..fa8799ca72d
--- /dev/null
+++ b/cocos2d/animation/animation-manager.js
@@ -0,0 +1,51 @@
+var JS = cc.js;
+
+var AnimationManager = cc._Class.extend({
+ ctor: function () {
+ this.animators = [];
+ },
+
+ // for manager
+
+ update: function (dt) {
+ var animators = this.animators;
+ for (var i = 0, len = animators.length; i < len; i++) {
+ var animator = animators[i];
+ if (animator._isPlaying && !animator._isPaused) {
+ animator.update(dt);
+ // if removed
+ if (! animator._isPlaying) {
+ i--;
+ len--;
+ }
+ }
+ }
+ },
+
+ destruct: function () {},
+
+ // for animator
+
+ /**
+ * @param {Animator} animator
+ */
+ addAnimator: function (animator) {
+ this.animators.push(animator);
+ },
+
+ /**
+ * @param {Animator} animator
+ */
+ removeAnimator: function (animator) {
+ var index = this.animators.indexOf(animator);
+ if (index >= 0) {
+ this.animators.splice(index, 1);
+ }
+ else {
+ cc.error('animator not added or already removed');
+ }
+ }
+});
+
+
+cc.AnimationManager = module.exports = AnimationManager;
diff --git a/cocos2d/animation/animation-state.js b/cocos2d/animation/animation-state.js
new file mode 100644
index 00000000000..a4a2b86581e
--- /dev/null
+++ b/cocos2d/animation/animation-state.js
@@ -0,0 +1,71 @@
+
+var JS = cc.js;
+var AnimationNode = require('./types').AnimationNode;
+
+/**
+ * The AnimationState gives full control over animation playback process.
+ * In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control.
+ *
+ * @class AnimationState
+ * @extends AnimationNode
+ * @constructor
+ * @param {AnimationClip} clip
+ * @param {String} [name]
+ */
+function AnimationState (clip, name) {
+ AnimationNode.call(this, null, null, {
+ duration: clip.length
+ });
+
+ this._clip = clip;
+ this._name = name || clip.name;
+}
+JS.extend(AnimationState, AnimationNode);
+
+var state = AnimationState.prototype;
+
+/**
+ * The clip that is being played by this animation state.
+ * @property clip
+ * @type {AnimationClip}
+ * @readOnly
+ */
+JS.get(state, 'clip', function () {
+ return this._clip;
+});
+
+/**
+ * The name of the playing animation.
+ * @property name
+ * @type {String}
+ * @readOnly
+ */
+JS.get(state, 'name', function () {
+ return this._name;
+});
+
+JS.obsolete(state, 'AnimationState.length', 'duration');
+
+JS.getset(state, 'curveLoaded',
+ function () {
+ return this.curves.length > 0;
+ },
+ function (value) {
+ this.curves.length = 0;
+ }
+);
+
+state.onPlay = function () {
+ // replay
+ this.setTime(0);
+};
+
+state.setTime = function (time) {
+ this.time = time || 0;
+
+ this.curves.forEach(function (curve) {
+ curve.onTimeChangedManually();
+ });
+}
+
+cc.AnimationState = module.exports = AnimationState;
diff --git a/cocos2d/animation/animators.js b/cocos2d/animation/animators.js
new file mode 100644
index 00000000000..8595cee4060
--- /dev/null
+++ b/cocos2d/animation/animators.js
@@ -0,0 +1,197 @@
+var JS = cc.js;
+var Playable = require('./playable');
+var AnimationNode = require('./types').AnimationNode;
+var DynamicAnimCurve = require('./animation-curves').DynamicAnimCurve;
+
+// The base of animators
+function Animator (target) {
+ this.target = target;
+ // {AnimationNodeBase}
+ this.playingAnims = [];
+}
+
+JS.extend(Animator, Playable);
+
+var animProto = Animator.prototype;
+
+// ç”± AnimationManager 调用,åªæœ‰åœ¨è¯¥ animator 处于æ’放状æ€æ—¶æ‰ä¼šè¢«è°ƒç”¨
+animProto.update = function (deltaTime) {
+ var anims = this.playingAnims;
+ for (var i = 0; i < anims.length; i++) {
+ var anim = anims[i];
+ if (anim._isPlaying && !anim._isPaused) {
+ anim.update(deltaTime);
+ // if removed
+ if (! anim._isPlaying) {
+ anims.splice(i, 1); // TODO: ç”± anim æ¥è´Ÿè´£è°ƒç”¨ splice
+ i--;
+ }
+ }
+ }
+ if (anims.length === 0) {
+ this.stop();
+ }
+};
+
+animProto.onPlay = function () {
+ cc.director.getAnimationManager().addAnimator(this);
+};
+
+animProto.onStop = function () {
+ this.playingAnims.length = 0;
+ cc.director.getAnimationManager().removeAnimator(this);
+};
+
+
+
+// The actual animator for Entity
+function EntityAnimator (target) {
+ Animator.call(this, target);
+}
+JS.extend(EntityAnimator, Animator);
+
+var entProto = EntityAnimator.prototype;
+
+// 通用逻辑
+
+function computeNullRatios (keyFrames) {
+ var lastIndex = 0;
+ var lastRatio = 0;
+
+ var len = keyFrames.length;
+ for (var i = 0; i < len; i++) {
+ var frame = keyFrames[i];
+ var ratio = frame.ratio;
+ if (i === 0 && typeof ratio !== "number") {
+ // 如果一开始就没有 ratio,则默认从 0 开始
+ frame.computedRatio = ratio = 0;
+ }
+ else if (i === len - 1 && typeof ratio !== "number") {
+ // 如果最åŽæ²¡æœ‰ ratio,则设置为 1
+ frame.computedRatio = ratio = 1;
+ }
+ if (typeof ratio === "number") {
+ if (lastIndex + 1 < i) {
+ var count = i - lastIndex;
+ var step = (ratio - lastRatio) / count;
+ for (var j = lastIndex + 1; j < i; j++) {
+ lastRatio += step;
+ keyFrames[j].computedRatio = lastRatio; // ä¸å 用已有å˜é‡ï¼Œè¿™æ · keyFrames æ‰èƒ½é‡ç”¨
+ }
+ }
+ lastIndex = i;
+ lastRatio = ratio;
+ }
+ }
+}
+
+if (CC_TEST) {
+ cc._Test.computeNullRatios = computeNullRatios;
+}
+
+///**
+// * @param {object[]} keyFrames
+// * @param {object} [timingInput] - This dictionary is used as a convenience for specifying the timing properties of an Animation in bulk.
+// * @return {AnimationNode}
+// */
+entProto.animate = function (keyFrames, timingInput) {
+ if (! keyFrames) {
+ cc.error('[animate] keyFrames must be non-nil');
+ return null;
+ }
+ // compute absolute ratio of each keyframe with a null ratio
+ computeNullRatios(keyFrames);
+
+ var anim = this._doAnimate(keyFrames, timingInput);
+
+ this.play();
+ return anim;
+};
+
+// 具体逻辑
+
+function findCurve (curves, target, propName) {
+ var i = 0, curve;
+
+ for (; i < curves.length; i++) {
+ curve = curves[i];
+ if (curve.target === target && curve.prop === propName) {
+ return curve;
+ }
+ }
+
+ return null;
+}
+
+function createPropCurve (curves, target, propName, value, ratio) {
+ var curve = findCurve(curves, target, propName);
+ if (! curve) {
+ curve = new DynamicAnimCurve();
+ curves.push(curve);
+ // 缓å˜ç›®æ ‡å¯¹è±¡ï¼Œæ‰€ä»¥ Component 必须一开始都创建好并且ä¸èƒ½è¿è¡Œæ—¶åŠ¨æ€æ›¿æ¢â€¦â€¦
+ curve.target = target;
+ curve.prop = propName;
+ }
+ curve.values.push(value);
+ curve.ratios.push(ratio);
+}
+
+entProto._doAnimate = function (keyFrames, timingInput) {
+ var anim = new AnimationNode(this, null, timingInput);
+ anim.play();
+ var curves = anim.curves;
+
+ // create curves
+ var lastRatio = -1;
+ for (var i = 0; i < keyFrames.length; i++) {
+ var frame = keyFrames[i];
+
+ // get ratio
+ var ratio = frame.ratio;
+ if (typeof ratio !== "number") {
+ ratio = frame.computedRatio;
+ }
+ if (ratio < 0) {
+ cc.error('[animate] ratio should >= 0!');
+ continue;
+ }
+ if (ratio < lastRatio) {
+ cc.error('[animate] ratio should in the order of smallest to largest!');
+ continue;
+ }
+ lastRatio = ratio;
+
+ // å…ˆé历æ¯ä¸€å¸§ï¼ŒèŽ·å¾—所有曲线
+ for (var key in frame) {
+
+ var data = frame[key];
+
+ if (key === 'props') {
+ for (var propName in data) {
+ createPropCurve(curves, this.target, propName, data[propName], ratio);
+ }
+ }
+ else if (key === 'comps') {
+ for (var compName in data) {
+ var comp = this.target.getComponent(compName);
+ var compData = data[compName];
+
+ for (var propName in compData) {
+ createPropCurve(curves, comp, propName, compData[propName], ratio);
+ }
+ }
+ }
+ }
+ }
+ this.playingAnims.push(anim);
+ return anim;
+};
+
+if (CC_TEST) {
+ cc._Test.EntityAnimator = EntityAnimator;
+}
+
+module.exports = {
+ Animator: Animator,
+ EntityAnimator: EntityAnimator
+};
diff --git a/cocos2d/animation/bezier.js b/cocos2d/animation/bezier.js
new file mode 100644
index 00000000000..0f284f18271
--- /dev/null
+++ b/cocos2d/animation/bezier.js
@@ -0,0 +1,196 @@
+//var bezier = (function () {
+// function B1 (t) { return (t * t * t); }
+// function B2 (t) { return (3 * t * t * (1 - t)); }
+// function B3 (t) { return (3 * t * (1 - t) * (1 - t)); }
+// function B4 (t) { return ((1 - t) * (1 - t) * (1 - t)); }
+// function bezier (C1, C2, C3, C4, t) {
+// return C1 * B1(t) + C2 * B2(t) + C3 * B3(t) + C4 * B4(t);
+// }
+//
+// //function bezier (C1, C2, C3, C4, t, out) {
+// // out.x = C1.x * B1(t) + C2.x * B2(t) + C3.x * B3(t) + C4.x * B4(t);
+// // out.y = C1.y * B1(t) + C2.y * B2(t) + C3.y * B3(t) + C4.y * B4(t);
+// //}
+//
+// return bezier;
+//})();
+function bezier (C1, C2, C3, C4, t) {
+ var t1 = 1 - t;
+ return C1 * t1 * t1 * t1 +
+ C2 * 3 * t1 * t1 * t +
+ C3 * 3 * t1 * t * t +
+ C4 * t * t * t;
+}
+//function bezier (c0, c1, c2, c3, t) {
+// var cy = 3.0 * (c1);
+// var by = 3.0 * (c3 - c1) - cy;
+// var ay = 1 - cy - by;
+// return (ay * t * t * t) + (by * t * t) + (cy * t);
+//}
+
+//var sin = Math.sin;
+var cos = Math.cos,
+ acos = Math.acos,
+ max = Math.max,
+ //atan2 = Math.atan2,
+ pi = Math.PI,
+ tau = 2 * pi,
+ sqrt = Math.sqrt;
+
+function crt (v) {
+ if (v < 0) {
+ return -Math.pow(-v, 1 / 3);
+ }
+ else {
+ return Math.pow(v, 1 / 3);
+ }
+}
+
+//function align (curve, line) {
+// var tx = line.p1.x,
+// ty = line.p1.y,
+// a = -atan2(line.p2.y-ty, line.p2.x-tx);
+// curve = [{x:0, y:1}, {x: curve[0], y: 1-curve[1]}, {x: curve[2], y: 1-curve[3]}, {x:1, y:0}];
+// return curve.map(function(v) {
+// return {
+// x: (v.x-tx)*cos(a) - (v.y-ty)*sin(a),
+// y: (v.x-tx)*sin(a) + (v.y-ty)*cos(a)
+// };
+// });
+//}
+
+// Modified from http://jsbin.com/yibipofeqi/1/edit, optimized for animations.
+// The origin Cardano's algorithm is based on http://www.trans4mind.com/personal_development/mathematics/polynomials/cubicAlgebra.htm
+function cardano (curve, x) {
+ // align curve with the intersecting line:
+ //var line = {p1: {x: x, y: 0}, p2: {x: x, y: 1}};
+ //var aligned = align(curve, line);
+ //// and rewrite from [a(1-t)^3 + 3bt(1-t)^2 + 3c(1-t)t^2 + dt^3] form
+ // pa = aligned[0].y,
+ // pb = aligned[1].y,
+ // pc = aligned[2].y,
+ // pd = aligned[3].y;
+ ////// curve = [{x:0, y:1}, {x: curve[0], y: 1-curve[1]}, {x: curve[2], y: 1-curve[3]}, {x:1, y:0}];
+ var pa = x - 0;
+ var pb = x - curve[0];
+ var pc = x - curve[2];
+ var pd = x - 1;
+
+ // to [t^3 + at^2 + bt + c] form:
+ var pa3 = pa * 3;
+ var pb3 = pb * 3;
+ var pc3 = pc * 3;
+ var d = (-pa + pb3 - pc3 + pd),
+ rd = 1 / d,
+ r3 = 1 / 3,
+ a = (pa3 - 6 * pb + pc3) * rd,
+ a3 = a * r3,
+ b = (-pa3 + pb3) * rd,
+ c = pa * rd,
+ // then, determine p and q:
+ p = (3 * b - a * a) * r3,
+ p3 = p * r3,
+ q = (2 * a * a * a - 9 * a * b + 27 * c) / 27,
+ q2 = q / 2,
+ // and determine the discriminant:
+ discriminant = q2 * q2 + p3 * p3 * p3,
+ // and some reserved variables
+ u1, v1, x1, x2, x3;
+
+ // If the discriminant is negative, use polar coordinates
+ // to get around square roots of negative numbers
+ if (discriminant < 0) {
+ var mp3 = -p * r3,
+ mp33 = mp3 * mp3 * mp3,
+ r = sqrt(mp33),
+ // compute cosphi corrected for IEEE float rounding:
+ t = -q / (2 * r),
+ cosphi = t < -1 ? -1 : t > 1 ? 1 : t,
+ phi = acos(cosphi),
+ crtr = crt(r),
+ t1 = 2 * crtr;
+ x1 = t1 * cos(phi * r3) - a3;
+ x2 = t1 * cos((phi + tau) * r3) - a3;
+ x3 = t1 * cos((phi + 2 * tau) * r3) - a3;
+
+ // choose best percentage
+ if (0 <= x1 && x1 <= 1) {
+ if (0 <= x2 && x2 <= 1) {
+ if (0 <= x3 && x3 <= 1) {
+ return max(x1, x2, x3);
+ }
+ else {
+ return max(x1, x2);
+ }
+ }
+ else if (0 <= x3 && x3 <= 1) {
+ return max(x1, x3);
+ }
+ else {
+ return x1;
+ }
+ }
+ else {
+ if (0 <= x2 && x2 <= 1) {
+ if (0 <= x3 && x3 <= 1) {
+ return max(x2, x3);
+ }
+ else {
+ return x2;
+ }
+ }
+ else {
+ return x3;
+ }
+ }
+ }
+ else if (discriminant === 0) {
+ u1 = q2 < 0 ? crt(-q2) : -crt(q2);
+ x1 = 2 * u1 - a3;
+ x2 = -u1 - a3;
+
+ // choose best percentage
+ if (0 <= x1 && x1 <= 1) {
+ if (0 <= x2 && x2 <= 1) {
+ return max(x1, x2);
+ }
+ else {
+ return x1;
+ }
+ }
+ else {
+ return x2;
+ }
+ }
+ // one real root, and two imaginary roots
+ else {
+ var sd = sqrt(discriminant);
+ u1 = crt(-q2 + sd);
+ v1 = crt(q2 + sd);
+ x1 = u1 - v1 - a3;
+ return x1;
+ }
+}
+
+function bezierByTime (controlPoints, x) {
+ var percent = cardano(controlPoints, x); // t
+ var p0y = 0; // a
+ var p1y = controlPoints[1]; // b
+ var p2y = controlPoints[3]; // c
+ var p3y = 1; // d
+ var t1 = 1 - percent;
+ return p0y * t1 * t1 * t1 +
+ p1y * 3 * percent * t1 * t1 +
+ p2y * 3 * percent * percent * t1 +
+ p3y * percent * percent * percent;
+}
+
+if (CC_TEST) {
+ cc._Test.bezier = bezier;
+ cc._Test.bezierByTime = bezierByTime;
+}
+
+module.exports = {
+ bezier: bezier,
+ bezierByTime: bezierByTime
+};
diff --git a/cocos2d/animation/binary-search.js b/cocos2d/animation/binary-search.js
new file mode 100644
index 00000000000..3ac8b52f41a
--- /dev/null
+++ b/cocos2d/animation/binary-search.js
@@ -0,0 +1,28 @@
+var EPSILON = 1e-6;
+
+//
+// Searches the entire sorted Array for an element and returns the zero-based index of the element.
+// @method binarySearch
+// @param {number[]} array
+// @param {number} value
+// @return {number} The zero-based index of item in the sorted Array, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise complement of array's length.
+//
+function binarySearch (array, value) {
+ var l = 0, h = array.length - 1;
+ while (l <= h) {
+ var m = ((l + h) >> 1);
+
+ if (Math.abs(array[m] - value) < EPSILON) {
+ return m;
+ }
+ if (array[m] > value) {
+ h = m - 1;
+ }
+ else {
+ l = m + 1;
+ }
+ }
+ return ~l;
+}
+
+module.exports = binarySearch;
diff --git a/cocos2d/animation/easing.js b/cocos2d/animation/easing.js
new file mode 100644
index 00000000000..af51505fa4a
--- /dev/null
+++ b/cocos2d/animation/easing.js
@@ -0,0 +1,257 @@
+var Easing = {
+ linear: function (k) { return k; },
+
+ // quad
+ // Easing equation function for a quadratic (t^2)
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+
+ quadIn: function (k) { return k * k; },
+ quadOut: function (k) { return k * ( 2 - k ); },
+ quadInOut: function (k) {
+ if (( k *= 2 ) < 1) {
+ return 0.5 * k * k;
+ }
+ return -0.5 * ( --k * ( k - 2 ) - 1 );
+ },
+
+ // cubic
+ // Easing equation function for a cubic (t^3)
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+
+ cubicIn: function (k) { return k * k * k; },
+ cubicOut: function (k) { return --k * k * k + 1; },
+ cubicInOut: function (k) {
+ if (( k *= 2 ) < 1) {
+ return 0.5 * k * k * k;
+ }
+ return 0.5 * ( ( k -= 2 ) * k * k + 2 );
+ },
+
+ // quart
+ // Easing equation function for a quartic (t^4)
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+
+ quartIn: function (k) { return k * k * k * k; },
+ quartOut: function (k) { return 1 - ( --k * k * k * k ); },
+ quartInOut: function (k) {
+ if (( k *= 2 ) < 1) {
+ return 0.5 * k * k * k * k;
+ }
+ return -0.5 * ( ( k -= 2 ) * k * k * k - 2 );
+ },
+
+ // quint
+ // Easing equation function for a quintic (t^5)
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+
+ quintIn: function (k) { return k * k * k * k * k; },
+ quintOut: function (k) { return --k * k * k * k * k + 1; },
+ quintInOut: function (k) {
+ if (( k *= 2 ) < 1) {
+ return 0.5 * k * k * k * k * k;
+ }
+ return 0.5 * ( ( k -= 2 ) * k * k * k * k + 2 );
+ },
+
+ // sine
+ // Easing equation function for a sinusoidal (sin(t))
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+
+ sineIn: function (k) { return 1 - Math.cos(k * Math.PI / 2); },
+ sineOut: function (k) { return Math.sin(k * Math.PI / 2); },
+ sineInOut: function (k) { return 0.5 * ( 1 - Math.cos(Math.PI * k) ); },
+
+ // expo
+ // Easing equation function for an exponential (2^t)
+ // param t: Current time (in frames or seconds).
+ // return: The correct value.
+
+ expoIn: function (k) { return k === 0 ? 0 : Math.pow(1024, k - 1); },
+ expoOut: function (k) { return k === 1 ? 1 : 1 - Math.pow(2, -10 * k); },
+ expoInOut: function (k) {
+ if (k === 0) {
+ return 0;
+ }
+ if (k === 1) {
+ return 1;
+ }
+ if (( k *= 2 ) < 1) {
+ return 0.5 * Math.pow(1024, k - 1);
+ }
+ return 0.5 * ( -Math.pow(2, -10 * ( k - 1 )) + 2 );
+ },
+
+ // circ
+ // Easing equation function for a circular (sqrt(1-t^2))
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+
+ circIn: function (k) { return 1 - Math.sqrt(1 - k * k); },
+ circOut: function (k) { return Math.sqrt(1 - ( --k * k )); },
+ circInOut: function (k) {
+ if (( k *= 2 ) < 1) {
+ return -0.5 * ( Math.sqrt(1 - k * k) - 1);
+ }
+ return 0.5 * ( Math.sqrt(1 - ( k -= 2) * k) + 1);
+ },
+
+ // elastic
+ // Easing equation function for an elastic (exponentially decaying sine wave)
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+ // recommand value: elastic (t)
+
+ elasticIn: function (k) {
+ var s, a = 0.1, p = 0.4;
+ if (k === 0) {
+ return 0;
+ }
+ if (k === 1) {
+ return 1;
+ }
+ if (!a || a < 1) {
+ a = 1;
+ s = p / 4;
+ }
+ else {
+ s = p * Math.asin(1 / a) / ( 2 * Math.PI );
+ }
+ return -( a * Math.pow(2, 10 * ( k -= 1 )) * Math.sin(( k - s ) * ( 2 * Math.PI ) / p) );
+ },
+ elasticOut: function (k) {
+ var s, a = 0.1, p = 0.4;
+ if (k === 0) {
+ return 0;
+ }
+ if (k === 1) {
+ return 1;
+ }
+ if (!a || a < 1) {
+ a = 1;
+ s = p / 4;
+ }
+ else {
+ s = p * Math.asin(1 / a) / ( 2 * Math.PI );
+ }
+ return ( a * Math.pow(2, -10 * k) * Math.sin(( k - s ) * ( 2 * Math.PI ) / p) + 1 );
+ },
+ elasticInOut: function (k) {
+ var s, a = 0.1, p = 0.4;
+ if (k === 0) {
+ return 0;
+ }
+ if (k === 1) {
+ return 1;
+ }
+ if (!a || a < 1) {
+ a = 1;
+ s = p / 4;
+ }
+ else {
+ s = p * Math.asin(1 / a) / ( 2 * Math.PI );
+ }
+ if (( k *= 2 ) < 1) {
+ return -0.5 *
+ ( a * Math.pow(2, 10 * ( k -= 1 )) * Math.sin(( k - s ) * ( 2 * Math.PI ) / p) );
+ }
+ return a * Math.pow(2, -10 * ( k -= 1 )) * Math.sin(( k - s ) * ( 2 * Math.PI ) / p) * 0.5 + 1;
+ },
+
+ // back
+ // Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2)
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+
+ backIn: function (k) {
+ var s = 1.70158;
+ return k * k * ( ( s + 1 ) * k - s );
+ },
+ backOut: function (k) {
+ var s = 1.70158;
+ return --k * k * ( ( s + 1 ) * k + s ) + 1;
+ },
+ backInOut: function (k) {
+ var s = 1.70158 * 1.525;
+ if (( k *= 2 ) < 1) {
+ return 0.5 * ( k * k * ( ( s + 1 ) * k - s ) );
+ }
+ return 0.5 * ( ( k -= 2 ) * k * ( ( s + 1 ) * k + s ) + 2 );
+ },
+
+ // bounce
+ // Easing equation function for a bounce (exponentially decaying parabolic bounce)
+ // @param t: Current time (in frames or seconds).
+ // @return: The correct value.
+
+ bounceOut: function (k) {
+ if (k < ( 1 / 2.75 )) {
+ return 7.5625 * k * k;
+ }
+ else if (k < ( 2 / 2.75 )) {
+ return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
+ }
+ else if (k < ( 2.5 / 2.75 )) {
+ return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
+ }
+ else {
+ return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
+ }
+ },
+
+ // smooth
+ // t<=0: 0 | 0=1: 1
+ smooth: function (t) {
+ if (t <= 0) {
+ return 0;
+ }
+ if (t >= 1) {
+ return 1;
+ }
+ return t * t * (3 - 2 * t);
+ },
+
+ // fade
+ // t<=0: 0 | 0=1: 1
+ fade: function (t) {
+ if (t <= 0) {
+ return 0;
+ }
+ if (t >= 1) {
+ return 1;
+ }
+ return t * t * t * (t * (t * 6 - 15) + 10);
+ },
+};
+
+function _makeOutIn (fnIn, fnOut) {
+ return function (k) {
+ if (k < 0.5) {
+ return fnOut(k * 2) / 2;
+ }
+ return fnIn(2 * k - 1) / 2 + 0.5;
+ };
+}
+Easing.quadOutIn = _makeOutIn(Easing.quadIn, Easing.quadOut);
+Easing.cubicOutIn = _makeOutIn(Easing.cubicIn, Easing.cubicOut);
+Easing.quartOutIn = _makeOutIn(Easing.quartIn, Easing.quartOut);
+Easing.quintOutIn = _makeOutIn(Easing.quintIn, Easing.quintOut);
+Easing.sineOutIn = _makeOutIn(Easing.sineIn, Easing.sineOut);
+Easing.expoOutIn = _makeOutIn(Easing.expoIn, Easing.expoOut);
+Easing.circOutIn = _makeOutIn(Easing.circIn, Easing.circOut);
+Easing.backOutIn = _makeOutIn(Easing.backIn, Easing.backOut);
+Easing.backOutIn = _makeOutIn(Easing.backIn, Easing.backOut);
+Easing.bounceIn = function (k) { return 1 - Easing.bounceOut(1 - k); };
+Easing.bounceInOut = function (k) {
+ if (k < 0.5) {
+ return Easing.bounceIn(k * 2) * 0.5;
+ }
+ return Easing.bounceOut(k * 2 - 1) * 0.5 + 0.5;
+};
+Easing.bounceOutIn = _makeOutIn(Easing.bounceIn, Easing.bounceOut);
+
+cc.Easing = module.exports = Easing;
diff --git a/cocos2d/animation/index.js b/cocos2d/animation/index.js
new file mode 100644
index 00000000000..20c03dace53
--- /dev/null
+++ b/cocos2d/animation/index.js
@@ -0,0 +1,10 @@
+require('./bezier');
+require('./easing');
+require('./types');
+require('./motion-path-helper');
+require('./animation-curves');
+require('./animation-clip');
+require('./animators');
+require('./animation-manager');
+require('./animation-state');
+require('./animation-animator');
diff --git a/cocos2d/animation/motion-path-helper.js b/cocos2d/animation/motion-path-helper.js
new file mode 100644
index 00000000000..83bc7489890
--- /dev/null
+++ b/cocos2d/animation/motion-path-helper.js
@@ -0,0 +1,327 @@
+var DynamicAnimCurve = require('./animation-curves').DynamicAnimCurve;
+var computeRatioByType = require('./animation-curves').computeRatioByType;
+
+var bezier = require('./bezier').bezier;
+var bezierByTime = require('./bezier').bezierByTime;
+
+var binarySearch = require('./binary-search');
+
+var v2 = cc.v2;
+
+function Curve (points) {
+ this.points = points || [];
+ this.beziers = [];
+ this.ratios = [];
+ this.progresses = [];
+
+ this.length = 0;
+
+ this.computeBeziers();
+}
+Curve.prototype.computeBeziers = function () {
+ this.beziers.length = 0;
+ this.ratios.length = 0;
+ this.progresses.length = 0;
+ this.length = 0;
+
+ for (var i = 1; i < this.points.length; i++) {
+ var startPoint = this.points[i - 1];
+ var endPoint = this.points[i];
+ var bezier = new Bezier();
+ bezier.start = startPoint.pos;
+ bezier.startCtrlPoint = startPoint.out;
+ bezier.end = endPoint.pos;
+ bezier.endCtrlPoint = endPoint.in;
+ this.beziers.push(bezier);
+
+ this.length += bezier.getLength();
+ }
+
+ var current = 0;
+ for (var i = 0; i < this.beziers.length; i++) {
+ var bezier = this.beziers[i];
+ this.ratios[i] = bezier.getLength() / this.length;
+ this.progresses[i] = current = current + this.ratios[i];
+ }
+
+ return this.beziers;
+};
+
+function Bezier () {
+ this.start = v2();
+ this.end = v2();
+ this.startCtrlPoint = v2(); // cp0, cp1
+ this.endCtrlPoint = v2(); // cp2, cp3
+}
+
+// Get point at relative position in curve according to arc length
+// - u [0 .. 1]
+Bezier.prototype.getPointAt = function ( u ) {
+ var t = this.getUtoTmapping( u );
+ return this.getPoint( t );
+};
+
+
+// Get point at time t
+// - t [0 .. 1]
+Bezier.prototype.getPoint = function ( t ) {
+ var x = bezier(this.start.x, this.startCtrlPoint.x, this.endCtrlPoint.x, this.end.x, t);
+ var y = bezier(this.start.y, this.startCtrlPoint.y, this.endCtrlPoint.y, this.end.y, t);
+
+ return new v2(x, y);
+};
+
+// Get total curve arc length
+Bezier.prototype.getLength = function () {
+
+ var lengths = this.getLengths();
+ return lengths[ lengths.length - 1 ];
+
+};
+
+// Get list of cumulative segment lengths
+Bezier.prototype.getLengths = function ( divisions ) {
+
+ if ( ! divisions ) divisions = (this.__arcLengthDivisions) ? (this.__arcLengthDivisions): 200;
+
+ if ( this.cacheArcLengths
+ && ( this.cacheArcLengths.length === divisions + 1 )) {
+
+ //console.log( "cached", this.cacheArcLengths );
+ return this.cacheArcLengths;
+
+ }
+
+ var cache = [];
+ var current, last = this.getPoint( 0 );
+ var p, sum = 0;
+
+ cache.push( 0 );
+
+ for ( p = 1; p <= divisions; p ++ ) {
+
+ current = this.getPoint ( p / divisions );
+ sum += cc.pDistance(current, last);
+ cache.push( sum );
+ last = current;
+
+ }
+
+ this.cacheArcLengths = cache;
+
+ return cache; // { sums: cache, sum:sum }; Sum is in the last element.
+};
+
+Bezier.prototype.getUtoTmapping = function ( u, distance ) {
+
+ var arcLengths = this.getLengths();
+
+ var i = 0, il = arcLengths.length;
+
+ var targetArcLength; // The targeted u distance value to get
+
+ if ( distance ) {
+ targetArcLength = distance;
+ } else {
+ targetArcLength = u * arcLengths[ il - 1 ];
+ }
+
+ //var time = Date.now();
+
+ // binary search for the index with largest value smaller than target u distance
+
+ var low = 0, high = il - 1, comparison;
+
+ while ( low <= high ) {
+
+ i = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats
+
+ comparison = arcLengths[ i ] - targetArcLength;
+
+ if ( comparison < 0 ) {
+
+ low = i + 1;
+ continue;
+
+ } else if ( comparison > 0 ) {
+
+ high = i - 1;
+ continue;
+
+ } else {
+
+ high = i;
+ break;
+
+ // DONE
+
+ }
+
+ }
+
+ i = high;
+
+ //console.log('b' , i, low, high, Date.now()- time);
+
+ if ( arcLengths[ i ] == targetArcLength ) {
+
+ var t = i / ( il - 1 );
+ return t;
+
+ }
+
+ // we could get finer grain at lengths, or use simple interpolatation between two points
+
+ var lengthBefore = arcLengths[ i ];
+ var lengthAfter = arcLengths[ i + 1 ];
+
+ var segmentLength = lengthAfter - lengthBefore;
+
+ // determine where we are between the 'before' and 'after' points
+
+ var segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;
+
+ // add that fractional amount to t
+
+ var t = ( i + segmentFraction ) / ( il -1 );
+
+ return t;
+};
+
+
+function sampleMotionPaths (motionPaths, data, duration, fps) {
+
+ function createControlPoints(array) {
+ if (array instanceof cc.Vec2) {
+ return {
+ in: array,
+ pos: array,
+ out: array
+ };
+ }
+ else if (Array.isArray(array) && array.length === 6) {
+ return {
+ in: v2(array[2], array[3]),
+ pos: v2(array[0], array[1]),
+ out: v2(array[4], array[5])
+ };
+ }
+
+ return {
+ in: cc.Vec2.ZERO,
+ pos: cc.Vec2.ZERO,
+ out: cc.Vec2.ZERO
+ };
+ }
+
+ var values = data.values;
+
+ values = values.map(function (value) {
+ return v2(value[0], value[1]);
+ });
+
+ var types = data.types;
+ var ratios = data.ratios;
+
+ var newValues = data.values = [];
+ var newTypes = data.types = [];
+ var newRatios = data.ratios = [];
+
+ function addNewDatas (value, type, ratio) {
+ newValues.push(value);
+ newTypes.push(type);
+ newRatios.push(ratio);
+ }
+
+ // ensure every ratio section's length is the same
+ var startRatioOffset = 0;
+
+ // from es6 Number.EPSILON
+ var EPSILON = 2.220446049250313e-16;
+
+ // do not need to compute last path
+ for (var i = 0, l = motionPaths.length; i < l-1; i++) {
+ var motionPath = motionPaths[i];
+
+ var ratio = ratios[i];
+ var nextRatio = ratios[i + 1];
+ var betweenRatio = nextRatio - ratio;
+
+ var value = values[i];
+ var nextValue = values[i + 1];
+
+ var type = types[i];
+
+ var results = [];
+ var progress = startRatioOffset / betweenRatio;
+ var speed = 1 / (betweenRatio * duration * fps);
+
+ if (motionPath) {
+ var points = [];
+ points.push(createControlPoints(value));
+
+ for (var j = 0, l2 = motionPath.length; j < l2; j++) {
+ var controlPoints = createControlPoints(motionPath[j]);
+ points.push(controlPoints);
+ }
+
+ points.push(createControlPoints(nextValue));
+
+ // create Curve to compute beziers
+ var curve = new Curve(points);
+ curve.computeBeziers();
+
+ // sample beziers
+ var progresses = curve.progresses;
+
+ while ( 1 - progress > EPSILON) {
+ var finalProgress = progress;
+
+ finalProgress = computeRatioByType(finalProgress, type);
+
+ var bezierIndex = binarySearch(progresses, finalProgress);
+ if (bezierIndex < 0) bezierIndex = ~bezierIndex;
+
+ finalProgress -= bezierIndex > 0 ? progresses[bezierIndex - 1] : 0;
+ finalProgress = finalProgress / curve.ratios[bezierIndex];
+
+ var pos = curve.beziers[bezierIndex].getPointAt(finalProgress);
+ results.push(pos);
+
+ progress += speed;
+ }
+
+ }
+ else {
+ while ( 1 - progress > EPSILON) {
+ var finalProgress = progress;
+
+ finalProgress = computeRatioByType(finalProgress, type);
+
+ results.push(value.lerp(nextValue, finalProgress));
+
+ progress += speed;
+ }
+ }
+
+ for (var j = 0, l2 = results.length; j < l2; j++) {
+ var newRatio = ratio + startRatioOffset + speed * j * betweenRatio;
+ addNewDatas(results[j], DynamicAnimCurve.Linear, newRatio);
+ }
+
+ if (Math.abs(progress - 1) > EPSILON) // progress > 1
+ startRatioOffset = (progress - 1) * betweenRatio;
+ else
+ startRatioOffset = 0;
+ }
+
+ addNewDatas(values[values.length - 1], DynamicAnimCurve.Linear, 1);
+}
+
+if (CC_TEST) {
+ cc._Test.sampleMotionPaths = sampleMotionPaths;
+}
+
+module.exports = {
+ sampleMotionPaths: sampleMotionPaths
+};
diff --git a/cocos2d/animation/playable.js b/cocos2d/animation/playable.js
new file mode 100644
index 00000000000..7a3fed11c9f
--- /dev/null
+++ b/cocos2d/animation/playable.js
@@ -0,0 +1,131 @@
+var JS = cc.js;
+
+/**
+ * @class Playable
+ * @constructor
+ */
+function Playable () {
+ this._isPlaying = false;
+ this._isPaused = false;
+ this._stepOnce = false;
+}
+
+var prototype = Playable.prototype;
+
+/**
+ * Is playing or paused in play mode?
+ * @property isPlaying
+ * @type {boolean}
+ * @default false
+ * @readOnly
+ */
+JS.get(prototype, 'isPlaying', function () {
+ return this._isPlaying;
+}, true);
+
+/**
+ * Is currently paused? This can be true even if in edit mode(isPlaying == false).
+ * @property isPaused
+ * @type {boolean}
+ * @default false
+ * @readOnly
+ */
+JS.get(prototype, 'isPaused', function () {
+ return this._isPaused;
+}, true);
+
+// virtual
+
+var virtual = function () {};
+/**
+ * @method onPlay
+ * @private
+ */
+prototype.onPlay = virtual;
+/**
+ * @method onPause
+ * @private
+ */
+prototype.onPause = virtual;
+/**
+ * @method onResume
+ * @private
+ */
+prototype.onResume = virtual;
+/**
+ * @method onStop
+ * @private
+ */
+prototype.onStop = virtual;
+/**
+ * @method onError
+ * @param {string} errorCode
+ * @private
+ */
+prototype.onError = virtual;
+
+// public
+
+/**
+ * Play this animation
+ * @method play
+ */
+prototype.play = function () {
+ if (this._isPlaying) {
+ if (this._isPaused) {
+ this._isPaused = false;
+ this.onResume();
+ }
+ else {
+ this.onError('already-playing');
+ }
+ }
+ else {
+ this._isPlaying = true;
+ this.onPlay();
+ }
+};
+
+/**
+ * Stop this animation
+ * @method stop
+ */
+prototype.stop = function () {
+ if (this._isPlaying) {
+ this._isPlaying = false;
+ this._isPaused = false;
+ this.onStop();
+ }
+};
+
+/**
+ * Pause this animation
+ * @method pause
+ */
+prototype.pause = function () {
+ this._isPaused = true;
+ this.onPause();
+};
+
+/**
+ * Resume this animation
+ * @method resume
+ */
+prototype.resume = function () {
+ this._isPaused = false;
+ this.onResume();
+};
+
+/**
+ * Perform a single frame step.
+ * @method step
+ */
+prototype.step = function () {
+ this.pause();
+ this._stepOnce = true;
+ if (!this._isPlaying) {
+ this.play();
+ }
+};
+
+module.exports = Playable;
diff --git a/cocos2d/animation/types.js b/cocos2d/animation/types.js
new file mode 100644
index 00000000000..8d6ce64c123
--- /dev/null
+++ b/cocos2d/animation/types.js
@@ -0,0 +1,364 @@
+var JS = cc.js;
+var Playable = require('./playable');
+
+var WrapModeMask = {
+ Loop: 1 << 1,
+ ShouldWrap: 1 << 2,
+ // Reserved: 1 << 3,
+ PingPong: 1 << 4 | 1 << 1 | 1 << 2, // Loop, ShouldWrap
+ Reverse: 1 << 5 | 1 << 2, // ShouldWrap
+};
+
+/**
+ * Specifies how time is treated when it is outside of the keyframe range of an Animation.
+ * @enum WrapMode
+ * @memberof cc
+ */
+var WrapMode = cc.Enum({
+
+ /**
+ * !#en Reads the default wrap mode set higher up.
+ * !#zh å‘ Animation Component 或者 AnimationClip 查找 wrapMode
+ * @property {Number} Default
+ */
+ Default: 0,
+
+ /**
+ * !#en All iterations are played as specified.
+ * !#zh 动画åªæ’放一é
+ * @property {Number} Normal
+ */
+ Normal: 1,
+
+ /**
+ * !#en All iterations are played in the reverse direction from the way they are specified.
+ * !#zh 从最åŽä¸€å¸§æˆ–结æŸä½ç½®å¼€å§‹åå‘æ’放,到第一帧或开始ä½ç½®åœæ¢
+ * @property {Number} Reverse
+ */
+ Reverse: WrapModeMask.Reverse,
+
+ /**
+ * !#en When time reaches the end of the animation, time will continue at the beginning.
+ * !#zh 循环æ’放
+ * @property {Number} Loop
+ */
+ Loop: WrapModeMask.Loop,
+
+ /**
+ * !#en All iterations are played in the reverse direction from the way they are specified.
+ * And when time reaches the start of the animation, time will continue at the ending.
+ * !#zh åå‘循环æ’放
+ * @property {Number} LoopReverse
+ */
+ LoopReverse: WrapModeMask.Loop | WrapModeMask.Reverse,
+
+ /**
+ * !#en Even iterations are played as specified, odd iterations are played in the reverse direction from the way they
+ * are specified.
+ * !#zh 从第一帧æ’放到最åŽä¸€å¸§ï¼Œç„¶åŽåå‘æ’放回第一帧,到第一帧åŽå†æ£å‘æ’放,如æ¤å¾ªçŽ¯
+ * @property {Number} PingPong
+ */
+ PingPong: WrapModeMask.PingPong,
+
+ /**
+ * !#en Even iterations are played in the reverse direction from the way they are specified, odd iterations are played
+ * as specified.
+ * !#zh 从最åŽä¸€å¸§å¼€å§‹åå‘æ’æ”¾ï¼Œå…¶ä»–åŒ PingPong
+ * @property {Number} PingPongReverse
+ */
+ PingPongReverse: WrapModeMask.PingPong | WrapModeMask.Reverse
+});
+
+cc.WrapMode = WrapMode;
+
+
+/**
+ * The abstract interface for all playing animation.
+ * @class AnimationNodeBase
+ * @constructor
+ * @extends Playable
+ */
+var AnimationNodeBase = function () {
+ Playable.call(this);
+};
+JS.extend(AnimationNodeBase, Playable);
+
+/**
+ * @method update
+ * @param deltaTime
+ * @private
+ */
+AnimationNodeBase.prototype.update = function (deltaTime) {};
+
+
+/**
+ * The collection and instance of playing animations created by entity.animate.
+ * @class AnimationNode
+ * @extends AnimationNodeBase
+ * @constructor
+ * @param {Animator} animator
+ * @param {AnimCurve[]} [curves]
+ * @param {Object} [timingInput] - This dictionary is used as a convenience for specifying the timing properties of an Animation in bulk.
+ */
+function AnimationNode (animator, curves, timingInput) {
+ AnimationNodeBase.call(this);
+
+ this.animator = animator;
+
+ /**
+ * @property curves
+ * @type {AnimCurve[]}
+ */
+ this.curves = curves || [];
+
+ // http://www.w3.org/TR/web-animations/#idl-def-AnimationTiming
+
+ /**
+ * !#en The start delay which represents the number of seconds from an animation's start time to the start of
+ * the active interval.
+ * !#zh 延迟多少秒æ’放
+ *
+ * @property delay
+ * @type {Number}
+ * @default 0
+ */
+ this.delay = 0;
+
+ /**
+ * !#en The animation's iteration count property.
+ *
+ * A real number greater than or equal to zero (including positive infinity) representing the number of times
+ * to repeat the animation node.
+ *
+ * Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model
+ * calculations.
+ *
+ * !#zh è¿ä»£æ¬¡æ•°, 指动画æ’放多少次åŽç»“æŸ, normalize time. 如 2.5 ( 2æ¬¡åŠ )
+ *
+ * @property repeatCount
+ * @type {Number}
+ * @default 1
+ */
+ this.repeatCount = 1;
+
+ /**
+ * !#en The iteration duration of this animation in seconds. (length)
+ * !#zh å•æ¬¡åŠ¨ç”»çš„æŒç»æ—¶é—´, 秒
+ *
+ * @property duration
+ * @type {Number}
+ * @readOnly
+ */
+ this.duration = 1;
+
+ /**
+ * !#en The animation's playback speed. 1 is normal playback speed.
+ * !#zh æ’放速率
+ * @property speed
+ * @type {Number}
+ * @default: 1.0
+ */
+ this.speed = 1;
+
+ /**
+ * !#en Wrapping mode of the playing animation.
+ * !#zh 动画循环方å¼
+ *
+ * @property wrapMode
+ * @type {WrapMode}
+ * @default: WrapMode.Normal
+ */
+ this.wrapMode = WrapMode.Normal;
+
+ if (timingInput) {
+ this.delay = timingInput.delay || this.delay;
+
+ var duration = timingInput.duration;
+ if (typeof duration !== 'undefined') {
+ this.duration = duration;
+ }
+
+ var speed = timingInput.speed;
+ if (typeof speed !== 'undefined') {
+ this.speed = speed;
+ }
+
+ //
+ var wrapMode = timingInput.wrapMode;
+ if (typeof wrapMode !== 'undefined') {
+ var isEnum = typeof wrapMode === 'number';
+ if (isEnum) {
+ this.wrapMode = wrapMode;
+ }
+ else {
+ this.wrapMode = WrapMode[wrapMode];
+ }
+ }
+
+ var repeatCount = timingInput.repeatCount;
+ if (typeof repeatCount !== 'undefined') {
+ this.repeatCount = repeatCount;
+ }
+ else if (this.wrapMode & WrapModeMask.Loop) {
+ this.repeatCount = Infinity;
+ }
+ }
+
+ /**
+ * The current time of this animation in seconds.
+ * @property time
+ * @type {Number}
+ * @default 0
+ */
+ this.time = 0;
+
+ this._timeNoScale = 0;
+ this._firstFramePlayed = false;
+
+ this._duringDelay = false;
+
+ // play
+
+ if (this.delay > 0) {
+ this._duringDelay = true;
+ }
+}
+JS.extend(AnimationNode, AnimationNodeBase);
+
+JS.mixin(AnimationNode.prototype, {
+
+ update: function (delta) {
+
+ // calculate delay time
+
+ if (this._duringDelay) {
+ this._timeNoScale += delta;
+ if (this._timeNoScale < this.delay) {
+ // still waiting
+ return;
+ }
+ else {
+ this._duringDelay = false;
+ }
+ //// start play
+ // delta -= (this._timeNoScale - this.delay);
+ }
+
+ // make first frame perfect
+
+ //var playPerfectFirstFrame = (this.time === 0);
+ if (this._firstFramePlayed) {
+ this.time += (delta * this.speed);
+ }
+ else {
+ this._firstFramePlayed = true;
+ }
+
+ // sample
+
+ if (this.sample()) {
+ this.stop();
+ }
+ },
+
+ _needRevers: function (currentIterations) {
+ var wrapMode = this.wrapMode;
+ var needRevers = false;
+
+ if ((wrapMode & WrapModeMask.PingPong) === WrapModeMask.PingPong) {
+ var isEnd = currentIterations - (currentIterations | 0) === 0;
+ if (isEnd && (currentIterations > 0)) {
+ currentIterations -= 1;
+ }
+
+ var isOddIteration = currentIterations & 1;
+ if (isOddIteration) {
+ needRevers = !needRevers;
+ }
+ }
+ if ((wrapMode & WrapModeMask.Reverse) === WrapModeMask.Reverse) {
+ needRevers = !needRevers;
+ }
+ return needRevers;
+ },
+
+ getWrappedInfo: function (time) {
+ var stopped = false;
+ var duration = this.duration;
+ var ratio = 0;
+ var wrapMode = this.wrapMode;
+
+ var currentIterations = Math.abs(time / duration);
+ if (currentIterations > this.repeatCount) currentIterations = this.repeatCount;
+
+ var needRevers = false;
+ if (wrapMode & WrapModeMask.ShouldWrap) {
+ needRevers = this._needRevers(currentIterations);
+ }
+
+ var direction = needRevers ? -1 : 1;
+ if (this.speed < 0) direction *= -1;
+
+ if (currentIterations >= this.repeatCount) {
+ stopped = true;
+ var tempRatio = this.repeatCount - (this.repeatCount | 0);
+ if (tempRatio === 0) {
+ tempRatio = 1; // 如果æ’放过,动画ä¸å¤ä½
+ }
+ time = tempRatio * duration * (time > 0 ? 1 : -1);
+ }
+
+ if (time > duration) {
+ var tempTime = time % duration;
+ time = tempTime === 0 ? duration : tempTime;
+ }
+ else if (time < 0) {
+ time = time % duration;
+ if (time !== 0 ) time += duration;
+ }
+
+ // calculate wrapped time
+ if (wrapMode & WrapModeMask.ShouldWrap) {
+ if (needRevers) time = duration - time;
+ }
+
+ ratio = time / duration;
+
+ return {
+ ratio: ratio,
+ time: time,
+ direction: direction,
+ stopped: stopped,
+ iterations: currentIterations
+ }
+ },
+
+ sample: function () {
+
+ // sample
+
+ var info = this.getWrappedInfo(this.time);
+
+ var curves = this.curves;
+ for (var i = 0, len = curves.length; i < len; i++) {
+ var curve = curves[i];
+ curve.sample(info.time, info.ratio, this);
+ }
+
+ return info.stopped;
+ }
+
+ //onPlay: function () {
+ //},
+ //
+ //onStop: function () {
+ //}
+});
+
+cc.AnimationNode = AnimationNode;
+
+module.exports = {
+ WrapModeMask: WrapModeMask,
+ WrapMode: WrapMode,
+ AnimationNode: AnimationNode,
+};
diff --git a/cocos2d/audio/CCAudio.js b/cocos2d/audio/CCAudio.js
new file mode 100644
index 00000000000..acdc4632f53
--- /dev/null
+++ b/cocos2d/audio/CCAudio.js
@@ -0,0 +1,1033 @@
+/****************************************************************************
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011-2012 cocos2d-x.org
+ Copyright (c) 2013-2014 Chukong Technologies Inc.
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+/**
+ * Audio support in the browser
+ *
+ * MULTI_CHANNEL : Multiple audio while playing - If it doesn't, you can only play background music
+ * WEB_AUDIO : Support for WebAudio - Support W3C WebAudio standards, all of the audio can be played
+ * AUTOPLAY : Supports auto-play audio - if Don‘t support it, On a touch detecting background music canvas, and then replay
+ * REPLAY_AFTER_TOUCH : The first music will fail, must be replay after touchstart
+ * USE_EMPTIED_EVENT : Whether to use the emptied event to replace load callback
+ * DELAY_CREATE_CTX : delay created the context object - only webAudio
+ * NEED_MANUAL_LOOP : WebAudio loop attribute failure, need to manually perform loop
+ *
+ * May be modifications for a few browser version
+ */
+(function(){
+
+ var DEBUG = false;
+
+ var sys = cc.sys;
+ var version = sys.browserVersion;
+
+ // check if browser supports Web Audio
+ // check Web Audio's context
+ var supportWebAudio = !!(window.AudioContext || window.webkitAudioContext || window.mozAudioContext);
+
+ var supportTable = {
+ "common" : {MULTI_CHANNEL: true , WEB_AUDIO: supportWebAudio , AUTOPLAY: true }
+ };
+ supportTable[sys.BROWSER_TYPE_IE] = {MULTI_CHANNEL: true , WEB_AUDIO: supportWebAudio , AUTOPLAY: true, USE_EMPTIED_EVENT: true};
+ // ANDROID //
+ supportTable[sys.BROWSER_TYPE_ANDROID] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: false};
+ supportTable[sys.BROWSER_TYPE_CHROME] = {MULTI_CHANNEL: true , WEB_AUDIO: true , AUTOPLAY: false};
+ supportTable[sys.BROWSER_TYPE_FIREFOX] = {MULTI_CHANNEL: true , WEB_AUDIO: true , AUTOPLAY: true , DELAY_CREATE_CTX: true};
+ supportTable[sys.BROWSER_TYPE_UC] = {MULTI_CHANNEL: true , WEB_AUDIO: false, AUTOPLAY: false};
+ supportTable[sys.BROWSER_TYPE_QQ] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: true };
+ supportTable[sys.BROWSER_TYPE_OUPENG] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: false, REPLAY_AFTER_TOUCH: true , USE_EMPTIED_EVENT: true };
+ supportTable[sys.BROWSER_TYPE_WECHAT] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: false, REPLAY_AFTER_TOUCH: true , USE_EMPTIED_EVENT: true };
+ supportTable[sys.BROWSER_TYPE_360] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: true };
+ supportTable[sys.BROWSER_TYPE_MIUI] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: true };
+ supportTable[sys.BROWSER_TYPE_LIEBAO] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: false, REPLAY_AFTER_TOUCH: true , USE_EMPTIED_EVENT: true };
+ supportTable[sys.BROWSER_TYPE_SOUGOU] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: false, REPLAY_AFTER_TOUCH: true , USE_EMPTIED_EVENT: true };
+ //"Baidu" browser can automatically play
+ //But because it may be play failed, so need to replay and auto
+ supportTable[sys.BROWSER_TYPE_BAIDU] = {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: false, REPLAY_AFTER_TOUCH: true , USE_EMPTIED_EVENT: true };
+ supportTable[sys.BROWSER_TYPE_BAIDU_APP]= {MULTI_CHANNEL: false, WEB_AUDIO: false, AUTOPLAY: false, REPLAY_AFTER_TOUCH: true , USE_EMPTIED_EVENT: true };
+
+ // APPLE //
+ supportTable[sys.BROWSER_TYPE_SAFARI] = {MULTI_CHANNEL: true , WEB_AUDIO: true , AUTOPLAY: false, webAudioCallback: function(realUrl){
+ document.createElement("audio").src = realUrl;
+ }};
+
+ if(cc.sys.isMobile){
+ if(cc.sys.os !== cc.sys.OS_IOS)
+ window.__audioSupport = supportTable[sys.browserType] || supportTable["common"];
+ else
+ window.__audioSupport = supportTable[sys.BROWSER_TYPE_SAFARI];
+ }else{
+ switch(sys.browserType){
+ case sys.BROWSER_TYPE_IE:
+ window.__audioSupport = supportTable[sys.BROWSER_TYPE_IE];
+ break;
+ case sys.BROWSER_TYPE_FIREFOX:
+ window.__audioSupport = supportTable[sys.BROWSER_TYPE_FIREFOX];
+ break;
+ default:
+ window.__audioSupport = supportTable["common"];
+ }
+ }
+
+ ///////////////////////////
+ // Browser compatibility//
+ ///////////////////////////
+ if(version){
+ switch(sys.browserType){
+ case sys.BROWSER_TYPE_CHROME:
+ version = parseInt(version);
+ if(version < 30){
+ window.__audioSupport = {MULTI_CHANNEL: false , WEB_AUDIO: true , AUTOPLAY: false};
+ }else if(version === 42){
+ window.__audioSupport.NEED_MANUAL_LOOP = true;
+ }
+ break;
+ case sys.BROWSER_TYPE_MIUI:
+ if(cc.sys.isMobile){
+ version = version.match(/\d+/g);
+ if(version[0] < 2 || (version[0] === 2 && version[1] === 0 && version[2] <= 1)){
+ window.__audioSupport.AUTOPLAY = false;
+ }
+ }
+ break;
+ }
+ }
+
+ if(DEBUG){
+ setTimeout(function(){
+ cc.log("browse type: " + sys.browserType);
+ cc.log("browse version: " + version);
+ cc.log("MULTI_CHANNEL: " + window.__audioSupport.MULTI_CHANNEL);
+ cc.log("WEB_AUDIO: " + window.__audioSupport.WEB_AUDIO);
+ cc.log("AUTOPLAY: " + window.__audioSupport.AUTOPLAY);
+ }, 0);
+ }
+
+})();
+
+/**
+ * Encapsulate DOM and webAudio
+ */
+cc.Audio = cc._Class.extend({
+ //TODO Maybe loader shift in will be better
+ volume: 1,
+ loop: false,
+ src: null,
+ _touch: false,
+
+ _playing: false,
+ _AUDIO_TYPE: "AUDIO",
+ _pause: false,
+
+ //Web Audio
+ _buffer: null,
+ _currentSource: null,
+ _startTime: null,
+ _currentTime: null,
+ _context: null,
+ _volume: null,
+
+ _ignoreEnded: false,
+ _manualLoop: false,
+
+ //DOM Audio
+ _element: null,
+
+ ctor: function(context, volume, url){
+ context && (this._context = context);
+ volume && (this._volume = volume);
+ if(context && volume){
+ this._AUDIO_TYPE = "WEBAUDIO";
+ }
+ this.src = url;
+ },
+
+ _setBufferCallback: null,
+ setBuffer: function(buffer){
+ if(!buffer) return;
+ var playing = this._playing;
+ this._AUDIO_TYPE = "WEBAUDIO";
+
+ if(this._buffer && this._buffer !== buffer && this.getPlaying())
+ this.stop();
+
+ this._buffer = buffer;
+ if(playing)
+ this.play();
+
+ this._volume["gain"].value = this.volume;
+ this._setBufferCallback && this._setBufferCallback(buffer);
+ },
+
+ _setElementCallback: null,
+ setElement: function(element){
+ if(!element) return;
+ var playing = this._playing;
+ this._AUDIO_TYPE = "AUDIO";
+
+ if(this._element && this._element !== element && this.getPlaying())
+ this.stop();
+
+ this._element = element;
+ if(playing)
+ this.play();
+
+ element.volume = this.volume;
+ element.loop = this.loop;
+ this._setElementCallback && this._setElementCallback(element);
+ },
+
+ play: function(offset, loop){
+ this._playing = true;
+ this.loop = loop === undefined ? this.loop : loop;
+ if(this._AUDIO_TYPE === "AUDIO"){
+ this._playOfAudio(offset);
+ }else{
+ this._playOfWebAudio(offset);
+ }
+ },
+
+ getPlaying: function(){
+ if(!this._playing){
+ return false;
+ }
+ if(this._AUDIO_TYPE === "AUDIO"){
+ var audio = this._element;
+ if(!audio || this._pause || audio.ended){
+ return this._playing = false;
+ }
+ return true;
+ }
+ var sourceNode = this._currentSource;
+ if(!sourceNode || !sourceNode["playbackState"])
+ return true;
+ return this._currentTime + this._context.currentTime - this._startTime < sourceNode.buffer.duration;
+ },
+
+ _playOfWebAudio: function(offset){
+ var cs = this._currentSource;
+ if(!this._buffer){
+ return;
+ }
+ if(!this._pause && cs){
+ if(this._context.currentTime === 0 || this._currentTime + this._context.currentTime - this._startTime > cs.buffer.duration)
+ this._stopOfWebAudio();
+ else
+ return;
+ }
+ var audio = this._context["createBufferSource"]();
+ audio.buffer = this._buffer;
+ audio["connect"](this._volume);
+ if(this._manualLoop)
+ audio.loop = false;
+ else
+ audio.loop = this.loop;
+ this._startTime = this._context.currentTime;
+ this._currentTime = offset || 0;
+ this._ignoreEnded = false;
+
+ /*
+ * Safari on iOS 6 only supports noteOn(), noteGrainOn(), and noteOff() now.(iOS 6.1.3)
+ * The latest version of chrome has supported start() and stop()
+ * start() & stop() are specified in the latest specification (written on 04/26/2013)
+ * Reference: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
+ * noteOn(), noteGrainOn(), and noteOff() are specified in Draft 13 version (03/13/2012)
+ * Reference: http://www.w3.org/2011/audio/drafts/2WD/Overview.html
+ */
+ if(audio.start){
+ audio.start(0, offset || 0);
+ }else if(audio["noteGrainOn"]){
+ var duration = audio.buffer.duration;
+ if (this.loop) {
+ /*
+ * On Safari on iOS 6, if loop == true, the passed in @param duration will be the duration from now on.
+ * In other words, the sound will keep playing the rest of the music all the time.
+ * On latest chrome desktop version, the passed in duration will only be the duration in this cycle.
+ * Now that latest chrome would have start() method, it is prepared for iOS here.
+ */
+ audio["noteGrainOn"](0, offset, duration);
+ } else {
+ audio["noteGrainOn"](0, offset, duration - offset);
+ }
+ }else {
+ // if only noteOn() is supported, resuming sound will NOT work
+ audio["noteOn"](0);
+ }
+ this._currentSource = audio;
+ var self = this;
+ audio["onended"] = function(){
+ if(self._manualLoop && self._playing && self.loop){
+ self.stop();
+ self.play();
+ return;
+ }
+ if(self._ignoreEnded){
+ self._ignoreEnded = false;
+ }else{
+ if(!self._pause)
+ self.stop();
+ else
+ self._playing = false;
+ }
+ };
+ },
+
+ _playOfAudio: function(){
+ var audio = this._element;
+ if(audio){
+ audio.loop = this.loop;
+ audio.play();
+ }
+ },
+
+ stop: function(){
+ this._playing = false;
+ if(this._AUDIO_TYPE === "AUDIO"){
+ this._stopOfAudio();
+ }else{
+ this._stopOfWebAudio();
+ }
+ },
+
+ _stopOfWebAudio: function(){
+ var audio = this._currentSource;
+ this._ignoreEnded = true;
+ if(audio){
+ audio.stop(0);
+ this._currentSource = null;
+ }
+ },
+
+ _stopOfAudio: function(){
+ var audio = this._element;
+ if(audio){
+ audio.pause();
+ if (audio.duration && audio.duration !== Infinity)
+ audio.currentTime = 0;
+ }
+ },
+
+ pause: function(){
+ if(this.getPlaying() === false)
+ return;
+ this._playing = false;
+ this._pause = true;
+ if(this._AUDIO_TYPE === "AUDIO"){
+ this._pauseOfAudio();
+ }else{
+ this._pauseOfWebAudio();
+ }
+ },
+
+ _pauseOfWebAudio: function(){
+ this._currentTime += this._context.currentTime - this._startTime;
+ var audio = this._currentSource;
+ if(audio){
+ audio.stop(0);
+ }
+ },
+
+ _pauseOfAudio: function(){
+ var audio = this._element;
+ if(audio){
+ audio.pause();
+ }
+ },
+
+ resume: function(){
+ if(this._pause){
+ if(this._AUDIO_TYPE === "AUDIO"){
+ this._resumeOfAudio();
+ }else{
+ this._resumeOfWebAudio();
+ }
+ this._pause = false;
+ this._playing = true;
+ }
+ },
+
+ _resumeOfWebAudio: function(){
+ var audio = this._currentSource;
+ if(audio){
+ this._startTime = this._context.currentTime;
+ var offset = this._currentTime % audio.buffer.duration;
+ this._playOfWebAudio(offset);
+ }
+ },
+
+ _resumeOfAudio: function(){
+ var audio = this._element;
+ if(audio){
+ audio.play();
+ }
+ },
+
+ setVolume: function(volume){
+ if(volume > 1) volume = 1;
+ if(volume < 0) volume = 0;
+ this.volume = volume;
+ if(this._AUDIO_TYPE === "AUDIO"){
+ if(this._element){
+ this._element.volume = volume;
+ }
+ }else{
+ if(this._volume){
+ this._volume["gain"].value = volume;
+ }
+ }
+ },
+
+ getVolume: function(){
+ return this.volume;
+ },
+
+ cloneNode: function(){
+ var audio, self;
+ if(this._AUDIO_TYPE === "AUDIO"){
+ audio = new cc.Audio();
+
+ var elem = document.createElement("audio");
+ elem.src = this.src;
+ audio.setElement(elem);
+ }else{
+ var volume = this._context["createGain"]();
+ volume["gain"].value = 1;
+ volume["connect"](this._context["destination"]);
+ audio = new cc.Audio(this._context, volume, this.src);
+ if(this._buffer){
+ audio.setBuffer(this._buffer);
+ }else{
+ self = this;
+ this._setBufferCallback = function(buffer){
+ audio.setBuffer(buffer);
+ self._setBufferCallback = null;
+ };
+ }
+ audio._manualLoop = this._manualLoop;
+ }
+ audio._AUDIO_TYPE = this._AUDIO_TYPE;
+ return audio;
+ }
+
+});
+
+(function(polyfill){
+
+ var SWA = polyfill.WEB_AUDIO,
+ SWB = polyfill.MULTI_CHANNEL,
+ SWC = polyfill.AUTOPLAY;
+
+ var support = [];
+
+ (function(){
+ var audio = document.createElement("audio");
+ if(audio.canPlayType) {
+ var ogg = audio.canPlayType('audio/ogg; codecs="vorbis"');
+ if (ogg && ogg !== "") support.push(".ogg");
+ var mp3 = audio.canPlayType("audio/mpeg");
+ if (mp3 && mp3 !== "") support.push(".mp3");
+ var wav = audio.canPlayType('audio/wav; codecs="1"');
+ if (wav && wav !== "") support.push(".wav");
+ var mp4 = audio.canPlayType("audio/mp4");
+ if (mp4 && mp4 !== "") support.push(".mp4");
+ var m4a = audio.canPlayType("audio/x-m4a");
+ if (m4a && m4a !== "") support.push(".m4a");
+ }
+ })();
+ try{
+ if(SWA){
+ var context = new (window.AudioContext || window.webkitAudioContext || window.mozAudioContext)();
+ if(polyfill.DELAY_CREATE_CTX)
+ setTimeout(function(){ context = new (window.AudioContext || window.webkitAudioContext || window.mozAudioContext)(); }, 0);
+ }
+ }catch(error){
+ SWA = false;
+ cc.log("browser don't support web audio");
+ }
+
+ var loader = {
+
+ cache: {},
+
+ load: function(realUrl, url, res, cb){
+
+ if(support.length === 0)
+ return cb("can not support audio!");
+
+ var i;
+
+ if(cc.loader.audioPath)
+ realUrl = cc.path.join(cc.loader.audioPath, realUrl);
+
+ var extname = cc.path.extname(realUrl);
+
+ var typeList = [extname];
+ for(i=0; itrue if the background music is playing, otherwise false
+ */
+ willPlayMusic: function(){return false;},
+
+ /**
+ * Play music.
+ * @param {String} url The path of the music file without filename extension.
+ * @param {Boolean} loop Whether the music loop or not.
+ * @example
+ * //example
+ * cc.audioEngine.playMusic(path, false);
+ */
+ playMusic: function(url, loop){
+ var bgMusic = this._currMusic;
+ if(bgMusic && bgMusic.src !== url && bgMusic.getPlaying()){
+ bgMusic.stop();
+ }
+ var audio = loader.cache[url];
+ if(!audio){
+ cc.loader.load(url);
+ audio = loader.cache[url];
+ }
+ audio.play(0, loop);
+ audio.setVolume(this._musicVolume);
+
+ this._currMusic = audio;
+ },
+
+ /**
+ * Stop playing music.
+ * @param {Boolean} [releaseData] If release the music data or not.As default value is false.
+ * @example
+ * //example
+ * cc.audioEngine.stopMusic();
+ */
+ stopMusic: function(releaseData){
+ var audio = this._currMusic;
+ if(audio){
+ audio.stop();
+ if (releaseData)
+ cc.loader.release(audio.src);
+ }
+ },
+
+ /**
+ * Pause playing music.
+ * @example
+ * //example
+ * cc.audioEngine.pauseMusic();
+ */
+ pauseMusic: function(){
+ var audio = this._currMusic;
+ if(audio)
+ audio.pause();
+ },
+
+ /**
+ * Resume playing music.
+ * @example
+ * //example
+ * cc.audioEngine.resumeMusic();
+ */
+ resumeMusic: function(){
+ var audio = this._currMusic;
+ if(audio)
+ audio.resume();
+ },
+
+ /**
+ * Rewind playing music.
+ * @example
+ * //example
+ * cc.audioEngine.rewindMusic();
+ */
+ rewindMusic: function(){
+ var audio = this._currMusic;
+ if(audio){
+ audio.stop();
+ audio.play();
+ }
+ },
+
+ /**
+ * The volume of the music max value is 1.0,the min value is 0.0 .
+ * @return {Number}
+ * @example
+ * //example
+ * var volume = cc.audioEngine.getMusicVolume();
+ */
+ getMusicVolume: function(){
+ return this._musicVolume;
+ },
+
+ /**
+ * Set the volume of music.
+ * @param {Number} volume Volume must be in 0.0~1.0 .
+ * @example
+ * //example
+ * cc.audioEngine.setMusicVolume(0.5);
+ */
+ setMusicVolume: function(volume){
+ volume = volume - 0;
+ if(isNaN(volume)) volume = 1;
+ if(volume > 1) volume = 1;
+ if(volume < 0) volume = 0;
+
+ this._musicVolume = volume;
+ var audio = this._currMusic;
+ if(audio){
+ audio.setVolume(volume);
+ }
+ },
+
+ /**
+ * Whether the music is playing.
+ * @return {Boolean} If is playing return true,or return false.
+ * @example
+ * //example
+ * if (cc.audioEngine.isMusicPlaying()) {
+ * cc.log("music is playing");
+ * }
+ * else {
+ * cc.log("music is not playing");
+ * }
+ */
+ isMusicPlaying: function(){
+ var audio = this._currMusic;
+ if(audio){
+ return audio.getPlaying();
+ }else{
+ return false;
+ }
+ },
+
+ _audioPool: {},
+ _maxAudioInstance: 5,
+ _effectVolume: 1,
+ /**
+ * Play sound effect.
+ * @param {String} url The path of the sound effect with filename extension.
+ * @param {Boolean} loop Whether to loop the effect playing, default value is false
+ * @return {Number|null} the audio id
+ * @example
+ * //example
+ * var soundId = cc.audioEngine.playEffect(path);
+ */
+ playEffect: function(url, loop){
+ //If the browser just support playing single audio
+ if(!SWB){
+ //Must be forced to shut down
+ //Because playing MULTI_CHANNEL audio will be stuck in chrome 28 (android)
+ return null;
+ }
+
+ var effectList = this._audioPool[url];
+ if(!effectList){
+ effectList = this._audioPool[url] = [];
+ }
+
+ var i;
+
+ for(i=0; i this._maxAudioInstance){
+ cc.log("Error: %s greater than %d", url, this._maxAudioInstance);
+ }else{
+ var audio = loader.cache[url];
+ if(!audio){
+ cc.loader.load(url);
+ audio = loader.cache[url];
+ }
+ audio = audio.cloneNode();
+ audio.setVolume(this._effectVolume);
+ audio.loop = loop || false;
+ audio.play();
+ effectList.push(audio);
+ }
+
+ return audio;
+ },
+
+ /**
+ * Set the volume of sound effects.
+ * @param {Number} volume Volume must be in 0.0~1.0 .
+ * @example
+ * //example
+ * cc.audioEngine.setEffectsVolume(0.5);
+ */
+ setEffectsVolume: function(volume){
+ volume = volume - 0;
+ if(isNaN(volume)) volume = 1;
+ if(volume > 1) volume = 1;
+ if(volume < 0) volume = 0;
+
+ this._effectVolume = volume;
+ var audioPool = this._audioPool;
+ for(var p in audioPool){
+ var audioList = audioPool[p];
+ if(Array.isArray(audioList))
+ for(var i=0; i
+ * cc.ClippingNode is a subclass of cc.Node.
+ * It draws its content (children) clipped using a stencil.
+ * The stencil is an other cc.Node that will not be drawn.
+ * The clipping is done using the alpha part of the stencil (adjusted with an alphaThreshold).
+ *
+ * @class
+ * @extends cc.Node
+ * @param {cc.Node} [stencil=null]
+ *
+ * @property {Number} alphaThreshold - Threshold for alpha value.
+ * @property {Boolean} inverted - Indicate whether in inverted mode.
+ * @property {cc.Node} stencil - he cc.Node to use as a stencil to do the clipping.
+ */
+cc.ClippingNode = cc.Node.extend(/** @lends cc.ClippingNode# */{
+ alphaThreshold: 0,
+ inverted: false,
+
+ _stencil: null,
+ _className: "ClippingNode",
+
+ /**
+ * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
+ * @param {cc.Node} [stencil=null]
+ */
+ ctor: function (stencil) {
+ stencil = stencil || null;
+ cc.Node.prototype.ctor.call(this);
+ this._stencil = stencil;
+ this.alphaThreshold = 1;
+ this.inverted = false;
+ this._renderCmd.initStencilBits();
+ },
+
+ /**
+ * Initialization of the node, please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
+ * @function
+ * @param {cc.Node} [stencil=null]
+ */
+ init: function (stencil) {
+ this._stencil = stencil;
+ this.alphaThreshold = 1;
+ this.inverted = false;
+ this._renderCmd.initStencilBits();
+ return true;
+ },
+
+ /**
+ *
+ * Event callback that is invoked every time when node enters the 'stage'.
+ * If the CCNode enters the 'stage' with a transition, this event is called when the transition starts.
+ * During onEnter you can't access a "sister/brother" node.
+ * If you override onEnter, you must call its parent's onEnter function with this._super().
+ *
+ * Event callback that is invoked when the node enters in the 'stage'.
+ * If the node enters the 'stage' with a transition, this event is called when the transition finishes.
+ * If you override onEnterTransitionDidFinish, you shall call its parent's onEnterTransitionDidFinish with this._super()
+ *
+ * callback that is called every time the node leaves the 'stage'.
+ * If the node leaves the 'stage' with a transition, this callback is called when the transition starts.
+ * If you override onExitTransitionDidStart, you shall call its parent's onExitTransitionDidStart with this._super()
+ *
+ * callback that is called every time the node leaves the 'stage'.
+ * If the node leaves the 'stage' with a transition, this callback is called when the transition finishes.
+ * During onExit you can't access a sibling node.
+ * If you override onExit, you shall call its parent's onExit with this._super().
+ *
+ * The alpha threshold.
+ * The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold.
+ * Should be a float between 0 and 1.
+ * This default to 1 (so alpha test is disabled).
+ *