mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Starting integration of tween.js
This commit is contained in:
parent
8a09469798
commit
d323404676
3 changed files with 1452 additions and 158 deletions
|
@ -3,6 +3,42 @@
|
|||
{
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"inter",
|
||||
"intersectsRaw"
|
||||
],
|
||||
[
|
||||
"cont",
|
||||
"containsRect"
|
||||
],
|
||||
[
|
||||
"prot",
|
||||
"prototype"
|
||||
],
|
||||
[
|
||||
"atl",
|
||||
"atlasURL"
|
||||
],
|
||||
[
|
||||
"addT",
|
||||
"addTextureAtlas"
|
||||
],
|
||||
[
|
||||
"TEX",
|
||||
"TEXTURE_ATLAS_JSON_HASH (variable)"
|
||||
],
|
||||
[
|
||||
"ad",
|
||||
"appendChild (function)"
|
||||
],
|
||||
[
|
||||
"fun",
|
||||
"function"
|
||||
],
|
||||
[
|
||||
"prop",
|
||||
"properties"
|
||||
],
|
||||
[
|
||||
"the",
|
||||
"the_terms"
|
||||
|
@ -478,47 +514,36 @@
|
|||
[
|
||||
"wavet",
|
||||
"waveTween1"
|
||||
],
|
||||
[
|
||||
"moveb",
|
||||
"moveBoatDown"
|
||||
],
|
||||
[
|
||||
"move",
|
||||
"moveBoatLeft"
|
||||
],
|
||||
[
|
||||
"boat",
|
||||
"boatTween"
|
||||
],
|
||||
[
|
||||
"fish",
|
||||
"fishLeft"
|
||||
],
|
||||
[
|
||||
"get",
|
||||
"getElementById"
|
||||
],
|
||||
[
|
||||
"fill",
|
||||
"fillStyle"
|
||||
],
|
||||
[
|
||||
"ist",
|
||||
"isTablet"
|
||||
],
|
||||
[
|
||||
"image",
|
||||
"imageLoadComplete"
|
||||
],
|
||||
[
|
||||
"gain",
|
||||
"gainNode"
|
||||
]
|
||||
]
|
||||
},
|
||||
"buffers":
|
||||
[
|
||||
{
|
||||
"file": "src/Game.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 5482,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "todo/Tween.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 12434,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "src/tween/TweenManager.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 3317,
|
||||
"line_ending": "Windows",
|
||||
"name": "Phaser.TweenManager = function () {"
|
||||
}
|
||||
}
|
||||
],
|
||||
"build_system": "",
|
||||
"command_palette":
|
||||
|
@ -548,9 +573,72 @@
|
|||
},
|
||||
"file_history":
|
||||
[
|
||||
"/D/wamp/www/phaser/TS Source/tweens/TweenManager.js",
|
||||
"/D/wamp/www/phaser/src/geom/Rectangle.js",
|
||||
"/D/wamp/www/phaser/TS Source/utils/RectangleUtils.js",
|
||||
"/D/wamp/www/phaser/TS Source/geom/Rectangle.js",
|
||||
"/D/wamp/www/phaser/src/system/Device.js",
|
||||
"/D/wamp/www/phaser/src/math/Math.js",
|
||||
"/D/wamp/www/phaser/examples/point.html",
|
||||
"/D/wamp/www/phaser/src/geom/Point.js",
|
||||
"/D/wamp/www/phaser/src/geom/Circle.js",
|
||||
"/D/wamp/www/phaser/TS Source/utils/PointUtils.js",
|
||||
"/D/wamp/www/phaser/TS Source/geom/Point.js",
|
||||
"/D/wamp/www/phaser/TS Source/time/TimeManager.js",
|
||||
"/D/wamp/www/phaser/TS Source/time/TimeManager.ts",
|
||||
"/D/wamp/www/phaser/TS Source/math/GameMath.js",
|
||||
"/D/wamp/www/phaser/examples/math sincos.html",
|
||||
"/D/wamp/www/phaser/examples/circle.html",
|
||||
"/D/wamp/www/phaser/TS Source/utils/CircleUtils.js",
|
||||
"/D/wamp/www/phaser/TS Source/geom/Circle.js",
|
||||
"/D/wamp/www/phaser/src/time/Time.js",
|
||||
"/D/wamp/www/phaser/src/net/Net.js",
|
||||
"/D/wamp/www/phaser/examples/net.html",
|
||||
"/D/wamp/www/phaser/TS Source/net/Net.js",
|
||||
"/D/wamp/www/phaser/src/animation/Parser.js",
|
||||
"/D/wamp/www/phaser/src/loader/Cache.js",
|
||||
"/D/wamp/www/phaser/src/loader/Loader.js",
|
||||
"/D/wamp/www/phaser/examples/loader audio.html",
|
||||
"/D/wamp/www/phaser/examples/loader spritesheet.html",
|
||||
"/D/wamp/www/phaser/examples/loader atlas xml.html",
|
||||
"/D/wamp/www/phaser/examples/loader atlas json.html",
|
||||
"/D/wamp/www/phaser/examples/assets/sprites/shoebot.xml",
|
||||
"/D/wamp/www/phaser/src/animation/Frame.js",
|
||||
"/D/wamp/www/phaser/TS Source/loader/AnimationLoader.js",
|
||||
"/D/wamp/www/phaser/TS Source/loader/AnimationLoader.ts",
|
||||
"/D/wamp/www/phaser/src/animation/Animation.js",
|
||||
"/D/wamp/www/phaser/src/loader/AnimationLoader.js",
|
||||
"/D/wamp/www/phaser/src/animation/FrameData.js",
|
||||
"/D/wamp/www/phaser/TS Source/animation/FrameData.ts",
|
||||
"/D/wamp/www/phaser/TS Source/animation/FrameData.js",
|
||||
"/D/wamp/www/phaser/TS Source/animation/Frame.ts",
|
||||
"/D/wamp/www/phaser/TS Source/animation/Frame.js",
|
||||
"/D/wamp/www/phaser/examples/loader 2.html",
|
||||
"/D/wamp/www/bbc-wolfblood/game.js",
|
||||
"/D/wamp/www/phaser/examples/loader.html",
|
||||
"/D/wamp/www/phaser/TS Source/loader/Loader.js",
|
||||
"/D/wamp/www/phaser/TS Source/Game.js",
|
||||
"/D/wamp/www/phaser/TS Source/loader/Cache.js",
|
||||
"/D/wamp/www/phaser/TS Source/loader/Cache.ts",
|
||||
"/D/wamp/www/phaser/src/Phaser.js",
|
||||
"/D/wamp/www/phaser/TS Source/loader/Loader.ts",
|
||||
"/D/wamp/www/phaser/src/math/RandomDataGenerator.js",
|
||||
"/D/wamp/www/phaser/src/core/SignalBinding.js",
|
||||
"/D/wamp/www/phaser/src/core/Signal.js",
|
||||
"/D/wamp/www/phaser/examples/signals.html",
|
||||
"/D/wamp/www/phaser/examples/rnd.html",
|
||||
"/D/wamp/www/phaser/TS Source/core/Signal.js",
|
||||
"/D/wamp/www/js-signals/src/Signal.js",
|
||||
"/D/wamp/www/js-signals/src/wrapper.js",
|
||||
"/D/wamp/www/pixi.js/examples/example 1 - Basics/index.html",
|
||||
"/D/wamp/www/awasenghi/lib/Core.js",
|
||||
"/D/wamp/www/phaser/TS Source/math/RandomDataGenerator.js",
|
||||
"/D/wamp/www/Nonsense/Nonsense.js",
|
||||
"/D/wamp/www/numtums/pop/bake.php",
|
||||
"/D/wamp/www/phaser/src/pixi/Pixi.js",
|
||||
"/D/wamp/www/phaser/TS Source/Phaser.ts",
|
||||
"/D/wamp/www/bbc-wolfblood/tsc.txt",
|
||||
"/D/wamp/www/bbc-wolfblood/load.php",
|
||||
"/D/wamp/www/bbc-wolfblood/game.js",
|
||||
"/D/wamp/www/phaser/build/phaser-debug.js",
|
||||
"/D/wamp/www/bbc-wolfblood/embed.js",
|
||||
"/D/wamp/www/phaser/README.md",
|
||||
|
@ -612,70 +700,7 @@
|
|||
"/D/wamp/www/phaser/Docs/tags.txt",
|
||||
"/D/wamp/www/phaser/Docs/docs_server.bat",
|
||||
"/D/wamp/www/phaser/Docs/docs_build.bat",
|
||||
"/D/wamp/www/phaser/Phaser/Phaser.csproj",
|
||||
"/D/wamp/www/phaser/Phaser/yuidoc.json",
|
||||
"/D/wamp/www/phaser/Tests/.gitignore",
|
||||
"/D/wamp/www/phaser/Phaser/_definitions.ts",
|
||||
"/D/wamp/www/bbc-wolfblood/Wolfblood/Registry.js",
|
||||
"/D/wamp/www/phaser/license.txt",
|
||||
"/D/wamp/www/phaser/package.json",
|
||||
"/D/wamp/www/phaser/.gitignore",
|
||||
"/D/wamp/www/phaser/Phaser/Game.js",
|
||||
"/D/wamp/www/phaser/Phaser/Phaser.js",
|
||||
"/D/wamp/www/phaser/Phaser/State.js",
|
||||
"/D/wamp/www/phaser/Phaser/Statics.js",
|
||||
"/D/wamp/www/phaser/Phaser/_definitions.js",
|
||||
"/D/amstrad",
|
||||
"/D/wamp/www/pixi.js/src/pixi/textures/RenderTexture.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/renderers/WebGLRenderer.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/renderers/CanvasRenderer.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/Sprite.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/MovieClip.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/renderers/WebGLBatch.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/InteractionManager.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/Polygon.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/Point.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/Rectangle.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/Outro.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/Intro.js",
|
||||
"/D/wamp/www/phaser/build/make-lib.bat",
|
||||
"/D/wamp/www/phaser/Plugins/CameraFX/Shake.js",
|
||||
"/D/wamp/www/phaser/Plugins/CameraFX/Shadow.js",
|
||||
"/D/wamp/www/phaser/jsdoc.conf.json",
|
||||
"/D/wamp/www/phaser/GruntFile.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/text/BitmapText.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/text/Text.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/extras/Spine.js",
|
||||
"/D/wamp/www/pixi.js/src/pixi/DisplayObject.js",
|
||||
"/D/wamp/www/bbc/firsttimeonline/lib/Core.js",
|
||||
"/D/wamp/www/collision-detection-2d/README.md",
|
||||
"/D/wamp/www/collision-detection-2d/util.js",
|
||||
"/D/wamp/www/collision-detection-2d/math.js",
|
||||
"/D/wamp/www/collision-detection-2d/collision.js",
|
||||
"/D/wamp/www/collision-detection-2d/app.js",
|
||||
"/D/wamp/www/bbc-wolfblood/wolfblood.css",
|
||||
"/D/wamp/www/bbc-wolfblood/desktop.html",
|
||||
"/D/wamp/www/bbc-wolfblood/index_embed.html",
|
||||
"/D/wamp/www/bbc-wolfblood/index.php",
|
||||
"/D/wamp/www/bbc-wolfblood/index_frame.html",
|
||||
"/D/wamp/www/phaser/todo/phaser tests/camera fx/scanlines.js",
|
||||
"/D/wamp/www/phaser/Tests/index.php",
|
||||
"/D/wamp/www/bbc-jigsaw/sarahandduck/embed.js",
|
||||
"/D/wamp/www/bbc-jigsaw/sarahandduck/index.html",
|
||||
"/D/webroot/photonstorm.com/wp-content/themes/photonstorm2013/archive.php",
|
||||
"/D/webroot/photonstorm.com/wp-content/themes/photonstorm2013/single-games.php",
|
||||
"/D/webroot/photonstorm.com/wp-content/themes/photonstorm2013/taxonomy.php",
|
||||
"/D/webroot/photonstorm.com/wp-content/themes/photonstorm2013/tpl-games.php",
|
||||
"/D/webroot/photonstorm.com/wp-content/themes/photonstorm2013/archives.php",
|
||||
"/D/wamp/www/awasenghi/index.html",
|
||||
"/D/webroot/photonstorm.com/wp-content/themes/photonstorm2012/header.php",
|
||||
"/D/webroot/photonstorm.com/wp-content/themes/photonstorm2013/header.php",
|
||||
"/D/wamp/www/bbc-jigsaw/woolyandtig/embed.js",
|
||||
"/D/wamp/www/bbc-jigsaw/woolyandtig/assets/1024/ui.json",
|
||||
"/D/wamp/www/bbc-jigsaw/woolyandtig/wooleyandtig.css",
|
||||
"/D/wamp/www/bbc-jigsaw/woolyandtig/index.html",
|
||||
"/D/wamp/www/bbc-jigsaw/woolyandtig/Wooley and Tig/Wooley and Tig.csproj",
|
||||
"/D/wamp/www/ascale/index.html"
|
||||
"/D/wamp/www/phaser/Phaser/Phaser.csproj"
|
||||
],
|
||||
"find":
|
||||
{
|
||||
|
@ -683,9 +708,10 @@
|
|||
},
|
||||
"find_in_files":
|
||||
{
|
||||
"height": 0.0,
|
||||
"height": 90.0,
|
||||
"where_history":
|
||||
[
|
||||
"D:\\wamp\\www\\phaser\\src\\pixi",
|
||||
"D:\\wamp\\www\\phaser\\Tests\\tilemap",
|
||||
"D:\\wamp\\www\\phaser\\Tests\\sprites",
|
||||
"D:\\wamp\\www\\phaser\\Tests\\particles",
|
||||
|
@ -707,6 +733,61 @@
|
|||
"case_sensitive": false,
|
||||
"find_history":
|
||||
[
|
||||
"TweenManager.prototype.",
|
||||
"Phaser.Rectangle.",
|
||||
"a.",
|
||||
"RectangleUtils",
|
||||
"defineProperty(Rectangle.prototype",
|
||||
"});",
|
||||
"x",
|
||||
"Rectangle.prototype.",
|
||||
"this.android",
|
||||
"dest",
|
||||
"this",
|
||||
"a",
|
||||
"*",
|
||||
"Point.prototype.",
|
||||
"GameMath.prototype.",
|
||||
"};",
|
||||
"GameMath.prototype.",
|
||||
"};",
|
||||
"GameMath.prototype.",
|
||||
"};",
|
||||
"GameMath.prototype.",
|
||||
"source",
|
||||
"(Circle.prototype",
|
||||
"defineProperty",
|
||||
"getter",
|
||||
"public ",
|
||||
"Net.prototype.",
|
||||
"this.TEXTURE",
|
||||
"Phaser",
|
||||
"FrameData.prototype.",
|
||||
"number;",
|
||||
"public ",
|
||||
"pop",
|
||||
"_queueSize",
|
||||
"nextFile",
|
||||
"Cache.prototype.",
|
||||
"public ",
|
||||
"{bool}",
|
||||
" if (this._fileList[key]) {\n return true;\n } else {\n return false;\n }\n",
|
||||
"_queueSize",
|
||||
"Phaser.Signal",
|
||||
";",
|
||||
"private ",
|
||||
"public ",
|
||||
"validateListener",
|
||||
" : function",
|
||||
"SignalBinding",
|
||||
" : function",
|
||||
" : ",
|
||||
"validateListener",
|
||||
"Nonsense.prototype.",
|
||||
" = ",
|
||||
";",
|
||||
" = null",
|
||||
"this.",
|
||||
"Maze",
|
||||
"Include=\"",
|
||||
"=",
|
||||
|
@ -779,62 +860,7 @@
|
|||
"damping",
|
||||
"gravity",
|
||||
"timeDelta",
|
||||
" for (var i = 0; i <= 10; i++) {\n var body = new Body(Body.DYNAMIC, new vec2(-6 + i * 1.2, 8));\n var shape = new ShapeCircle(0, 0, 0.4);\n shape.e = i / 10;\n shape.u = 1.0;\n shape.density = 1;\n body.addShape(shape);\n body.resetMassData();\n space.addBody(body);\n }\n",
|
||||
"step",
|
||||
"velocityIterations",
|
||||
"_circle2Circle",
|
||||
"black",
|
||||
"this.parent",
|
||||
" if (myGame.stage.fullscreen.isLandscape == true)\n {\n pic1.visible = true;\n pic2.visible = false;\n }\n else\n {\n pic2.visible = true;\n pic1.visible = false;\n }\n",
|
||||
"mouseScaleX",
|
||||
"rotateDiv",
|
||||
"vornoiRegion",
|
||||
"D:\\wamp\\www\\phaser",
|
||||
"touchmove",
|
||||
"scrollSpeedX",
|
||||
"<br />",
|
||||
"runningBot",
|
||||
"running bot.swf/",
|
||||
"mouseScaleX",
|
||||
"index.php",
|
||||
"/Kiwi Lite/",
|
||||
"bigCam",
|
||||
"car",
|
||||
"myGame",
|
||||
"MainMenu",
|
||||
"myGame",
|
||||
"car",
|
||||
"drawImage",
|
||||
"_msMin",
|
||||
"setCurrentTime",
|
||||
"webaudio",
|
||||
" extends Kiwi.State",
|
||||
"Kiwi.SignalBinding",
|
||||
"Kiwi.Signal",
|
||||
"/// <reference path=\"../../kiwi/Kiwi.ts\" />",
|
||||
"//",
|
||||
"sections",
|
||||
"PointsDisplay",
|
||||
"this.pointsDisplay",
|
||||
"score",
|
||||
"money",
|
||||
"show me",
|
||||
"touch",
|
||||
"wrap",
|
||||
"this.driveSpeed",
|
||||
"startMusic",
|
||||
"nice",
|
||||
"200",
|
||||
"148",
|
||||
"3000",
|
||||
"this.distance",
|
||||
"distanceLength",
|
||||
"Cubic",
|
||||
"distancePx",
|
||||
"wellDone",
|
||||
"delivery",
|
||||
"createCanvas",
|
||||
"render"
|
||||
" for (var i = 0; i <= 10; i++) {\n var body = new Body(Body.DYNAMIC, new vec2(-6 + i * 1.2, 8));\n var shape = new ShapeCircle(0, 0, 0.4);\n shape.e = i / 10;\n shape.u = 1.0;\n shape.density = 1;\n body.addShape(shape);\n body.resetMassData();\n space.addBody(body);\n }\n"
|
||||
],
|
||||
"highlight": true,
|
||||
"in_selection": false,
|
||||
|
@ -842,6 +868,10 @@
|
|||
"regex": false,
|
||||
"replace_history":
|
||||
[
|
||||
"queueSize",
|
||||
"{boolean}",
|
||||
"queueSize",
|
||||
"Phaser.SignalBinding",
|
||||
"launcher.html",
|
||||
"/Phaser/",
|
||||
"",
|
||||
|
@ -878,8 +908,399 @@
|
|||
"groups":
|
||||
[
|
||||
{
|
||||
"selected": 2,
|
||||
"sheets":
|
||||
[
|
||||
{
|
||||
"buffer": 0,
|
||||
"file": "src/Game.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 5482,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
1281,
|
||||
1281
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"translate_tabs_to_spaces": false
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 1,
|
||||
"file": "todo/Tween.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 12434,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
726,
|
||||
1538
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"translate_tabs_to_spaces": false
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 798.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 2,
|
||||
"file": "src/tween/TweenManager.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 3317,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
720,
|
||||
720
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"auto_name": "Phaser.TweenManager = function () {",
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
149
src/tween/TweenManager.js
Normal file
149
src/tween/TweenManager.js
Normal file
|
@ -0,0 +1,149 @@
|
|||
/**
|
||||
* Phaser - TweenManager
|
||||
*
|
||||
* Phaser.Game has a single instance of the TweenManager through which all Tween objects are created and updated.
|
||||
* Tweens are hooked into the game clock and pause system, adjusting based on the game state.
|
||||
*
|
||||
* TweenManager is based heavily on tween.js by sole (http://soledadpenades.com).
|
||||
* The difference being that tweens belong to a games instance of TweenManager, rather than to a global TWEEN object.
|
||||
* It also has callbacks swapped for Signals and a few issues patched with regard to properties and completion errors.
|
||||
* Please see https://github.com/sole/tween.js for a full list of contributors.
|
||||
*/
|
||||
Phaser.TweenManager = function (game) {
|
||||
|
||||
this.game = game;
|
||||
this._tweens = [];
|
||||
|
||||
};
|
||||
|
||||
Phaser.TweenManager.prototype = {
|
||||
|
||||
REVISION: '11dev',
|
||||
|
||||
/**
|
||||
* Get all the tween objects in an array.
|
||||
* @return {Phaser.Tween[]} Array with all tween objects.
|
||||
*/
|
||||
getAll: function () {
|
||||
|
||||
return _tweens;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove all tween objects.
|
||||
*/
|
||||
removeAll: function () {
|
||||
|
||||
_tweens = [];
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a new tween into the TweenManager.
|
||||
*
|
||||
* @param tween {Phaser.Tween} The tween object you want to add.
|
||||
* @return {Phaser.Tween} The tween object you added to the manager.
|
||||
*/
|
||||
add: function ( tween ) {
|
||||
|
||||
_tweens.push( tween );
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
*
|
||||
* @param obj {object} Object the tween will be run on.
|
||||
* @param [localReference] {bool} If true the tween will be stored in the object.tween property so long as it exists. If already set it'll be over-written.
|
||||
* @return {Phaser.Tween} The newly created tween object.
|
||||
*/
|
||||
create: function (object, localReference) {
|
||||
|
||||
if (typeof localReference === "undefined") { localReference = false; }
|
||||
|
||||
if (localReference)
|
||||
{
|
||||
object['tween'] = new Phaser.Tween(object, this.game);
|
||||
return object['tween'];
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Phaser.Tween(object, this.game);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a tween from this manager.
|
||||
*
|
||||
* @param tween {Phaser.Tween} The tween object you want to remove.
|
||||
*/
|
||||
remove: function ( tween ) {
|
||||
|
||||
var i = _tweens.indexOf( tween );
|
||||
|
||||
if ( i !== -1 ) {
|
||||
|
||||
_tweens.splice( i, 1 );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Update all the tween objects you added to this manager.
|
||||
*
|
||||
* @return {bool} Return false if there's no tween to update, otherwise return true.
|
||||
*/
|
||||
update: function ( time ) {
|
||||
|
||||
if ( _tweens.length === 0 ) return false;
|
||||
|
||||
var i = 0, numTweens = _tweens.length;
|
||||
|
||||
time = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );
|
||||
|
||||
while ( i < numTweens ) {
|
||||
|
||||
if ( _tweens[ i ].update( time ) ) {
|
||||
|
||||
i ++;
|
||||
|
||||
} else {
|
||||
|
||||
_tweens.splice( i, 1 );
|
||||
|
||||
numTweens --;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Pauses all currently running tweens.
|
||||
*/
|
||||
pauseAll: function () {
|
||||
|
||||
for (var i = this._tweens.length - 1; i >= 0; i--) {
|
||||
this._tweens[i].pause();
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Pauses all currently paused tweens.
|
||||
*/
|
||||
resumeAll: function () {
|
||||
|
||||
for (var i = this._tweens.length - 1; i >= 0; i--) {
|
||||
this._tweens[i].resume();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
};
|
724
todo/Tween.js
Normal file
724
todo/Tween.js
Normal file
|
@ -0,0 +1,724 @@
|
|||
/**
|
||||
* @author sole / http://soledadpenades.com
|
||||
* @author mrdoob / http://mrdoob.com
|
||||
* @author Robert Eisele / http://www.xarg.org
|
||||
* @author Philippe / http://philippe.elsass.me
|
||||
* @author Robert Penner / http://www.robertpenner.com/easing_terms_of_use.html
|
||||
* @author Paul Lewis / http://www.aerotwist.com/
|
||||
* @author lechecacharro
|
||||
* @author Josh Faul / http://jocafa.com/
|
||||
* @author egraether / http://egraether.com/
|
||||
* @author endel / http://endel.me
|
||||
* @author Ben Delarre / http://delarre.net
|
||||
*/
|
||||
|
||||
// Date.now shim for (ahem) Internet Explo(d|r)er
|
||||
if ( Date.now === undefined ) {
|
||||
|
||||
Date.now = function () {
|
||||
|
||||
return new Date().valueOf();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var TWEEN = TWEEN || ( function () {
|
||||
|
||||
var _tweens = [];
|
||||
|
||||
return {
|
||||
|
||||
REVISION: '11dev',
|
||||
|
||||
getAll: function () {
|
||||
|
||||
return _tweens;
|
||||
|
||||
},
|
||||
|
||||
removeAll: function () {
|
||||
|
||||
_tweens = [];
|
||||
|
||||
},
|
||||
|
||||
add: function ( tween ) {
|
||||
|
||||
_tweens.push( tween );
|
||||
|
||||
},
|
||||
|
||||
remove: function ( tween ) {
|
||||
|
||||
var i = _tweens.indexOf( tween );
|
||||
|
||||
if ( i !== -1 ) {
|
||||
|
||||
_tweens.splice( i, 1 );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
update: function ( time ) {
|
||||
|
||||
if ( _tweens.length === 0 ) return false;
|
||||
|
||||
var i = 0, numTweens = _tweens.length;
|
||||
|
||||
time = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );
|
||||
|
||||
while ( i < numTweens ) {
|
||||
|
||||
if ( _tweens[ i ].update( time ) ) {
|
||||
|
||||
i ++;
|
||||
|
||||
} else {
|
||||
|
||||
_tweens.splice( i, 1 );
|
||||
|
||||
numTweens --;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
} )();
|
||||
|
||||
TWEEN.Tween = function ( object ) {
|
||||
|
||||
var _object = object;
|
||||
var _valuesStart = {};
|
||||
var _valuesEnd = {};
|
||||
var _valuesStartRepeat = {};
|
||||
var _duration = 1000;
|
||||
var _repeat = 0;
|
||||
var _yoyo = false;
|
||||
var _reversed = false;
|
||||
var _delayTime = 0;
|
||||
var _startTime = null;
|
||||
var _easingFunction = TWEEN.Easing.Linear.None;
|
||||
var _interpolationFunction = TWEEN.Interpolation.Linear;
|
||||
var _chainedTweens = [];
|
||||
var _onStartCallback = null;
|
||||
var _onStartCallbackFired = false;
|
||||
var _onUpdateCallback = null;
|
||||
var _onCompleteCallback = null;
|
||||
|
||||
// Set all starting values present on the target object
|
||||
for ( var field in object ) {
|
||||
|
||||
_valuesStart[ field ] = parseFloat(object[field], 10);
|
||||
|
||||
}
|
||||
|
||||
this.to = function ( properties, duration ) {
|
||||
|
||||
if ( duration !== undefined ) {
|
||||
|
||||
_duration = duration;
|
||||
|
||||
}
|
||||
|
||||
_valuesEnd = properties;
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.start = function ( time ) {
|
||||
|
||||
TWEEN.add( this );
|
||||
|
||||
_onStartCallbackFired = false;
|
||||
|
||||
_startTime = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() );
|
||||
_startTime += _delayTime;
|
||||
|
||||
for ( var property in _valuesEnd ) {
|
||||
|
||||
// check if an Array was provided as property value
|
||||
if ( _valuesEnd[ property ] instanceof Array ) {
|
||||
|
||||
if ( _valuesEnd[ property ].length === 0 ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
// create a local copy of the Array with the start value at the front
|
||||
_valuesEnd[ property ] = [ _object[ property ] ].concat( _valuesEnd[ property ] );
|
||||
|
||||
}
|
||||
|
||||
_valuesStart[ property ] = _object[ property ];
|
||||
|
||||
if( ( _valuesStart[ property ] instanceof Array ) === false ) {
|
||||
_valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings
|
||||
}
|
||||
|
||||
_valuesStartRepeat[ property ] = _valuesStart[ property ] || 0;
|
||||
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.stop = function () {
|
||||
|
||||
TWEEN.remove( this );
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.delay = function ( amount ) {
|
||||
|
||||
_delayTime = amount;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.repeat = function ( times ) {
|
||||
|
||||
_repeat = times;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.yoyo = function( yoyo ) {
|
||||
|
||||
_yoyo = yoyo;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
|
||||
this.easing = function ( easing ) {
|
||||
|
||||
_easingFunction = easing;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.interpolation = function ( interpolation ) {
|
||||
|
||||
_interpolationFunction = interpolation;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.chain = function () {
|
||||
|
||||
_chainedTweens = arguments;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.onStart = function ( callback ) {
|
||||
|
||||
_onStartCallback = callback;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.onUpdate = function ( callback ) {
|
||||
|
||||
_onUpdateCallback = callback;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.onComplete = function ( callback ) {
|
||||
|
||||
_onCompleteCallback = callback;
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
this.update = function ( time ) {
|
||||
|
||||
var property;
|
||||
|
||||
if ( time < _startTime ) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if ( _onStartCallbackFired === false ) {
|
||||
|
||||
if ( _onStartCallback !== null ) {
|
||||
|
||||
_onStartCallback.call( _object );
|
||||
|
||||
}
|
||||
|
||||
_onStartCallbackFired = true;
|
||||
|
||||
}
|
||||
|
||||
var elapsed = ( time - _startTime ) / _duration;
|
||||
elapsed = elapsed > 1 ? 1 : elapsed;
|
||||
|
||||
var value = _easingFunction( elapsed );
|
||||
|
||||
for ( property in _valuesEnd ) {
|
||||
|
||||
var start = _valuesStart[ property ] || 0;
|
||||
var end = _valuesEnd[ property ];
|
||||
|
||||
if ( end instanceof Array ) {
|
||||
|
||||
_object[ property ] = _interpolationFunction( end, value );
|
||||
|
||||
} else {
|
||||
|
||||
// Parses relative end values with start as base (e.g.: +10, -3)
|
||||
if ( typeof(end) === "string" ) {
|
||||
end = start + parseFloat(end, 10);
|
||||
}
|
||||
|
||||
// protect against non numeric properties.
|
||||
if ( typeof(end) === "number" ) {
|
||||
_object[ property ] = start + ( end - start ) * value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( _onUpdateCallback !== null ) {
|
||||
|
||||
_onUpdateCallback.call( _object, value );
|
||||
|
||||
}
|
||||
|
||||
if ( elapsed == 1 ) {
|
||||
|
||||
if ( _repeat > 0 ) {
|
||||
|
||||
if( isFinite( _repeat ) ) {
|
||||
_repeat--;
|
||||
}
|
||||
|
||||
// reassign starting values, restart by making startTime = now
|
||||
for( property in _valuesStartRepeat ) {
|
||||
|
||||
if ( typeof( _valuesEnd[ property ] ) === "string" ) {
|
||||
_valuesStartRepeat[ property ] = _valuesStartRepeat[ property ] + parseFloat(_valuesEnd[ property ], 10);
|
||||
}
|
||||
|
||||
if (_yoyo) {
|
||||
var tmp = _valuesStartRepeat[ property ];
|
||||
_valuesStartRepeat[ property ] = _valuesEnd[ property ];
|
||||
_valuesEnd[ property ] = tmp;
|
||||
_reversed = !_reversed;
|
||||
}
|
||||
_valuesStart[ property ] = _valuesStartRepeat[ property ];
|
||||
|
||||
}
|
||||
|
||||
_startTime = time + _delayTime;
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
if ( _onCompleteCallback !== null ) {
|
||||
|
||||
_onCompleteCallback.call( _object );
|
||||
|
||||
}
|
||||
|
||||
for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i ++ ) {
|
||||
|
||||
_chainedTweens[ i ].start( time );
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
TWEEN.Easing = {
|
||||
|
||||
Linear: {
|
||||
|
||||
None: function ( k ) {
|
||||
|
||||
return k;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Quadratic: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
return k * k;
|
||||
|
||||
},
|
||||
|
||||
Out: function ( k ) {
|
||||
|
||||
return k * ( 2 - k );
|
||||
|
||||
},
|
||||
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k;
|
||||
return - 0.5 * ( --k * ( k - 2 ) - 1 );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Cubic: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
return k * k * k;
|
||||
|
||||
},
|
||||
|
||||
Out: function ( k ) {
|
||||
|
||||
return --k * k * k + 1;
|
||||
|
||||
},
|
||||
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k;
|
||||
return 0.5 * ( ( k -= 2 ) * k * k + 2 );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Quartic: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
return k * k * k * k;
|
||||
|
||||
},
|
||||
|
||||
Out: function ( k ) {
|
||||
|
||||
return 1 - ( --k * k * k * k );
|
||||
|
||||
},
|
||||
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1) return 0.5 * k * k * k * k;
|
||||
return - 0.5 * ( ( k -= 2 ) * k * k * k - 2 );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Quintic: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
return k * k * k * k * k;
|
||||
|
||||
},
|
||||
|
||||
Out: function ( k ) {
|
||||
|
||||
return --k * k * k * k * k + 1;
|
||||
|
||||
},
|
||||
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k * k * k;
|
||||
return 0.5 * ( ( k -= 2 ) * k * k * k * k + 2 );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Sinusoidal: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
return 1 - Math.cos( k * Math.PI / 2 );
|
||||
|
||||
},
|
||||
|
||||
Out: function ( k ) {
|
||||
|
||||
return Math.sin( k * Math.PI / 2 );
|
||||
|
||||
},
|
||||
|
||||
InOut: function ( k ) {
|
||||
|
||||
return 0.5 * ( 1 - Math.cos( Math.PI * k ) );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Exponential: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
return k === 0 ? 0 : Math.pow( 1024, k - 1 );
|
||||
|
||||
},
|
||||
|
||||
Out: function ( k ) {
|
||||
|
||||
return k === 1 ? 1 : 1 - Math.pow( 2, - 10 * k );
|
||||
|
||||
},
|
||||
|
||||
InOut: 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 );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Circular: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
return 1 - Math.sqrt( 1 - k * k );
|
||||
|
||||
},
|
||||
|
||||
Out: function ( k ) {
|
||||
|
||||
return Math.sqrt( 1 - ( --k * k ) );
|
||||
|
||||
},
|
||||
|
||||
InOut: 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: {
|
||||
|
||||
In: 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 ) );
|
||||
|
||||
},
|
||||
|
||||
Out: 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 );
|
||||
|
||||
},
|
||||
|
||||
InOut: 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: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
var s = 1.70158;
|
||||
return k * k * ( ( s + 1 ) * k - s );
|
||||
|
||||
},
|
||||
|
||||
Out: function ( k ) {
|
||||
|
||||
var s = 1.70158;
|
||||
return --k * k * ( ( s + 1 ) * k + s ) + 1;
|
||||
|
||||
},
|
||||
|
||||
InOut: 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: {
|
||||
|
||||
In: function ( k ) {
|
||||
|
||||
return 1 - TWEEN.Easing.Bounce.Out( 1 - k );
|
||||
|
||||
},
|
||||
|
||||
Out: 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;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( k < 0.5 ) return TWEEN.Easing.Bounce.In( k * 2 ) * 0.5;
|
||||
return TWEEN.Easing.Bounce.Out( k * 2 - 1 ) * 0.5 + 0.5;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
TWEEN.Interpolation = {
|
||||
|
||||
Linear: function ( v, k ) {
|
||||
|
||||
var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.Linear;
|
||||
|
||||
if ( k < 0 ) return fn( v[ 0 ], v[ 1 ], f );
|
||||
if ( k > 1 ) return fn( v[ m ], v[ m - 1 ], m - f );
|
||||
|
||||
return fn( v[ i ], v[ i + 1 > m ? m : i + 1 ], f - i );
|
||||
|
||||
},
|
||||
|
||||
Bezier: function ( v, k ) {
|
||||
|
||||
var b = 0, n = v.length - 1, pw = Math.pow, bn = TWEEN.Interpolation.Utils.Bernstein, i;
|
||||
|
||||
for ( i = 0; i <= n; i++ ) {
|
||||
b += pw( 1 - k, n - i ) * pw( k, i ) * v[ i ] * bn( n, i );
|
||||
}
|
||||
|
||||
return b;
|
||||
|
||||
},
|
||||
|
||||
CatmullRom: function ( v, k ) {
|
||||
|
||||
var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.CatmullRom;
|
||||
|
||||
if ( v[ 0 ] === v[ m ] ) {
|
||||
|
||||
if ( k < 0 ) i = Math.floor( f = m * ( 1 + k ) );
|
||||
|
||||
return fn( v[ ( i - 1 + m ) % m ], v[ i ], v[ ( i + 1 ) % m ], v[ ( i + 2 ) % m ], f - i );
|
||||
|
||||
} else {
|
||||
|
||||
if ( k < 0 ) return v[ 0 ] - ( fn( v[ 0 ], v[ 0 ], v[ 1 ], v[ 1 ], -f ) - v[ 0 ] );
|
||||
if ( k > 1 ) return v[ m ] - ( fn( v[ m ], v[ m ], v[ m - 1 ], v[ m - 1 ], f - m ) - v[ m ] );
|
||||
|
||||
return fn( v[ i ? i - 1 : 0 ], v[ i ], v[ m < i + 1 ? m : i + 1 ], v[ m < i + 2 ? m : i + 2 ], f - i );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Utils: {
|
||||
|
||||
Linear: function ( p0, p1, t ) {
|
||||
|
||||
return ( p1 - p0 ) * t + p0;
|
||||
|
||||
},
|
||||
|
||||
Bernstein: function ( n , i ) {
|
||||
|
||||
var fc = TWEEN.Interpolation.Utils.Factorial;
|
||||
return fc( n ) / fc( i ) / fc( n - i );
|
||||
|
||||
},
|
||||
|
||||
Factorial: ( function () {
|
||||
|
||||
var a = [ 1 ];
|
||||
|
||||
return function ( n ) {
|
||||
|
||||
var s = 1, i;
|
||||
if ( a[ n ] ) return a[ n ];
|
||||
for ( i = n; i > 1; i-- ) s *= i;
|
||||
return a[ n ] = s;
|
||||
|
||||
};
|
||||
|
||||
} )(),
|
||||
|
||||
CatmullRom: function ( p0, p1, p2, p3, t ) {
|
||||
|
||||
var v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5, t2 = t * t, t3 = t * t2;
|
||||
return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
Loading…
Reference in a new issue