├── .gitignore ├── js ├── .npmignore ├── .jshintrc ├── docs │ ├── fonts │ │ ├── OpenSans-Bold-webfont.eot │ │ ├── OpenSans-Bold-webfont.woff │ │ ├── OpenSans-Italic-webfont.eot │ │ ├── OpenSans-Italic-webfont.woff │ │ ├── OpenSans-Light-webfont.eot │ │ ├── OpenSans-Light-webfont.woff │ │ ├── OpenSans-Regular-webfont.eot │ │ ├── OpenSans-Regular-webfont.woff │ │ ├── OpenSans-BoldItalic-webfont.eot │ │ ├── OpenSans-BoldItalic-webfont.woff │ │ ├── OpenSans-LightItalic-webfont.eot │ │ └── OpenSans-LightItalic-webfont.woff │ ├── scripts │ │ ├── linenumber.js │ │ └── prettify │ │ │ ├── lang-css.js │ │ │ ├── Apache-License-2.0.txt │ │ │ └── prettify.js │ ├── ActionLibrary.js.html │ ├── Marker.js.html │ ├── styles │ │ ├── prettify-jsdoc.css │ │ ├── prettify-tomorrow.css │ │ └── jsdoc-default.css │ ├── enums_Easing.js.html │ ├── enums_Extrapolation.js.html │ ├── enums_RotationMode.js.html │ ├── enums_Interpolation.js.html │ ├── FCurveArray.js.html │ ├── index.html │ ├── ActionLibrary.html │ ├── Keyframe.js.html │ ├── Marker.html │ ├── Action.js.html │ ├── FCurve.js.html │ ├── FCurve.html │ ├── FCurveArray.html │ └── global.html ├── example │ ├── export_animations.py │ ├── animations.blend │ └── js │ │ ├── .jshintrc │ │ ├── index.html │ │ └── script.js ├── jsdoc.config.json ├── src │ ├── index.js │ ├── ActionLibrary.js │ ├── Marker.js │ ├── bezier.js │ ├── FCurveArray.js │ ├── Keyframe.js │ ├── Action.js │ ├── FCurve.js │ └── easing.js ├── webpack.min.config.js ├── webpack.config.js ├── package.json ├── Readme.md └── dist │ └── blender-html5-animations.min.js ├── .gitattributes ├── Readme.md └── blender-addon ├── Readme.md └── html5_animations.py /.gitignore: -------------------------------------------------------------------------------- 1 | exported-* 2 | node_modules/ 3 | npm-debug.log 4 | *.blend? 5 | -------------------------------------------------------------------------------- /js/.npmignore: -------------------------------------------------------------------------------- 1 | .jshintrc 2 | docs/ 3 | dist/ 4 | example/ 5 | jsdoc.* 6 | webpack.* 7 | -------------------------------------------------------------------------------- /js/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "eqeqeq": true, 3 | "node": true, 4 | "undef": true, 5 | "unused": true 6 | } 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.blend filter=lfs diff=lfs merge=lfs -text 2 | docs/fonts/** filter=lfs diff=lfs merge=lfs -text 3 | -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /js/docs/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KoltesDigital/blender-html5-animations/HEAD/js/docs/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /js/example/export_animations.py: -------------------------------------------------------------------------------- 1 | import bpy 2 | 3 | bpy.ops.html5_animations.export('EXEC_DEFAULT', 4 | filepath="js/exported-animations.js", 5 | format='JS') 6 | -------------------------------------------------------------------------------- /js/example/animations.blend: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:98212280d5491df276a831065655da77558c0846e3d383c30d3db8110a7ccdad 3 | size 473880 4 | -------------------------------------------------------------------------------- /js/example/js/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "browser": true, 3 | "eqeqeq": true, 4 | "globals": { 5 | "blenderHTML5Animations": false, 6 | "actions": false 7 | }, 8 | "undef": true, 9 | "unused": true 10 | } 11 | -------------------------------------------------------------------------------- /js/jsdoc.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "source": { 3 | "include": [ 4 | "src" 5 | ] 6 | }, 7 | "opts": { 8 | "destination": "./docs/", 9 | "encoding": "utf8", 10 | "readme": "./Readme.md", 11 | "recurse": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /js/src/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports.Action = require('./Action'); 4 | module.exports.ActionLibrary = require('./ActionLibrary'); 5 | module.exports.FCurve = require('./FCurve'); 6 | module.exports.FCurveArray = require('./FCurveArray'); 7 | module.exports.Keyframe = require('./Keyframe'); 8 | module.exports.Marker = require('./Marker'); 9 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Blender HTML5 Animations 2 | 3 | This project aims at using Blender for designing generic animation curves, and exporting them as CSS, JS, or JSON files, for use with web technologies. 4 | 5 | *CSS is in progress.* 6 | 7 | ## License 8 | 9 | Copyright 2016 Jonathan Giroux 10 | 11 | [MIT License](https://opensource.org/licenses/MIT) 12 | -------------------------------------------------------------------------------- /js/src/ActionLibrary.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Action = require('./Action'); 4 | 5 | /** 6 | * @class An ActionLibrary is an object of Actions. 7 | * @param data Data from Blender. 8 | */ 9 | function ActionLibrary(data) { 10 | for (var actionName in data) { 11 | this[actionName] = new Action(data[actionName]); 12 | } 13 | } 14 | 15 | module.exports = ActionLibrary; 16 | -------------------------------------------------------------------------------- /js/webpack.min.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | 3 | module.exports = require('./webpack.config.js'); 4 | 5 | module.exports.plugins.unshift( 6 | new webpack.optimize.UglifyJsPlugin() 7 | ); 8 | 9 | var extIndex = module.exports.output.filename.lastIndexOf('.js'); 10 | module.exports.output.filename = module.exports.output.filename.substring(0, extIndex) + '.min.js'; 11 | -------------------------------------------------------------------------------- /js/src/Marker.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @class A Marker is a generic information in time. 5 | * @param data Data from Blender 6 | */ 7 | function Marker(data) { 8 | /** 9 | * Time. 10 | * @member {number} 11 | */ 12 | this.time = data[0]; 13 | 14 | /** 15 | * Name. 16 | * @member {string} 17 | */ 18 | this.name = data[1]; 19 | } 20 | 21 | module.exports = Marker; 22 | -------------------------------------------------------------------------------- /js/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | 3 | var entry = require('./package.json').main; 4 | 5 | var header = [ 6 | '/**', 7 | ' * Blender HTML5 Animations 1.0.2', 8 | ' * Copyright 2016 Jonathan Giroux', 9 | ' * MIT licence', 10 | ' */', 11 | ].join('\n'); 12 | 13 | module.exports = { 14 | entry: entry, 15 | externals: { 16 | "gl-matrix": { 17 | root: "window", 18 | commonjs: "gl-matrix", 19 | commonjs2: "gl-matrix", 20 | amd: "gl-matrix", 21 | }, 22 | }, 23 | output: { 24 | path: 'dist', 25 | filename: 'blender-html5-animations.js', 26 | libraryTarget: 'umd', 27 | library: 'blenderHTML5Animations', 28 | }, 29 | plugins: [ 30 | new webpack.BannerPlugin(header, { raw: true }), 31 | ], 32 | }; 33 | -------------------------------------------------------------------------------- /js/docs/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /blender-addon/Readme.md: -------------------------------------------------------------------------------- 1 | # Blender add-on 2 | 3 | ## Installation 4 | 5 | One-time import into Blender: 6 | 7 | 1. Open **File** > **User Preferences...** (`Ctrl + Alt + U`) 8 | 2. Open the **Add-ons** tab (at the top) 9 | 3. Click on **Install from File...** (at the bottom) 10 | 4. Browse and select *html5_animations.py* 11 | 12 | Enable the add-on by ticking the square next to the add-on name. 13 | 14 | To automatically enable the add-on at program start-up, enable it and click on **Save User Settings**. 15 | 16 | ## Export 17 | 18 | Click on **File** > **Export** > **HTML5 Animations**. 19 | 20 | The add-on exports all actions. For each action, it exports the fcurves and the pose markers. 21 | 22 | ## License 23 | 24 | Copyright 2016 Jonathan Giroux 25 | 26 | [MIT License](https://opensource.org/licenses/MIT) 27 | -------------------------------------------------------------------------------- /js/docs/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blender-html5-animations", 3 | "version": "1.0.2", 4 | "description": "Use animation curves from Blender.", 5 | "main": "./src/index.js", 6 | "scripts": { 7 | "build": "webpack", 8 | "build-min": "webpack --config webpack.min.config.js", 9 | "build-doc": "jsdoc -c jsdoc.config.json", 10 | "build-example": "cd example && blender -b animations.blend -P ../../blender-addon/html5_animations.py -P export_animations.py", 11 | "build-all": "npm run build && npm run build-min && npm run build-doc" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/KoltesDigital/blender-html5-animations.git" 16 | }, 17 | "keywords": [ 18 | "blender", 19 | "animations" 20 | ], 21 | "author": "Jonathan Giroux", 22 | "license": "MIT", 23 | "devDependencies": { 24 | "jsdoc": "^3.4.0", 25 | "webpack": "^1.13.1" 26 | }, 27 | "dependencies": { 28 | "gl-matrix": "^2.3.2" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /js/example/js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 31 | 32 | 33 |
34 |

If Blender is in your PATH, run the following command from the js directory:

35 |
npm run build-examples
36 |

Otherwise, or if you haven't understood the previous paragraph, open animations.blend (in the parent directory) and use the HTML5 Animations add-on to export exported-animations.js (in this directory) with the default settings.

37 |

Afterwards, refresh this page.

38 |
39 |
My object
40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /js/src/bezier.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function bezierInterpolation(A, B, C, D, t) { 4 | var T = 1 - t; 5 | return T*T*T*A + 3*T*T*t*B + 3*T*t*t*C + t*t*t*D; 6 | } 7 | 8 | function bezier(time, leftKeyframe, rightKeyframe) { 9 | var aT = leftKeyframe.time; 10 | var aV = leftKeyframe.value; 11 | var bT = leftKeyframe.rightTime; 12 | var bV = leftKeyframe.rightValue; 13 | var cT = rightKeyframe.leftTime; 14 | var cV = rightKeyframe.leftValue; 15 | var dT = rightKeyframe.time; 16 | var dV = rightKeyframe.value; 17 | 18 | var leftDeltaTime = bT - aT; 19 | var rightDeltaTime = dT - cT; 20 | var duration = dT - aT; 21 | 22 | if (leftDeltaTime + rightDeltaTime > duration) { 23 | var leftDeltaValue = bV - aV; 24 | var rightDeltaValue = dV - cV; 25 | 26 | var factor = duration / (leftDeltaTime + rightDeltaTime); 27 | 28 | bT = aT + factor * leftDeltaTime; 29 | bV = aV + factor * leftDeltaValue; 30 | 31 | cT = dT - factor * rightDeltaTime; 32 | cV = dV - factor * rightDeltaValue; 33 | } 34 | 35 | var uLeft = 0, uRight = 1; 36 | var u, T; 37 | do { 38 | u = (uLeft + uRight) / 2; 39 | T = bezierInterpolation(aT, bT, cT, dT, u); 40 | if (T > time) 41 | uRight = u; 42 | else 43 | uLeft = u; 44 | } while (Math.abs(T - time) > 0.01); 45 | 46 | return bezierInterpolation(aV, bV, cV, dV, u); 47 | } 48 | 49 | module.exports = bezier; 50 | -------------------------------------------------------------------------------- /js/Readme.md: -------------------------------------------------------------------------------- 1 | # Blender HTML5 Animations 2 | 3 | Use animation curves from Blender. 4 | 5 | ## API 6 | 7 | The entry point is the class *ActionLibrary*. Create an *ActionLibrary* with the data exported from Blender, and enjoy. 8 | 9 | The library relies on [glMatrix](https://github.com/toji/gl-matrix) for math computations. 10 | 11 | ## Browser 12 | 13 | Copy *blender-html5-animations.min.js* from the *dist* folder. 14 | 15 | Copy *gl-matrix-min.js* from [glMatrix](https://github.com/toji/gl-matrix)'s *dist* folder. 16 | 17 | ```html 18 | 19 | 20 | 21 | 26 | ``` 27 | 28 | ## Node.js 29 | 30 | npm install --save blender-html5-animations 31 | 32 | ```js 33 | var exportedData = require('./exported-data.json'); 34 | var blenderHTML5Animations = require('blender-html5-animations'); 35 | 36 | var myActionLibrary = new blenderHTML5Animations.ActionLibrary(exportedData); 37 | 38 | var value = myActionLibrary['my-action'].paths['location'].evaluate(time, blenderHTML5Animations.FCurveArray.DefaultValues.LOCATION); 39 | ``` 40 | 41 | ## License 42 | 43 | Copyright 2016 Jonathan Giroux 44 | 45 | [MIT licence](https://opensource.org/licenses/MIT) 46 | -------------------------------------------------------------------------------- /js/example/js/script.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | if (typeof actions === 'undefined') { 5 | document.getElementById('build-missing').style.display = 'block'; 6 | return; 7 | } 8 | 9 | var objectElement = document.getElementById('object'); 10 | objectElement.style.display = 'block'; 11 | 12 | var myActions = new blenderHTML5Animations.ActionLibrary(actions); 13 | var myAction = myActions['my-action']; 14 | var myActionTime = myAction.startTime; 15 | 16 | function markerCallback(marker) { 17 | var element = document.createElement('div'); 18 | document.body.appendChild(element); 19 | element.textContent = marker.name; 20 | 21 | setTimeout(function() { 22 | element.remove(); 23 | }, 500); 24 | } 25 | 26 | var startTime = Date.now(); 27 | var lastTime = 0; 28 | 29 | function render() { 30 | requestAnimationFrame(render); 31 | 32 | var time = (Date.now() - startTime) / 1000; 33 | var dt = Math.min(time - lastTime, 0.1); 34 | lastTime = time; 35 | 36 | var newActionTime = myActionTime + dt; 37 | while (newActionTime >= myAction.endTime) { 38 | myAction.forEachMarker(myActionTime, myAction.endTime, markerCallback); 39 | myActionTime = 0; 40 | 41 | newActionTime -= (myAction.endTime - myAction.startTime); 42 | } 43 | 44 | myAction.forEachMarker(myActionTime, newActionTime, markerCallback); 45 | 46 | myActionTime = newActionTime; 47 | 48 | myAction.setElementTransform(objectElement, myActionTime, blenderHTML5Animations.Action.RotationMode.EULER_XYZ); 49 | } 50 | 51 | requestAnimationFrame(render); 52 | })(); 53 | -------------------------------------------------------------------------------- /js/src/FCurveArray.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var FCurve = require('./FCurve'); 4 | /** 5 | * Provides a value when a FCurve does not exist. 6 | * @callback FCurveArray~DefaultValues 7 | * @param {number} index Array index 8 | * @param {number} time Evaluation time 9 | * @return {number} Value 10 | */ 11 | 12 | /** 13 | * @class A FCurveArray is an array of FCurves. 14 | * @param data Data from Blender. 15 | */ 16 | function FCurveArray(data) { 17 | var array = data.map(function(data) { 18 | return data && new FCurve(data); 19 | }); 20 | 21 | /** 22 | * Evaluates the array. 23 | * @method FCurveArray~evaluate 24 | * @param {number} time Evaluation time. 25 | * @param {FCurveArray~DefaultValues} defaultValues In case a FCurve does not exist. 26 | * @return {number[]} 27 | */ 28 | array.evaluate = function(time, defaultValues) { 29 | return array.map(function(fcurve, index) { 30 | return fcurve ? fcurve.evaluate(time) : defaultValues(index, time); 31 | }); 32 | }; 33 | 34 | return array; 35 | } 36 | 37 | /** 38 | * Built-in DefaultValues functions. 39 | * @enum {FCurveArray~DefaultValues} 40 | * @readonly 41 | */ 42 | FCurveArray.DefaultValues = { 43 | /** Returns 0. */ 44 | LOCATION: function() { 45 | return 0; 46 | }, 47 | /** Returns 0. */ 48 | ROTATION: function() { 49 | return 0; 50 | }, 51 | /** Returns 0 for XYZ and 1 for W. */ 52 | ROTATION_QUATERNION: function(index) { 53 | return (index === 3 ? 1 : 0); 54 | }, 55 | /** Returns 1. */ 56 | SCALE: function() { 57 | return 1; 58 | }, 59 | }; 60 | 61 | module.exports = FCurveArray; 62 | -------------------------------------------------------------------------------- /js/docs/ActionLibrary.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: ActionLibrary.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: ActionLibrary.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
30 | 
31 | var Action = require('./Action');
32 | 
33 | /**
34 |  * @class An ActionLibrary is an object of Actions.
35 |  * @param data Data from Blender.
36 |  */
37 | function ActionLibrary(data) {
38 | 	for (var actionName in data) {
39 | 		this[actionName] = new Action(data[actionName]);
40 | 	}
41 | }
42 | 
43 | module.exports = ActionLibrary;
44 | 
45 |
46 |
47 | 48 | 49 | 50 | 51 |
52 | 53 | 56 | 57 |
58 | 59 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /js/docs/Marker.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: Marker.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: Marker.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
30 | 
31 | /**
32 |  * @class A Marker is a generic information in time.
33 |  * @param data Data from Blender
34 |  */
35 | function Marker(data) {
36 | 	/**
37 | 	 * Time.
38 | 	 * @member {number}
39 | 	 */
40 | 	this.time = data[0];
41 | 
42 | 	/**
43 | 	 * Name.
44 | 	 * @member {string}
45 | 	 */
46 | 	this.name = data[1];
47 | }
48 | 
49 | module.exports = Marker;
50 | 
51 |
52 |
53 | 54 | 55 | 56 | 57 |
58 | 59 | 62 | 63 |
64 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /js/docs/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /js/docs/enums_Easing.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: enums/Easing.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: enums/Easing.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
30 | 
31 | // GRAPH_OT_easing_type
32 | 
33 | /**
34 |  * FCurve easing types.
35 |  * @enum {number}
36 |  * @readonly
37 | */
38 | var Easing = {
39 | 	/** Automatic easing. */
40 | 	AUTO: 0,
41 | 	/** Starts slow. */
42 | 	IN: 1,
43 | 	/** Ends slow. */
44 | 	OUT: 2,
45 | 	/** Starts and ends slow. */
46 | 	IN_OUT: 3,
47 | };
48 | 
49 | module.exports = Easing;
50 | 
51 |
52 |
53 | 54 | 55 | 56 | 57 |
58 | 59 | 62 | 63 |
64 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /js/docs/enums_Extrapolation.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: enums/Extrapolation.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: enums/Extrapolation.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
30 | 
31 | // GRAPH_OT_extrapolation_type
32 | 
33 | /**
34 |  * FCurve extrapolation types, before its first keyframe and after its last keyframe.
35 |  * @enum {number}
36 |  * @readonly
37 | */
38 | var Extrapolation = {
39 | 	/** Keeps a constant value. */
40 | 	CONSTANT: 0,
41 | 	/** Continues as straight lines. */
42 | 	LINEAR: 1,
43 | };
44 | 
45 | module.exports = Extrapolation;
46 | 
47 |
48 |
49 | 50 | 51 | 52 | 53 |
54 | 55 | 58 | 59 |
60 | 61 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /js/docs/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /js/docs/enums_RotationMode.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: enums/RotationMode.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: enums/RotationMode.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
30 | 
31 | // POSE_OT_rotation_mode_set
32 | 
33 | /**
34 |  * Object rotation modes.
35 |  * @enum {number}
36 |  * @readonly
37 | */
38 | var RotationMode = {
39 | 	/** Reads from rotation_quaternion and delta_rotation_quaternion paths. */
40 | 	QUATERNION: 0,
41 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
42 | 	EULER_XYZ: 1,
43 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
44 | 	EULER_YXZ: 3,
45 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
46 | 	EULER_XZY: 2,
47 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
48 | 	EULER_ZXY: 5,
49 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
50 | 	EULER_YZX: 4,
51 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
52 | 	EULER_ZYX: 6,
53 | 	/** Reads from rotation_axis path. */
54 | 	AXIS_ANGLE: -1,
55 | };
56 | 
57 | module.exports = RotationMode;
58 | 
59 |
60 |
61 | 62 | 63 | 64 | 65 |
66 | 67 | 70 | 71 |
72 | 73 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /js/src/Keyframe.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @class A Keyframe is a value in time with control handles. 5 | * @param data Data from Blender. 6 | */ 7 | function Keyframe(data) { 8 | /** 9 | * Time. 10 | * @member {number} 11 | */ 12 | this.time = data[0]; 13 | 14 | /** 15 | * Value. 16 | * @member {number} 17 | */ 18 | this.value = data[1]; 19 | 20 | /** 21 | * Left handle's time. 22 | * @member {number} 23 | */ 24 | this.leftTime = data[2]; 25 | 26 | /** 27 | * Left handle's value. 28 | * @member {number} 29 | */ 30 | this.leftValue = data[3]; 31 | 32 | /** 33 | * Right handle's time. 34 | * @member {number} 35 | */ 36 | this.rightTime = data[4]; 37 | 38 | /** 39 | * Right handle's value. 40 | * @member {number} 41 | */ 42 | this.rightValue = data[5]; 43 | 44 | /** 45 | * Interpolation type. 46 | * @member {Keyframe.Interpolation} 47 | */ 48 | this.interpolation = data[6]; 49 | 50 | /** 51 | * Easing type. 52 | * @member {Keyframe.Easing} 53 | */ 54 | this.easing = data[7]; 55 | 56 | /** 57 | * Overshoot (for back interpolation). 58 | * @member {number} 59 | */ 60 | this.overshoot = data[8]; 61 | 62 | /** 63 | * Amplitude (for elastic interpolation). 64 | * @member {number} 65 | */ 66 | this.amplitude = data[8]; 67 | 68 | /** 69 | * Period (for elastic interpolation). 70 | * @member {number} 71 | */ 72 | this.period = data[9]; 73 | } 74 | 75 | // GRAPH_OT_easing_type 76 | 77 | /** 78 | * FCurve easing types. 79 | * @enum {number} 80 | * @readonly 81 | */ 82 | Keyframe.Easing = { 83 | /** Automatic easing. */ 84 | AUTO: 0, 85 | /** Starts slow. */ 86 | IN: 1, 87 | /** Ends slow. */ 88 | OUT: 2, 89 | /** Starts and ends slow. */ 90 | IN_OUT: 3, 91 | }; 92 | 93 | // GRAPH_OT_interpolation_type 94 | 95 | /** 96 | * FCurve interpolation types, between two keyframes. 97 | * @enum {number} 98 | * @readonly 99 | */ 100 | Keyframe.Interpolation = { 101 | /** No interpolation, value gets held. */ 102 | CONSTANT: 0, 103 | /** Straight-line interpolation. */ 104 | LINEAR: 1, 105 | /** Smooth interpolation. */ 106 | BEZIER: 2, 107 | /** Cubic easing with overshoot and settle. */ 108 | BACK: 3, 109 | /** Exponentially decaying parabolic bounce. */ 110 | BOUNCE: 4, 111 | /** Circular easing. */ 112 | CIRCULAR: 5, 113 | /** Cubic easing. */ 114 | CUBIC: 6, 115 | /** Exponentially decaying sine wave. */ 116 | ELASTIC: 7, 117 | /** Exponential easing. */ 118 | EXPONENTIAL: 8, 119 | /** Quadratic easing. */ 120 | QUADRATIC: 9, 121 | /** Quartic easing. */ 122 | QUARTIC: 10, 123 | /** Quintic easing. */ 124 | QUINTIC: 11, 125 | /** Sinusoidal easing. */ 126 | SINUSOIDAL: 12, 127 | }; 128 | 129 | module.exports = Keyframe; 130 | -------------------------------------------------------------------------------- /js/docs/enums_Interpolation.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: enums/Interpolation.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: enums/Interpolation.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
30 | 
31 | // GRAPH_OT_interpolation_type
32 | 
33 | /**
34 |  * FCurve interpolation types, between two keyframes.
35 |  * @enum {number}
36 |  * @readonly
37 | */
38 | var Interpolation = {
39 | 	/** No interpolation, value gets held. */
40 | 	CONSTANT: 0,
41 | 	/** Straight-line interpolation. */
42 | 	LINEAR: 1,
43 | 	/** Smooth interpolation. */
44 | 	BEZIER: 2,
45 | 	/** Cubic easing with overshoot and settle. */
46 | 	BACK: 3,
47 | 	/** Exponentially decaying parabolic bounce. */
48 | 	BOUNCE: 4,
49 | 	/** Circular easing. */
50 | 	CIRCULAR: 5,
51 | 	/** Cubic easing. */
52 | 	CUBIC: 6,
53 | 	/** Exponentially decaying sine wave. */
54 | 	ELASTIC: 7,
55 | 	/** Exponential easing. */
56 | 	EXPONENTIAL: 8,
57 | 	/** Quadratic easing. */
58 | 	QUADRATIC: 9,
59 | 	/** Quartic easing. */
60 | 	QUARTIC: 10,
61 | 	/** Quintic easing. */
62 | 	QUINTIC: 11,
63 | 	/** Sinusoidal easing. */
64 | 	SINUSOIDAL: 12,
65 | };
66 | 
67 | module.exports = Interpolation;
68 | 
69 |
70 |
71 | 72 | 73 | 74 | 75 |
76 | 77 | 80 | 81 |
82 | 83 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /js/docs/FCurveArray.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: FCurveArray.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: FCurveArray.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
 30 | 
 31 | var FCurve = require('./FCurve');
 32 | /**
 33 |  * Provides a value when a FCurve does not exist.
 34 |  * @callback FCurveArray~DefaultValues
 35 |  * @param {number} index Array index
 36 |  * @param {number} time Evaluation time
 37 |  * @return {number} Value
 38 |  */
 39 | 
 40 | /**
 41 |  * @class A FCurveArray is an array of FCurves.
 42 |  * @param data Data from Blender.
 43 |  */
 44 | function FCurveArray(data) {
 45 | 	var array = data.map(function(data) {
 46 | 		return data && new FCurve(data);
 47 | 	});
 48 | 
 49 | 	/**
 50 | 	 * Evaluates the array.
 51 | 	 * @method FCurveArray~evaluate
 52 | 	 * @param {number} time Evaluation time.
 53 | 	 * @param {FCurveArray~DefaultValues} defaultValues In case a FCurve does not exist.
 54 | 	 * @return {number[]}
 55 | 	 */
 56 | 	array.evaluate = function(time, defaultValues) {
 57 | 		return array.map(function(fcurve, index) {
 58 | 			return fcurve ? fcurve.evaluate(time) : defaultValues(index, time);
 59 | 		});
 60 | 	};
 61 | 
 62 | 	return array;
 63 | }
 64 | 
 65 | /**
 66 |  * Built-in DefaultValues functions.
 67 |  * @enum {FCurveArray~DefaultValues}
 68 |  * @readonly
 69 | */
 70 | FCurveArray.DefaultValues = {
 71 | 	/** Returns 0. */
 72 | 	LOCATION: function() {
 73 | 		return 0;
 74 | 	},
 75 | 	/** Returns 0. */
 76 | 	ROTATION: function() {
 77 | 		return 0;
 78 | 	},
 79 | 	/** Returns 0 for XYZ and 1 for W. */
 80 | 	ROTATION_QUATERNION: function(index) {
 81 | 		return (index === 3 ? 1 : 0);
 82 | 	},
 83 | 	/** Returns 1. */
 84 | 	SCALE: function() {
 85 | 		return 1;
 86 | 	},
 87 | };
 88 | 
 89 | module.exports = FCurveArray;
 90 | 
91 |
92 |
93 | 94 | 95 | 96 | 97 |
98 | 99 | 102 | 103 |
104 | 105 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /js/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Home 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Home

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |

Blender HTML5 Animations

Use animation curves from Blender.

47 |

API

The entry point is the class ActionLibrary. Create an ActionLibrary with the data exported from Blender, and enjoy.

48 |

The library relies on glMatrix for math computations.

49 |

Browser

Copy blender-html5-animations.min.js from the dist folder.

50 |

Copy gl-matrix-min.js from glMatrix's dist folder.

51 |
<script src="exported-data.js"></script>
52 | <script src="gl-matrix-min.js"></script>
53 | <script src="blender-html5-animations.min.js"></script>
54 | <script>
55 |     var myActionLibrary = new blenderHTML5Animations.ActionLibrary(exportedData);
56 | 
57 |     var value = myActionLibrary['my-action'].paths['location'].evaluate(time, blenderHTML5Animations.FCurveArray.DefaultValues.LOCATION);
58 | </script>

Node.js

npm install --save blender-html5-animations
var exportedData = require('./exported-data.json');
59 | var blenderHTML5Animations = require('blender-html5-animations');
60 | 
61 | var myActionLibrary = new blenderHTML5Animations.ActionLibrary(exportedData);
62 | 
63 | var value = myActionLibrary['my-action'].paths['location'].evaluate(time, blenderHTML5Animations.FCurveArray.DefaultValues.LOCATION);

License

Copyright 2016 Jonathan Giroux

64 |

MIT licence

65 |
66 | 67 | 68 | 69 | 70 | 71 | 72 |
73 | 74 | 77 | 78 |
79 | 80 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /js/docs/ActionLibrary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Class: ActionLibrary 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Class: ActionLibrary

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

ActionLibrary

32 | 33 |
An ActionLibrary is an object of Actions.
34 | 35 | 36 |
37 | 38 |
39 |
40 | 41 | 42 | 43 | 44 |

Constructor

45 | 46 | 47 |

new ActionLibrary(data)

48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
Parameters:
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |
NameTypeDescription
data 90 | 91 | Data from Blender.
103 | 104 | 105 | 106 | 107 | 108 | 109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
Source:
137 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 |
185 | 186 |
187 | 188 | 189 | 190 | 191 |
192 | 193 | 196 | 197 |
198 | 199 | 202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /js/docs/Keyframe.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: Keyframe.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: Keyframe.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
 30 | 
 31 | /**
 32 |  * @class A Keyframe is a value in time with control handles.
 33 |  * @param data Data from Blender.
 34 |  */
 35 | function Keyframe(data) {
 36 | 	/**
 37 | 	 * Time.
 38 | 	 * @member {number}
 39 | 	 */
 40 | 	this.time = data[0];
 41 | 
 42 | 	/**
 43 | 	 * Value.
 44 | 	 * @member {number}
 45 | 	 */
 46 | 	this.value = data[1];
 47 | 
 48 | 	/**
 49 | 	 * Left handle's time.
 50 | 	 * @member {number}
 51 | 	 */
 52 | 	this.leftTime = data[2];
 53 | 
 54 | 	/**
 55 | 	 * Left handle's value.
 56 | 	 * @member {number}
 57 | 	 */
 58 | 	this.leftValue = data[3];
 59 | 
 60 | 	/**
 61 | 	 * Right handle's time.
 62 | 	 * @member {number}
 63 | 	 */
 64 | 	this.rightTime = data[4];
 65 | 
 66 | 	/**
 67 | 	 * Right handle's value.
 68 | 	 * @member {number}
 69 | 	 */
 70 | 	this.rightValue = data[5];
 71 | 
 72 | 	/**
 73 | 	 * Interpolation type.
 74 | 	 * @member {Keyframe.Interpolation}
 75 | 	 */
 76 | 	this.interpolation = data[6];
 77 | 
 78 | 	/**
 79 | 	 * Easing type.
 80 | 	 * @member {Keyframe.Easing}
 81 | 	 */
 82 | 	this.easing = data[7];
 83 | 
 84 | 	/**
 85 | 	 * Overshoot (for back interpolation).
 86 | 	 * @member {number}
 87 | 	 */
 88 | 	this.overshoot = data[8];
 89 | 
 90 | 	/**
 91 | 	 * Amplitude (for elastic interpolation).
 92 | 	 * @member {number}
 93 | 	 */
 94 | 	this.amplitude = data[8];
 95 | 
 96 | 	/**
 97 | 	 * Period (for elastic interpolation).
 98 | 	 * @member {number}
 99 | 	 */
100 | 	this.period = data[9];
101 | }
102 | 
103 | // GRAPH_OT_easing_type
104 | 
105 | /**
106 |  * FCurve easing types.
107 |  * @enum {number}
108 |  * @readonly
109 | */
110 | Keyframe.Easing = {
111 | 	/** Automatic easing. */
112 | 	AUTO: 0,
113 | 	/** Starts slow. */
114 | 	IN: 1,
115 | 	/** Ends slow. */
116 | 	OUT: 2,
117 | 	/** Starts and ends slow. */
118 | 	IN_OUT: 3,
119 | };
120 | 
121 | // GRAPH_OT_interpolation_type
122 | 
123 | /**
124 |  * FCurve interpolation types, between two keyframes.
125 |  * @enum {number}
126 |  * @readonly
127 | */
128 | Keyframe.Interpolation = {
129 | 	/** No interpolation, value gets held. */
130 | 	CONSTANT: 0,
131 | 	/** Straight-line interpolation. */
132 | 	LINEAR: 1,
133 | 	/** Smooth interpolation. */
134 | 	BEZIER: 2,
135 | 	/** Cubic easing with overshoot and settle. */
136 | 	BACK: 3,
137 | 	/** Exponentially decaying parabolic bounce. */
138 | 	BOUNCE: 4,
139 | 	/** Circular easing. */
140 | 	CIRCULAR: 5,
141 | 	/** Cubic easing. */
142 | 	CUBIC: 6,
143 | 	/** Exponentially decaying sine wave. */
144 | 	ELASTIC: 7,
145 | 	/** Exponential easing. */
146 | 	EXPONENTIAL: 8,
147 | 	/** Quadratic easing. */
148 | 	QUADRATIC: 9,
149 | 	/** Quartic easing. */
150 | 	QUARTIC: 10,
151 | 	/** Quintic easing. */
152 | 	QUINTIC: 11,
153 | 	/** Sinusoidal easing. */
154 | 	SINUSOIDAL: 12,
155 | };
156 | 
157 | module.exports = Keyframe;
158 | 
159 |
160 |
161 | 162 | 163 | 164 | 165 |
166 | 167 | 170 | 171 |
172 | 173 | 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /js/docs/Marker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Class: Marker 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Class: Marker

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

Marker

32 | 33 |
A Marker is a generic information in time.
34 | 35 | 36 |
37 | 38 |
39 |
40 | 41 | 42 | 43 | 44 |

Constructor

45 | 46 | 47 |

new Marker(data)

48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
Parameters:
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |
NameTypeDescription
data 90 | 91 | Data from Blender
103 | 104 | 105 | 106 | 107 | 108 | 109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
Source:
137 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 |

Members

179 | 180 | 181 | 182 |

name :string

183 | 184 | 185 | 186 | 187 |
188 | Name. 189 |
190 | 191 | 192 | 193 |
Type:
194 |
    195 |
  • 196 | 197 | string 198 | 199 | 200 |
  • 201 |
202 | 203 | 204 | 205 | 206 | 207 |
208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 |
Source:
235 |
238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 |
246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 |

time :number

255 | 256 | 257 | 258 | 259 |
260 | Time. 261 |
262 | 263 | 264 | 265 |
Type:
266 |
    267 |
  • 268 | 269 | number 270 | 271 | 272 |
  • 273 |
274 | 275 | 276 | 277 | 278 | 279 |
280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 |
Source:
307 |
310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 |
318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 |
333 | 334 |
335 | 336 | 337 | 338 | 339 |
340 | 341 | 344 | 345 |
346 | 347 | 350 | 351 | 352 | 353 | 354 | -------------------------------------------------------------------------------- /js/src/Action.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var glMatrixLib = require('gl-matrix'); 4 | 5 | var glMatrix = glMatrixLib.glMatrix; 6 | var mat4 = glMatrixLib.mat4; 7 | var vec3 = glMatrixLib.vec3; 8 | 9 | var FCurveArray = require('./FCurveArray'); 10 | var Marker = require('./Marker'); 11 | 12 | /** 13 | * @class An Action describes a keyframed animation. 14 | * @param data Data from Blender. 15 | */ 16 | function Action(data) { 17 | var self = this; 18 | 19 | /** 20 | * Time of the first keyframe. 21 | * @member {number} 22 | */ 23 | this.startTime = +Infinity; 24 | /** 25 | * Time of the last keyframe. 26 | * @member {number} 27 | */ 28 | this.endTime = -Infinity; 29 | 30 | function timeUpdater(fcurve) { 31 | if (fcurve) { 32 | self.startTime = Math.min(self.startTime, fcurve.keyframes[0].time); 33 | self.endTime = Math.max(self.endTime, fcurve.keyframes[fcurve.keyframes.length - 1].time); 34 | } 35 | } 36 | 37 | /** 38 | * FCurves grouped by data path. 39 | * @member {FCurveArray[]} 40 | */ 41 | this.paths = {}; 42 | for (var groupName in data[0]) { 43 | var path = new FCurveArray(data[0][groupName]); 44 | this.paths[groupName] = path; 45 | 46 | path.forEach(timeUpdater); 47 | } 48 | 49 | /** 50 | * Pose markers. 51 | * @member {Marker[]} 52 | */ 53 | this.markers = data.length > 1 ? data[1].map(function(data) { 54 | return new Marker(data); 55 | }) : []; 56 | } 57 | 58 | // POSE_OT_rotation_mode_set 59 | 60 | /** 61 | * Object rotation modes. 62 | * @enum {number} 63 | * @readonly 64 | */ 65 | Action.RotationMode = { 66 | /** Reads from rotation_quaternion and delta_rotation_quaternion paths. */ 67 | QUATERNION: 0, 68 | /** Reads from rotation_euler and delta_rotation_euler paths. */ 69 | EULER_XYZ: 1, 70 | /** Reads from rotation_euler and delta_rotation_euler paths. */ 71 | EULER_YXZ: 3, 72 | /** Reads from rotation_euler and delta_rotation_euler paths. */ 73 | EULER_XZY: 2, 74 | /** Reads from rotation_euler and delta_rotation_euler paths. */ 75 | EULER_ZXY: 5, 76 | /** Reads from rotation_euler and delta_rotation_euler paths. */ 77 | EULER_YZX: 4, 78 | /** Reads from rotation_euler and delta_rotation_euler paths. */ 79 | EULER_ZYX: 6, 80 | /** Reads from rotation_axis path. */ 81 | AXIS_ANGLE: -1, 82 | }; 83 | 84 | /** 85 | * Calls a function for each marker in a time range. 86 | * @param {number} startTime Included start time 87 | * @param {number} endTime Excluded end time 88 | * @param {function} callback Callback 89 | */ 90 | Action.prototype.forEachMarker = function(startTime, endTime, callback) { 91 | return this.markers.forEach(function(marker, index) { 92 | if (marker.time >= startTime && marker.time < endTime) 93 | return callback(marker, index); 94 | }); 95 | }; 96 | 97 | var qmat = new glMatrix.ARRAY_TYPE(16); 98 | 99 | /** 100 | * Computes the local to world matrix. 101 | * @param {mat4} out Receiving matrix 102 | * @param {number} time Evaluation time 103 | * @param {Action.RotationMode} rotationMode Rotation mode 104 | */ 105 | Action.prototype.toWorld = function(out, time, rotationMode) { 106 | mat4.identity(out); 107 | 108 | var paths = this.paths; 109 | var angles; 110 | 111 | function computeEulerAngles() { 112 | angles = vec3.fromValues(0, 0, 0); 113 | [paths.rotation_euler, paths.delta_rotation_euler].forEach(function(path) { 114 | if (path) 115 | vec3.add(angles, angles, path.evaluate(time, FCurveArray.DefaultValues.ROTATION)); 116 | }); 117 | } 118 | 119 | var location = vec3.fromValues(0, 0, 0); 120 | [paths.location, paths.delta_location].forEach(function(path) { 121 | if (path) 122 | vec3.add(location, location, path.evaluate(time, FCurveArray.DefaultValues.LOCATION)); 123 | }); 124 | mat4.translate(out, out, location); 125 | 126 | switch (rotationMode) { 127 | case Action.RotationMode.QUATERNION: 128 | [paths.rotation_quaternion, paths.delta_rotation_quaternion].forEach(function(path) { 129 | if (path) { 130 | mat4.fromQuat(qmat, path.evaluate(time, FCurveArray.DefaultValues.ROTATION_QUATERNION)); 131 | mat4.multiply(out, out, qmat); 132 | } 133 | }); 134 | break; 135 | 136 | case Action.RotationMode.EULER_XYZ: 137 | computeEulerAngles(); 138 | mat4.rotateZ(out, out, angles[2]); 139 | mat4.rotateY(out, out, angles[1]); 140 | mat4.rotateX(out, out, angles[0]); 141 | break; 142 | 143 | case Action.RotationMode.EULER_XZY: 144 | computeEulerAngles(); 145 | mat4.rotateY(out, out, angles[1]); 146 | mat4.rotateZ(out, out, angles[2]); 147 | mat4.rotateX(out, out, angles[0]); 148 | break; 149 | 150 | case Action.RotationMode.EULER_YXZ: 151 | computeEulerAngles(); 152 | mat4.rotateZ(out, out, angles[2]); 153 | mat4.rotateX(out, out, angles[0]); 154 | mat4.rotateY(out, out, angles[1]); 155 | break; 156 | 157 | case Action.RotationMode.EULER_YZX: 158 | computeEulerAngles(); 159 | mat4.rotateX(out, out, angles[0]); 160 | mat4.rotateZ(out, out, angles[2]); 161 | mat4.rotateY(out, out, angles[1]); 162 | break; 163 | 164 | case Action.RotationMode.EULER_ZXY: 165 | computeEulerAngles(); 166 | mat4.rotateY(out, out, angles[1]); 167 | mat4.rotateX(out, out, angles[0]); 168 | mat4.rotateZ(out, out, angles[2]); 169 | break; 170 | 171 | case Action.RotationMode.EULER_ZYX: 172 | computeEulerAngles(); 173 | mat4.rotateX(out, out, angles[0]); 174 | mat4.rotateY(out, out, angles[1]); 175 | mat4.rotateZ(out, out, angles[2]); 176 | break; 177 | 178 | case Action.RotationMode.AXIS_ANGLE: 179 | // no delta 180 | if (paths.rotation_axis) { 181 | var vec = paths.rotation_axis.evaluate(time, FCurveArray.DefaultValues.ROTATION); 182 | mat4.rotate(out, out, vec[3], vec); 183 | } 184 | break; 185 | } 186 | 187 | var scale = vec3.fromValues(1, 1, 1); 188 | [paths.scale, paths.delta_scale].forEach(function(path) { 189 | if (path) 190 | vec3.multiply(scale, scale, path.evaluate(time, FCurveArray.DefaultValues.SCALE)); 191 | }); 192 | mat4.scale(out, out, scale); 193 | 194 | return out; 195 | }; 196 | 197 | /** 198 | * Computes the world to local matrix. 199 | * @param {mat4} out Receiving matrix 200 | * @param {number} time Evaluation time 201 | * @param {Action.RotationMode} rotationMode Rotation mode 202 | */ 203 | Action.prototype.toLocal = function(out, time, rotationMode) { 204 | this.toWorld(out, time, rotationMode); 205 | mat4.invert(out, out); 206 | return out; 207 | }; 208 | 209 | /** 210 | * Applies a CSS3 Transform. 211 | * @param {element} element Receiving element 212 | * @param {number} time Evaluation time 213 | * @param {Action.RotationMode} rotationMode Rotation mode 214 | */ 215 | Action.prototype.setElementTransform = function(element, time, rotationMode) { 216 | var mat = new glMatrix.ARRAY_TYPE(16); 217 | this.toWorld(mat, time, rotationMode); 218 | 219 | var transform = 'matrix3d(' + mat.join(',') + ')'; 220 | 221 | ['transform', 'mozTransform', 'oTransform', 'webkitTransform'].forEach(function(property) { 222 | element.style[property] = transform; 223 | }); 224 | }; 225 | 226 | module.exports = Action; 227 | -------------------------------------------------------------------------------- /js/docs/styles/jsdoc-default.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Open Sans'; 3 | font-weight: normal; 4 | font-style: normal; 5 | src: url('../fonts/OpenSans-Regular-webfont.eot'); 6 | src: 7 | local('Open Sans'), 8 | local('OpenSans'), 9 | url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), 10 | url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), 11 | url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); 12 | } 13 | 14 | @font-face { 15 | font-family: 'Open Sans Light'; 16 | font-weight: normal; 17 | font-style: normal; 18 | src: url('../fonts/OpenSans-Light-webfont.eot'); 19 | src: 20 | local('Open Sans Light'), 21 | local('OpenSans Light'), 22 | url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), 23 | url('../fonts/OpenSans-Light-webfont.woff') format('woff'), 24 | url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); 25 | } 26 | 27 | html 28 | { 29 | overflow: auto; 30 | background-color: #fff; 31 | font-size: 14px; 32 | } 33 | 34 | body 35 | { 36 | font-family: 'Open Sans', sans-serif; 37 | line-height: 1.5; 38 | color: #4d4e53; 39 | background-color: white; 40 | } 41 | 42 | a, a:visited, a:active { 43 | color: #0095dd; 44 | text-decoration: none; 45 | } 46 | 47 | a:hover { 48 | text-decoration: underline; 49 | } 50 | 51 | header 52 | { 53 | display: block; 54 | padding: 0px 4px; 55 | } 56 | 57 | tt, code, kbd, samp { 58 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 59 | } 60 | 61 | .class-description { 62 | font-size: 130%; 63 | line-height: 140%; 64 | margin-bottom: 1em; 65 | margin-top: 1em; 66 | } 67 | 68 | .class-description:empty { 69 | margin: 0; 70 | } 71 | 72 | #main { 73 | float: left; 74 | width: 70%; 75 | } 76 | 77 | article dl { 78 | margin-bottom: 40px; 79 | } 80 | 81 | section 82 | { 83 | display: block; 84 | background-color: #fff; 85 | padding: 12px 24px; 86 | border-bottom: 1px solid #ccc; 87 | margin-right: 30px; 88 | } 89 | 90 | .variation { 91 | display: none; 92 | } 93 | 94 | .signature-attributes { 95 | font-size: 60%; 96 | color: #aaa; 97 | font-style: italic; 98 | font-weight: lighter; 99 | } 100 | 101 | nav 102 | { 103 | display: block; 104 | float: right; 105 | margin-top: 28px; 106 | width: 30%; 107 | box-sizing: border-box; 108 | border-left: 1px solid #ccc; 109 | padding-left: 16px; 110 | } 111 | 112 | nav ul { 113 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; 114 | font-size: 100%; 115 | line-height: 17px; 116 | padding: 0; 117 | margin: 0; 118 | list-style-type: none; 119 | } 120 | 121 | nav ul a, nav ul a:visited, nav ul a:active { 122 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 123 | line-height: 18px; 124 | color: #4D4E53; 125 | } 126 | 127 | nav h3 { 128 | margin-top: 12px; 129 | } 130 | 131 | nav li { 132 | margin-top: 6px; 133 | } 134 | 135 | footer { 136 | display: block; 137 | padding: 6px; 138 | margin-top: 12px; 139 | font-style: italic; 140 | font-size: 90%; 141 | } 142 | 143 | h1, h2, h3, h4 { 144 | font-weight: 200; 145 | margin: 0; 146 | } 147 | 148 | h1 149 | { 150 | font-family: 'Open Sans Light', sans-serif; 151 | font-size: 48px; 152 | letter-spacing: -2px; 153 | margin: 12px 24px 20px; 154 | } 155 | 156 | h2, h3 157 | { 158 | font-size: 30px; 159 | font-weight: 700; 160 | letter-spacing: -1px; 161 | margin-bottom: 12px; 162 | } 163 | 164 | h4 165 | { 166 | font-size: 18px; 167 | letter-spacing: -0.33px; 168 | margin-bottom: 12px; 169 | color: #4d4e53; 170 | } 171 | 172 | h5, .container-overview .subsection-title 173 | { 174 | font-size: 120%; 175 | font-weight: bold; 176 | letter-spacing: -0.01em; 177 | margin: 8px 0 3px 0; 178 | } 179 | 180 | h6 181 | { 182 | font-size: 100%; 183 | letter-spacing: -0.01em; 184 | margin: 6px 0 3px 0; 185 | font-style: italic; 186 | } 187 | 188 | .ancestors { color: #999; } 189 | .ancestors a 190 | { 191 | color: #999 !important; 192 | text-decoration: none; 193 | } 194 | 195 | .clear 196 | { 197 | clear: both; 198 | } 199 | 200 | .important 201 | { 202 | font-weight: bold; 203 | color: #950B02; 204 | } 205 | 206 | .yes-def { 207 | text-indent: -1000px; 208 | } 209 | 210 | .type-signature { 211 | color: #aaa; 212 | } 213 | 214 | .name, .signature { 215 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 216 | } 217 | 218 | .details { margin-top: 14px; border-left: 2px solid #DDD; } 219 | .details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } 220 | .details dd { margin-left: 70px; } 221 | .details ul { margin: 0; } 222 | .details ul { list-style-type: none; } 223 | .details li { margin-left: 30px; padding-top: 6px; } 224 | .details pre.prettyprint { margin: 0 } 225 | .details .object-value { padding-top: 0; } 226 | 227 | .description { 228 | margin-bottom: 1em; 229 | margin-top: 1em; 230 | } 231 | 232 | .code-caption 233 | { 234 | font-style: italic; 235 | font-size: 107%; 236 | margin: 0; 237 | } 238 | 239 | .prettyprint 240 | { 241 | border: 1px solid #ddd; 242 | width: 80%; 243 | overflow: auto; 244 | } 245 | 246 | .prettyprint.source { 247 | width: inherit; 248 | } 249 | 250 | .prettyprint code 251 | { 252 | font-size: 100%; 253 | line-height: 18px; 254 | display: block; 255 | padding: 4px 12px; 256 | margin: 0; 257 | background-color: #fff; 258 | color: #4D4E53; 259 | } 260 | 261 | .prettyprint code span.line 262 | { 263 | display: inline-block; 264 | } 265 | 266 | .prettyprint.linenums 267 | { 268 | padding-left: 70px; 269 | -webkit-user-select: none; 270 | -moz-user-select: none; 271 | -ms-user-select: none; 272 | user-select: none; 273 | } 274 | 275 | .prettyprint.linenums ol 276 | { 277 | padding-left: 0; 278 | } 279 | 280 | .prettyprint.linenums li 281 | { 282 | border-left: 3px #ddd solid; 283 | } 284 | 285 | .prettyprint.linenums li.selected, 286 | .prettyprint.linenums li.selected * 287 | { 288 | background-color: lightyellow; 289 | } 290 | 291 | .prettyprint.linenums li * 292 | { 293 | -webkit-user-select: text; 294 | -moz-user-select: text; 295 | -ms-user-select: text; 296 | user-select: text; 297 | } 298 | 299 | .params, .props 300 | { 301 | border-spacing: 0; 302 | border: 0; 303 | border-collapse: collapse; 304 | } 305 | 306 | .params .name, .props .name, .name code { 307 | color: #4D4E53; 308 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 309 | font-size: 100%; 310 | } 311 | 312 | .params td, .params th, .props td, .props th 313 | { 314 | border: 1px solid #ddd; 315 | margin: 0px; 316 | text-align: left; 317 | vertical-align: top; 318 | padding: 4px 6px; 319 | display: table-cell; 320 | } 321 | 322 | .params thead tr, .props thead tr 323 | { 324 | background-color: #ddd; 325 | font-weight: bold; 326 | } 327 | 328 | .params .params thead tr, .props .props thead tr 329 | { 330 | background-color: #fff; 331 | font-weight: bold; 332 | } 333 | 334 | .params th, .props th { border-right: 1px solid #aaa; } 335 | .params thead .last, .props thead .last { border-right: 1px solid #ddd; } 336 | 337 | .params td.description > p:first-child, 338 | .props td.description > p:first-child 339 | { 340 | margin-top: 0; 341 | padding-top: 0; 342 | } 343 | 344 | .params td.description > p:last-child, 345 | .props td.description > p:last-child 346 | { 347 | margin-bottom: 0; 348 | padding-bottom: 0; 349 | } 350 | 351 | .disabled { 352 | color: #454545; 353 | } 354 | -------------------------------------------------------------------------------- /js/src/FCurve.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var bezier = require('./bezier'); 4 | var easing = require('./easing'); 5 | var Keyframe = require('./Keyframe'); 6 | 7 | /** 8 | * @class A FCurveArray is an array of FCurves. 9 | * @param data Data from Blender. 10 | */ 11 | function FCurve(data) { 12 | /** 13 | * Keyframes. 14 | * @member {Keyframe[]} 15 | */ 16 | this.keyframes = data[0].map(function(data) { 17 | return new Keyframe(data); 18 | }); 19 | 20 | /** 21 | * Extrapolation type. 22 | * @member {FCurve.Extrapolation} 23 | */ 24 | this.extrapolation = data[1]; 25 | } 26 | 27 | // GRAPH_OT_extrapolation_type 28 | 29 | /** 30 | * FCurve extrapolation types, before its first keyframe and after its last keyframe. 31 | * @enum {number} 32 | * @readonly 33 | */ 34 | FCurve.Extrapolation = { 35 | /** Keeps a constant value. */ 36 | CONSTANT: 0, 37 | /** Continues as straight lines. */ 38 | LINEAR: 1, 39 | }; 40 | 41 | /** 42 | * When evaluation time differs less than epsilon from a keyframe, snaps to that keyframe. 43 | * @type {number} 44 | */ 45 | FCurve.evaluationTimeEpsilon = 0.0001; 46 | 47 | function areTimesAlmostEqual(t1, t2) { 48 | return Math.abs(t1 - t2) <= FCurve.evaluationTimeEpsilon; 49 | } 50 | 51 | /** 52 | * Evaluates the curve. 53 | * @param {number} time Evaluation time. 54 | * @return {number} Value. 55 | */ 56 | FCurve.prototype.evaluate = function(time) { 57 | var leftIndex = 0; 58 | var leftKeyframe = this.keyframes[leftIndex]; 59 | 60 | if (areTimesAlmostEqual(time, leftKeyframe.time)) 61 | { 62 | return leftKeyframe.value; 63 | } 64 | 65 | if (time <= leftKeyframe.time) { 66 | switch (this.extrapolation) { 67 | case FCurve.Extrapolation.LINEAR: 68 | return leftKeyframe.value + (leftKeyframe.leftValue - leftKeyframe.value) * (time - leftKeyframe.time) / (leftKeyframe.leftTime - leftKeyframe.time); 69 | default: 70 | return leftKeyframe.value; 71 | } 72 | } 73 | 74 | var rightIndex = this.keyframes.length - 1; 75 | var rightKeyframe = this.keyframes[rightIndex]; 76 | 77 | if (areTimesAlmostEqual(time, rightKeyframe.time)) 78 | { 79 | return rightKeyframe.value; 80 | } 81 | 82 | if (time >= rightKeyframe.time) { 83 | switch (this.extrapolation) { 84 | case FCurve.Extrapolation.LINEAR: 85 | return rightKeyframe.value + (rightKeyframe.rightValue - rightKeyframe.value) * (time - rightKeyframe.time) / (rightKeyframe.rightTime - rightKeyframe.time); 86 | default: 87 | return rightKeyframe.value; 88 | } 89 | } 90 | 91 | while (rightIndex - leftIndex > 1) { 92 | var index = ((leftIndex + rightIndex) / 2) | 0; 93 | if (this.keyframes[index].time >= time) 94 | rightIndex = index; 95 | else 96 | leftIndex = index; 97 | } 98 | 99 | leftKeyframe = this.keyframes[leftIndex]; 100 | if (areTimesAlmostEqual(time, leftKeyframe.time)) 101 | { 102 | return leftKeyframe.value; 103 | } 104 | 105 | rightKeyframe = this.keyframes[rightIndex]; 106 | if (areTimesAlmostEqual(time, rightKeyframe.time)) 107 | { 108 | return rightKeyframe.value; 109 | } 110 | 111 | var relTime = time - leftKeyframe.time; 112 | var begin = leftKeyframe.value; 113 | var duration = rightKeyframe.time - leftKeyframe.time; 114 | var change = rightKeyframe.value - leftKeyframe.value; 115 | 116 | switch (leftKeyframe.interpolation) { 117 | case Keyframe.Interpolation.BACK: 118 | switch (leftKeyframe.easing) { 119 | case Keyframe.Easing.IN: 120 | return easing.backEaseIn(relTime, begin, change, duration, leftKeyframe.overshoot); 121 | case Keyframe.Easing.IN_OUT: 122 | return easing.backEaseInOut(relTime, begin, change, duration, leftKeyframe.overshoot); 123 | default: 124 | return easing.backEaseOut(relTime, begin, change, duration, leftKeyframe.overshoot); 125 | } 126 | break; 127 | 128 | case Keyframe.Interpolation.BEZIER: 129 | return bezier(time, leftKeyframe, rightKeyframe); 130 | 131 | case Keyframe.Interpolation.BOUNCE: 132 | switch (leftKeyframe.easing) { 133 | case Keyframe.Easing.IN: 134 | return easing.bounceEaseIn(relTime, begin, change, duration); 135 | case Keyframe.Easing.IN_OUT: 136 | return easing.bounceEaseInOut(relTime, begin, change, duration); 137 | default: 138 | return easing.bounceEaseOut(relTime, begin, change, duration); 139 | } 140 | break; 141 | 142 | case Keyframe.Interpolation.CIRCULAR: 143 | switch (leftKeyframe.easing) { 144 | case Keyframe.Easing.OUT: 145 | return easing.circularEaseOut(relTime, begin, change, duration); 146 | case Keyframe.Easing.IN_OUT: 147 | return easing.circularEaseInOut(relTime, begin, change, duration); 148 | default: 149 | return easing.circularEaseIn(relTime, begin, change, duration); 150 | } 151 | break; 152 | 153 | case Keyframe.Interpolation.CUBIC: 154 | switch (leftKeyframe.easing) { 155 | case Keyframe.Easing.OUT: 156 | return easing.cubicEaseOut(relTime, begin, change, duration); 157 | case Keyframe.Easing.IN_OUT: 158 | return easing.cubicEaseInOut(relTime, begin, change, duration); 159 | default: 160 | return easing.cubicEaseIn(relTime, begin, change, duration); 161 | } 162 | break; 163 | 164 | case Keyframe.Interpolation.ELASTIC: 165 | switch (leftKeyframe.easing) { 166 | case Keyframe.Easing.IN: 167 | return easing.elasticEaseIn(relTime, begin, change, duration); 168 | case Keyframe.Easing.IN_OUT: 169 | return easing.elasticEaseInOut(relTime, begin, change, duration); 170 | default: 171 | return easing.elasticEaseOut(relTime, begin, change, duration, leftKeyframe.amplitude, leftKeyframe.period); 172 | } 173 | break; 174 | 175 | case Keyframe.Interpolation.EXPONENTIAL: 176 | switch (leftKeyframe.easing) { 177 | case Keyframe.Easing.OUT: 178 | return easing.exponentialEaseOut(relTime, begin, change, duration); 179 | case Keyframe.Keyframe.Easing.IN_OUT: 180 | return easing.exponentialEaseInOut(relTime, begin, change, duration); 181 | default: 182 | return easing.exponentialEaseIn(relTime, begin, change, duration); 183 | } 184 | break; 185 | 186 | case Keyframe.Interpolation.LINEAR: 187 | return easing.linear(relTime, begin, change, duration); 188 | 189 | case Keyframe.Interpolation.QUADRATIC: 190 | switch (leftKeyframe.easing) { 191 | case Keyframe.Easing.OUT: 192 | return easing.quadraticEaseOut(relTime, begin, change, duration); 193 | case Keyframe.Easing.IN_OUT: 194 | return easing.quadraticEaseInOut(relTime, begin, change, duration); 195 | default: 196 | return easing.quadraticEaseIn(relTime, begin, change, duration); 197 | } 198 | break; 199 | 200 | case Keyframe.Interpolation.QUARTIC: 201 | switch (leftKeyframe.easing) { 202 | case Keyframe.Easing.OUT: 203 | return easing.quarticEaseOut(relTime, begin, change, duration); 204 | case Keyframe.Easing.IN_OUT: 205 | return easing.quarticEaseInOut(relTime, begin, change, duration); 206 | default: 207 | return easing.quarticEaseIn(relTime, begin, change, duration); 208 | } 209 | break; 210 | 211 | case Keyframe.Interpolation.QUINTIC: 212 | switch (leftKeyframe.easing) { 213 | case Keyframe.Easing.OUT: 214 | return easing.quinticEaseOut(relTime, begin, change, duration); 215 | case Keyframe.Easing.IN_OUT: 216 | return easing.quinticEaseInOut(relTime, begin, change, duration); 217 | default: 218 | return easing.quinticEaseIn(relTime, begin, change, duration); 219 | } 220 | break; 221 | 222 | case Keyframe.Interpolation.SINUSOIDAL: 223 | switch (leftKeyframe.easing) { 224 | case Keyframe.Easing.OUT: 225 | return easing.sinusoidalEaseOut(relTime, begin, change, duration); 226 | case Keyframe.Easing.IN_OUT: 227 | return easing.sinusoidalEaseInOut(relTime, begin, change, duration); 228 | default: 229 | return easing.sinusoidalEaseIn(relTime, begin, change, duration); 230 | } 231 | break; 232 | 233 | default: 234 | return begin; 235 | } 236 | }; 237 | 238 | module.exports = FCurve; 239 | -------------------------------------------------------------------------------- /js/docs/Action.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: Action.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: Action.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
 30 | 
 31 | var glMatrixLib = require('gl-matrix');
 32 | 
 33 | var glMatrix = glMatrixLib.glMatrix;
 34 | var mat4 = glMatrixLib.mat4;
 35 | var vec3 = glMatrixLib.vec3;
 36 | 
 37 | var FCurveArray = require('./FCurveArray');
 38 | var Marker = require('./Marker');
 39 | 
 40 | /**
 41 |  * @class An Action describes a keyframed animation.
 42 |  * @param data Data from Blender.
 43 |  */
 44 | function Action(data) {
 45 | 	var self = this;
 46 | 
 47 | 	/**
 48 | 	 * Time of the first keyframe.
 49 | 	 * @member {number}
 50 | 	 */
 51 | 	this.startTime = +Infinity;
 52 | 	/**
 53 | 	 * Time of the last keyframe.
 54 | 	 * @member {number}
 55 | 	 */
 56 | 	this.endTime = -Infinity;
 57 | 
 58 | 	function timeUpdater(fcurve) {
 59 | 		if (fcurve) {
 60 | 			self.startTime = Math.min(self.startTime, fcurve.keyframes[0].time);
 61 | 			self.endTime = Math.max(self.endTime, fcurve.keyframes[fcurve.keyframes.length - 1].time);
 62 | 		}
 63 | 	}
 64 | 
 65 | 	/**
 66 | 	 * FCurves grouped by data path.
 67 | 	 * @member {FCurveArray[]}
 68 | 	 */
 69 | 	this.paths = {};
 70 | 	for (var groupName in data[0]) {
 71 | 		var path = new FCurveArray(data[0][groupName]);
 72 | 		this.paths[groupName] = path;
 73 | 
 74 | 		path.forEach(timeUpdater);
 75 | 	}
 76 | 
 77 | 	/**
 78 | 	 * Pose markers.
 79 | 	 * @member {Marker[]}
 80 | 	 */
 81 | 	this.markers = data.length > 1 ? data[1].map(function(data) {
 82 | 		return new Marker(data);
 83 | 	}) : [];
 84 | }
 85 | 
 86 | // POSE_OT_rotation_mode_set
 87 | 
 88 | /**
 89 |  * Object rotation modes.
 90 |  * @enum {number}
 91 |  * @readonly
 92 | */
 93 | Action.RotationMode = {
 94 | 	/** Reads from rotation_quaternion and delta_rotation_quaternion paths. */
 95 | 	QUATERNION: 0,
 96 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
 97 | 	EULER_XYZ: 1,
 98 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
 99 | 	EULER_YXZ: 3,
100 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
101 | 	EULER_XZY: 2,
102 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
103 | 	EULER_ZXY: 5,
104 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
105 | 	EULER_YZX: 4,
106 | 	/** Reads from rotation_euler and delta_rotation_euler paths. */
107 | 	EULER_ZYX: 6,
108 | 	/** Reads from rotation_axis path. */
109 | 	AXIS_ANGLE: -1,
110 | };
111 | 
112 | /**
113 |  * Calls a function for each marker in a time range.
114 |  * @param {number} startTime Included start time
115 |  * @param {number} endTime Excluded end time
116 |  * @param {function} callback Callback
117 |  */
118 | Action.prototype.forEachMarker = function(startTime, endTime, callback) {
119 | 	return this.markers.forEach(function(marker, index) {
120 | 		if (marker.time >= startTime && marker.time < endTime)
121 | 			return callback(marker, index);
122 | 	});
123 | };
124 | 
125 | var qmat = new glMatrix.ARRAY_TYPE(16);
126 | 
127 | /**
128 |  * Computes the local to world matrix.
129 |  * @param {mat4} out Receiving matrix
130 |  * @param {number} time Evaluation time
131 |  * @param {Action.RotationMode} rotationMode Rotation mode
132 |  */
133 | Action.prototype.toWorld = function(out, time, rotationMode) {
134 | 	mat4.identity(out);
135 | 
136 | 	var paths = this.paths;
137 | 	var angles;
138 | 
139 | 	function computeEulerAngles() {
140 | 		angles = vec3.fromValues(0, 0, 0);
141 | 		[paths.rotation_euler, paths.delta_rotation_euler].forEach(function(path) {
142 | 			if (path)
143 | 				vec3.add(angles, angles, path.evaluate(time, FCurveArray.DefaultValues.ROTATION));
144 | 		});
145 | 	}
146 | 
147 | 	var location = vec3.fromValues(0, 0, 0);
148 | 	[paths.location, paths.delta_location].forEach(function(path) {
149 | 		if (path)
150 | 			vec3.add(location, location, path.evaluate(time, FCurveArray.DefaultValues.LOCATION));
151 | 	});
152 | 	mat4.translate(out, out, location);
153 | 
154 | 	switch (rotationMode) {
155 | 		case Action.RotationMode.QUATERNION:
156 | 			[paths.rotation_quaternion, paths.delta_rotation_quaternion].forEach(function(path) {
157 | 				if (path) {
158 | 					mat4.fromQuat(qmat, path.evaluate(time, FCurveArray.DefaultValues.ROTATION_QUATERNION));
159 | 					mat4.multiply(out, out, qmat);
160 | 				}
161 | 			});
162 | 			break;
163 | 
164 | 		case Action.RotationMode.EULER_XYZ:
165 | 			computeEulerAngles();
166 | 			mat4.rotateZ(out, out, angles[2]);
167 | 			mat4.rotateY(out, out, angles[1]);
168 | 			mat4.rotateX(out, out, angles[0]);
169 | 			break;
170 | 
171 | 		case Action.RotationMode.EULER_XZY:
172 | 			computeEulerAngles();
173 | 			mat4.rotateY(out, out, angles[1]);
174 | 			mat4.rotateZ(out, out, angles[2]);
175 | 			mat4.rotateX(out, out, angles[0]);
176 | 			break;
177 | 
178 | 		case Action.RotationMode.EULER_YXZ:
179 | 			computeEulerAngles();
180 | 			mat4.rotateZ(out, out, angles[2]);
181 | 			mat4.rotateX(out, out, angles[0]);
182 | 			mat4.rotateY(out, out, angles[1]);
183 | 			break;
184 | 
185 | 		case Action.RotationMode.EULER_YZX:
186 | 			computeEulerAngles();
187 | 			mat4.rotateX(out, out, angles[0]);
188 | 			mat4.rotateZ(out, out, angles[2]);
189 | 			mat4.rotateY(out, out, angles[1]);
190 | 			break;
191 | 
192 | 		case Action.RotationMode.EULER_ZXY:
193 | 			computeEulerAngles();
194 | 			mat4.rotateY(out, out, angles[1]);
195 | 			mat4.rotateX(out, out, angles[0]);
196 | 			mat4.rotateZ(out, out, angles[2]);
197 | 			break;
198 | 
199 | 		case Action.RotationMode.EULER_ZYX:
200 | 			computeEulerAngles();
201 | 			mat4.rotateX(out, out, angles[0]);
202 | 			mat4.rotateY(out, out, angles[1]);
203 | 			mat4.rotateZ(out, out, angles[2]);
204 | 			break;
205 | 
206 | 		case Action.RotationMode.AXIS_ANGLE:
207 | 			// no delta
208 | 			if (paths.rotation_axis) {
209 | 				var vec = paths.rotation_axis.evaluate(time, FCurveArray.DefaultValues.ROTATION);
210 | 				mat4.rotate(out, out, vec[3], vec);
211 | 			}
212 | 			break;
213 | 	}
214 | 
215 | 	var scale = vec3.fromValues(1, 1, 1);
216 | 	[paths.scale, paths.delta_scale].forEach(function(path) {
217 | 		if (path)
218 | 			vec3.multiply(scale, scale, path.evaluate(time, FCurveArray.DefaultValues.SCALE));
219 | 	});
220 | 	mat4.scale(out, out, scale);
221 | 
222 | 	return out;
223 | };
224 | 
225 | /**
226 |  * Computes the world to local matrix.
227 |  * @param {mat4} out Receiving matrix
228 |  * @param {number} time Evaluation time
229 |  * @param {Action.RotationMode} rotationMode Rotation mode
230 |  */
231 | Action.prototype.toLocal = function(out, time, rotationMode) {
232 | 	this.toWorld(out, time, rotationMode);
233 | 	mat4.invert(out, out);
234 | 	return out;
235 | };
236 | 
237 | /**
238 |  * Applies a CSS3 Transform.
239 |  * @param {element} element Receiving element
240 |  * @param {number} time Evaluation time
241 |  * @param {Action.RotationMode} rotationMode Rotation mode
242 |  */
243 | Action.prototype.setElementTransform = function(element, time, rotationMode) {
244 | 	var mat = new glMatrix.ARRAY_TYPE(16);
245 | 	this.toWorld(mat, time, rotationMode);
246 | 
247 | 	var transform = 'matrix3d(' + mat.join(',') + ')';
248 | 
249 | 	['transform', 'mozTransform', 'oTransform', 'webkitTransform'].forEach(function(property) {
250 | 		element.style[property] = transform;
251 | 	});
252 | };
253 | 
254 | module.exports = Action;
255 | 
256 |
257 |
258 | 259 | 260 | 261 | 262 |
263 | 264 | 267 | 268 |
269 | 270 | 273 | 274 | 275 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /js/docs/FCurve.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Source: FCurve.js 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Source: FCurve.js

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
'use strict';
 30 | 
 31 | var bezier = require('./bezier');
 32 | var easing = require('./easing');
 33 | var Keyframe = require('./Keyframe');
 34 | 
 35 | /**
 36 |  * @class A FCurveArray is an array of FCurves.
 37 |  * @param data Data from Blender.
 38 |  */
 39 | function FCurve(data) {
 40 | 	/**
 41 | 	 * Keyframes.
 42 | 	 * @member {Keyframe[]}
 43 | 	 */
 44 | 	this.keyframes = data[0].map(function(data) {
 45 | 		return new Keyframe(data);
 46 | 	});
 47 | 
 48 | 	/**
 49 | 	 * Extrapolation type.
 50 | 	 * @member {FCurve.Extrapolation}
 51 | 	 */
 52 | 	this.extrapolation = data[1];
 53 | }
 54 | 
 55 | // GRAPH_OT_extrapolation_type
 56 | 
 57 | /**
 58 |  * FCurve extrapolation types, before its first keyframe and after its last keyframe.
 59 |  * @enum {number}
 60 |  * @readonly
 61 | */
 62 | FCurve.Extrapolation = {
 63 | 	/** Keeps a constant value. */
 64 | 	CONSTANT: 0,
 65 | 	/** Continues as straight lines. */
 66 | 	LINEAR: 1,
 67 | };
 68 | 
 69 | /**
 70 |  * When evaluation time differs less than epsilon from a keyframe, snaps to that keyframe.
 71 |  * @type {number}
 72 |  */
 73 | FCurve.evaluationTimeEpsilon = 0.0001;
 74 | 
 75 | function areTimesAlmostEqual(t1, t2) {
 76 | 	return Math.abs(t1 - t2) <= FCurve.evaluationTimeEpsilon;
 77 | }
 78 | 
 79 | /**
 80 |  * Evaluates the curve.
 81 |  * @param {number} time Evaluation time.
 82 |  * @return {number} Value.
 83 |  */
 84 | FCurve.prototype.evaluate = function(time) {
 85 | 	var leftIndex = 0;
 86 | 	var leftKeyframe = this.keyframes[leftIndex];
 87 | 
 88 | 	if (areTimesAlmostEqual(time, leftKeyframe.time))
 89 | 	{
 90 | 		return leftKeyframe.value;
 91 | 	}
 92 | 
 93 | 	if (time <= leftKeyframe.time) {
 94 | 		switch (this.extrapolation) {
 95 | 			case FCurve.Extrapolation.LINEAR:
 96 | 				return leftKeyframe.value + (leftKeyframe.leftValue - leftKeyframe.value) * (time - leftKeyframe.time) / (leftKeyframe.leftTime - leftKeyframe.time);
 97 | 			default:
 98 | 				return leftKeyframe.value;
 99 | 		}
100 | 	}
101 | 
102 | 	var rightIndex = this.keyframes.length - 1;
103 | 	var rightKeyframe = this.keyframes[rightIndex];
104 | 
105 | 	if (areTimesAlmostEqual(time, rightKeyframe.time))
106 | 	{
107 | 		return rightKeyframe.value;
108 | 	}
109 | 
110 | 	if (time >= rightKeyframe.time) {
111 | 		switch (this.extrapolation) {
112 | 			case FCurve.Extrapolation.LINEAR:
113 | 				return rightKeyframe.value + (rightKeyframe.rightValue - rightKeyframe.value) * (time - rightKeyframe.time) / (rightKeyframe.rightTime - rightKeyframe.time);
114 | 			default:
115 | 				return rightKeyframe.value;
116 | 		}
117 | 	}
118 | 
119 | 	while (rightIndex - leftIndex > 1) {
120 | 		var index = ((leftIndex + rightIndex) / 2) | 0;
121 | 		if (this.keyframes[index].time >= time)
122 | 			rightIndex = index;
123 | 		else
124 | 			leftIndex = index;
125 | 	}
126 | 
127 | 	leftKeyframe = this.keyframes[leftIndex];
128 | 	if (areTimesAlmostEqual(time, leftKeyframe.time))
129 | 	{
130 | 		return leftKeyframe.value;
131 | 	}
132 | 
133 | 	rightKeyframe = this.keyframes[rightIndex];
134 | 	if (areTimesAlmostEqual(time, rightKeyframe.time))
135 | 	{
136 | 		return rightKeyframe.value;
137 | 	}
138 | 
139 | 	var relTime = time - leftKeyframe.time;
140 | 	var begin = leftKeyframe.value;
141 | 	var duration = rightKeyframe.time - leftKeyframe.time;
142 | 	var change = rightKeyframe.value - leftKeyframe.value;
143 | 
144 | 	switch (leftKeyframe.interpolation) {
145 | 		case Keyframe.Interpolation.BACK:
146 | 			switch (leftKeyframe.easing) {
147 | 				case Keyframe.Easing.IN:
148 | 					return easing.backEaseIn(relTime, begin, change, duration, leftKeyframe.overshoot);
149 | 				case Keyframe.Easing.IN_OUT:
150 | 					return easing.backEaseInOut(relTime, begin, change, duration, leftKeyframe.overshoot);
151 | 				default:
152 | 					return easing.backEaseOut(relTime, begin, change, duration, leftKeyframe.overshoot);
153 | 			}
154 | 			break;
155 | 
156 | 		case Keyframe.Interpolation.BEZIER:
157 | 			return bezier(time, leftKeyframe, rightKeyframe);
158 | 
159 | 		case Keyframe.Interpolation.BOUNCE:
160 | 			switch (leftKeyframe.easing) {
161 | 				case Keyframe.Easing.IN:
162 | 					return easing.bounceEaseIn(relTime, begin, change, duration);
163 | 				case Keyframe.Easing.IN_OUT:
164 | 					return easing.bounceEaseInOut(relTime, begin, change, duration);
165 | 				default:
166 | 					return easing.bounceEaseOut(relTime, begin, change, duration);
167 | 			}
168 | 			break;
169 | 
170 | 		case Keyframe.Interpolation.CIRCULAR:
171 | 			switch (leftKeyframe.easing) {
172 | 				case Keyframe.Easing.OUT:
173 | 					return easing.circularEaseOut(relTime, begin, change, duration);
174 | 				case Keyframe.Easing.IN_OUT:
175 | 					return easing.circularEaseInOut(relTime, begin, change, duration);
176 | 				default:
177 | 					return easing.circularEaseIn(relTime, begin, change, duration);
178 | 			}
179 | 			break;
180 | 
181 | 		case Keyframe.Interpolation.CUBIC:
182 | 			switch (leftKeyframe.easing) {
183 | 				case Keyframe.Easing.OUT:
184 | 					return easing.cubicEaseOut(relTime, begin, change, duration);
185 | 				case Keyframe.Easing.IN_OUT:
186 | 					return easing.cubicEaseInOut(relTime, begin, change, duration);
187 | 				default:
188 | 					return easing.cubicEaseIn(relTime, begin, change, duration);
189 | 			}
190 | 			break;
191 | 
192 | 		case Keyframe.Interpolation.ELASTIC:
193 | 			switch (leftKeyframe.easing) {
194 | 				case Keyframe.Easing.IN:
195 | 					return easing.elasticEaseIn(relTime, begin, change, duration);
196 | 				case Keyframe.Easing.IN_OUT:
197 | 					return easing.elasticEaseInOut(relTime, begin, change, duration);
198 | 				default:
199 | 					return easing.elasticEaseOut(relTime, begin, change, duration, leftKeyframe.amplitude, leftKeyframe.period);
200 | 			}
201 | 			break;
202 | 
203 | 		case Keyframe.Interpolation.EXPONENTIAL:
204 | 			switch (leftKeyframe.easing) {
205 | 				case Keyframe.Easing.OUT:
206 | 					return easing.exponentialEaseOut(relTime, begin, change, duration);
207 | 				case Keyframe.Keyframe.Easing.IN_OUT:
208 | 					return easing.exponentialEaseInOut(relTime, begin, change, duration);
209 | 				default:
210 | 					return easing.exponentialEaseIn(relTime, begin, change, duration);
211 | 			}
212 | 			break;
213 | 
214 | 		case Keyframe.Interpolation.LINEAR:
215 | 			return easing.linear(relTime, begin, change, duration);
216 | 
217 | 		case Keyframe.Interpolation.QUADRATIC:
218 | 			switch (leftKeyframe.easing) {
219 | 				case Keyframe.Easing.OUT:
220 | 					return easing.quadraticEaseOut(relTime, begin, change, duration);
221 | 				case Keyframe.Easing.IN_OUT:
222 | 					return easing.quadraticEaseInOut(relTime, begin, change, duration);
223 | 				default:
224 | 					return easing.quadraticEaseIn(relTime, begin, change, duration);
225 | 			}
226 | 			break;
227 | 
228 | 		case Keyframe.Interpolation.QUARTIC:
229 | 			switch (leftKeyframe.easing) {
230 | 				case Keyframe.Easing.OUT:
231 | 					return easing.quarticEaseOut(relTime, begin, change, duration);
232 | 				case Keyframe.Easing.IN_OUT:
233 | 					return easing.quarticEaseInOut(relTime, begin, change, duration);
234 | 				default:
235 | 					return easing.quarticEaseIn(relTime, begin, change, duration);
236 | 			}
237 | 			break;
238 | 
239 | 		case Keyframe.Interpolation.QUINTIC:
240 | 			switch (leftKeyframe.easing) {
241 | 				case Keyframe.Easing.OUT:
242 | 					return easing.quinticEaseOut(relTime, begin, change, duration);
243 | 				case Keyframe.Easing.IN_OUT:
244 | 					return easing.quinticEaseInOut(relTime, begin, change, duration);
245 | 				default:
246 | 					return easing.quinticEaseIn(relTime, begin, change, duration);
247 | 			}
248 | 			break;
249 | 
250 | 		case Keyframe.Interpolation.SINUSOIDAL:
251 | 			switch (leftKeyframe.easing) {
252 | 				case Keyframe.Easing.OUT:
253 | 					return easing.sinusoidalEaseOut(relTime, begin, change, duration);
254 | 				case Keyframe.Easing.IN_OUT:
255 | 					return easing.sinusoidalEaseInOut(relTime, begin, change, duration);
256 | 				default:
257 | 					return easing.sinusoidalEaseIn(relTime, begin, change, duration);
258 | 			}
259 | 			break;
260 | 
261 | 		default:
262 | 			return begin;
263 | 	}
264 | };
265 | 
266 | module.exports = FCurve;
267 | 
268 |
269 |
270 | 271 | 272 | 273 | 274 |
275 | 276 | 279 | 280 |
281 | 282 | 285 | 286 | 287 | 288 | 289 | 290 | -------------------------------------------------------------------------------- /blender-addon/html5_animations.py: -------------------------------------------------------------------------------- 1 | # Blender HTML5 Animations 2 | # Copyright 2016 Jonathan Giroux 3 | # MIT License 4 | 5 | bl_info = { 6 | "name": "HTML5 Animations", 7 | "author": "Jonathan Giroux", 8 | "version": (1, 0, 2), 9 | "blender": (2, 70, 0), 10 | "location": "File > Export > HTML5 Animations", 11 | "description": "Export animation curves as CSS, JS, or JSON.", 12 | "warning": "", 13 | "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/System/HTML5_Animations", 14 | "category": "Import-Export", 15 | } 16 | 17 | import bpy 18 | import json 19 | 20 | from bpy.props import ( 21 | BoolProperty, 22 | EnumProperty, 23 | StringProperty, 24 | ) 25 | from bpy.types import Operator 26 | from bpy_extras.io_utils import ( 27 | ExportHelper, 28 | orientation_helper_factory, 29 | ) 30 | 31 | 32 | Easings = bpy.types.GRAPH_OT_easing_type.bl_rna.properties['type'].enum_items 33 | Extrapolations = bpy.types.GRAPH_OT_extrapolation_type.bl_rna.properties['type'].enum_items 34 | Interpolations = bpy.types.GRAPH_OT_interpolation_type.bl_rna.properties['type'].enum_items 35 | 36 | 37 | CoordinateSystemChangeDataPaths = { 38 | 'location', 39 | 'delta_location', 40 | 'rotation_axis', 41 | 'rotation_euler', 42 | 'delta_rotation_euler', 43 | 'rotation_quaternion', 44 | 'delta_rotation_quaternion', 45 | } 46 | 47 | CoordinateSystemChangeAxisIndex = { 48 | 'X': (0, 1), 49 | '-X': (0, -1), 50 | 'Y': (1, 1), 51 | '-Y': (1, -1), 52 | 'Z': (2, 1), 53 | '-Z': (2, -1), 54 | } 55 | 56 | def export_json(time_coefficient, coordinate_system_mapping): 57 | actions_obj = {} 58 | 59 | for action in bpy.data.actions: 60 | fcurves_obj = {} 61 | for fcurve in action.fcurves: 62 | if fcurve.data_path not in fcurves_obj: 63 | fcurves_obj[fcurve.data_path] = [] 64 | fcurves_arr = fcurves_obj[fcurve.data_path] 65 | 66 | array_index = fcurve.array_index 67 | value_coefficient = 1 68 | if coordinate_system_mapping is not None: 69 | array_index, value_coefficient = coordinate_system_mapping(array_index) 70 | 71 | # Fill missing array indexes 72 | while len(fcurves_arr) <= array_index: 73 | fcurves_arr.append(0) 74 | 75 | keyframes_arr = [] 76 | for keyframe_point in fcurve.keyframe_points: 77 | keyframe_arr = [ 78 | keyframe_point.co[0] * time_coefficient, 79 | keyframe_point.co[1] * value_coefficient, 80 | keyframe_point.handle_left[0] * time_coefficient, 81 | keyframe_point.handle_left[1] * value_coefficient, 82 | keyframe_point.handle_right[0] * time_coefficient, 83 | keyframe_point.handle_right[1] * value_coefficient, 84 | Interpolations[keyframe_point.interpolation].value, 85 | ] 86 | 87 | if keyframe_point.interpolation not in {'BEZIER', 'CONSTANT', 'LINEAR'}: 88 | keyframe_arr.append(Easings[keyframe_point.easing].value) 89 | 90 | if keyframe_point.interpolation == 'BACK': 91 | keyframe_arr.append(keyframe_point.back) 92 | 93 | if keyframe_point.interpolation == 'ELASTIC': 94 | keyframe_arr.append(keyframe_point.amplitude) 95 | keyframe_arr.append(keyframe_point.period) 96 | 97 | keyframes_arr.append(keyframe_arr) 98 | 99 | fcurve_obj = [ 100 | keyframes_arr, 101 | Extrapolations[fcurve.extrapolation].value, 102 | ] 103 | 104 | fcurves_arr[array_index] = fcurve_obj 105 | 106 | markers_arr = [] 107 | for marker in action.pose_markers: 108 | marker_arr = [ 109 | marker.frame * time_coefficient, 110 | marker.name, 111 | ] 112 | markers_arr.append(marker_arr) 113 | 114 | action_arr = [ 115 | fcurves_obj, 116 | ] 117 | 118 | if len(markers_arr) > 0: 119 | action_arr.append(markers_arr) 120 | 121 | actions_obj[action.name] = action_arr 122 | 123 | return actions_obj 124 | 125 | 126 | HTML5AnimationsOrientationHelper = orientation_helper_factory("HTML5AnimationsOrientationHelper", axis_forward='-Z', axis_up='Y') 127 | 128 | 129 | class Export(Operator, ExportHelper, HTML5AnimationsOrientationHelper): 130 | """Export animation curves as CSS, JS, or JSON.""" 131 | bl_idname = "html5_animations.export" 132 | bl_label = "Export HTML5 Animations" 133 | 134 | filename_ext = ".js" 135 | 136 | filter_glob = StringProperty( 137 | default="*.css;*.js;*.json", 138 | options={'HIDDEN'}, 139 | maxlen=255, 140 | ) 141 | 142 | change_coordinate_system = BoolProperty( 143 | name="Change coordinate system", 144 | description="Affected data paths: location, rotation_axis, rotation_euler, rotation_quaternion, scale + delta_", 145 | default=False, 146 | ) 147 | 148 | format = EnumProperty( 149 | name="Format", 150 | items=( 151 | ('CSS', "CSS", ""), 152 | ('JS', "JS", ""), 153 | ('JSON', "JSON", "") 154 | ), 155 | default='JS', 156 | ) 157 | 158 | css_vendor_prefixes = EnumProperty( 159 | name="Vendor Prefixes", 160 | options={'ENUM_FLAG'}, 161 | items=( 162 | ('NONE', "", ""), 163 | ('MOZ', "-moz-", ""), 164 | ('O', "-o-", ""), 165 | ('WEBKIT', "-webkit-", ""), 166 | ), 167 | default={'NONE'}, 168 | ) 169 | 170 | css_animation_prefix = StringProperty( 171 | name="Prefix", 172 | description="Animation name prefix.", 173 | default="", 174 | ) 175 | 176 | js_json_pretty_formatting = BoolProperty( 177 | name="Pretty Formatting", 178 | description="If true, format with indents and line breaks.", 179 | default=False, 180 | ) 181 | 182 | js_variable_name = StringProperty( 183 | name="Variable Name", 184 | description="It can be a complex path, e.g. 'foo.bar' (provided that foo is an object).", 185 | default="actions", 186 | ) 187 | 188 | def draw(self, context): 189 | layout = self.layout 190 | 191 | layout.prop(self, "change_coordinate_system") 192 | if self.change_coordinate_system: 193 | layout.prop(self, "axis_forward") 194 | layout.prop(self, "axis_up") 195 | 196 | layout.separator() 197 | 198 | layout.prop(self, 'format', expand=True) 199 | 200 | if self.format == 'CSS': 201 | self.filename_ext = ".css" 202 | layout.prop(self, 'css_vendor_prefixes') 203 | layout.prop(self, 'css_animation_prefix') 204 | 205 | elif self.format == 'JS': 206 | self.filename_ext = ".js" 207 | layout.prop(self, 'js_json_pretty_formatting') 208 | layout.prop(self, 'js_variable_name') 209 | 210 | elif self.format == 'JSON': 211 | self.filename_ext = ".json" 212 | layout.prop(self, 'js_json_pretty_formatting') 213 | 214 | def execute(self, context): 215 | if not self.filepath: 216 | raise Exception("filepath not set") 217 | 218 | coordinate_system_mapping = None 219 | if self.change_coordinate_system: 220 | forward_index, forward_coefficient = CoordinateSystemChangeAxisIndex[self.axis_forward] 221 | up_index, up_coefficient = CoordinateSystemChangeAxisIndex[self.axis_up] 222 | if forward_index == up_index: 223 | raise Exception("Wrong coordinate system change") 224 | right_index = 3 - forward_index - up_index 225 | right_coefficient = 1 if (forward_index < up_index) == (forward_coefficient == up_coefficient) else -1 226 | 227 | def coordinate_system_mapping(array_index): 228 | if array_index == 0: 229 | return (right_index, right_coefficient) 230 | if array_index == 1: 231 | return (forward_index, forward_coefficient) 232 | if array_index == 2: 233 | return (up_index, up_coefficient) 234 | return (array_index, 1) 235 | 236 | time_coefficient = context.scene.render.fps_base / context.scene.render.fps 237 | 238 | if self.format == 'CSS': 239 | raise Exception("Not implemented") 240 | 241 | else: 242 | if self.js_json_pretty_formatting: 243 | indent = ' ' 244 | separators = (', ', ': ') 245 | else: 246 | indent = None 247 | separators = (',', ':') 248 | 249 | obj = export_json(time_coefficient, coordinate_system_mapping) 250 | 251 | if self.format == 'JS': 252 | with open(self.filepath, 'w', encoding='utf-8') as f: 253 | f.write(self.js_variable_name + '=') 254 | json.dump(obj, f, indent=indent, separators=separators) 255 | f.write(';\n') 256 | return {'FINISHED'} 257 | 258 | elif self.format == 'JSON': 259 | with open(self.filepath, 'w', encoding='utf-8') as f: 260 | json.dump(obj, f, indent=indent, separators=separators) 261 | return {'FINISHED'} 262 | 263 | 264 | def menu_export(self, context): 265 | self.layout.operator(Export.bl_idname, text="HTML5 Animations (.css, .js, .json)") 266 | 267 | 268 | def register(): 269 | bpy.utils.register_module(__name__) 270 | bpy.types.INFO_MT_file_export.append(menu_export) 271 | 272 | 273 | def unregister(): 274 | bpy.utils.unregister_module(__name__) 275 | bpy.types.INFO_MT_file_export.remove(menu_export) 276 | 277 | 278 | if __name__ == "__main__": 279 | register() 280 | -------------------------------------------------------------------------------- /js/src/easing.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // easing.c 4 | 5 | function backEaseIn(time, begin, change, duration, overshoot) { 6 | time /= duration; 7 | return change * time * time * ((overshoot + 1) * time - overshoot) + begin; 8 | } 9 | 10 | function backEaseOut(time, begin, change, duration, overshoot) { 11 | time = time / duration - 1; 12 | return change * (time * time * ((overshoot + 1) * time + overshoot) + 1) + begin; 13 | } 14 | 15 | function backEaseInOut(time, begin, change, duration, overshoot) { 16 | overshoot *= 1.525; 17 | if ((time /= duration / 2) < 1) { 18 | return change / 2 * (time * time * ((overshoot + 1) * time - overshoot)) + begin; 19 | } 20 | time -= 2.0; 21 | return change / 2 * (time * time * ((overshoot + 1) * time + overshoot) + 2) + begin; 22 | } 23 | 24 | function bounceEaseOut(time, begin, change, duration) { 25 | time /= duration; 26 | if (time < (1 / 2.75)) { 27 | return change * (7.5625 * time * time) + begin; 28 | } 29 | else if (time < (2 / 2.75)) { 30 | time -= (1.5 / 2.75); 31 | return change * ((7.5625 * time) * time + 0.75) + begin; 32 | } 33 | else if (time < (2.5 / 2.75)) { 34 | time -= (2.25 / 2.75); 35 | return change * ((7.5625 * time) * time + 0.9375) + begin; 36 | } 37 | else { 38 | time -= (2.625 / 2.75); 39 | return change * ((7.5625 * time) * time + 0.984375) + begin; 40 | } 41 | } 42 | 43 | function bounceEaseIn(time, begin, change, duration) { 44 | return change - bounceEaseOut(duration - time, 0, change, duration) + begin; 45 | } 46 | 47 | function bounceEaseInOut(time, begin, change, duration) { 48 | if (time < duration / 2) 49 | return bounceEaseIn(time * 2, 0, change, duration) * 0.5 + begin; 50 | else 51 | return bounceEaseOut(time * 2 - duration, 0, change, duration) * 0.5 + change * 0.5 + begin; 52 | } 53 | 54 | function circularEaseIn(time, begin, change, duration) { 55 | time /= duration; 56 | return -change * (Math.sqrt(1 - time * time) - 1) + begin; 57 | } 58 | 59 | function circularEaseOut(time, begin, change, duration) { 60 | time = time / duration - 1; 61 | return change * Math.sqrt(1 - time * time) + begin; 62 | } 63 | 64 | function circularEaseInOut(time, begin, change, duration) { 65 | if ((time /= duration / 2) < 1.0) 66 | return -change / 2 * (Math.sqrt(1 - time * time) - 1) + begin; 67 | time -= 2.0; 68 | return change / 2 * (Math.sqrt(1 - time * time) + 1) + begin; 69 | } 70 | 71 | function cubicEaseIn(time, begin, change, duration) { 72 | time /= duration; 73 | return change * time * time * time + begin; 74 | } 75 | 76 | function cubicEaseOut(time, begin, change, duration) { 77 | time = time / duration - 1; 78 | return change * (time * time * time + 1) + begin; 79 | } 80 | 81 | function cubicEaseInOut(time, begin, change, duration) { 82 | if ((time /= duration / 2) < 1.0) 83 | return change / 2 * time * time * time + begin; 84 | time -= 2.0; 85 | return change / 2 * (time * time * time + 2) + begin; 86 | } 87 | 88 | function elasticBlend(time, change, duration, amplitude, s, f) { 89 | if (change) { 90 | var t = Math.abs(s); 91 | if (amplitude) { 92 | f *= amplitude / Math.abs(change); 93 | } 94 | else { 95 | f = 0; 96 | } 97 | 98 | var td = Math.abs(time * duration); 99 | if (td < t) { 100 | var l = td / t; 101 | f = (f * l) + (1 - l); 102 | } 103 | } 104 | 105 | return f; 106 | } 107 | 108 | function elasticEaseIn(time, begin, change, duration, amplitude, period) { 109 | var s; 110 | var f = 1.0; 111 | 112 | if (time <= 0.0) 113 | return begin; 114 | if ((time /= duration) >= 1.0) 115 | return begin + change; 116 | time -= 1.0; 117 | if (!period) 118 | period = duration * 0.3; 119 | if (!amplitude || amplitude < Math.abs(change)) { 120 | s = period / 4; 121 | f = elasticBlend(time, change, duration, amplitude, s, f); 122 | amplitude = change; 123 | } 124 | else 125 | s = period / (2 * Math.PI) * Math.asin(change / amplitude); 126 | 127 | return (-f * (amplitude * Math.pow(2, 10 * time) * Math.sin((time * duration - s) * (2 * Math.PI) / period))) + begin; 128 | } 129 | 130 | function elasticEaseOut(time, begin, change, duration, amplitude, period) { 131 | var s; 132 | var f = 1; 133 | 134 | if (time <= 0) 135 | return begin; 136 | if ((time /= duration) >= 1.0) 137 | return begin + change; 138 | time = -time; 139 | if (!period) 140 | period = duration * 0.3; 141 | if (!amplitude || amplitude < Math.abs(change)) { 142 | s = period / 4; 143 | f = elasticBlend(time, change, duration, amplitude, s, f); 144 | amplitude = change; 145 | } else 146 | s = period / (2 * Math.PI) * Math.asin(change / amplitude); 147 | 148 | return (f * (amplitude * Math.pow(2, 10 * time) * Math.sin((time * duration - s) * (2 * Math.PI) / period))) + change + begin; 149 | } 150 | 151 | function elasticEaseInOut(time, begin, change, duration, amplitude, period) { 152 | var s; 153 | var f = 1.0; 154 | 155 | if (time <= 0.0) 156 | return begin; 157 | if ((time /= duration / 2) >= 2.0) 158 | return begin + change; 159 | time -= 1.0; 160 | if (!period) 161 | period = duration * (0.3 * 1.5); 162 | if (!amplitude || amplitude < Math.abs(change)) { 163 | s = period / 4; 164 | f = elasticBlend(time, change, duration, amplitude, s, f); 165 | amplitude = change; 166 | } 167 | else 168 | s = period / (2 * Math.PI) * Math.asin(change / amplitude); 169 | 170 | if (time < 0.0) { 171 | f *= -0.5; 172 | return (f * (amplitude * Math.pow(2, 10 * time) * Math.sin((time * duration - s) * (2 * Math.PI) / period))) + begin; 173 | } 174 | else { 175 | time = -time; 176 | f *= 0.5; 177 | return (f * (amplitude * Math.pow(2, 10 * time) * Math.sin((time * duration - s) * (2 * Math.PI) / period))) + change + begin; 178 | } 179 | } 180 | 181 | function exponentialEaseIn(time, begin, change, duration) { 182 | return (time <= 0.0) ? begin : change * Math.pow(2, 10 * (time / duration - 1)) + begin; 183 | } 184 | 185 | function exponentialEaseOut(time, begin, change, duration) { 186 | return (time >= duration) ? begin + change : change * (-Math.pow(2, -10 * time / duration) + 1) + begin; 187 | } 188 | 189 | function exponentialEaseInOut(time, begin, change, duration) { 190 | if (time <= 0.0) 191 | return begin; 192 | if (time >= duration) 193 | return begin + change; 194 | if ((time /= duration / 2) < 1) 195 | return change / 2 * Math.pow(2, 10 * (time - 1)) + begin; 196 | time -= 1.0; 197 | return change / 2 * (-Math.pow(2, -10 * time) + 2) + begin; 198 | } 199 | 200 | function linear(time, begin, change, duration) { 201 | return change * time / duration + begin; 202 | } 203 | 204 | function quadraticEaseIn(time, begin, change, duration) { 205 | time /= duration; 206 | return change * time * time + begin; 207 | } 208 | 209 | function quadraticEaseOut(time, begin, change, duration) { 210 | time /= duration; 211 | return -change * time * (time - 2) + begin; 212 | } 213 | 214 | function quadraticEaseInOut(time, begin, change, duration) { 215 | if ((time /= duration / 2) < 1.0) 216 | return change / 2 * time * time + begin; 217 | time -= 1.0; 218 | return -change / 2 * (time * (time - 2) - 1) + begin; 219 | } 220 | 221 | 222 | function quarticEaseIn(time, begin, change, duration) { 223 | time /= duration; 224 | return change * time * time * time * time + begin; 225 | } 226 | 227 | function quarticEaseOut(time, begin, change, duration) { 228 | time = time / duration - 1; 229 | return -change * (time * time * time * time - 1) + begin; 230 | } 231 | 232 | function quarticEaseInOut(time, begin, change, duration) { 233 | if ((time /= duration / 2) < 1.0) 234 | return change / 2 * time * time * time * time + begin; 235 | time -= 2.0; 236 | return -change / 2 * ( time * time * time * time - 2) + begin; 237 | } 238 | 239 | function quinticEaseIn(time, begin, change, duration) { 240 | time /= duration; 241 | return change * time * time * time * time * time + begin; 242 | } 243 | 244 | function quinticEaseOut(time, begin, change, duration) { 245 | time = time / duration - 1; 246 | return change * (time * time * time * time * time + 1) + begin; 247 | } 248 | 249 | function quinticEaseInOut(time, begin, change, duration) { 250 | if ((time /= duration / 2) < 1.0) 251 | return change / 2 * time * time * time * time * time + begin; 252 | time -= 2.0; 253 | return change / 2 * (time * time * time * time * time + 2) + begin; 254 | } 255 | 256 | function sinusoidalEaseIn(time, begin, change, duration) { 257 | return -change * Math.cos(time / duration * Math.PI / 2) + change + begin; 258 | } 259 | 260 | function sinusoidalEaseOut(time, begin, change, duration) { 261 | return change * Math.sin(time / duration * Math.PI / 2) + begin; 262 | } 263 | 264 | function sinusoidalEaseInOut(time, begin, change, duration) { 265 | return -change / 2 * (Math.cos(Math.PI * time / duration) - 1) + begin; 266 | } 267 | 268 | module.exports.backEaseIn = backEaseIn; 269 | module.exports.backEaseOut = backEaseOut; 270 | module.exports.backEaseInOut = backEaseInOut; 271 | module.exports.bounceEaseOut = bounceEaseOut; 272 | module.exports.bounceEaseIn = bounceEaseIn; 273 | module.exports.bounceEaseInOut = bounceEaseInOut; 274 | module.exports.circularEaseIn = circularEaseIn; 275 | module.exports.circularEaseOut = circularEaseOut; 276 | module.exports.circularEaseInOut = circularEaseInOut; 277 | module.exports.cubicEaseIn = cubicEaseIn; 278 | module.exports.cubicEaseOut = cubicEaseOut; 279 | module.exports.cubicEaseInOut = cubicEaseInOut; 280 | module.exports.elasticEaseIn = elasticEaseIn; 281 | module.exports.elasticEaseOut = elasticEaseOut; 282 | module.exports.elasticEaseInOut = elasticEaseInOut; 283 | module.exports.exponentialEaseIn = exponentialEaseIn; 284 | module.exports.exponentialEaseOut = exponentialEaseOut; 285 | module.exports.exponentialEaseInOut = exponentialEaseInOut; 286 | module.exports.linear = linear; 287 | module.exports.quadraticEaseIn = quadraticEaseIn; 288 | module.exports.quadraticEaseOut = quadraticEaseOut; 289 | module.exports.quadraticEaseInOut = quadraticEaseInOut; 290 | module.exports.quarticEaseIn = quarticEaseIn; 291 | module.exports.quarticEaseOut = quarticEaseOut; 292 | module.exports.quarticEaseInOut = quarticEaseInOut; 293 | module.exports.quinticEaseIn = quinticEaseIn; 294 | module.exports.quinticEaseOut = quinticEaseOut; 295 | module.exports.quinticEaseInOut = quinticEaseInOut; 296 | module.exports.sinusoidalEaseIn = sinusoidalEaseIn; 297 | module.exports.sinusoidalEaseOut = sinusoidalEaseOut; 298 | module.exports.sinusoidalEaseInOut = sinusoidalEaseInOut; 299 | -------------------------------------------------------------------------------- /js/dist/blender-html5-animations.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Blender HTML5 Animations 1.0.2 3 | * Copyright 2016 Jonathan Giroux 4 | * MIT licence 5 | */ 6 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("gl-matrix")):"function"==typeof define&&define.amd?define(["gl-matrix"],e):"object"==typeof exports?exports.blenderHTML5Animations=e(require("gl-matrix")):t.blenderHTML5Animations=e(t.window)}(this,function(t){return function(t){function e(r){if(a[r])return a[r].exports;var n=a[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var a={};return e.m=t,e.c=a,e.p="",e(0)}([function(t,e,a){"use strict";t.exports.Action=a(1),t.exports.ActionLibrary=a(9),t.exports.FCurve=a(4),t.exports.FCurveArray=a(3),t.exports.Keyframe=a(7),t.exports.Marker=a(8)},function(t,e,a){"use strict";function r(t){function e(t){t&&(a.startTime=Math.min(a.startTime,t.keyframes[0].time),a.endTime=Math.max(a.endTime,t.keyframes[t.keyframes.length-1].time))}var a=this;this.startTime=+(1/0),this.endTime=-(1/0),this.paths={};for(var r in t[0]){var n=new u(t[0][r]);this.paths[r]=n,n.forEach(e)}this.markers=t.length>1?t[1].map(function(t){return new c(t)}):[]}var n=a(2),i=n.glMatrix,s=n.mat4,o=n.vec3,u=a(3),c=a(8);r.RotationMode={QUATERNION:0,EULER_XYZ:1,EULER_YXZ:3,EULER_XZY:2,EULER_ZXY:5,EULER_YZX:4,EULER_ZYX:6,AXIS_ANGLE:-1},r.prototype.forEachMarker=function(t,e,a){return this.markers.forEach(function(r,n){if(r.time>=t&&r.time=c.time)switch(this.extrapolation){case r.Extrapolation.LINEAR:return c.value+(c.rightValue-c.value)*(t-c.time)/(c.rightTime-c.time);default:return c.value}for(;u-e>1;){var l=(e+u)/2|0;this.keyframes[l].time>=t?u=l:e=l}if(a=this.keyframes[e],n(t,a.time))return a.value;if(c=this.keyframes[u],n(t,c.time))return c.value;var f=t-a.time,E=a.value,p=c.time-a.time,I=c.value-a.value;switch(a.interpolation){case o.Interpolation.BACK:switch(a.easing){case o.Easing.IN:return s.backEaseIn(f,E,I,p,a.overshoot);case o.Easing.IN_OUT:return s.backEaseInOut(f,E,I,p,a.overshoot);default:return s.backEaseOut(f,E,I,p,a.overshoot)}break;case o.Interpolation.BEZIER:return i(t,a,c);case o.Interpolation.BOUNCE:switch(a.easing){case o.Easing.IN:return s.bounceEaseIn(f,E,I,p);case o.Easing.IN_OUT:return s.bounceEaseInOut(f,E,I,p);default:return s.bounceEaseOut(f,E,I,p)}break;case o.Interpolation.CIRCULAR:switch(a.easing){case o.Easing.OUT:return s.circularEaseOut(f,E,I,p);case o.Easing.IN_OUT:return s.circularEaseInOut(f,E,I,p);default:return s.circularEaseIn(f,E,I,p)}break;case o.Interpolation.CUBIC:switch(a.easing){case o.Easing.OUT:return s.cubicEaseOut(f,E,I,p);case o.Easing.IN_OUT:return s.cubicEaseInOut(f,E,I,p);default:return s.cubicEaseIn(f,E,I,p)}break;case o.Interpolation.ELASTIC:switch(a.easing){case o.Easing.IN:return s.elasticEaseIn(f,E,I,p);case o.Easing.IN_OUT:return s.elasticEaseInOut(f,E,I,p);default:return s.elasticEaseOut(f,E,I,p,a.amplitude,a.period)}break;case o.Interpolation.EXPONENTIAL:switch(a.easing){case o.Easing.OUT:return s.exponentialEaseOut(f,E,I,p);case o.Keyframe.Easing.IN_OUT:return s.exponentialEaseInOut(f,E,I,p);default:return s.exponentialEaseIn(f,E,I,p)}break;case o.Interpolation.LINEAR:return s.linear(f,E,I,p);case o.Interpolation.QUADRATIC:switch(a.easing){case o.Easing.OUT:return s.quadraticEaseOut(f,E,I,p);case o.Easing.IN_OUT:return s.quadraticEaseInOut(f,E,I,p);default:return s.quadraticEaseIn(f,E,I,p)}break;case o.Interpolation.QUARTIC:switch(a.easing){case o.Easing.OUT:return s.quarticEaseOut(f,E,I,p);case o.Easing.IN_OUT:return s.quarticEaseInOut(f,E,I,p);default:return s.quarticEaseIn(f,E,I,p)}break;case o.Interpolation.QUINTIC:switch(a.easing){case o.Easing.OUT:return s.quinticEaseOut(f,E,I,p);case o.Easing.IN_OUT:return s.quinticEaseInOut(f,E,I,p);default:return s.quinticEaseIn(f,E,I,p)}break;case o.Interpolation.SINUSOIDAL:switch(a.easing){case o.Easing.OUT:return s.sinusoidalEaseOut(f,E,I,p);case o.Easing.IN_OUT:return s.sinusoidalEaseInOut(f,E,I,p);default:return s.sinusoidalEaseIn(f,E,I,p)}break;default:return E}},t.exports=r},function(t,e){"use strict";function a(t,e,a,r,n){var i=1-n;return i*i*i*t+3*i*i*n*e+3*i*n*n*a+n*n*n*r}function r(t,e,r){var n=e.time,i=e.value,s=e.rightTime,o=e.rightValue,u=r.leftTime,c=r.leftValue,l=r.time,f=r.value,E=s-n,p=l-u,I=l-n;if(E+p>I){var h=o-i,O=f-c,m=I/(E+p);s=n+m*E,o=i+m*h,u=l-m*p,c=f-m*O}var x,T,d=0,v=1;do x=(d+v)/2,T=a(n,s,u,l,x),T>t?v=x:d=x;while(Math.abs(T-t)>.01);return a(i,o,c,f,x)}t.exports=r},function(t,e){"use strict";function a(t,e,a,r,n){return t/=r,a*t*t*((n+1)*t-n)+e}function r(t,e,a,r,n){return t=t/r-1,a*(t*t*((n+1)*t+n)+1)+e}function n(t,e,a,r,n){return n*=1.525,(t/=r/2)<1?a/2*(t*t*((n+1)*t-n))+e:(t-=2,a/2*(t*t*((n+1)*t+n)+2)+e)}function i(t,e,a,r){return t/=r,t<1/2.75?a*(7.5625*t*t)+e:t<2/2.75?(t-=1.5/2.75,a*(7.5625*t*t+.75)+e):t<2.5/2.75?(t-=2.25/2.75,a*(7.5625*t*t+.9375)+e):(t-=2.625/2.75,a*(7.5625*t*t+.984375)+e)}function s(t,e,a,r){return a-i(r-t,0,a,r)+e}function o(t,e,a,r){return t=1?e+a:(t-=1,i||(i=.3*r),!n||n=1?e+a:(t=-t,i||(i=.3*r),!n||n=2?e+a:(t-=1,i||(i=r*(.3*1.5)),!n||n=r?e+a:a*(-Math.pow(2,-10*t/r)+1)+e}function d(t,e,a,r){return t<=0?e:t>=r?e+a:(t/=r/2)<1?a/2*Math.pow(2,10*(t-1))+e:(t-=1,a/2*(-Math.pow(2,-10*t)+2)+e)}function v(t,e,a,r){return a*t/r+e}function M(t,e,a,r){return t/=r,a*t*t+e}function N(t,e,a,r){return t/=r,-a*t*(t-2)+e}function b(t,e,a,r){return(t/=r/2)<1?a/2*t*t+e:(t-=1,-a/2*(t*(t-2)-1)+e)}function A(t,e,a,r){return t/=r,a*t*t*t*t+e}function U(t,e,a,r){return t=t/r-1,-a*(t*t*t*t-1)+e}function R(t,e,a,r){return(t/=r/2)<1?a/2*t*t*t*t+e:(t-=2,-a/2*(t*t*t*t-2)+e)}function g(t,e,a,r){return t/=r,a*t*t*t*t*t+e}function _(t,e,a,r){return t=t/r-1,a*(t*t*t*t*t+1)+e}function k(t,e,a,r){return(t/=r/2)<1?a/2*t*t*t*t*t+e:(t-=2,a/2*(t*t*t*t*t+2)+e)}function L(t,e,a,r){return-a*Math.cos(t/r*Math.PI/2)+a+e}function w(t,e,a,r){return a*Math.sin(t/r*Math.PI/2)+e}function C(t,e,a,r){return-a/2*(Math.cos(Math.PI*t/r)-1)+e}t.exports.backEaseIn=a,t.exports.backEaseOut=r,t.exports.backEaseInOut=n,t.exports.bounceEaseOut=i,t.exports.bounceEaseIn=s,t.exports.bounceEaseInOut=o,t.exports.circularEaseIn=u,t.exports.circularEaseOut=c,t.exports.circularEaseInOut=l,t.exports.cubicEaseIn=f,t.exports.cubicEaseOut=E,t.exports.cubicEaseInOut=p,t.exports.elasticEaseIn=h,t.exports.elasticEaseOut=O,t.exports.elasticEaseInOut=m,t.exports.exponentialEaseIn=x,t.exports.exponentialEaseOut=T,t.exports.exponentialEaseInOut=d,t.exports.linear=v,t.exports.quadraticEaseIn=M,t.exports.quadraticEaseOut=N,t.exports.quadraticEaseInOut=b,t.exports.quarticEaseIn=A,t.exports.quarticEaseOut=U,t.exports.quarticEaseInOut=R,t.exports.quinticEaseIn=g,t.exports.quinticEaseOut=_,t.exports.quinticEaseInOut=k,t.exports.sinusoidalEaseIn=L,t.exports.sinusoidalEaseOut=w,t.exports.sinusoidalEaseInOut=C},function(t,e){"use strict";function a(t){this.time=t[0],this.value=t[1],this.leftTime=t[2],this.leftValue=t[3],this.rightTime=t[4],this.rightValue=t[5],this.interpolation=t[6],this.easing=t[7],this.overshoot=t[8],this.amplitude=t[8],this.period=t[9]}a.Easing={AUTO:0,IN:1,OUT:2,IN_OUT:3},a.Interpolation={CONSTANT:0,LINEAR:1,BEZIER:2,BACK:3,BOUNCE:4,CIRCULAR:5,CUBIC:6,ELASTIC:7,EXPONENTIAL:8,QUADRATIC:9,QUARTIC:10,QUINTIC:11,SINUSOIDAL:12},t.exports=a},function(t,e){"use strict";function a(t){this.time=t[0],this.name=t[1]}t.exports=a},function(t,e,a){"use strict";function r(t){for(var e in t)this[e]=new n(t[e])}var n=a(1);t.exports=r}])}); -------------------------------------------------------------------------------- /js/docs/scripts/prettify/Apache-License-2.0.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /js/docs/FCurve.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Class: FCurve 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Class: FCurve

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

FCurve

32 | 33 |
A FCurveArray is an array of FCurves.
34 | 35 | 36 |
37 | 38 |
39 |
40 | 41 | 42 | 43 | 44 |

Constructor

45 | 46 | 47 |

new FCurve(data)

48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
Parameters:
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |
NameTypeDescription
data 90 | 91 | Data from Blender.
103 | 104 | 105 | 106 | 107 | 108 | 109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
Source:
137 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 |

Members

179 | 180 | 181 | 182 |

(static) evaluationTimeEpsilon :number

183 | 184 | 185 | 186 | 187 |
188 | When evaluation time differs less than epsilon from a keyframe, snaps to that keyframe. 189 |
190 | 191 | 192 | 193 |
Type:
194 |
    195 |
  • 196 | 197 | number 198 | 199 | 200 |
  • 201 |
202 | 203 | 204 | 205 | 206 | 207 |
208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 |
Source:
235 |
238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 |
246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 |

(static, readonly) Extrapolation :number

255 | 256 | 257 | 258 | 259 |
260 | FCurve extrapolation types, before its first keyframe and after its last keyframe. 261 |
262 | 263 | 264 | 265 |
Type:
266 |
    267 |
  • 268 | 269 | number 270 | 271 | 272 |
  • 273 |
274 | 275 | 276 | 277 | 278 | 279 |
Properties:
280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 |
NameTypeDescription
CONSTANT 309 | 310 | 311 | number 312 | 313 | 314 | 315 | Keeps a constant value.
LINEAR 332 | 333 | 334 | number 335 | 336 | 337 | 338 | Continues as straight lines.
350 | 351 | 352 | 353 | 354 |
355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 |
Source:
382 |
385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 |
393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 |

extrapolation :FCurve.Extrapolation

402 | 403 | 404 | 405 | 406 |
407 | Extrapolation type. 408 |
409 | 410 | 411 | 412 |
Type:
413 | 421 | 422 | 423 | 424 | 425 | 426 |
427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 |
Source:
454 |
457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 |
465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 |

keyframes :Array.<Keyframe>

474 | 475 | 476 | 477 | 478 |
479 | Keyframes. 480 |
481 | 482 | 483 | 484 |
Type:
485 |
    486 |
  • 487 | 488 | Array.<Keyframe> 489 | 490 | 491 |
  • 492 |
493 | 494 | 495 | 496 | 497 | 498 |
499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 |
Source:
526 |
529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 |
537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 |

Methods

548 | 549 | 550 | 551 | 552 | 553 | 554 |

evaluate(time) → {number}

555 | 556 | 557 | 558 | 559 | 560 |
561 | Evaluates the curve. 562 |
563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 |
Parameters:
573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 |
NameTypeDescription
time 601 | 602 | 603 | number 604 | 605 | 606 | 607 | Evaluation time.
619 | 620 | 621 | 622 | 623 | 624 | 625 |
626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 |
Source:
653 |
656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 |
664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 |
Returns:
678 | 679 | 680 |
681 | Value. 682 |
683 | 684 | 685 | 686 |
687 |
688 | Type 689 |
690 |
691 | 692 | number 693 | 694 | 695 |
696 |
697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 |
709 | 710 |
711 | 712 | 713 | 714 | 715 |
716 | 717 | 720 | 721 |
722 | 723 |
724 | Documentation generated by JSDoc 3.4.0 on Mon Jan 23 2017 18:51:06 GMT+0100 (Romance Standard Time) 725 |
726 | 727 | 728 | 729 | 730 | -------------------------------------------------------------------------------- /js/docs/scripts/prettify/prettify.js: -------------------------------------------------------------------------------- 1 | var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; 2 | (function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= 3 | [],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), 9 | l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, 10 | q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, 11 | q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, 12 | "");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), 13 | a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} 14 | for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], 18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], 19 | H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], 20 | J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ 21 | I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), 22 | ["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", 23 | /^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), 24 | ["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", 25 | hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= 26 | !k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p 2 | 3 | 4 | 5 | JSDoc: Class: FCurveArray 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Class: FCurveArray

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

FCurveArray

32 | 33 |
A FCurveArray is an array of FCurves.
34 | 35 | 36 |
37 | 38 |
39 |
40 | 41 | 42 | 43 | 44 |

Constructor

45 | 46 | 47 |

new FCurveArray(data)

48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
Parameters:
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |
NameTypeDescription
data 90 | 91 | Data from Blender.
103 | 104 | 105 | 106 | 107 | 108 | 109 |
110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
Source:
137 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 |

Members

179 | 180 | 181 | 182 |

(static, readonly) DefaultValues :FCurveArray~DefaultValues

183 | 184 | 185 | 186 | 187 |
188 | Built-in DefaultValues functions. 189 |
190 | 191 | 192 | 193 |
Type:
194 | 202 | 203 | 204 | 205 | 206 | 207 |
Properties:
208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 |
NameTypeDescription
LOCATION 237 | 238 | 239 | FCurveArray~DefaultValues 240 | 241 | 242 | 243 | Returns 0.
ROTATION 260 | 261 | 262 | FCurveArray~DefaultValues 263 | 264 | 265 | 266 | Returns 0.
ROTATION_QUATERNION 283 | 284 | 285 | FCurveArray~DefaultValues 286 | 287 | 288 | 289 | Returns 0 for XYZ and 1 for W.
SCALE 306 | 307 | 308 | FCurveArray~DefaultValues 309 | 310 | 311 | 312 | Returns 1.
324 | 325 | 326 | 327 | 328 |
329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 |
Source:
356 |
359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 |
367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 |

Methods

378 | 379 | 380 | 381 | 382 | 383 | 384 |

(inner) evaluate(time, defaultValues) → {Array.<number>}

385 | 386 | 387 | 388 | 389 | 390 |
391 | Evaluates the array. 392 |
393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 |
Parameters:
403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 |
NameTypeDescription
time 431 | 432 | 433 | number 434 | 435 | 436 | 437 | Evaluation time.
defaultValues 454 | 455 | 456 | FCurveArray~DefaultValues 457 | 458 | 459 | 460 | In case a FCurve does not exist.
472 | 473 | 474 | 475 | 476 | 477 | 478 |
479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 |
Source:
506 |
509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 |
517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 |
Returns:
531 | 532 | 533 | 534 | 535 |
536 |
537 | Type 538 |
539 |
540 | 541 | Array.<number> 542 | 543 | 544 |
545 |
546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 |

Type Definitions

556 | 557 | 558 | 559 | 560 | 561 | 562 |

DefaultValues(index, time) → {number}

563 | 564 | 565 | 566 | 567 | 568 |
569 | Provides a value when a FCurve does not exist. 570 |
571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 |
Parameters:
581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 |
NameTypeDescription
index 609 | 610 | 611 | number 612 | 613 | 614 | 615 | Array index
time 632 | 633 | 634 | number 635 | 636 | 637 | 638 | Evaluation time
650 | 651 | 652 | 653 | 654 | 655 | 656 |
657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 |
Source:
684 |
687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 |
695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 |
Returns:
709 | 710 | 711 |
712 | Value 713 |
714 | 715 | 716 | 717 |
718 |
719 | Type 720 |
721 |
722 | 723 | number 724 | 725 | 726 |
727 |
728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 |
738 | 739 |
740 | 741 | 742 | 743 | 744 |
745 | 746 | 749 | 750 |
751 | 752 |
753 | Documentation generated by JSDoc 3.4.0 on Mon Jan 23 2017 18:51:06 GMT+0100 (Romance Standard Time) 754 |
755 | 756 | 757 | 758 | 759 | -------------------------------------------------------------------------------- /js/docs/global.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Global 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Global

21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 |

32 | 33 | 34 |
35 | 36 |
37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 |
78 | 79 | 80 | 81 | 82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |

Members

96 | 97 | 98 | 99 |

(readonly) Easing :number

100 | 101 | 102 | 103 | 104 |
105 | FCurve easing types. 106 |
107 | 108 | 109 | 110 |
Type:
111 |
    112 |
  • 113 | 114 | number 115 | 116 | 117 |
  • 118 |
119 | 120 | 121 | 122 | 123 | 124 |
Properties:
125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 |
NameTypeDescription
AUTO 154 | 155 | 156 | number 157 | 158 | 159 | 160 | Automatic easing.
IN 177 | 178 | 179 | number 180 | 181 | 182 | 183 | Starts slow.
OUT 200 | 201 | 202 | number 203 | 204 | 205 | 206 | Ends slow.
IN_OUT 223 | 224 | 225 | number 226 | 227 | 228 | 229 | Starts and ends slow.
241 | 242 | 243 | 244 | 245 |
246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 |
Source:
273 |
276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 |
284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 |

(readonly) Extrapolation :number

293 | 294 | 295 | 296 | 297 |
298 | FCurve extrapolation types, before its first keyframe and after its last keyframe. 299 |
300 | 301 | 302 | 303 |
Type:
304 |
    305 |
  • 306 | 307 | number 308 | 309 | 310 |
  • 311 |
312 | 313 | 314 | 315 | 316 | 317 |
Properties:
318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 |
NameTypeDescription
CONSTANT 347 | 348 | 349 | number 350 | 351 | 352 | 353 | Keeps a constant value.
LINEAR 370 | 371 | 372 | number 373 | 374 | 375 | 376 | Continues as straight lines.
388 | 389 | 390 | 391 | 392 |
393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 |
Source:
420 |
423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 |
431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 |

(readonly) Interpolation :number

440 | 441 | 442 | 443 | 444 |
445 | FCurve interpolation types, between two keyframes. 446 |
447 | 448 | 449 | 450 |
Type:
451 |
    452 |
  • 453 | 454 | number 455 | 456 | 457 |
  • 458 |
459 | 460 | 461 | 462 | 463 | 464 |
Properties:
465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 |
NameTypeDescription
CONSTANT 494 | 495 | 496 | number 497 | 498 | 499 | 500 | No interpolation, value gets held.
LINEAR 517 | 518 | 519 | number 520 | 521 | 522 | 523 | Straight-line interpolation.
BEZIER 540 | 541 | 542 | number 543 | 544 | 545 | 546 | Smooth interpolation.
BACK 563 | 564 | 565 | number 566 | 567 | 568 | 569 | Cubic easing with overshoot and settle.
BOUNCE 586 | 587 | 588 | number 589 | 590 | 591 | 592 | Exponentially decaying parabolic bounce.
CIRCULAR 609 | 610 | 611 | number 612 | 613 | 614 | 615 | Circular easing.
CUBIC 632 | 633 | 634 | number 635 | 636 | 637 | 638 | Cubic easing.
ELASTIC 655 | 656 | 657 | number 658 | 659 | 660 | 661 | Exponentially decaying sine wave.
EXPONENTIAL 678 | 679 | 680 | number 681 | 682 | 683 | 684 | Exponential easing.
QUADRATIC 701 | 702 | 703 | number 704 | 705 | 706 | 707 | Quadratic easing.
QUARTIC 724 | 725 | 726 | number 727 | 728 | 729 | 730 | Quartic easing.
QUINTIC 747 | 748 | 749 | number 750 | 751 | 752 | 753 | Quintic easing.
SINUSOIDAL 770 | 771 | 772 | number 773 | 774 | 775 | 776 | Sinusoidal easing.
788 | 789 | 790 | 791 | 792 |
793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 |
Source:
820 |
823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 |
831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 |

(readonly) RotationMode :number

840 | 841 | 842 | 843 | 844 |
845 | Object rotation modes. 846 |
847 | 848 | 849 | 850 |
Type:
851 |
    852 |
  • 853 | 854 | number 855 | 856 | 857 |
  • 858 |
859 | 860 | 861 | 862 | 863 | 864 |
Properties:
865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 |
NameTypeDescription
QUATERNION 894 | 895 | 896 | number 897 | 898 | 899 | 900 | Reads from rotation_quaternion and delta_rotation_quaternion paths.
EULER_XYZ 917 | 918 | 919 | number 920 | 921 | 922 | 923 | Reads from rotation_euler and delta_rotation_euler paths.
EULER_YXZ 940 | 941 | 942 | number 943 | 944 | 945 | 946 | Reads from rotation_euler and delta_rotation_euler paths.
EULER_XZY 963 | 964 | 965 | number 966 | 967 | 968 | 969 | Reads from rotation_euler and delta_rotation_euler paths.
EULER_ZXY 986 | 987 | 988 | number 989 | 990 | 991 | 992 | Reads from rotation_euler and delta_rotation_euler paths.
EULER_YZX 1009 | 1010 | 1011 | number 1012 | 1013 | 1014 | 1015 | Reads from rotation_euler and delta_rotation_euler paths.
EULER_ZYX 1032 | 1033 | 1034 | number 1035 | 1036 | 1037 | 1038 | Reads from rotation_euler and delta_rotation_euler paths.
AXIS_ANGLE 1055 | 1056 | 1057 | number 1058 | 1059 | 1060 | 1061 | Reads from rotation_axis path.
1073 | 1074 | 1075 | 1076 | 1077 |
1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 |
Source:
1105 |
1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 |
1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 |
1131 | 1132 |
1133 | 1134 | 1135 | 1136 | 1137 |
1138 | 1139 | 1142 | 1143 |
1144 | 1145 |
1146 | Documentation generated by JSDoc 3.4.0 on Sun Jul 24 2016 14:31:11 GMT+0200 (Romance Daylight Time) 1147 |
1148 | 1149 | 1150 | 1151 | 1152 | --------------------------------------------------------------------------------