JavaScript animation engine
Merge branch '3.0.0' into pr/271
Julian Garnier53d595e8aa50
diff --git a/README.md b/README.mdindex d58a2955..85ceb728 100644--- a/README.md+++ b/README.md@@ -62,866 +62,4 @@ anime({duration: 2000,loop: true});-```--# API--## Targets--The `targets` property defines the elements or JS `Object`s to animate.--| Types | Examples-| --- | ----| CSS Selectors | `'div'`, `'.item'`, `'path'`, `'#el path'` ...-| DOM Element | `document.querySelector('.item')`-| NodeList | `document.querySelectorAll('.item')`-| `Object` | `{prop1: 100, prop2: 200}`-| `Array` | `['div', '.item', domNode]`--➜ [Targets examples](http://animejs.com/documentation/#cssSelector)--## Animatable properties--| Types | Examples-| --- | ----| CSS | `opacity`, `backgroundColor`, `fontSize` ...-| Transforms | `translateX`, `rotate`, `scale` ...-| Object properties | Any `Object` property containing numerical values-| DOM attributes | Any DOM attributes containing numerical values-| SVG attributes | Any SVG attributes containing numerical values--➜ [Animatable properties examples](http://animejs.com/documentation/#cssProperties)--### CSS--<img src="http://animejs.com/documentation/assets/img/readme/prop-css.gif" width="332" />--Any CSS properties can be animated:--```javascript-anime({- targets: 'div',- left: '80%', // Animate all divs left position to 80%- opacity: .8, // Animate all divs opacity to .8- backgroundColor: '#FFF' // Animate all divs background color to #FFF-});-```--➜ [CSS properties example](http://animejs.com/documentation/#cssProperties)--### Individual CSS transforms--<img src="http://animejs.com/documentation/assets/img/readme/prop-transforms.gif" width="332" />--CSS transforms can be animated individually:--```javascript-anime({- targets: 'div',- translateX: 250, // Animate all divs translateX property to 250px- scale: 2, // Animate all divs scale to 2- rotate: '1turn' // Animate all divs rotation to 1 turn-});-```--➜ [CSS Transforms example](http://animejs.com/documentation/#CSStransforms)--### JavaScript Object properties--<img src="http://animejs.com/documentation/assets/img/readme/prop-js-obj.gif" width="332" />--Any `Object` property containing a numerical value can be animated:--```javascript-var myObject = {- prop1: 0,- prop2: '0%'-}--anime({- targets: myObject,- prop1: 50, // Animate the 'prop1' property from myObject to 50- prop2: '100%' // Animate the 'prop2' property from myObject to 100%-});-```--➜ [Object properties example](http://animejs.com/documentation/#JSobjectProp)--### DOM Attributes--<img src="http://animejs.com/documentation/assets/img/readme/prop-dom-attr.gif" width="332" />--Any DOM Attribute containing a numerical values can be animated:--```html-<input value="0">-```--```javascript-anime({- targets: input,- value: 1000 // Animate the input value to 1000- round: 1 // Remove decimals by rounding the value-});-```--➜ [DOM Attributes example](http://animejs.com/documentation/#domAttributes)--### SVG Attributes--<img src="http://animejs.com/documentation/assets/img/readme/prop-svg-attr.gif" width="332" />--Any SVG Attribute containing a numerical values can be animated:--```html-<svg width="128" height="128" viewBox="0 0 128 128">- <polygon points="64 68.73508918222262 8.574 99.9935923731656 63.35810017508558 67.62284396863708 64 3.993592373165592 64.64189982491442 67.62284396863708 119.426 99.9935923731656"></polygon>-</svg>-```--```javascript-anime({- targets: 'polygon',- points: '64 128 8.574 96 8.574 32 64 0 119.426 32 119.426 96'-});-```--➜ [SVG Attributes example](http://animejs.com/documentation/#svgAttributes)--## Property parameters--<img src="http://animejs.com/documentation/assets/img/readme/prop-parameters.gif" width="332" />--Defines duration, delay and easing for each property animations.<br>-Can be set globally, or individually to each properties:--| Names | Defaults | Types | Info-| --- | --- | --- | ----| duration | `1000` | `number`, `function` | millisecond-| delay | `0` | `number`, `function` | millisecond-| easing | `'easeOutElastic'` | `function` | [See Easing functions](#easing-functions)-| elasticity | `500` | `number`, `function` | Range [0 - 1000]-| round | `false` | `number`, `boolean`, `function` | Power of 10--```javascript-anime({- translateX: {- value: 250,- duration: 800- },- rotate: {- value: 360,- duration: 1800,- easing: 'easeInOutSine'- },- scale: {- value: 2,- duration: 1600,- delay: 800,- easing: 'easeInOutQuart'- },- delay: 250 // All properties except 'scale' inherit 250ms delay-});-```--➜ [Property parameters examples](http://animejs.com/documentation/#duration)--## Function based property parameters--<img src="http://animejs.com/documentation/assets/img/readme/fb-parameters.gif" width="332" />--Get different property parameters for every target of the animation.<br>-The function accepts 3 arguments: `target`, `index`, `targetsLength`.--```javascript-anime({- targets: 'div',- translateX: 250,- rotate: 180,- duration: function(target) {- // Duration based on every div 'data-duration' attribute- return target.getAttribute('data-duration');- },- delay: function(target, index) {- // 100ms delay multiplied by every div index, in ascending order- return index * 100;- },- elasticity: function(target, index, totalTargets) {- // Elasticity multiplied by every div index, in descending order- return 200 + ((totalTargets - index) * 200);- }-});-```--➜ [Function based parameters examples](http://animejs.com/documentation/#functionBasedDuration)--## Animation parameters--<img src="http://animejs.com/documentation/assets/img/readme/anim-parameters.gif" width="332" />--Parameters relative to the animation to specify the direction, the number of loops or autoplay.--| Names | Defaults | Types-| --- | --- | ----| loop | `false` | `number`, `boolean`-| direction | `'normal'` | `'normal'`, `'reverse'`, `'alternate'`-| autoplay | `true` | `boolean`--```javascript-anime({- targets: 'div',- translateX: 100,- duration: 2000,- loop: 3, // Play the animation 3 times- direction: 'reverse', // Play the animation in reverse- autoplay: false // Animation paused by default-});-```--➜ [Animation parameters examples](http://animejs.com/documentation/#alternate)--## Property values--### Single value--Defines the end value of the animation.<br>-Start value is the original target value, or default transforms value.--| Types | Examples | Infos-| --- | --- | ----| Number | `100` | Automatically add original or default unit if needed-| String | `'10em'`, `'1turn'`, `'M21 1v160'`, `'50%'` | Must contains at least one numerical value-| Relative values | `'+=100px'`, `'-=20em'`, `'*=4'` | Add, subtract or multiply the original property value-| Colors | `'#FFF'`, `'rgb(255,0,0)'`, `'hsl(100, 20%, 80%)'` | Accepts 3 or 6 hex digit, rgb, or hsl values--➜ [Values examples](http://animejs.com/documentation/#unitlessValue)--```javascript-anime({- targets: 'div',- translateX: 100, // Add 'px' by default (from 0px to 100px)- rotate: '1turn', // Use 'turn' as unit (from 0turn to 1turn)- scale: '*=2', // Multiply the current scale value by 2 (from 1 to (1 * 2))- backgroundColor: '#FFF', // Animate the background color to #FFF (from 'rgb(0,0,0)' to 'rgb(255,255,255)')- duration: 1500-});-```--### From > To values--<img src="http://animejs.com/documentation/assets/img/readme/value-from-to.gif" width="332" />--Force the animation to start at a certain value.--```javascript-anime({- targets: 'div',- translateX: [100, 200], // Translate X from 100 to 200- rotate: ['.5turn', '1turn'], // Rotate from 180deg to 360deg- scale: ['*=2', 1], // Scale from 2 times the original value to 1,- backgroundColor: ['rgb(255,0,0)', '#FFF'], // Will transition the background color from red to white- duration: 1500-});-```--➜ [Specific initial value example](http://animejs.com/documentation/#specificInitialValue)--### Function based values--<img src="http://animejs.com/documentation/assets/img/readme/value-fb.gif" width="332" />--Same as [function based property parameters](#function-based-property-parameters).<br>-Get different values for every target and property of the animation.<br>-The function accepts 3 arguments: `target`, `index`, `targetsLength`.--```javascript-anime({- targets: 'div',- translateX: function(el) {- return el.getAttribute('data-x');- },- translateY: function(el, i) {- return 50 + (-50 * i);- },- scale: function(el, i, l) {- return (l - i) + .25;- },- rotate: function() { return anime.random(-360, 360); },- duration: function() { return anime.random(800, 1600); },- delay: function() { return anime.random(0, 1000); }-});-```--➜ [Function based value example](http://animejs.com/documentation/#functionBasedPropVal)--### Keyframes--<img src="http://animejs.com/documentation/assets/img/readme/value-keyframes.gif" width="332" />--Keyframes are defined using an `Array` of property Object.<br>-Instance's `duration` is divided by the number of keyframes of each properties if not specified.--```javascript-anime({- targets: 'div',- translateX: [- { value: 250, duration: 1000, delay: 500, elasticity: 0 },- { value: 0, duration: 1000, delay: 500, elasticity: 0 }- ],- translateY: [- { value: -40, duration: 500, elasticity: 100 },- { value: 40, duration: 500, delay: 1000, elasticity: 100 },- { value: 0, duration: 500, delay: 1000, elasticity: 100 }- ],- scaleX: [- { value: 4, duration: 100, delay: 500, easing: 'easeOutExpo' },- { value: 1, duration: 900, elasticity: 300 },- { value: 4, duration: 100, delay: 500, easing: 'easeOutExpo' },- { value: 1, duration: 900, elasticity: 300 }- ],- scaleY: [- { value: [1.75, 1], duration: 500 },- { value: 2, duration: 50, delay: 1000, easing: 'easeOutExpo' },- { value: 1, duration: 450 },- { value: 1.75, duration: 50, delay: 1000, easing: 'easeOutExpo' },- { value: 1, duration: 450 }- ]-});-```--➜ [Specific keyframes properties example](http://animejs.com/documentation/#keyframes)--## Timeline--### Basic timeline--<img src="http://animejs.com/documentation/assets/img/readme/timeline.gif" width="332" />--Play animations in sequence by creating a timeline:--```javascript-var myTimeline = anime.timeline();-```--A timeline accepts the same parameters as an animation: `direction`, `loop` and `autoplay`.--```javascript-var myTimeline = anime.timeline({- direction: 'alternate',- loop: 3,- autoplay: false-});-```--Add animations to the timeline with `.add()` :--```javascript-myTimeline- .add({- targets: '.square',- translateX: 250- })- .add({- targets: '.circle',- translateX: 250- })- .add({- targets: '.triangle',- translateX: 250- });-```--Access timeline children animations with `myTimeline.children`--➜ [Basic timeline example](http://animejs.com/documentation/#basicTimeline)--### Timeline animations offsets--`offset` defines the starting time of an animation on the timeline.--#### Relative offset--<img src="http://animejs.com/documentation/assets/img/readme/timeline-relative.gif" width="332" />--Defines starting time relative to the previous animations duration.--| Types | Examples | Infos-| --- | --- | ----| `+=` | `'+=100'` | Starts 100ms after the previous animation ends-| `-=` | `'-=100'` | Starts 100ms before the previous animation ends-| `*=` | `'*=2'` | Starts at 2 times the previous animations duration--```javascript-myTimeline- .add({- targets: '.square',- translateX: 250- })- .add({- targets: '.circle',- translateX: 250,- offset: '-=600' // Starts 600ms before the previous animation ends- })- .add({- targets: '.triangle',- translateX: 250,- offset: '-=800' // Starts 800ms before the previous animation ends- });-```--➜ [Relative offset example](http://animejs.com/documentation/#relativeOffset)--#### Absolute offset--<img src="http://animejs.com/documentation/assets/img/readme/timeline-absolute.gif" width="332" />--Defines an absolute starting time on the timeline with a number.--```javascript-myTimeline- .add({- targets: '.square',- translateX: 250,- offset: 1000 // Starts at 1000ms- })- .add({- targets: '.circle',- translateX: 250,- offset: 500 // Starts at 500ms- })- .add({- targets: '.triangle',- translateX: 250,- offset: 0 // Starts at 0ms- });-```--➜ [Absolute offset example](http://animejs.com/documentation/absoluteOffset)--## Playback controls--Play, pause, restart, seek animations or timelines.--### Play / Pause--<img src="http://animejs.com/documentation/assets/img/readme/playback-play-pause.gif" width="332" />--```javascript-var playPauseAnim = anime({- targets: 'div',- translateX: 250,- direction: 'alternate',- loop: true,- autoplay: false // prevent the instance from playing-});--playPauseAnim.play(); // Manually play-playPauseAnim.pause(); // Manually pause-```--➜ [Play / Pause example](http://animejs.com/documentation/#playPause)--### Restart--<img src="http://animejs.com/documentation/assets/img/readme/playback-restart.gif" width="332" />--```javascript-var restartAnim = anime({- targets: 'div',- translateX: 250,- direction: 'alternate',- loop: true,- autoplay: false-});--restartAnim.restart(); // Restart the animation and reset the loop count / current direction-```--➜ [Restart example](http://animejs.com/documentation/#restartAnim)--### Reverse--<img src="http://animejs.com/documentation/assets/img/readme/playback-reverse.gif" width="332" />--```javascript-var reverseAnim = anime({- targets: 'div',- translateX: 250,- direction: 'alternate',- loop: true-});--reverseAnim.reverse(); // Change the animation direction-```--➜ [Reverse example](http://animejs.com/documentation/#reverseAnim)--### Seek--<img src="http://animejs.com/documentation/assets/img/readme/playback-seek.gif" width="332" />--Change animations or timelines current time.--```javascript-var seekAnim = anime({- targets: 'div',- translateX: 250,- delay: function(el, i, l) { return i * 100; },- elasticity: 200,- autoplay: false-});--seekAnim.seek(500); // Set the animation current time to 500ms-```--➜ [Seek example](http://animejs.com/documentation/#seekAnim)--## Callbacks--<img src="http://animejs.com/documentation/assets/img/readme/callbacks-all.gif" width="332" />--Execute a function at the beginning, during or when an animation or timeline is completed.--| Names | Types | Arguments | Info-| --- | --- | --- | ----| update | `function`| animation `Object` | Called at time = 0-| begin | `function` | animation `Object` | Called after animation delay is over-| complete | `function` | animation `Object` | Called only after all the loops are completed--➜ [Callbacks examples](http://animejs.com/documentation/#allCallbacks)--### Update--`update()` is called on every frame while the instance is playing.--```javascript-var myAnimation = anime({- targets: '#update .el',- translateX: 250,- delay: 1000,- update: function(anim) {- console.log(anim.currentTime + 'ms'); // Get current animation time with `myAnimation.currentTime`, return value in ms.- console.log(anim.progress + '%'); // Get current animation progress with `myAnimation.progress`, return value in %- }-});-```--➜ [Update example](http://animejs.com/documentation/#update)--### Begin--`begin()` is called once after the delay is finished.--```javascript-var myAnimation = anime({- targets: '#begin .el',- translateX: 250,- delay: 1000,- begin: function(anim) {- console.log(anim.began); // true after 1000ms- }-});-```--Check if the animation has begun with `myAnimation.began`, return `true` or `false`.--➜ [Begin example](http://animejs.com/documentation/#begin)--### Run--`run()` is called every frame after the delay is finished.--```javascript-var myAnimation = anime({- targets: '#run .el',- translateX: 250,- delay: 1000,- run: function(anim) {- console.log(anim.currentTime);- }-});-```--➜ [Run example](http://animejs.com/documentation/#run)--### Complete--`complete()` is called once after the animation is finished.--```javascript-var myAnimation = anime({- targets: '#complete .el',- translateX: 250,- complete: function(anim) {- console.log(anim.completed);- }-});-```--Check if the animation has finished with `myAnimation.completed`, return `true` or `false`.--➜ [Complete example](http://animejs.com/documentation/#complete)--## Promises--`myAnimation.finished` returns a Promise object which will resolve once the animation has finished running.--➜ [Promises example](http://animejs.com/documentation/#finishedPromise)--## SVG--### Motion path--<img src="http://animejs.com/documentation/assets/img/readme/svg-motion-path.gif" width="332" />--Translate and rotate DOM elements along an SVG path:--```javascript-// Create a path `Object`-var path = anime.path('#motionPath path');--var motionPath = anime({- targets: '#motionPath .el',- translateX: path('x'), // Follow the x values from the path `Object`- translateY: path('y'), // Follow the y values from the path `Object`- rotate: path('angle') // Follow the angle values from the path `Object`-});-```--➜ [Motion path example](http://animejs.com/documentation/#motionPath)--### Morphing--<img src="http://animejs.com/documentation/assets/img/readme/svg-morphing.gif" width="332" />--Animate the transition between two SVG shapes:--```html-<svg class="shape" width="128" height="128" viewBox="0 0 128 128">- <polygon points="64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100"></polygon>-</svg>-```--```javascript-var svgAttributes = anime({- targets: '.shape polygon',- points: '64 128 8.574 96 8.574 32 64 0 119.426 32 119.426 96'-});-```--Shapes need to have the same number of points.--➜ [Morphing example](http://animejs.com/documentation/#morphing)--### Line drawing--<img src="http://animejs.com/documentation/assets/img/readme/svg-line-drawing.gif" width="332" />--Line drawing animation of an SVG shape:--```javascript-anime({- targets: '.shape path',- strokeDashoffset: [anime.setDashoffset, 0]-});-```--➜ [Line drawing example](http://animejs.com/documentation/#lineDrawing)--## Easing functions--The `easing` parameter can accept either a string or a custom Bézier curve coordinates (array).--| Types | Examples | Infos-| --- | --- | ----| String | `'easeOutExpo'` | Built in function names-| `Array` | [.91,-0.54,.29,1.56] | Custom Bézier curve coordinates ([x1, y1, x2, y2])--### Built in functions--Linear easing: `'linear'`--Penner's equations:--| easeIn | easeOut | easeInOut-| --- | --- | ----| easeInQuad | easeOutQuad | easeInOutQuad |-| easeInCubic | easeOutCubic | easeInOutCubic-| easeInQuart | easeOutQuart | easeInOutQuart-| easeInQuint | easeOutQuint | easeInOutQuint-| easeInSine | easeOutSine | easeInOutSine-| easeInExpo | easeOutExpo | easeInOutExpo-| easeInCirc | easeOutCirc | easeInOutCirc-| easeInBack | easeOutBack | easeInOutBack-| easeInElastic | easeOutElastic | easeInOutElastic--➜ [Built in easing functions examples](http://animejs.com/documentation/#penner)--Usage:--```javascript-anime({- targets: 'div',- translateX: 100,- easing: 'easeOutExpo' // Default 'easeOutElastic'-});-```--Elasticity of Elastic easings can be configured with the `elasticity` parameters:--```javascript-anime({- targets: 'div',- translateX: 100,- easing: 'easeOutElastic',- elasticity: 600 // Default 500, range [0-1000]-});-```--➜ [Elasticity examples](http://animejs.com/documentation/#elasticity)--### Custom Bézier curves--Define a Bézier curve with an `Array` of 4 coordinates:--```javascript-anime({- targets: 'div',- translateX: 100,- easing: [.91,-0.54,.29,1.56]-});-```--Custom Bézier curves coordinates can be generated here <https://matthewlein.com/ceaser/>--➜ [Custom Bézier curves example](http://animejs.com/documentation/#customBezier)--### Defining custom functions--Expand the built in easing functions from `anime.easings`.--```javascript-// Add custom function-anime.easings['myCustomEasingName'] = function(t) {- return Math.pow(Math.sin(t * 3), 3);-}--// Usage-anime({- targets: 'div',- translateX: 100,- easing: 'myCustomEasingName'-});--// add custom Bézier curve function-anime.easings['myCustomCurve'] = anime.bezier([.91,-0.54,.29,1.56]);--// Usage-anime({- targets: 'div',- translateX: 100,- easing: 'myCustomCurve'-});-```--➜ [Custom easing functions example](http://animejs.com/documentation/#customEasingFunction)--## Helpers--### anime.speed = x--Change all animations speed (from 0 to 1).--```javascript-anime.speed = .5; // Slow down all animations by half of their original speed-```--### anime.running--Return an `Array` of all active Anime instances.--```javascript-anime.running;-```--### anime.remove(target)--Remove one or multiple targets from the animation.--```javascript-anime.remove('.item-2'); // Remove all elements with the class 'item-2'-```--### anime.getValue(target, property)--Get current valid value from an element.--```javascript-anime.getValue('div', 'translateX'); // Return '100px'-```--### anime.path(pathEl)--Create a path Function for motion path animation.<br>-Accepts either a DOM node or CSS selector.--```javascript-var path = anime.path('svg path', 'translateX'); // Return path(attribute)-```--➜ [Motion path example](http://animejs.com/documentation/#motionPath)--### anime.setDashoffset(pathEl)--An helper for line drawing animation.<br>-Sets the 'stroke-dasharray' to the total path length and return its value.--```javascript-anime({- targets: '.shape path',- strokeDashoffset: [anime.pathDashoffset, 0]-});-```--➜ [Line drawing example](http://animejs.com/documentation/#lineDrawing)--### anime.easings--Return the complete list of built in easing functions--```javascript-anime.easings;-```--### anime.bezier(x1, x2, y1, y2)--Return a custom Bézier curve easing function--```javascript-anime.bezier(x1, x2, y1, y2); // Return function(t)-```--### anime.timeline()--Create a timeline to synchronise other Anime instances.--```javascript-var timeline = anime.timeline();-timeline.add([instance1, instance2, ...]);-```--➜ [Timeline examples](http://animejs.com/documentation/#basicTimeline)--### anime.random(x, y)--Generate a random number between two numbers.--```javascript-anime.random(10, 40); // Will return a random number between 10 and 40-```--====--[MIT License](LICENSE.md). © 2017 [Julian Garnier](http://juliangarnier.com).--Thanks to [Animate Plus](https://github.com/bendc/animateplus) and [Velocity](https://github.com/julianshapiro/velocity) that inspired `anime.js` API, [BezierEasing](https://github.com/gre/bezier-easing) and [jQuery UI](https://jqueryui.com/) for the easing system. [Tim Branyen](https://github.com/tbranyen) For the Promise implementation.+```\ No newline at end of filediff --git a/anime.js b/anime.jsindex 9d6c5f0e..4819a0e9 100644--- a/anime.js+++ b/anime.js@@ -1,7 +1,7 @@/*** http://animejs.com* JavaScript animation engine- * @version v2.2.0+ * @version v3.0.0* @author Julian Garnier* @copyright ©2017 Julian Garnier* Released under the MIT license@@ -25,26 +25,33 @@// Defaultsconst defaultInstanceSettings = {- update: undefined,- begin: undefined,- run: undefined,- complete: undefined,+ update: null,+ begin: null,+ run: null,+ complete: null,loop: 1,direction: 'normal',autoplay: true,- offset: 0+ startTime: 0,+ timelineOffset: 0}const defaultTweenSettings = {duration: 1000,delay: 0,- easing: 'easeOutElastic',- elasticity: 500,+ endDelay: 0,+ easing: 'easeOutElastic(1, .5)',round: 0}- const validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skewX', 'skewY', 'perspective'];- let transformString;+ const validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'perspective'];++ // Caching++ const cache = {+ CSS: {},+ springs: {}+ }// Utils@@ -52,6 +59,10 @@return str.indexOf(text) > -1;}+ function applyArguments(func, args) {+ return func.apply(null, args);+ }+const is = {arr: a => Array.isArray(a),obj: a => stringContains(Object.prototype.toString.call(a), 'Object'),@@ -67,6 +78,78 @@col: a => (is.hex(a) || is.rgb(a) || is.hsl(a))}+ function parseEasingParameters(string) {+ const match = /\(([^)]+)\)/.exec(string);+ return match ? match[1].split(',').map(p => parseFloat(p)) : [];+ }++ // Spring solver inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js++ function spring(string, duration) {++ const params = parseEasingParameters(string);+ const mass = minMaxValue(is.und(params[0]) ? 1 : params[0], .1, 100);+ const stiffness = minMaxValue(is.und(params[1]) ? 100 : params[1], .1, 100);+ const damping = minMaxValue(is.und(params[2]) ? 10 : params[2], .1, 100);+ const velocity = minMaxValue(is.und(params[3]) ? 0 : params[3], .1, 100);+ const w0 = Math.sqrt(stiffness / mass);+ const zeta = damping / (2 * Math.sqrt(stiffness * mass));+ const wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;+ const a = 1;+ const b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0;++ function solver(t) {+ let progress = duration ? (duration * t) / 1000 : t;+ if (zeta < 1) {+ progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress));+ } else {+ progress = (a + b * progress) * Math.exp(-progress * w0);+ }+ if (t === 0 || t === 1) return t;+ return 1 - progress;+ }++ function getDuration() {+ const cached = cache.springs[string];+ if (cached) return cached;+ const frame = 1/6;+ let elapsed = 0;+ let rest = 0;+ while(true) {+ elapsed += frame;+ if (solver(elapsed) === 1) {+ rest++;+ if (rest >= 16) break;+ } else {+ rest = 0;+ }+ }+ const duration = elapsed * frame * 1000;+ cache.springs[string] = duration;+ return duration;+ }++ return duration ? solver : getDuration;++ }++ // Elastic easing adapted from jQueryUI http://api.jqueryui.com/easings/++ function elastic(amplitude = 1, period = .5) {+ const a = minMaxValue(amplitude, 1, 10);+ const p = minMaxValue(period, .1, 2);+ return t => {+ return (t === 0 || t === 1) ? t :+ -a * Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2) * Math.asin(1 / a))) * (Math.PI * 2)) / p);+ }+ }++ // Basic steps easing implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function++ function steps(steps = 10) {+ return t => Math.round(t * steps) * (1 / steps);+ }+// BezierEasing https://github.com/gre/bezier-easingconst bezier = (() => {@@ -74,14 +157,14 @@const kSplineTableSize = 11;const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);- function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 };- function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 };- function C (aA1) { return 3.0 * aA1 };+ function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 };+ function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 };+ function C(aA1) { return 3.0 * aA1 };- function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT };- function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) };+ function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT };+ function getSlope(aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) };- function binarySubdivide (aX, aA, aB, mX1, mX2) {+ function binarySubdivide(aX, aA, aB, mX1, mX2) {let currentX, currentT, i = 0;do {currentT = aA + (aB - aA) / 2.0;@@ -91,7 +174,7 @@return currentT;}- function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {+ function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {for (let i = 0; i < 4; ++i) {const currentSlope = getSlope(aGuessT, mX1, mX2);if (currentSlope === 0.0) return aGuessT;@@ -140,8 +223,7 @@return x => {if (mX1 === mY1 && mX2 === mY2) return x;- if (x === 0) return 0;- if (x === 1) return 1;+ if (x === 0 || x === 1) return x;return calcBezier(getTForX(x), mY1, mY2);}@@ -155,71 +237,74 @@const names = ['Quad', 'Cubic', 'Quart', 'Quint', 'Sine', 'Expo', 'Circ', 'Back', 'Elastic'];- // Elastic easing adapted from jQueryUI http://api.jqueryui.com/easings/-- function elastic(t, p) {- return t === 0 || t === 1 ? t :- -Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2.0) * Math.asin(1))) * (Math.PI * 2)) / p );- }-// Approximated Penner equations http://matthewlein.com/ceaser/- const equations = {+ const penner = {In: [- [0.550, 0.085, 0.680, 0.530], /* InQuad */- [0.550, 0.055, 0.675, 0.190], /* InCubic */- [0.895, 0.030, 0.685, 0.220], /* InQuart */- [0.755, 0.050, 0.855, 0.060], /* InQuint */- [0.470, 0.000, 0.745, 0.715], /* InSine */- [0.950, 0.050, 0.795, 0.035], /* InExpo */- [0.600, 0.040, 0.980, 0.335], /* InCirc */- [0.600, -0.280, 0.735, 0.045], /* InBack */- elastic /* InElastic */- ], Out: [- [0.250, 0.460, 0.450, 0.940], /* OutQuad */- [0.215, 0.610, 0.355, 1.000], /* OutCubic */- [0.165, 0.840, 0.440, 1.000], /* OutQuart */- [0.230, 1.000, 0.320, 1.000], /* OutQuint */- [0.390, 0.575, 0.565, 1.000], /* OutSine */- [0.190, 1.000, 0.220, 1.000], /* OutExpo */- [0.075, 0.820, 0.165, 1.000], /* OutCirc */- [0.175, 0.885, 0.320, 1.275], /* OutBack */- (t, f) => 1 - elastic(1 - t, f) /* OutElastic */- ], InOut: [- [0.455, 0.030, 0.515, 0.955], /* InOutQuad */- [0.645, 0.045, 0.355, 1.000], /* InOutCubic */- [0.770, 0.000, 0.175, 1.000], /* InOutQuart */- [0.860, 0.000, 0.070, 1.000], /* InOutQuint */- [0.445, 0.050, 0.550, 0.950], /* InOutSine */- [1.000, 0.000, 0.000, 1.000], /* InOutExpo */- [0.785, 0.135, 0.150, 0.860], /* InOutCirc */- [0.680, -0.550, 0.265, 1.550], /* InOutBack */- (t, f) => t < .5 ? elastic(t * 2, f) / 2 : 1 - elastic(t * -2 + 2, f) / 2 /* InOutElastic */+ [0.550, 0.085, 0.680, 0.530], /* inQuad */+ [0.550, 0.055, 0.675, 0.190], /* inCubic */+ [0.895, 0.030, 0.685, 0.220], /* inQuart */+ [0.755, 0.050, 0.855, 0.060], /* inQuint */+ [0.470, 0.000, 0.745, 0.715], /* inSine */+ [0.950, 0.050, 0.795, 0.035], /* inExpo */+ [0.600, 0.040, 0.980, 0.335], /* inCirc */+ [0.600,-0.280, 0.735, 0.045], /* inBack */+ elastic /* inElastic */+ ],+ Out: [+ [0.250, 0.460, 0.450, 0.940], /* outQuad */+ [0.215, 0.610, 0.355, 1.000], /* outCubic */+ [0.165, 0.840, 0.440, 1.000], /* outQuart */+ [0.230, 1.000, 0.320, 1.000], /* outQuint */+ [0.390, 0.575, 0.565, 1.000], /* outSine */+ [0.190, 1.000, 0.220, 1.000], /* outExpo */+ [0.075, 0.820, 0.165, 1.000], /* outCirc */+ [0.175, 0.885, 0.320, 1.275], /* outBack */+ (a, p) => t => 1 - elastic(a, p)(1 - t) /* outElastic */+ ],+ InOut: [+ [0.455, 0.030, 0.515, 0.955], /* inOutQuad */+ [0.645, 0.045, 0.355, 1.000], /* inOutCubic */+ [0.770, 0.000, 0.175, 1.000], /* inOutQuart */+ [0.860, 0.000, 0.070, 1.000], /* inOutQuint */+ [0.445, 0.050, 0.550, 0.950], /* inOutSine */+ [1.000, 0.000, 0.000, 1.000], /* inOutExpo */+ [0.785, 0.135, 0.150, 0.860], /* inOutCirc */+ [0.680,-0.550, 0.265, 1.550], /* inOutBack */+ (a, p) => t => t < .5 ? elastic(a, p)(t * 2) / 2 : 1 - elastic(a, p)(t * -2 + 2) / 2 /* inOutElastic */]}- let functions = {- linear: bezier(0.250, 0.250, 0.750, 0.750)+ let eases = {+ linear: [0.250, 0.250, 0.750, 0.750]}- for (let type in equations) {- equations[type].forEach((f, i) => {- functions['ease'+type+names[i]] = is.fnc(f) ? f : bezier.apply(this, f);+ for (let equation in penner) {+ penner[equation].forEach((ease, i) => {+ eases['ease'+equation+names[i]] = ease;});}- return functions;+ return eases;})();- // Strings-- function stringToHyphens(str) {- return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();+ function parseEasings(tween) {+ const string = tween.easing;+ const name = string.split('(')[0];+ const args = parseEasingParameters(string);+ const ease = easings[name];+ switch (name) {+ case 'spring' : return spring(string, tween.duration);+ case 'cubicBezier' : return applyArguments(bezier, args);+ case 'steps' : return applyArguments(steps, args);+ default : return is.fnc(ease) ? applyArguments(ease, args) : applyArguments(bezier, ease);+ }}+ // Strings+function selectString(str) {- if (is.col(str)) return;try {let nodes = document.querySelectorAll(str);return nodes;@@ -299,9 +384,9 @@function hslToRgba(hslValue) {const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);- const h = parseInt(hsl[1]) / 360;- const s = parseInt(hsl[2]) / 100;- const l = parseInt(hsl[3]) / 100;+ const h = parseInt(hsl[1], 10) / 360;+ const s = parseInt(hsl[2], 10) / 100;+ const l = parseInt(hsl[3], 10) / 100;const a = hsl[4] || 1;function hue2rgb(p, q, t) {if (t < 0) t += 1;@@ -353,43 +438,67 @@return val(animatable.target, animatable.id, animatable.total);}- function getCSSValue(el, prop) {+ function getAttribute(el, prop) {+ return el.getAttribute(prop);+ }++ function convertPxToUnit(el, value, unit) {+ const valueUnit = getUnit(value);+ if (arrayContains([unit, 'deg', 'rad', 'turn'], valueUnit)) return value;+ const cached = cache.CSS[value + unit];+ if (!is.und(cached)) return cached;+ const baseline = 100;+ const tempEl = document.createElement(el.tagName);+ const parentEl = el.parentNode || document.body;+ parentEl.appendChild(tempEl);+ tempEl.style.position = 'absolute';+ tempEl.style.width = baseline + unit;+ const factor = baseline / tempEl.offsetWidth;+ parentEl.removeChild(tempEl);+ const convertedUnit = factor * parseFloat(value);+ cache.CSS[value + unit] = convertedUnit;+ return convertedUnit;+ }++ function getCSSValue(el, prop, unit) {if (prop in el.style) {- return getComputedStyle(el).getPropertyValue(stringToHyphens(prop)) || '0';+ const uppercasePropName = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();+ const value = el.style[prop] || getComputedStyle(el).getPropertyValue(uppercasePropName) || '0';+ return unit ? convertPxToUnit(el, value, unit) : value;}}function getAnimationType(el, prop) {+ if (is.dom(el) && (getAttribute(el, prop) || (is.svg(el) && el[prop]))) return 'attribute';if (is.dom(el) && arrayContains(validTransforms, prop)) return 'transform';- if (is.dom(el) && (el.getAttribute(prop) || (is.svg(el) && el[prop]))) return 'attribute';if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) return 'css';if (el[prop] != null) return 'object';}- function getTransformValue(el, propName) {- const defaultUnit = getTransformUnit(propName);- const defaultVal = stringContains(propName, 'scale') ? 1 : 0 + defaultUnit;- const str = el.style.transform;- if (!str) return defaultVal;- let match = [];- let props = [];- let values = [];- const rgx = /(\w+)\((.+?)\)/g;- while (match = rgx.exec(str)) {- props.push(match[1]);- values.push(match[2]);- }- const value = filterArray(values, (val, i) => props[i] === propName);- return value.length ? value[0] : defaultVal;+ function getElementTransforms(el) {+ if (!is.dom(el)) return;+ const str = el.style.transform || '';+ const reg = /(\w+)\(([^)]*)\)/g;+ const transforms = new Map();+ let m; while (m = reg.exec(str)) transforms.set(m[1], m[2]);+ return transforms;+ }++ function getTransformValue(el, propName, animatable, unit) {+ const defaultVal = stringContains(propName, 'scale') ? 1 : 0 + getTransformUnit(propName);+ const value = getElementTransforms(el).get(propName) || defaultVal;+ animatable.transforms.list.set(propName, value);+ animatable.transforms['last'] = propName;+ return unit ? convertPxToUnit(el, value, unit) : value;}- function getOriginalTargetValue(target, propName) {+ function getOriginalTargetValue(target, propName, unit, animatable) {switch (getAnimationType(target, propName)) {- case 'transform': return getTransformValue(target, propName);- case 'css': return getCSSValue(target, propName);- case 'attribute': return target.getAttribute(propName);+ case 'transform': return getTransformValue(target, propName, animatable, unit);+ case 'css': return getCSSValue(target, propName, unit);+ case 'attribute': return getAttribute(target, propName);+ default: return target[propName] || 0;}- return target[propName] || 0;}function getRelativeValue(to, from) {@@ -412,25 +521,25 @@return unit && !/\s/g.test(val) ? unitLess + unit : unitLess;}- // getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes.+ // getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes// adapted from https://gist.github.com/SebLambla/3e0550c496c236709744function getDistance(p1, p2) {- return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));+ return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));}function getCircleLength(el) {- return 2 * Math.PI * el.getAttribute('r');+ return Math.PI * 2 * getAttribute(el, 'r');}function getRectLength(el) {- return (el.getAttribute('width') * 2) + (el.getAttribute('height') * 2);+ return (getAttribute(el, 'width') * 2) + (getAttribute(el, 'height') * 2);}function getLineLength(el) {return getDistance(- {x: el.getAttribute('x1'), y: el.getAttribute('y1')},- {x: el.getAttribute('x2'), y: el.getAttribute('y2')}+ {x: getAttribute(el, 'x1'), y: getAttribute(el, 'y1')},+ {x: getAttribute(el, 'x2'), y: getAttribute(el, 'y2')});}@@ -475,10 +584,10 @@function getPath(path, percent) {const el = is.str(path) ? selectString(path)[0] : path;const p = percent || 100;- return function(prop) {+ return function(property) {return {- el: el,- property: prop,+ el,+ property,totalLength: getTotalLength(el) * (p / 100)}}@@ -521,7 +630,7 @@function getAnimatables(targets) {const parsed = parseTargets(targets);return parsed.map((t, i) => {- return {target: t, id: i, total: parsed.length};+ return {target: t, id: i, total: parsed.length, transforms: { list: getElementTransforms(t) } };});}@@ -529,6 +638,8 @@function normalizePropertyTweens(prop, tweenSettings) {let settings = cloneObject(tweenSettings);+ // Override duration if easing is a spring+ if (/^spring/.test(settings.easing)) settings.duration = spring(settings.easing);if (is.arr(prop)) {const l = prop.length;const isFromTo = (l === 2 && !is.obj(prop[0]));@@ -540,25 +651,21 @@prop = {value: prop};}}- return toArray(prop).map((v, i) => {+ const propArray = is.arr(prop) ? prop : [prop];+ return propArray.map((v, i) => {+ const obj = (is.obj(v) && !is.pth(v)) ? v : {value: v};// Default delay value should be applied only on the first tween- const delay = !i ? tweenSettings.delay : 0;- // Use path object as a tween value- let obj = is.obj(v) && !is.pth(v) ? v : {value: v};- // Set default delay value- if (is.und(obj.delay)) obj.delay = delay;+ if (is.und(obj.delay)) obj.delay = !i ? tweenSettings.delay : 0;return obj;}).map(k => mergeObjects(k, settings));}function getProperties(instanceSettings, tweenSettings, params) {let properties = [];- const settings = mergeObjects(instanceSettings, tweenSettings);for (let p in params) {- if (!settings.hasOwnProperty(p) && p !== 'targets') {+ if (!instanceSettings.hasOwnProperty(p) && !tweenSettings.hasOwnProperty(p) && p !== 'targets') {properties.push({name: p,- offset: settings['offset'],tweens: normalizePropertyTweens(params[p], tweenSettings)});}@@ -583,26 +690,23 @@return t;}- function normalizeEasing(val) {- return is.arr(val) ? bezier.apply(this, val) : easings[val];- }-function normalizeTweens(prop, animatable) {let previousTween;return prop.tweens.map(t => {- let tween = normalizeTweenValues(t, animatable);+ const tween = normalizeTweenValues(t, animatable);const tweenValue = tween.value;- const originalValue = getOriginalTargetValue(animatable.target, prop.name);+ const to = is.arr(tweenValue) ? tweenValue[1] : tweenValue;+ const toUnit = getUnit(to);+ const originalValue = getOriginalTargetValue(animatable.target, prop.name, toUnit, animatable);const previousValue = previousTween ? previousTween.to.original : originalValue;const from = is.arr(tweenValue) ? tweenValue[0] : previousValue;- const to = getRelativeValue(is.arr(tweenValue) ? tweenValue[1] : tweenValue, from);- const unit = getUnit(to) || getUnit(from) || getUnit(originalValue);+ const fromUnit = getUnit(from) || getUnit(originalValue);+ const unit = toUnit || fromUnit;tween.from = decomposeValue(from, unit);- tween.to = decomposeValue(to, unit);- tween.start = previousTween ? previousTween.end : prop.offset;- tween.end = tween.start + tween.delay + tween.duration;- tween.easing = normalizeEasing(tween.easing);- tween.elasticity = (1000 - minMaxValue(tween.elasticity, 1, 999)) / 1000;+ tween.to = decomposeValue(getRelativeValue(to, from), unit);+ tween.start = previousTween ? previousTween.end : 0;+ tween.end = tween.start + tween.delay + tween.duration + tween.endDelay;+ tween.easing = parseEasings(tween);tween.isPath = is.pth(tweenValue);tween.isColor = is.col(tween.from.original);if (tween.isColor) tween.round = 1;@@ -613,13 +717,19 @@// Tween progress- const setTweenProgress = {+ const setProgressValue = {css: (t, p, v) => t.style[p] = v,attribute: (t, p, v) => t.setAttribute(p, v),object: (t, p, v) => t[p] = v,- transform: (t, p, v, transforms, id) => {- if (!transforms[id]) transforms[id] = [];- transforms[id].push(`${p}(${v})`);+ transform: (t, p, v, transforms, manual) => {+ transforms.list.set(p, v);+ if (p === transforms.last || manual) {+ let str = '';+ transforms.list.forEach((value, prop) => {+ str += `${prop}(${value}) `;+ });+ t.style.transform = str;+ }}}@@ -650,12 +760,12 @@// Create Instance- function getInstanceTimings(type, animations, instanceSettings, tweenSettings) {+ function getInstanceTimings(type, animations, tweenSettings) {const isDelay = (type === 'delay');if (animations.length) {return (isDelay ? Math.min : Math.max).apply(Math, animations.map(anim => anim[type]));} else {- return isDelay ? tweenSettings.delay : instanceSettings.offset + tweenSettings.delay + tweenSettings.duration;+ return isDelay ? tweenSettings.delay : tweenSettings.delay + tweenSettings.duration;}}@@ -666,45 +776,68 @@const properties = getProperties(instanceSettings, tweenSettings, params);const animations = getAnimations(animatables, properties);return mergeObjects(instanceSettings, {+ states: {default: params},children: [],animatables: animatables,animations: animations,- duration: getInstanceTimings('duration', animations, instanceSettings, tweenSettings),- delay: getInstanceTimings('delay', animations, instanceSettings, tweenSettings)+ duration: getInstanceTimings('duration', animations, tweenSettings),+ delay: getInstanceTimings('delay', animations, tweenSettings)});}// Corelet activeInstances = [];- let raf = 0;+ let pausedInstances = [];+ let raf;const engine = (() => {- function play() { raf = requestAnimationFrame(step); };+ function play() {+ raf = requestAnimationFrame(step);+ }function step(t) {- const activeLength = activeInstances.length;- if (activeLength) {+ let activeInstancesLength = activeInstances.length;+ if (activeInstancesLength) {let i = 0;- while (i < activeLength) {- if (activeInstances[i]) activeInstances[i].tick(t);+ while (i < activeInstancesLength) {+ const activeInstance = activeInstances[i];+ if (!activeInstance.paused) {+ activeInstance.tick(t);+ } else {+ const instanceIndex = activeInstances.indexOf(activeInstance);+ if (instanceIndex > -1) {+ activeInstances.splice(instanceIndex, 1);+ activeInstancesLength = activeInstances.length;+ }+ }i++;}play();} else {- cancelAnimationFrame(raf);- raf = 0;+ raf = cancelAnimationFrame(raf);}}return play;})();+ function handleVisibilityChange() {+ if (document.hidden) {+ activeInstances.forEach(ins => ins.pause());+ pausedInstances = activeInstances.slice(0);+ activeInstances = [];+ } else {+ pausedInstances.forEach(ins => ins.play());+ }+ }++ document.addEventListener('visibilitychange', handleVisibilityChange);// Public Instancefunction anime(params = {}) {- let now, startTime, lastTime = 0;-+ let startTime = 0, lastTime = 0, now = 0;+ let children, childrenLength = 0;let resolve = null;function makePromise() {@@ -717,6 +850,12 @@function toggleInstanceDirection() {instance.reversed = !instance.reversed;+ children.forEach(child => child.reversed = instance.reversed);+ }++ function resetTime() {+ startTime = 0;+ lastTime = adjustTime(instance.currentTime) * (1 / anime.speed);}function adjustTime(time) {@@ -724,18 +863,15 @@}function syncInstanceChildren(time) {- const children = instance.children;- const childrenLength = children.length;if (time >= instance.currentTime) {- for (let i = 0; i < childrenLength; i++) children[i].seek(time);+ for (let i = 0; i < childrenLength; i++) children[i].seek(time - children[i].timelineOffset);} else {- for (let i = childrenLength; i--;) children[i].seek(time);+ for (let i = childrenLength; i--;) children[i].seek(time - children[i].timelineOffset);}}function setAnimationsProgress(insTime) {let i = 0;- let transforms = {};const animations = instance.animations;const animationsLength = animations.length;while (i < animationsLength) {@@ -747,12 +883,12 @@// Only check for keyframes if there is more than one tweenif (tweenLength) tween = filterArray(tweens, t => (insTime < t.end))[0] || tween;const elapsed = minMaxValue(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;- const eased = isNaN(elapsed) ? 1 : tween.easing(elapsed, tween.elasticity);+ const eased = isNaN(elapsed) ? 1 : tween.easing(elapsed);const strings = tween.to.strings;const round = tween.round;- let numbers = [];- let progress;+ const numbers = [];const toNumbersLength = tween.to.numbers.length;+ let progress;for (let n = 0; n < toNumbersLength; n++) {let value;const toNumber = tween.to.numbers[n];@@ -788,22 +924,11 @@}}}- setTweenProgress[anim.type](animatable.target, anim.property, progress, transforms, animatable.id);+ setProgressValue[anim.type](animatable.target, anim.property, progress, animatable.transforms);anim.currentValue = progress;i++;}- const transformsLength = Object.keys(transforms).length;- if (transformsLength) {- for (let id = 0; id < transformsLength; id++) {- if (!transformString) {- const t = 'transform';- transformString = (getCSSValue(document.body, t) ? t : `-webkit-${t}`);- }- instance.animatables[id].target.style[transformString] = transforms[id].join(' ');- }- }instance.currentTime = insTime;- instance.progress = (insTime / instance.duration) * 100;}function setCallback(cb) {@@ -818,38 +943,37 @@function setInstanceProgress(engineTime) {const insDuration = instance.duration;- const insOffset = instance.offset;- const insStart = insOffset + instance.delay;- const insCurrentTime = instance.currentTime;- const insReversed = instance.reversed;+ const insDelay = instance.delay;const insTime = adjustTime(engineTime);- if (instance.children.length) syncInstanceChildren(insTime);- if (insTime >= insStart || !insDuration) {+ instance.progress = minMaxValue((insTime / insDuration) * 100, 0, 100);+ if (children) syncInstanceChildren(insTime);+ if (insTime >= insDelay || !insDuration) {if (!instance.began) {instance.began = true;setCallback('begin');}setCallback('run');}- if (insTime > insOffset && insTime < insDuration) {+ if (insTime > insDelay && insTime < insDuration) {setAnimationsProgress(insTime);} else {- if (insTime <= insOffset && insCurrentTime !== 0) {+ if (insTime <= insDelay && instance.currentTime !== 0) {setAnimationsProgress(0);- if (insReversed) countIteration();+ if (instance.reversed) countIteration();}- if ((insTime >= insDuration && insCurrentTime !== insDuration) || !insDuration) {+ if ((insTime >= insDuration && instance.currentTime !== insDuration) || !insDuration) {setAnimationsProgress(insDuration);- if (!insReversed) countIteration();+ if (!instance.reversed) countIteration();}}setCallback('update');if (engineTime >= insDuration) {+ lastTime = 0;if (instance.remaining) {startTime = now;if (instance.direction === 'alternate') toggleInstanceDirection();} else {- instance.pause();+ instance.paused = true;if (!instance.completed) {instance.completed = true;setCallback('complete');@@ -859,7 +983,6 @@}}}- lastTime = 0;}}@@ -873,17 +996,16 @@instance.completed = false;instance.reversed = direction === 'reverse';instance.remaining = direction === 'alternate' && loops === 1 ? 2 : loops;+ children = instance.children;+ childrenLength = children.length;+ for (let i = childrenLength; i--;) instance.children[i].reset();setAnimationsProgress(0);- for (let i = instance.children.length; i--; ){- instance.children[i].reset();- }}instance.tick = function(t) {now = t;if (!startTime) startTime = now;- const engineTime = ((lastTime * (1 / anime.speed)) + now - startTime) * anime.speed;- setInstanceProgress(engineTime);+ setInstanceProgress((now + (lastTime - startTime)) * anime.speed);}instance.seek = function(time) {@@ -891,24 +1013,20 @@}instance.pause = function() {- const i = activeInstances.indexOf(instance);- if (i > -1) activeInstances.splice(i, 1);instance.paused = true;}instance.play = function() {if (!instance.paused) return;instance.paused = false;- startTime = 0;- lastTime = adjustTime(instance.currentTime);+ resetTime();activeInstances.push(instance);if (!raf) engine();}instance.reverse = function() {toggleInstanceDirection();- startTime = 0;- lastTime = adjustTime(instance.currentTime);+ resetTime();}instance.restart = function() {@@ -917,10 +1035,30 @@instance.play();}+ instance.animateTo = function(stateName, paramsOverrides = {}, bypassAnimation) {+ const nextState = instance.states[stateName];+ const defaultState = instance.states.default;+ const params = mergeObjects(paramsOverrides, mergeObjects(nextState, defaultState));+ const animation = anime(params);+ if (!bypassAnimation) {+ animation.play();+ } else {+ animation.seek(animation.duration);+ }+ }++ instance.goTo = function(stateName, paramsOverrides) {+ instance.animateTo(stateName, paramsOverrides, true);+ }+instance.finished = promise;instance.reset();+ if (instance.startTime) {+ setInstanceProgress(instance.startTime - (instance.duration * Math.floor(instance.startTime / instance.duration)));+ }+if (instance.autoplay) instance.play();return instance;@@ -929,45 +1067,54 @@// Remove targets from animation+ function removeTargetsFromAnimations(targetsArray, animations) {+ for (let a = animations.length; a--;) {+ if (arrayContains(targetsArray, animations[a].animatable.target)) {+ animations.splice(a, 1);+ }+ }+ }+function removeTargets(targets) {const targetsArray = parseTargets(targets);for (let i = activeInstances.length; i--;) {const instance = activeInstances[i];const animations = instance.animations;- for (let a = animations.length; a--;) {- if (arrayContains(targetsArray, animations[a].animatable.target)) {- animations.splice(a, 1);- if (!animations.length) instance.pause();- }+ const children = instance.children;+ removeTargetsFromAnimations(targetsArray, animations);+ for (let c = children.length; c--;) {+ const child = children[c];+ const childAnimations = child.animations;+ removeTargetsFromAnimations(targetsArray, childAnimations);+ if (!childAnimations.length && !child.children.length) children.splice(c, 1);}+ if (!animations.length && !children.length) instance.pause();}}// Timeline- function timeline(params) {+ function timeline(params = {}) {let tl = anime(params);tl.pause();tl.duration = 0;- tl.add = function(instancesParams) {- tl.children.forEach(i => { i.began = true; i.completed = true; });- toArray(instancesParams).forEach(instanceParams => {- let insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params || {}));- insParams.targets = insParams.targets || params.targets;- const tlDuration = tl.duration;- const insOffset = insParams.offset;- insParams.autoplay = false;- insParams.direction = tl.direction;- insParams.offset = is.und(insOffset) ? tlDuration : getRelativeValue(insOffset, tlDuration);- tl.began = true;- tl.completed = true;- tl.seek(insParams.offset);- const ins = anime(insParams);- ins.began = true;- ins.completed = true;- if (ins.duration > tlDuration) tl.duration = ins.duration;- tl.children.push(ins);- });+ tl.add = function(instanceParams, timelineOffset) {+ function passThrough(ins) { ins.began = true; ins.completed = true; };+ tl.children.forEach(passThrough);+ let insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));+ insParams.targets = insParams.targets || params.targets;+ const tlDuration = tl.duration;+ insParams.autoplay = false;+ insParams.direction = tl.direction;+ insParams.timelineOffset = is.und(timelineOffset) ? tlDuration : getRelativeValue(timelineOffset, tlDuration);+ passThrough(tl);+ tl.seek(insParams.timelineOffset);+ const ins = anime(insParams);+ passThrough(ins);+ const totalDuration = ins.duration + insParams.timelineOffset;+ if (is.fnc(tl.delay)) tl.delay = ins.delay;+ if (is.fnc(tlDuration) || totalDuration > tlDuration) tl.duration = totalDuration;+ tl.children.push(ins);tl.seek(0);tl.reset();if (tl.autoplay) tl.restart();@@ -976,16 +1123,15 @@return tl;}- anime.version = '2.2.0';+ anime.version = '3.0.0';anime.speed = 1;anime.running = activeInstances;anime.remove = removeTargets;anime.getValue = getOriginalTargetValue;anime.path = getPath;anime.setDashoffset = setDashoffset;- anime.bezier = bezier;- anime.easings = easings;anime.timeline = timeline;+ anime.easings = easings;anime.random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;return anime;diff --git a/anime.min.js b/anime.min.jsindex c3993246..04a162ee 100644--- a/anime.min.js+++ b/anime.min.js@@ -2,32 +2,31 @@2017 Julian GarnierReleased under the MIT license*/-var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,r,p){if(p.get||p.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[r]=p.value)};$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";-$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++};-$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(e){var r=0;return $jscomp.iteratorPrototype(function(){return r<e.length?{done:!1,value:e[r++]}:{done:!0}})};-$jscomp.iteratorPrototype=function(e){$jscomp.initSymbolIterator();e={next:e};e[$jscomp.global.Symbol.iterator]=function(){return this};return e};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(e,r){$jscomp.initSymbolIterator();e instanceof String&&(e+="");var p=0,m={next:function(){if(p<e.length){var u=p++;return{value:r(u,e[u]),done:!1}}m.next=function(){return{done:!0,value:void 0}};return m.next()}};m[Symbol.iterator]=function(){return m};return m};-$jscomp.polyfill=function(e,r,p,m){if(r){p=$jscomp.global;e=e.split(".");for(m=0;m<e.length-1;m++){var u=e[m];u in p||(p[u]={});p=p[u]}e=e[e.length-1];m=p[e];r=r(m);r!=m&&null!=r&&$jscomp.defineProperty(p,e,{configurable:!0,writable:!0,value:r})}};$jscomp.polyfill("Array.prototype.keys",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6-impl","es3");var $jscomp$this=this;-(function(e,r){"function"===typeof define&&define.amd?define([],r):"object"===typeof module&&module.exports?module.exports=r():e.anime=r()})(this,function(){function e(a){if(!h.col(a))try{return document.querySelectorAll(a)}catch(c){}}function r(a,c){for(var d=a.length,b=2<=arguments.length?arguments[1]:void 0,f=[],n=0;n<d;n++)if(n in a){var k=a[n];c.call(b,k,n,a)&&f.push(k)}return f}function p(a){return a.reduce(function(a,d){return a.concat(h.arr(d)?p(d):d)},[])}function m(a){if(h.arr(a))return a;-h.str(a)&&(a=e(a)||a);return a instanceof NodeList||a instanceof HTMLCollection?[].slice.call(a):[a]}function u(a,c){return a.some(function(a){return a===c})}function C(a){var c={},d;for(d in a)c[d]=a[d];return c}function D(a,c){var d=C(a),b;for(b in a)d[b]=c.hasOwnProperty(b)?c[b]:a[b];return d}function z(a,c){var d=C(a),b;for(b in c)d[b]=h.und(a[b])?c[b]:a[b];return d}function T(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,c,d,k){return c+c+d+d+k+k});var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);-a=parseInt(c[1],16);var d=parseInt(c[2],16),c=parseInt(c[3],16);return"rgba("+a+","+d+","+c+",1)"}function U(a){function c(a,c,b){0>b&&(b+=1);1<b&&--b;return b<1/6?a+6*(c-a)*b:.5>b?c:b<2/3?a+(c-a)*(2/3-b)*6:a}var d=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a=parseInt(d[1])/360;var b=parseInt(d[2])/100,f=parseInt(d[3])/100,d=d[4]||1;if(0==b)f=b=a=f;else{var n=.5>f?f*(1+b):f+b-f*b,k=2*f-n,f=c(k,n,a+1/3),b=c(k,n,a);a=c(k,n,a-1/3)}return"rgba("+-255*f+","+255*b+","+255*a+","+d+")"}function y(a){if(a=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a))return a[2]}function V(a){if(-1<a.indexOf("translate")||"perspective"===a)return"px";if(-1<a.indexOf("rotate")||-1<a.indexOf("skew"))return"deg"}function I(a,c){return h.fnc(a)?a(c.target,c.id,c.total):a}function E(a,c){if(c in a.style)return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())||"0"}function J(a,c){if(h.dom(a)&&-u(W,c))return"transform";if(h.dom(a)&&(a.getAttribute(c)||h.svg(a)&&a[c]))return"attribute";if(h.dom(a)&&"transform"!==c&&E(a,c))return"css";if(null!=a[c])return"object"}function X(a,c){var d=V(c),d=-1<c.indexOf("scale")?1:0+d;a=a.style.transform;if(!a)return d;for(var b=[],f=[],n=[],k=/(\w+)\((.+?)\)/g;b=k.exec(a);)f.push(b[1]),n.push(b[2]);a=r(n,function(a,b){return f[b]===c});return a.length?a[0]:d}function K(a,c){switch(J(a,c)){case "transform":return X(a,c);case "css":return E(a,c);case "attribute":return a.getAttribute(c)}return a[c]||-0}function L(a,c){var d=/^(\*=|\+=|-=)/.exec(a);if(!d)return a;var b=y(a)||0;c=parseFloat(c);a=parseFloat(a.replace(d[0],""));switch(d[0][0]){case "+":return c+a+b;case "-":return c-a+b;case "*":return c*a+b}}function F(a,c){return Math.sqrt(Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2))}function M(a){a=a.points;for(var c=0,d,b=0;b<a.numberOfItems;b++){var f=a.getItem(b);0<b&&(c+=F(d,f));d=f}return c}function N(a){if(a.getTotalLength)return a.getTotalLength();switch(a.tagName.toLowerCase()){case "circle":return 2*-Math.PI*a.getAttribute("r");case "rect":return 2*a.getAttribute("width")+2*a.getAttribute("height");case "line":return F({x:a.getAttribute("x1"),y:a.getAttribute("y1")},{x:a.getAttribute("x2"),y:a.getAttribute("y2")});case "polyline":return M(a);case "polygon":var c=a.points;return M(a)+F(c.getItem(c.numberOfItems-1),c.getItem(0))}}function Y(a,c){function d(b){b=void 0===b?0:b;return a.el.getPointAtLength(1<=c+b?c+b:0)}var b=d(),f=d(-1),n=d(1);switch(a.property){case "x":return b.x;case "y":return b.y;-case "angle":return 180*Math.atan2(n.y-f.y,n.x-f.x)/Math.PI}}function O(a,c){var d=/-?\d*\.?\d+/g,b;b=h.pth(a)?a.totalLength:a;if(h.col(b))if(h.rgb(b)){var f=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b=f?"rgba("+f[1]+",1)":b}else b=h.hex(b)?T(b):h.hsl(b)?U(b):void 0;else f=(f=y(b))?b.substr(0,b.length-f.length):b,b=c&&!/\s/g.test(b)?f+c:f;b+="";return{original:b,numbers:b.match(d)?b.match(d).map(Number):[0],strings:h.str(a)||c?b.split(d):[]}}function P(a){a=a?p(h.arr(a)?a.map(m):m(a)):[];return r(a,-function(a,d,b){return b.indexOf(a)===d})}function Z(a){var c=P(a);return c.map(function(a,b){return{target:a,id:b,total:c.length}})}function aa(a,c){var d=C(c);if(h.arr(a)){var b=a.length;2!==b||h.obj(a[0])?h.fnc(c.duration)||(d.duration=c.duration/b):a={value:a}}return m(a).map(function(a,b){b=b?0:c.delay;a=h.obj(a)&&!h.pth(a)?a:{value:a};h.und(a.delay)&&(a.delay=b);return a}).map(function(a){return z(a,d)})}function ba(a,c){var d={},b;for(b in a){var f=I(a[b],c);h.arr(f)&&(f=f.map(function(a){return I(a,-c)}),1===f.length&&(f=f[0]));d[b]=f}d.duration=parseFloat(d.duration);d.delay=parseFloat(d.delay);return d}function ca(a){return h.arr(a)?A.apply(this,a):Q[a]}function da(a,c){var d;return a.tweens.map(function(b){b=ba(b,c);var f=b.value,e=K(c.target,a.name),k=d?d.to.original:e,k=h.arr(f)?f[0]:k,w=L(h.arr(f)?f[1]:f,k),e=y(w)||y(k)||y(e);b.from=O(k,e);b.to=O(w,e);b.start=d?d.end:a.offset;b.end=b.start+b.delay+b.duration;b.easing=ca(b.easing);b.elasticity=(1E3-Math.min(Math.max(b.elasticity,1),999))/-1E3;b.isPath=h.pth(f);b.isColor=h.col(b.from.original);b.isColor&&(b.round=1);return d=b})}function ea(a,c){return r(p(a.map(function(a){return c.map(function(b){var c=J(a.target,b.name);if(c){var d=da(b,a);b={type:c,property:b.name,animatable:a,tweens:d,duration:d[d.length-1].end,delay:d[0].delay}}else b=void 0;return b})})),function(a){return!h.und(a)})}function R(a,c,d,b){var f="delay"===a;return c.length?(f?Math.min:Math.max).apply(Math,c.map(function(b){return b[a]})):f?b.delay:d.offset+b.delay+-b.duration}function fa(a){var c=D(ga,a),d=D(S,a),b=Z(a.targets),f=[],e=z(c,d),k;for(k in a)e.hasOwnProperty(k)||"targets"===k||f.push({name:k,offset:e.offset,tweens:aa(a[k],d)});a=ea(b,f);return z(c,{children:[],animatables:b,animations:a,duration:R("duration",a,c,d),delay:R("delay",a,c,d)})}function q(a){function c(){return window.Promise&&new Promise(function(a){return p=a})}function d(a){return g.reversed?g.duration-a:a}function b(a){for(var b=0,c={},d=g.animations,f=d.length;b<f;){var e=d[b],-k=e.animatable,h=e.tweens,n=h.length-1,l=h[n];n&&(l=r(h,function(b){return a<b.end})[0]||l);for(var h=Math.min(Math.max(a-l.start-l.delay,0),l.duration)/l.duration,w=isNaN(h)?1:l.easing(h,l.elasticity),h=l.to.strings,p=l.round,n=[],m=void 0,m=l.to.numbers.length,t=0;t<m;t++){var x=void 0,x=l.to.numbers[t],q=l.from.numbers[t],x=l.isPath?Y(l.value,w*x):q+w*(x-q);p&&(l.isColor&&2<t||(x=Math.round(x*p)/p));n.push(x)}if(l=h.length)for(m=h[0],w=0;w<l;w++)p=h[w+1],t=n[w],isNaN(t)||(m=p?m+(t+p):m+(t+" "));-else m=n[0];ha[e.type](k.target,e.property,m,c,k.id);e.currentValue=m;b++}if(b=Object.keys(c).length)for(d=0;d<b;d++)H||(H=E(document.body,"transform")?"transform":"-webkit-transform"),g.animatables[d].target.style[H]=c[d].join(" ");g.currentTime=a;g.progress=a/g.duration*100}function f(a){if(g[a])g[a](g)}function e(){g.remaining&&!0!==g.remaining&&g.remaining--}function k(a){var k=g.duration,n=g.offset,w=n+g.delay,r=g.currentTime,x=g.reversed,q=d(a);if(g.children.length){var u=g.children,v=u.length;-if(q>=g.currentTime)for(var G=0;G<v;G++)u[G].seek(q);else for(;v--;)u[v].seek(q)}if(q>=w||!k)g.began||(g.began=!0,f("begin")),f("run");if(q>n&&q<k)b(q);else if(q<=n&&0!==r&&(b(0),x&&e()),q>=k&&r!==k||!k)b(k),x||e();f("update");a>=k&&(g.remaining?(t=h,"alternate"===g.direction&&(g.reversed=!g.reversed)):(g.pause(),g.completed||(g.completed=!0,f("complete"),"Promise"in window&&(p(),m=c()))),l=0)}a=void 0===a?{}:a;var h,t,l=0,p=null,m=c(),g=fa(a);g.reset=function(){var a=g.direction,c=g.loop;g.currentTime=-0;g.progress=0;g.paused=!0;g.began=!1;g.completed=!1;g.reversed="reverse"===a;g.remaining="alternate"===a&&1===c?2:c;b(0);for(a=g.children.length;a--;)g.children[a].reset()};g.tick=function(a){h=a;t||(t=h);k((l+h-t)*q.speed)};g.seek=function(a){k(d(a))};g.pause=function(){var a=v.indexOf(g);-1<a&&v.splice(a,1);g.paused=!0};g.play=function(){g.paused&&(g.paused=!1,t=0,l=d(g.currentTime),v.push(g),B||ia())};g.reverse=function(){g.reversed=!g.reversed;t=0;l=d(g.currentTime)};g.restart=function(){g.pause();-g.reset();g.play()};g.finished=m;g.reset();g.autoplay&&g.play();return g}var ga={update:void 0,begin:void 0,run:void 0,complete:void 0,loop:1,direction:"normal",autoplay:!0,offset:0},S={duration:1E3,delay:0,easing:"easeOutElastic",elasticity:500,round:0},W="translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "),H,h={arr:function(a){return Array.isArray(a)},obj:function(a){return-1<Object.prototype.toString.call(a).indexOf("Object")},-pth:function(a){return h.obj(a)&&a.hasOwnProperty("totalLength")},svg:function(a){return a instanceof SVGElement},dom:function(a){return a.nodeType||h.svg(a)},str:function(a){return"string"===typeof a},fnc:function(a){return"function"===typeof a},und:function(a){return"undefined"===typeof a},hex:function(a){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)},rgb:function(a){return/^rgb/.test(a)},hsl:function(a){return/^hsl/.test(a)},col:function(a){return h.hex(a)||h.rgb(a)||h.hsl(a)}},A=function(){function a(a,-d,b){return(((1-3*b+3*d)*a+(3*b-6*d))*a+3*d)*a}return function(c,d,b,f){if(0<=c&&1>=c&&0<=b&&1>=b){var e=new Float32Array(11);if(c!==d||b!==f)for(var k=0;11>k;++k)e[k]=a(.1*k,c,b);return function(k){if(c===d&&b===f)return k;if(0===k)return 0;if(1===k)return 1;for(var h=0,l=1;10!==l&&e[l]<=k;++l)h+=.1;--l;var l=h+(k-e[l])/(e[l+1]-e[l])*.1,n=3*(1-3*b+3*c)*l*l+2*(3*b-6*c)*l+3*c;if(.001<=n){for(h=0;4>h;++h){n=3*(1-3*b+3*c)*l*l+2*(3*b-6*c)*l+3*c;if(0===n)break;var m=a(l,c,b)-k,l=l-m/n}k=l}else if(0===-n)k=l;else{var l=h,h=h+.1,g=0;do m=l+(h-l)/2,n=a(m,c,b)-k,0<n?h=m:l=m;while(1e-7<Math.abs(n)&&10>++g);k=m}return a(k,d,f)}}}}(),Q=function(){function a(a,b){return 0===a||1===a?a:-Math.pow(2,10*(a-1))*Math.sin(2*(a-1-b/(2*Math.PI)*Math.asin(1))*Math.PI/b)}var c="Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "),d={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],a],Out:[[.25,-.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(b,c){return 1-a(1-b,c)}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(b,c){return.5>b?a(2*b,c)/2:1-a(-2*b+2,c)/2}]},b={linear:A(.25,.25,.75,.75)},f={},e;for(e in d)f.type=e,d[f.type].forEach(function(a){return function(d,f){b["ease"+a.type+c[f]]=h.fnc(d)?-d:A.apply($jscomp$this,d)}}(f)),f={type:f.type};return b}(),ha={css:function(a,c,d){return a.style[c]=d},attribute:function(a,c,d){return a.setAttribute(c,d)},object:function(a,c,d){return a[c]=d},transform:function(a,c,d,b,f){b[f]||(b[f]=[]);b[f].push(c+"("+d+")")}},v=[],B=0,ia=function(){function a(){B=requestAnimationFrame(c)}function c(c){var b=v.length;if(b){for(var d=0;d<b;)v[d]&&v[d].tick(c),d++;a()}else cancelAnimationFrame(B),B=0}return a}();q.version="2.2.0";q.speed=1;q.running=v;q.remove=-function(a){a=P(a);for(var c=v.length;c--;)for(var d=v[c],b=d.animations,f=b.length;f--;)u(a,b[f].animatable.target)&&(b.splice(f,1),b.length||d.pause())};q.getValue=K;q.path=function(a,c){var d=h.str(a)?e(a)[0]:a,b=c||100;return function(a){return{el:d,property:a,totalLength:N(d)*(b/100)}}};q.setDashoffset=function(a){var c=N(a);a.setAttribute("stroke-dasharray",c);return c};q.bezier=A;q.easings=Q;q.timeline=function(a){var c=q(a);c.pause();c.duration=0;c.add=function(d){c.children.forEach(function(a){a.began=-!0;a.completed=!0});m(d).forEach(function(b){var d=z(b,D(S,a||{}));d.targets=d.targets||a.targets;b=c.duration;var e=d.offset;d.autoplay=!1;d.direction=c.direction;d.offset=h.und(e)?b:L(e,b);c.began=!0;c.completed=!0;c.seek(d.offset);d=q(d);d.began=!0;d.completed=!0;d.duration>b&&(c.duration=d.duration);c.children.push(d)});c.seek(0);c.reset();c.autoplay&&c.restart();return c};return c};q.random=function(a,c){return Math.floor(Math.random()*(c-a+1))+a};return q});\ No newline at end of file+(function(y,v){"function"===typeof define&&define.amd?define([],v):"object"===typeof module&&module.exports?module.exports=v():y.anime=v()})(this,function(){function y(a){return(a=/\(([^)]+)\)/.exec(a))?a[1].split(",").map(function(a){return parseFloat(a)}):[]}function v(a,b){function d(a){var c=b?b*a/1E3:a;c=1>h?Math.exp(-c*h*q)*(1*Math.cos(r*c)+n*Math.sin(r*c)):(1+n*c)*Math.exp(-c*q);return 0===a||1===a?a:1-c}function c(){var b=A.springs[a];if(b)return b;b=1/6;for(var c=0,e=0;;)if(c+=b,1===d(c)){if(e++,+16<=e)break}else e=0;b=c*b*1E3;return A.springs[a]=b}var e=y(a),k=x(f.und(e[0])?1:e[0],.1,100),l=x(f.und(e[1])?100:e[1],.1,100),m=x(f.und(e[2])?10:e[2],.1,100);e=x(f.und(e[3])?0:e[3],.1,100);var q=Math.sqrt(l/k),h=m/(2*Math.sqrt(l*k)),r=1>h?q*Math.sqrt(1-h*h):0,n=1>h?(h*q+-e)/r:-e+q;return b?d:c}function B(a,b){b=void 0===b?.5:b;var d=x(void 0===a?1:a,1,10),c=x(b,.1,2);return function(a){return 0===a||1===a?a:-d*Math.pow(2,10*(a-1))*Math.sin(2*(a-1-c/(2*Math.PI)*Math.asin(1/d))*Math.PI/c)}}function ca(a){a=+void 0===a?10:a;return function(b){return 1/a*Math.round(b*a)}}function da(a){var b=a.easing,d=b.split("(")[0],c=y(b),e=J[d];switch(d){case "spring":return v(b,a.duration);case "cubicBezier":return K.apply(null,c);case "steps":return ca.apply(null,c);default:return f.fnc(e)?e.apply(null,c):K.apply(null,e)}}function L(a){try{return document.querySelectorAll(a)}catch(b){}}function D(a,b){for(var d=a.length,c=2<=arguments.length?arguments[1]:void 0,e=[],k=0;k<d;k++)if(k in a){var l=a[k];b.call(c,l,k,+a)&&e.push(l)}return e}function E(a){return a.reduce(function(a,d){return a.concat(f.arr(d)?E(d):d)},[])}function M(a){if(f.arr(a))return a;f.str(a)&&(a=L(a)||a);return a instanceof NodeList||a instanceof HTMLCollection?[].slice.call(a):[a]}function F(a,b){return a.some(function(a){return a===b})}function G(a){var b={},d;for(d in a)b[d]=a[d];return b}function H(a,b){var d=G(a),c;for(c in a)d[c]=b.hasOwnProperty(c)?b[c]:a[c];return d}function z(a,b){var d=G(a),c;for(c in b)d[c]=f.und(a[c])?b[c]:a[c];+return d}function ea(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,d,l){return b+b+d+d+l+l});var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);a=parseInt(b[1],16);var d=parseInt(b[2],16);b=parseInt(b[3],16);return"rgba("+a+","+d+","+b+",1)"}function fa(a){function b(a,b,c){0>c&&(c+=1);1<c&&--c;return c<1/6?a+6*(b-a)*c:.5>c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}var d=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a=parseInt(d[1],+10)/360;var c=parseInt(d[2],10)/100,e=parseInt(d[3],10)/100;d=d[4]||1;if(0==c)e=c=a=e;else{var k=.5>e?e*(1+c):e+c-e*c,l=2*e-k;e=b(l,k,a+1/3);c=b(l,k,a);a=b(l,k,a-1/3)}return"rgba("+255*e+","+255*c+","+255*a+","+d+")"}function w(a){if(a=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a))return a[2]}function x(a,b,d){return Math.min(Math.max(a,b),d)}function N(a,b){return f.fnc(a)?a(b.target,b.id,b.total):a}function O(a,b,d){var c=w(b);if(F([d,"deg","rad",+"turn"],c))return b;if(c=A.CSS[b+d])return c;c=document.createElement(a.tagName);a=a.parentNode||document.body;a.appendChild(c);c.style.position="absolute";c.style.width=100+d;var e=100/c.offsetWidth;a.removeChild(c);a=e*parseFloat(b);return A.CSS[b+d]=a}function P(a,b,d){if(b in a.style){var c=b.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();b=a.style[b]||getComputedStyle(a).getPropertyValue(c)||"0";return d?O(a,b,d):b}}function Q(a,b){if(f.dom(a)&&(a.getAttribute(b)||f.svg(a)&&a[b]))return"attribute";+if(f.dom(a)&&F(ha,b))return"transform";if(f.dom(a)&&"transform"!==b&&P(a,b))return"css";if(null!=a[b])return"object"}function R(a){if(f.dom(a)){a=a.style.transform||"";for(var b=/(\w+)\(([^)]*)\)/g,d=new Map,c;c=b.exec(a);)d.set(c[1],c[2]);return d}}function S(a,b,d,c){switch(Q(a,b)){case "transform":if(-1<b.indexOf("scale"))var e=1;else e=-1<b.indexOf("translate")||"perspective"===b?"px":-1<b.indexOf("rotate")||-1<b.indexOf("skew")?"deg":void 0,e=0+e;e=R(a).get(b)||e;c.transforms.list.set(b,e);c.transforms.last=+b;return d?O(a,e,d):e;case "css":return P(a,b,d);case "attribute":return a.getAttribute(b);default:return a[b]||0}}function T(a,b){var d=/^(\*=|\+=|-=)/.exec(a);if(!d)return a;var c=w(a)||0;b=parseFloat(b);a=parseFloat(a.replace(d[0],""));switch(d[0][0]){case "+":return b+a+c;case "-":return b-a+c;case "*":return b*a+c}}function I(a,b){return Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2))}function U(a){a=a.points;for(var b=0,d,c=0;c<a.numberOfItems;c++){var e=a.getItem(c);0<c&&(b+=I(d,e));d=e}return b}+function V(a){if(a.getTotalLength)return a.getTotalLength();switch(a.tagName.toLowerCase()){case "circle":return 2*Math.PI*a.getAttribute("r");case "rect":return 2*a.getAttribute("width")+2*a.getAttribute("height");case "line":return I({x:a.getAttribute("x1"),y:a.getAttribute("y1")},{x:a.getAttribute("x2"),y:a.getAttribute("y2")});case "polyline":return U(a);case "polygon":var b=a.points;return U(a)+I(b.getItem(b.numberOfItems-1),b.getItem(0))}}function ia(a,b){function d(c){c=void 0===c?0:c;return a.el.getPointAtLength(1<=+b+c?b+c:0)}var c=d(),e=d(-1),k=d(1);switch(a.property){case "x":return c.x;case "y":return c.y;case "angle":return 180*Math.atan2(k.y-e.y,k.x-e.x)/Math.PI}}function W(a,b){var d=/-?\d*\.?\d+/g;var c=f.pth(a)?a.totalLength:a;if(f.col(c))if(f.rgb(c)){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(c);c=e?"rgba("+e[1]+",1)":c}else c=f.hex(c)?ea(c):f.hsl(c)?fa(c):void 0;else e=(e=w(c))?c.substr(0,c.length-e.length):c,c=b&&!/\s/g.test(c)?e+b:e;c+="";return{original:c,numbers:c.match(d)?c.match(d).map(Number):+[0],strings:f.str(a)||b?c.split(d):[]}}function X(a){a=a?E(f.arr(a)?a.map(M):M(a)):[];return D(a,function(a,d,c){return c.indexOf(a)===d})}function ja(a){var b=X(a);return b.map(function(a,c){return{target:a,id:c,total:b.length,transforms:{list:R(a)}}})}function ka(a,b){var d=G(b);/^spring/.test(d.easing)&&(d.duration=v(d.easing));if(f.arr(a)){var c=a.length;2!==c||f.obj(a[0])?f.fnc(b.duration)||(d.duration=b.duration/c):a={value:a}}return(f.arr(a)?a:[a]).map(function(a,c){a=f.obj(a)&&!f.pth(a)?a:+{value:a};f.und(a.delay)&&(a.delay=c?0:b.delay);return a}).map(function(a){return z(a,d)})}function la(a,b){var d={},c;for(c in a){var e=N(a[c],b);f.arr(e)&&(e=e.map(function(a){return N(a,b)}),1===e.length&&(e=e[0]));d[c]=e}d.duration=parseFloat(d.duration);d.delay=parseFloat(d.delay);return d}function ma(a,b){var d;return a.tweens.map(function(c){c=la(c,b);var e=c.value,k=f.arr(e)?e[1]:e,l=w(k),m=S(b.target,a.name,l,b),q=d?d.to.original:m;q=f.arr(e)?e[0]:q;m=w(q)||w(m);l=l||m;c.from=W(q,l);c.to=+W(T(k,q),l);c.start=d?d.end:0;c.end=c.start+c.delay+c.duration+c.endDelay;c.easing=da(c);c.isPath=f.pth(e);c.isColor=f.col(c.from.original);c.isColor&&(c.round=1);return d=c})}function na(a,b){return D(E(a.map(function(a){return b.map(function(b){var c=Q(a.target,b.name);if(c){var d=ma(b,a);b={type:c,property:b.name,animatable:a,tweens:d,duration:d[d.length-1].end,delay:d[0].delay}}else b=void 0;return b})})),function(a){return!f.und(a)})}function Y(a,b,d){var c="delay"===a;return b.length?(c?Math.min:+Math.max).apply(Math,b.map(function(b){return b[a]})):c?d.delay:d.delay+d.duration}function oa(a){var b=H(pa,a),d=H(Z,a),c=ja(a.targets),e=[],k;for(k in a)b.hasOwnProperty(k)||d.hasOwnProperty(k)||"targets"===k||e.push({name:k,tweens:ka(a[k],d)});e=na(c,e);return z(b,{states:{default:a},children:[],animatables:c,animations:e,duration:Y("duration",e,d),delay:Y("delay",e,d)})}function p(a){function b(){return window.Promise&&new Promise(function(a){return w=a})}function d(){g.reversed=!g.reversed;n.forEach(function(a){return a.reversed=+g.reversed})}function c(a){return g.reversed?g.duration-a:a}function e(a){for(var b=0,c=g.animations,d=c.length;b<d;){var e=c[b],k=e.animatable,f=e.tweens,l=f.length-1,h=f[l];l&&(h=D(f,function(b){return a<b.end})[0]||h);f=x(a-h.start-h.delay,0,h.duration)/h.duration;var m=isNaN(f)?1:h.easing(f);f=h.to.strings;var q=h.round;l=[];var t=h.to.numbers.length,n=void 0;for(n=0;n<t;n++){var r=void 0;r=h.to.numbers[n];var p=h.from.numbers[n];r=h.isPath?ia(h.value,m*r):p+m*(r-p);q&&(h.isColor&&2<n||(r=Math.round(r*+q)/q));l.push(r)}if(h=f.length)for(n=f[0],m=0;m<h;m++)q=f[m+1],t=l[m],isNaN(t)||(n=q?n+(t+q):n+(t+" "));else n=l[0];qa[e.type](k.target,e.property,n,k.transforms);e.currentValue=n;b++}g.currentTime=a}function k(a){if(g[a])g[a](g)}function f(){g.remaining&&!0!==g.remaining&&g.remaining--}function m(a){var l=g.duration,m=g.delay,t=c(a);g.progress=x(t/l*100,0,100);if(n)if(t>=g.currentTime)for(var p=0;p<v;p++)n[p].seek(t-n[p].timelineOffset);else for(p=v;p--;)n[p].seek(t-n[p].timelineOffset);if(t>=m||+!l)g.began||(g.began=!0,k("begin")),k("run");if(t>m&&t<l)e(t);else if(t<=m&&0!==g.currentTime&&(e(0),g.reversed&&f()),t>=l&&g.currentTime!==l||!l)e(l),g.reversed||f();k("update");a>=l&&(h=0,g.remaining?(q=r,"alternate"===g.direction&&d()):(g.paused=!0,g.completed||(g.completed=!0,k("complete"),"Promise"in window&&(w(),y=b()))))}a=void 0===a?{}:a;var q=0,h=0,r=0,n,v=0,w=null,y=b(),g=oa(a);g.reset=function(){var a=g.direction,b=g.loop;g.currentTime=0;g.progress=0;g.paused=!0;g.began=!1;g.completed=+!1;g.reversed="reverse"===a;g.remaining="alternate"===a&&1===b?2:b;n=g.children;for(a=v=n.length;a--;)g.children[a].reset();e(0)};g.tick=function(a){r=a;q||(q=r);m((r+(h-q))*p.speed)};g.seek=function(a){m(c(a))};g.pause=function(){g.paused=!0};g.play=function(){g.paused&&(g.paused=!1,q=0,h=c(g.currentTime),u.push(g),C||ra())};g.reverse=function(){d();q=0;h=c(g.currentTime)};g.restart=function(){g.pause();g.reset();g.play()};g.animateTo=function(a,b,c){b=void 0===b?{}:b;a=z(b,z(g.states[a],g.states.default));+a=p(a);c?a.seek(a.duration):a.play()};g.goTo=function(a,b){g.animateTo(a,b,!0)};g.finished=y;g.reset();g.startTime&&m(g.startTime-g.duration*Math.floor(g.startTime/g.duration));g.autoplay&&g.play();return g}function aa(a,b){for(var d=b.length;d--;)F(a,b[d].animatable.target)&&b.splice(d,1)}var pa={update:null,begin:null,run:null,complete:null,loop:1,direction:"normal",autoplay:!0,startTime:0,timelineOffset:0},Z={duration:1E3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},ha="translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skew skewX skewY perspective".split(" "),+A={CSS:{},springs:{}},f={arr:function(a){return Array.isArray(a)},obj:function(a){return-1<Object.prototype.toString.call(a).indexOf("Object")},pth:function(a){return f.obj(a)&&a.hasOwnProperty("totalLength")},svg:function(a){return a instanceof SVGElement},dom:function(a){return a.nodeType||f.svg(a)},str:function(a){return"string"===typeof a},fnc:function(a){return"function"===typeof a},und:function(a){return"undefined"===typeof a},hex:function(a){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)},+rgb:function(a){return/^rgb/.test(a)},hsl:function(a){return/^hsl/.test(a)},col:function(a){return f.hex(a)||f.rgb(a)||f.hsl(a)}},K=function(){function a(a,d,c){return(((1-3*c+3*d)*a+(3*c-6*d))*a+3*d)*a}return function(b,d,c,e){if(0<=b&&1>=b&&0<=c&&1>=c){var k=new Float32Array(11);if(b!==d||c!==e)for(var f=0;11>f;++f)k[f]=a(.1*f,b,c);return function(f){if(b===d&&c===e||0===f||1===f)return f;for(var l=0,h=1;10!==h&&k[h]<=f;++h)l+=.1;--h;h=l+(f-k[h])/(k[h+1]-k[h])*.1;var m=3*(1-3*c+3*b)*h*h+2*(3*c-+6*b)*h+3*b;if(.001<=m){for(l=0;4>l;++l){m=3*(1-3*c+3*b)*h*h+2*(3*c-6*b)*h+3*b;if(0===m)break;var n=a(h,b,c)-f;h-=n/m}f=h}else if(0===m)f=h;else{h=l;l+=.1;var p=0;do n=h+(l-h)/2,m=a(n,b,c)-f,0<m?l=n:h=n;while(1e-7<Math.abs(m)&&10>++p);f=n}return a(f,d,e)}}}}(),J=function(){var a="Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "),b={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],+B],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(a,b){return function(c){return 1-B(a,b)(1-c)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(a,b){return function(c){return.5>c?B(a,b)(2*c)/2:1-B(a,b)(-2*c+2)/2}}]},d={linear:[.25,.25,.75,.75]},c={},e;for(e in b)c.equation=e,b[c.equation].forEach(function(b){return function(c,+e){d["ease"+b.equation+a[e]]=c}}(c)),c={equation:c.equation};return d}(),qa={css:function(a,b,d){return a.style[b]=d},attribute:function(a,b,d){return a.setAttribute(b,d)},object:function(a,b,d){return a[b]=d},transform:function(a,b,d,c,e){c.list.set(b,d);if(b===c.last||e){var f="";c.list.forEach(function(a,b){f+=b+"("+a+") "});a.style.transform=f}}},u=[],ba=[],C,ra=function(){function a(){C=requestAnimationFrame(b)}function b(b){var c=u.length;if(c){for(var d=0;d<c;){var f=u[d];f.paused?(f=u.indexOf(f),+-1<f&&(u.splice(f,1),c=u.length)):f.tick(b);d++}a()}else C=cancelAnimationFrame(C)}return a}();document.addEventListener("visibilitychange",function(){document.hidden?(u.forEach(function(a){return a.pause()}),ba=u.slice(0),u=[]):ba.forEach(function(a){return a.play()})});p.version="3.0.0";p.speed=1;p.running=u;p.remove=function(a){a=X(a);for(var b=u.length;b--;){var d=u[b],c=d.animations,e=d.children;aa(a,c);for(var f=e.length;f--;){var l=e[f],m=l.animations;aa(a,m);m.length||l.children.length||e.splice(f,+1)}c.length||e.length||d.pause()}};p.getValue=S;p.path=function(a,b){var d=f.str(a)?L(a)[0]:a,c=b||100;return function(a){return{el:d,property:a,totalLength:V(d)*(c/100)}}};p.setDashoffset=function(a){var b=V(a);a.setAttribute("stroke-dasharray",b);return b};p.timeline=function(a){a=void 0===a?{}:a;var b=p(a);b.pause();b.duration=0;b.add=function(d,c){function e(a){a.began=!0;a.completed=!0}b.children.forEach(e);var k=z(d,H(Z,a));k.targets=k.targets||a.targets;d=b.duration;k.autoplay=!1;k.direction=+b.direction;k.timelineOffset=f.und(c)?d:T(c,d);e(b);b.seek(k.timelineOffset);c=p(k);e(c);k=c.duration+k.timelineOffset;f.fnc(b.delay)&&(b.delay=c.delay);if(f.fnc(d)||k>d)b.duration=k;b.children.push(c);b.seek(0);b.reset();b.autoplay&&b.restart();return b};return b};p.easings=J;p.random=function(a,b){return Math.floor(Math.random()*(b-a+1))+a};return p});\ No newline at end of filediff --git a/build.js b/build.jsindex 419e8076..a07cdd7c 100644--- a/build.js+++ b/build.js@@ -11,13 +11,12 @@ fs.unlink(fileOut, (err) => {if (err) throw err;const flags = {jsCode: [{src: data}],- languageIn: 'ES6',- languageOut: 'ES5'+ rewritePolyfills: false};const out = compile(flags);fs.writeFile(fileOut, out.compiledCode, function(err) {if (err) throw err;- console.info('Compilation was a success! 😎 🍺');+ console.info('Compilation was a success! 😎');});});});\ No newline at end of filediff --git a/documentation/assets/css/anime.css b/documentation/assets/css/anime.cssindex f310ccb9..ec092654 100644--- a/documentation/assets/css/anime.css+++ b/documentation/assets/css/anime.css@@ -1,15 +1,13 @@-html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}+html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}* {- margin: 0;- padding: 0;box-sizing: border-box;}html,body,header {- background-color: #111116; /* Black */+ background-color: #16161c; /* Black */}body {diff --git a/documentation/assets/css/documentation.css b/documentation/assets/css/documentation.cssindex da5e58c7..29d362c9 100644--- a/documentation/assets/css/documentation.css+++ b/documentation/assets/css/documentation.css@@ -1,18 +1,50 @@+html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}++* {+ box-sizing: border-box;+}++html,+body,+header {+ background-color: #16161c; /* Black */+}++body {+ position: absolute;+ width: 100%;+ height: 100%;+ color: white;+ font-family: Helvetica Neue, Helvetica, Arial, sans-serif;+ -webkit-font-smoothing: antialiased;+ overflow-x: hidden;+}++.color-targets { color: #FF1461; } /* Red */+.color-properties { color: #FF7C72; } /* Orange */+.color-prop-params { color: #FBF38C; } /* Yellow */+.color-anim-params { color: #A6FF8F; } /* Citrus */+.color-values { color: #18FF92; } /* Green */+.color-tl { color: #1CE2B2; } /* Darkgreen */+.color-controls { color: #5EF3FB; } /* Turquoise */+.color-states { color: #61C3FF; } /* Lightblue */+.color-callbacks { color: #5A87FF; } /* Blue */+.color-svg { color: #8453E3; } /* Purple */+.color-easings { color: #C26EFF; } /* Lavender */+.color-helpers { color: #FB89FB; } /* Pink */++.content {+ overflow: hidden;opacity: 0;- display: -webkit-box;- display: -ms-flexbox;display: flex;- -webkit-box-orient: horizontal;- -webkit-box-direction: normal;- -ms-flex-direction: row;- flex-direction: row;+ flex-direction: row;width: 100%;height: 100%;transition: opacity 1s ease;}-body.ready .content {+.ready .content {opacity: 1;}@@ -27,12 +59,8 @@ body.ready .content {}.logo {- display: -webkit-box;- display: -ms-flexbox;display: flex;- -webkit-box-align: center;- -ms-flex-align: center;- align-items: center;+ align-items: center;width: 240px;height: 60px;padding: 10px 0 10px 55px;@@ -45,37 +73,30 @@ body.ready .content {}header {- position: -webkit-sticky;- position: -moz-sticky;- position: -o-sticky;- position: -ms-sticky;position: sticky;top: 0;z-index: 2;- display: -webkit-box;- display: -ms-flexbox;display: flex;- -webkit-box-align: center;- -ms-flex-align: center;- align-items: center;- -webkit-box-pack: justify;- -ms-flex-pack: justify;- justify-content: space-between;+ align-items: center;+ justify-content: space-between;width: 100%;height: 60px;padding-left: 20px;padding-right: 20px;- border-bottom: 1px solid #000;+ border-bottom: 1px solid rgba(0,0,0,.25);}.logo, h2 {- opacity: .6;font-size: 22px;letter-spacing: 2px;text-transform: uppercase;font-weight: 200;}+.logo {+ opacity: .6;+}+.logo:hover {opacity: 1;}@@ -90,9 +111,17 @@ header {/* Sidebar */.sidebar {+ display: flex;+ flex-direction: column;width: 240px;padding-top: 60px;- border-right: 1px solid #000;+ border-right: 1px solid rgba(0,0,0,.25);+}++.sidebar-info {+ display: flex;+ justify-content: space-between;+ padding: 20px;}.navigation {@@ -130,7 +159,7 @@ header {.navigation a {display: block;- padding-left: 15px;+ padding-left: 10px;color: #FFF;text-decoration: none;font-size: 12px;@@ -178,45 +207,148 @@ header {color: currentColor;}-/* Code */+/* Info pane */-.code-examples {+.demo-info {+ flex-direction: column;width: 50%;- -webkit-box-orient: vertical;- -webkit-box-direction: normal;- -ms-flex-direction: column;- flex-direction: column;- border-left: 1px solid #000;+ font-size: 15px;+ line-height: 25px;+ border-left: 1px solid rgba(0,0,0,.25);}-.code-pane {+.info-output {+ overflow-x: hidden;+ overflow-y: auto;position: relative;- border-bottom: 1px solid #000;+ top: 0;+ width: 100%;+ height: calc(100% - 60px);+ padding: 20px;+}++.demo-info pre {+ font-variant-ligatures: none;+ -webkit-font-variant-ligatures: none;+}++.demo-info code {+ font-family: "Input Mono Reg", "Space Mono", monospace;+ font-size: 14px;+ line-height: 25px;+ white-space: pre-wrap;}-.code-pane-js {- height: 66%;+.demo-info p {+ margin-bottom: 20px;}-.code-pane-html {- height: 34%;+.demo-info p,+.demo-info td {+ color: rgba(255,255,255,.7);}-.code-header {+.demo-info i {+ font-style: italic;+}++.demo-info a[href^="http"]:visited {+ color: currentColor;+}++.demo-info p.bubble {+ display: inline-block;+ position: relative;+ padding: 8px 12px;+}++.demo-info p.bubble.warning {+ color: #FBF38C;+}++.demo-info p.bubble.info {+ color: #61C3FF;+}++.demo-info p.bubble:after {+ content: "";+ pointer-events: none;+ color: currentColor;+ display: inline-block;position: absolute;top: 0;+ left: 0;+ right: 0;+ bottom: 0;+ background-color: currentColor;+ border-radius: 3px;+ opacity: .05;+}++.demo-info code.hljs {+ display: inline-block;+ font-size: 14px;}-pre {- overflow: auto;- font-family: 'Space Mono', monospace;- line-height: 22px;+.demo-info pre {+ margin-bottom: 20px;}-.code-output {+.demo-info pre code {+ position: relative;+ display: inline-block;width: 100%;- height: 100%;- padding: 80px 20px 20px 20px;+ padding: 8px 12px;+ background-color: rgba(0,0,0,.2);+ border: 1px solid rgba(0,0,0,.4);+ border-radius: 3px;+}++.demo-info p code {+ position: relative;+ padding: 0 2px;+ height: 24px;+ background-color: rgba(0,0,0,.2);+ box-shadow: inset 0 0 1px rgba(0,0,0,.4);+ border-radius: 3px;+}++.demo-info table {+ margin-bottom: 20px;+ border: 1px solid #2E2E33;+ border-spacing: 0;+ border-radius: 3px;+}++.demo-info thead {+ font-weight: 200;+ text-transform: uppercase;+ letter-spacing: .15em;+ color: rgba(255,255,255,.5);+}++.demo-info td {+ vertical-align: middle;+ padding: 8px 12px;+ border-left: 1px solid #2E2E33;+ border-top: 1px solid #2E2E33;+}++.demo-info thead td {+ border-top: none;+}++.demo-info td:first-child {+ border-left: none;+}++.code-preview {+ width: 100%;+ padding-top: 40px;+}++.code-preview h2 {+ margin-bottom: 20px;}/* Demos */@@ -229,21 +361,11 @@ pre {article {width: 100%;- display: -webkit-box;- display: -ms-flexbox;display: flex;- -webkit-box-orient: vertical;- -webkit-box-direction: normal;- -ms-flex-direction: column;- flex-direction: column;- -ms-flex-wrap: wrap;- flex-wrap: wrap;- -webkit-box-align: start;- -ms-flex-align: start;- align-items: flex-start;- -webkit-box-pack: start;- -ms-flex-pack: start;- justify-content: flex-start;+ flex-direction: column;+ flex-wrap: wrap;+ align-items: flex-start;+ justify-content: flex-start;}.demos-title {@@ -253,22 +375,21 @@ article {.demo {position: relative;z-index: 1;- display: -webkit-box;- display: -ms-flexbox;display: flex;- -webkit-box-align: center;- -ms-flex-align: center;- align-items: center;- -webkit-box-pack: center;- -ms-flex-pack: center;- justify-content: center;+ align-items: center;+ flex-pack: center;+ justify-content: center;width: 100%;min-height: 200px;padding-top: 35px;- border-bottom: 1px solid #000;+ border-bottom: 1px solid rgba(0,0,0,.25);cursor: pointer;}+.demo-description {+ display: none;+}+.demo.controls {padding-top: 50px;}@@ -296,30 +417,14 @@ article {.demo-content {position: relative;- display: -webkit-box;- display: -ms-flexbox;display: flex;- -webkit-box-orient: vertical;- -webkit-box-direction: normal;- -ms-flex-direction: column;- flex-direction: column;- -webkit-box-pack: center;- -ms-flex-pack: center;- justify-content: center;+ flex-direction: column;+ justify-content: center;text-align: center;width: 290px;height: 100%;}-#penner .demo-content {- padding: 25px 0;-}--#timeline .demo-content,-#motionpath .demo-content {- padding: 40px 0;-}-.demo-title {position: absolute;top: 0;@@ -345,15 +450,9 @@ article {.player {opacity: .4;- display: -webkit-box;- display: -ms-flexbox;display: flex;- -webkit-box-align: center;- -ms-flex-align: center;- align-items: center;- -webkit-box-pack: center;- -ms-flex-pack: center;- justify-content: center;+ align-items: center;+ justify-content: center;padding-top: 20px;padding-bottom: 10px;}@@ -410,7 +509,7 @@ article {.log {width: 100%;- height: 22px;+ height: 100%;background: transparent;color: currentColor;border: none;@@ -418,18 +517,16 @@ article {text-align: center;}+.bottom.log {+ padding-top: 10px;+ padding-bottom: 10px;+}+.logs {pointer-events: none;- display: -webkit-box;- display: -ms-flexbox;display: flex;- -webkit-box-orient: vertical;- -webkit-box-direction: normal;- -ms-flex-direction: column;- flex-direction: column;- -webkit-box-align: center;- -ms-flex-align: center;- align-items: center;+ flex-direction: column;+ align-items: center;position: absolute;width: 100%;height: 100%;@@ -443,6 +540,37 @@ input.progress {cursor: ew-resize;}+input.progress[value] {+ position: relative;+ width: auto;+ height: 27px;+ -webkit-appearance: none;+ background-color: transparent;+ color: currentColor;+}++input.progress[value]:focus {+ outline: none;+}++input.progress[value]:after {+ content: "";+ position: absolute;+ top: 13px;+ left: 0;+ width: 100%;+ height: 1px;+ background-color: currentColor;+}++input.progress[value]::-webkit-slider-thumb {+ -webkit-appearance: none;+ background-color: currentColor;+ border-radius: 50%;+ width: 16px;+ height: 16px;+}+.square,.circle {pointer-events: none;@@ -473,6 +601,10 @@ input.progress {height: 18px;}+.small.triangle {+ border-width: 0 10px 17px 10px;+}+.large {width: 48px;height: 48px;@@ -487,6 +619,33 @@ input.progress {opacity: .2;}+.label {+ position: absolute;+ opacity: 0;+ display: flex;+ flex-direction: column;+ justify-content: center;+ text-align: left;+ width: 100%;+ height: 28px;+ padding-left: 38px;+ transition: opacity .5s ease;+}++.demo.active .label {+ opacity: .2;+}++.small.label {+ height: 18px;+ padding-left: 28px;+}++.large.label {+ height: 48px;+ padding-left: 58px;+}+.motion-path {position: relative;width: 256px;@@ -500,14 +659,15 @@ input.progress {}.align-center {- -webkit-box-align: center;- -ms-flex-align: center;- align-items: center;+ align-items: center;+}++.add-states-demo .el {+ border: 1px solid rgba(0,0,0,0);}#cssProperties .el {- -webkit-transform: translate3d(0,0,0);- transform: translate3d(0,0,0);+ transform: translate3d(0,0,0);}/* Responsive */diff --git a/documentation/assets/js/anime.1.0.js b/documentation/assets/js/anime/anime.1.0.jssimilarity index 100%rename from documentation/assets/js/anime.1.0.jsrename to documentation/assets/js/anime/anime.1.0.jsdiff --git a/documentation/assets/js/anime.1.3.js b/documentation/assets/js/anime/anime.1.3.jssimilarity index 100%rename from documentation/assets/js/anime.1.3.jsrename to documentation/assets/js/anime/anime.1.3.jsdiff --git a/documentation/assets/js/anime.2.0.0.js b/documentation/assets/js/anime/anime.2.0.0.jssimilarity index 100%rename from documentation/assets/js/anime.2.0.0.jsrename to documentation/assets/js/anime/anime.2.0.0.jsdiff --git a/documentation/assets/js/anime.2.0.1.js b/documentation/assets/js/anime/anime.2.0.1.jssimilarity index 100%rename from documentation/assets/js/anime.2.0.1.jsrename to documentation/assets/js/anime/anime.2.0.1.jsdiff --git a/documentation/assets/js/anime.2.0.2.js b/documentation/assets/js/anime/anime.2.0.2.jssimilarity index 100%rename from documentation/assets/js/anime.2.0.2.jsrename to documentation/assets/js/anime/anime.2.0.2.jsdiff --git a/documentation/assets/js/anime.2.1.0.js b/documentation/assets/js/anime/anime.2.1.0.jssimilarity index 100%rename from documentation/assets/js/anime.2.1.0.jsrename to documentation/assets/js/anime/anime.2.1.0.jsdiff --git a/documentation/assets/js/anime/anime.2.2.0.js b/documentation/assets/js/anime/anime.2.2.0.jsnew file mode 100644index 00000000..64730fac--- /dev/null+++ b/documentation/assets/js/anime/anime.2.2.0.js@@ -0,0 +1,993 @@+/**+ * http://animejs.com+ * JavaScript animation engine+ * @version v2.2.0+ * @author Julian Garnier+ * @copyright ©2017 Julian Garnier+ * Released under the MIT license+**/++(function(root, factory) {+ if (typeof define === 'function' && define.amd) {+ // AMD. Register as an anonymous module.+ define([], factory);+ } else if (typeof module === 'object' && module.exports) {+ // Node. Does not work with strict CommonJS, but+ // only CommonJS-like environments that support module.exports,+ // like Node.+ module.exports = factory();+ } else {+ // Browser globals (root is window)+ root.anime = factory();+ }+}(this, () => {++ // Defaults++ const defaultInstanceSettings = {+ update: undefined,+ begin: undefined,+ run: undefined,+ complete: undefined,+ loop: 1,+ direction: 'normal',+ autoplay: true,+ offset: 0+ }++ const defaultTweenSettings = {+ duration: 1000,+ delay: 0,+ easing: 'easeOutElastic',+ elasticity: 500,+ round: 0+ }++ const validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skewX', 'skewY', 'perspective'];+ let transformString;++ // Utils++ function stringContains(str, text) {+ return str.indexOf(text) > -1;+ }++ const is = {+ arr: a => Array.isArray(a),+ obj: a => stringContains(Object.prototype.toString.call(a), 'Object'),+ pth: a => is.obj(a) && a.hasOwnProperty('totalLength'),+ svg: a => a instanceof SVGElement,+ dom: a => a.nodeType || is.svg(a),+ str: a => typeof a === 'string',+ fnc: a => typeof a === 'function',+ und: a => typeof a === 'undefined',+ hex: a => /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a),+ rgb: a => /^rgb/.test(a),+ hsl: a => /^hsl/.test(a),+ col: a => (is.hex(a) || is.rgb(a) || is.hsl(a))+ }++ // BezierEasing https://github.com/gre/bezier-easing++ const bezier = (() => {++ const kSplineTableSize = 11;+ const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);++ function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 };+ function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 };+ function C (aA1) { return 3.0 * aA1 };++ function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT };+ function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) };++ function binarySubdivide (aX, aA, aB, mX1, mX2) {+ let currentX, currentT, i = 0;+ do {+ currentT = aA + (aB - aA) / 2.0;+ currentX = calcBezier(currentT, mX1, mX2) - aX;+ if (currentX > 0.0) { aB = currentT } else { aA = currentT };+ } while (Math.abs(currentX) > 0.0000001 && ++i < 10);+ return currentT;+ }++ function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {+ for (let i = 0; i < 4; ++i) {+ const currentSlope = getSlope(aGuessT, mX1, mX2);+ if (currentSlope === 0.0) return aGuessT;+ const currentX = calcBezier(aGuessT, mX1, mX2) - aX;+ aGuessT -= currentX / currentSlope;+ }+ return aGuessT;+ }++ function bezier(mX1, mY1, mX2, mY2) {++ if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) return;+ let sampleValues = new Float32Array(kSplineTableSize);++ if (mX1 !== mY1 || mX2 !== mY2) {+ for (let i = 0; i < kSplineTableSize; ++i) {+ sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);+ }+ }++ function getTForX(aX) {++ let intervalStart = 0.0;+ let currentSample = 1;+ const lastSample = kSplineTableSize - 1;++ for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {+ intervalStart += kSampleStepSize;+ }++ --currentSample;++ const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);+ const guessForT = intervalStart + dist * kSampleStepSize;+ const initialSlope = getSlope(guessForT, mX1, mX2);++ if (initialSlope >= 0.001) {+ return newtonRaphsonIterate(aX, guessForT, mX1, mX2);+ } else if (initialSlope === 0.0) {+ return guessForT;+ } else {+ return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);+ }++ }++ return x => {+ if (mX1 === mY1 && mX2 === mY2) return x;+ if (x === 0) return 0;+ if (x === 1) return 1;+ return calcBezier(getTForX(x), mY1, mY2);+ }++ }++ return bezier;++ })();++ const easings = (() => {++ const names = ['Quad', 'Cubic', 'Quart', 'Quint', 'Sine', 'Expo', 'Circ', 'Back', 'Elastic'];++ // Elastic easing adapted from jQueryUI http://api.jqueryui.com/easings/++ function elastic(t, p) {+ return t === 0 || t === 1 ? t :+ -Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2.0) * Math.asin(1))) * (Math.PI * 2)) / p );+ }++ // Approximated Penner equations http://matthewlein.com/ceaser/++ const equations = {+ In: [+ [0.550, 0.085, 0.680, 0.530], /* InQuad */+ [0.550, 0.055, 0.675, 0.190], /* InCubic */+ [0.895, 0.030, 0.685, 0.220], /* InQuart */+ [0.755, 0.050, 0.855, 0.060], /* InQuint */+ [0.470, 0.000, 0.745, 0.715], /* InSine */+ [0.950, 0.050, 0.795, 0.035], /* InExpo */+ [0.600, 0.040, 0.980, 0.335], /* InCirc */+ [0.600, -0.280, 0.735, 0.045], /* InBack */+ elastic /* InElastic */+ ], Out: [+ [0.250, 0.460, 0.450, 0.940], /* OutQuad */+ [0.215, 0.610, 0.355, 1.000], /* OutCubic */+ [0.165, 0.840, 0.440, 1.000], /* OutQuart */+ [0.230, 1.000, 0.320, 1.000], /* OutQuint */+ [0.390, 0.575, 0.565, 1.000], /* OutSine */+ [0.190, 1.000, 0.220, 1.000], /* OutExpo */+ [0.075, 0.820, 0.165, 1.000], /* OutCirc */+ [0.175, 0.885, 0.320, 1.275], /* OutBack */+ (t, f) => 1 - elastic(1 - t, f) /* OutElastic */+ ], InOut: [+ [0.455, 0.030, 0.515, 0.955], /* InOutQuad */+ [0.645, 0.045, 0.355, 1.000], /* InOutCubic */+ [0.770, 0.000, 0.175, 1.000], /* InOutQuart */+ [0.860, 0.000, 0.070, 1.000], /* InOutQuint */+ [0.445, 0.050, 0.550, 0.950], /* InOutSine */+ [1.000, 0.000, 0.000, 1.000], /* InOutExpo */+ [0.785, 0.135, 0.150, 0.860], /* InOutCirc */+ [0.680, -0.550, 0.265, 1.550], /* InOutBack */+ (t, f) => t < .5 ? elastic(t * 2, f) / 2 : 1 - elastic(t * -2 + 2, f) / 2 /* InOutElastic */+ ]+ }++ let functions = {+ linear: bezier(0.250, 0.250, 0.750, 0.750)+ }++ for (let type in equations) {+ equations[type].forEach((f, i) => {+ functions['ease'+type+names[i]] = is.fnc(f) ? f : bezier.apply(this, f);+ });+ }++ return functions;++ })();++ // Strings++ function stringToHyphens(str) {+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();+ }++ function selectString(str) {+ if (is.col(str)) return;+ try {+ let nodes = document.querySelectorAll(str);+ return nodes;+ } catch(e) {+ return;+ }+ }++ // Arrays++ function filterArray(arr, callback) {+ const len = arr.length;+ const thisArg = arguments.length >= 2 ? arguments[1] : void 0;+ let result = [];+ for (let i = 0; i < len; i++) {+ if (i in arr) {+ const val = arr[i];+ if (callback.call(thisArg, val, i, arr)) {+ result.push(val);+ }+ }+ }+ return result;+ }++ function flattenArray(arr) {+ return arr.reduce((a, b) => a.concat(is.arr(b) ? flattenArray(b) : b), []);+ }++ function toArray(o) {+ if (is.arr(o)) return o;+ if (is.str(o)) o = selectString(o) || o;+ if (o instanceof NodeList || o instanceof HTMLCollection) return [].slice.call(o);+ return [o];+ }++ function arrayContains(arr, val) {+ return arr.some(a => a === val);+ }++ // Objects++ function cloneObject(o) {+ let clone = {};+ for (let p in o) clone[p] = o[p];+ return clone;+ }++ function replaceObjectProps(o1, o2) {+ let o = cloneObject(o1);+ for (let p in o1) o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p];+ return o;+ }++ function mergeObjects(o1, o2) {+ let o = cloneObject(o1);+ for (let p in o2) o[p] = is.und(o1[p]) ? o2[p] : o1[p];+ return o;+ }++ // Colors++ function rgbToRgba(rgbValue) {+ const rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue);+ return rgb ? `rgba(${rgb[1]},1)` : rgbValue;+ }++ function hexToRgba(hexValue) {+ const rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;+ const hex = hexValue.replace(rgx, (m, r, g, b) => r + r + g + g + b + b );+ const rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);+ const r = parseInt(rgb[1], 16);+ const g = parseInt(rgb[2], 16);+ const b = parseInt(rgb[3], 16);+ return `rgba(${r},${g},${b},1)`;+ }++ function hslToRgba(hslValue) {+ const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);+ const h = parseInt(hsl[1]) / 360;+ const s = parseInt(hsl[2]) / 100;+ const l = parseInt(hsl[3]) / 100;+ const a = hsl[4] || 1;+ function hue2rgb(p, q, t) {+ if (t < 0) t += 1;+ if (t > 1) t -= 1;+ if (t < 1/6) return p + (q - p) * 6 * t;+ if (t < 1/2) return q;+ if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;+ return p;+ }+ let r, g, b;+ if (s == 0) {+ r = g = b = l;+ } else {+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;+ const p = 2 * l - q;+ r = hue2rgb(p, q, h + 1/3);+ g = hue2rgb(p, q, h);+ b = hue2rgb(p, q, h - 1/3);+ }+ return `rgba(${r * 255},${g * 255},${b * 255},${a})`;+ }++ function colorToRgb(val) {+ if (is.rgb(val)) return rgbToRgba(val);+ if (is.hex(val)) return hexToRgba(val);+ if (is.hsl(val)) return hslToRgba(val);+ }++ // Units++ function getUnit(val) {+ const split = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val);+ if (split) return split[2];+ }++ function getTransformUnit(propName) {+ if (stringContains(propName, 'translate') || propName === 'perspective') return 'px';+ if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) return 'deg';+ }++ // Values++ function minMaxValue(val, min, max) {+ return Math.min(Math.max(val, min), max);+ }++ function getFunctionValue(val, animatable) {+ if (!is.fnc(val)) return val;+ return val(animatable.target, animatable.id, animatable.total);+ }++ function getCSSValue(el, prop) {+ if (prop in el.style) {+ return getComputedStyle(el).getPropertyValue(stringToHyphens(prop)) || '0';+ }+ }++ function getAnimationType(el, prop) {+ if (is.dom(el) && arrayContains(validTransforms, prop)) return 'transform';+ if (is.dom(el) && (el.getAttribute(prop) || (is.svg(el) && el[prop]))) return 'attribute';+ if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) return 'css';+ if (el[prop] != null) return 'object';+ }++ function getTransformValue(el, propName) {+ const defaultUnit = getTransformUnit(propName);+ const defaultVal = stringContains(propName, 'scale') ? 1 : 0 + defaultUnit;+ const str = el.style.transform;+ if (!str) return defaultVal;+ let match = [];+ let props = [];+ let values = [];+ const rgx = /(\w+)\((.+?)\)/g;+ while (match = rgx.exec(str)) {+ props.push(match[1]);+ values.push(match[2]);+ }+ const value = filterArray(values, (val, i) => props[i] === propName);+ return value.length ? value[0] : defaultVal;+ }++ function getOriginalTargetValue(target, propName) {+ switch (getAnimationType(target, propName)) {+ case 'transform': return getTransformValue(target, propName);+ case 'css': return getCSSValue(target, propName);+ case 'attribute': return target.getAttribute(propName);+ }+ return target[propName] || 0;+ }++ function getRelativeValue(to, from) {+ const operator = /^(\*=|\+=|-=)/.exec(to);+ if (!operator) return to;+ const u = getUnit(to) || 0;+ const x = parseFloat(from);+ const y = parseFloat(to.replace(operator[0], ''));+ switch (operator[0][0]) {+ case '+': return x + y + u;+ case '-': return x - y + u;+ case '*': return x * y + u;+ }+ }++ function validateValue(val, unit) {+ if (is.col(val)) return colorToRgb(val);+ const originalUnit = getUnit(val);+ const unitLess = originalUnit ? val.substr(0, val.length - originalUnit.length) : val;+ return unit && !/\s/g.test(val) ? unitLess + unit : unitLess;+ }++ // getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes.+ // adapted from https://gist.github.com/SebLambla/3e0550c496c236709744++ function getDistance(p1, p2) {+ return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));+ }++ function getCircleLength(el) {+ return 2 * Math.PI * el.getAttribute('r');+ }++ function getRectLength(el) {+ return (el.getAttribute('width') * 2) + (el.getAttribute('height') * 2);+ }++ function getLineLength(el) {+ return getDistance(+ {x: el.getAttribute('x1'), y: el.getAttribute('y1')},+ {x: el.getAttribute('x2'), y: el.getAttribute('y2')}+ );+ }++ function getPolylineLength(el) {+ const points = el.points;+ let totalLength = 0;+ let previousPos;+ for (let i = 0 ; i < points.numberOfItems; i++) {+ const currentPos = points.getItem(i);+ if (i > 0) totalLength += getDistance(previousPos, currentPos);+ previousPos = currentPos;+ }+ return totalLength;+ }++ function getPolygonLength(el) {+ const points = el.points;+ return getPolylineLength(el) + getDistance(points.getItem(points.numberOfItems - 1), points.getItem(0));+ }++ // Path animation++ function getTotalLength(el) {+ if (el.getTotalLength) return el.getTotalLength();+ switch(el.tagName.toLowerCase()) {+ case 'circle': return getCircleLength(el);+ case 'rect': return getRectLength(el);+ case 'line': return getLineLength(el);+ case 'polyline': return getPolylineLength(el);+ case 'polygon': return getPolygonLength(el);+ }+ }++ function setDashoffset(el) {+ const pathLength = getTotalLength(el);+ el.setAttribute('stroke-dasharray', pathLength);+ return pathLength;+ }++ // Motion path++ function getPath(path, percent) {+ const el = is.str(path) ? selectString(path)[0] : path;+ const p = percent || 100;+ return function(prop) {+ return {+ el: el,+ property: prop,+ totalLength: getTotalLength(el) * (p / 100)+ }+ }+ }++ function getPathProgress(path, progress) {+ function point(offset = 0) {+ const l = progress + offset >= 1 ? progress + offset : 0;+ return path.el.getPointAtLength(l);+ }+ const p = point();+ const p0 = point(-1);+ const p1 = point(+1);+ switch (path.property) {+ case 'x': return p.x;+ case 'y': return p.y;+ case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI;+ }+ }++ // Decompose value++ function decomposeValue(val, unit) {+ const rgx = /-?\d*\.?\d+/g;+ const value = validateValue((is.pth(val) ? val.totalLength : val), unit) + '';+ return {+ original: value,+ numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],+ strings: (is.str(val) || unit) ? value.split(rgx) : []+ }+ }++ // Animatables++ function parseTargets(targets) {+ const targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];+ return filterArray(targetsArray, (item, pos, self) => self.indexOf(item) === pos);+ }++ function getAnimatables(targets) {+ const parsed = parseTargets(targets);+ return parsed.map((t, i) => {+ return {target: t, id: i, total: parsed.length};+ });+ }++ // Properties++ function normalizePropertyTweens(prop, tweenSettings) {+ let settings = cloneObject(tweenSettings);+ if (is.arr(prop)) {+ const l = prop.length;+ const isFromTo = (l === 2 && !is.obj(prop[0]));+ if (!isFromTo) {+ // Duration divided by the number of tweens+ if (!is.fnc(tweenSettings.duration)) settings.duration = tweenSettings.duration / l;+ } else {+ // Transform [from, to] values shorthand to a valid tween value+ prop = {value: prop};+ }+ }+ return toArray(prop).map((v, i) => {+ // Default delay value should be applied only on the first tween+ const delay = !i ? tweenSettings.delay : 0;+ // Use path object as a tween value+ let obj = is.obj(v) && !is.pth(v) ? v : {value: v};+ // Set default delay value+ if (is.und(obj.delay)) obj.delay = delay;+ return obj;+ }).map(k => mergeObjects(k, settings));+ }++ function getProperties(instanceSettings, tweenSettings, params) {+ let properties = [];+ const settings = mergeObjects(instanceSettings, tweenSettings);+ for (let p in params) {+ if (!settings.hasOwnProperty(p) && p !== 'targets') {+ properties.push({+ name: p,+ offset: settings['offset'],+ tweens: normalizePropertyTweens(params[p], tweenSettings)+ });+ }+ }+ return properties;+ }++ // Tweens++ function normalizeTweenValues(tween, animatable) {+ let t = {};+ for (let p in tween) {+ let value = getFunctionValue(tween[p], animatable);+ if (is.arr(value)) {+ value = value.map(v => getFunctionValue(v, animatable));+ if (value.length === 1) value = value[0];+ }+ t[p] = value;+ }+ t.duration = parseFloat(t.duration);+ t.delay = parseFloat(t.delay);+ return t;+ }++ function normalizeEasing(val) {+ return is.arr(val) ? bezier.apply(this, val) : easings[val];+ }++ function normalizeTweens(prop, animatable) {+ let previousTween;+ return prop.tweens.map(t => {+ let tween = normalizeTweenValues(t, animatable);+ const tweenValue = tween.value;+ const originalValue = getOriginalTargetValue(animatable.target, prop.name);+ const previousValue = previousTween ? previousTween.to.original : originalValue;+ const from = is.arr(tweenValue) ? tweenValue[0] : previousValue;+ const to = getRelativeValue(is.arr(tweenValue) ? tweenValue[1] : tweenValue, from);+ const unit = getUnit(to) || getUnit(from) || getUnit(originalValue);+ tween.from = decomposeValue(from, unit);+ tween.to = decomposeValue(to, unit);+ tween.start = previousTween ? previousTween.end : prop.offset;+ tween.end = tween.start + tween.delay + tween.duration;+ tween.easing = normalizeEasing(tween.easing);+ tween.elasticity = (1000 - minMaxValue(tween.elasticity, 1, 999)) / 1000;+ tween.isPath = is.pth(tweenValue);+ tween.isColor = is.col(tween.from.original);+ if (tween.isColor) tween.round = 1;+ previousTween = tween;+ return tween;+ });+ }++ // Tween progress++ const setTweenProgress = {+ css: (t, p, v) => t.style[p] = v,+ attribute: (t, p, v) => t.setAttribute(p, v),+ object: (t, p, v) => t[p] = v,+ transform: (t, p, v, transforms, id) => {+ if (!transforms[id]) transforms[id] = [];+ transforms[id].push(`${p}(${v})`);+ }+ }++ // Animations++ function createAnimation(animatable, prop) {+ const animType = getAnimationType(animatable.target, prop.name);+ if (animType) {+ const tweens = normalizeTweens(prop, animatable);+ return {+ type: animType,+ property: prop.name,+ animatable: animatable,+ tweens: tweens,+ duration: tweens[tweens.length - 1].end,+ delay: tweens[0].delay+ }+ }+ }++ function getAnimations(animatables, properties) {+ return filterArray(flattenArray(animatables.map(animatable => {+ return properties.map(prop => {+ return createAnimation(animatable, prop);+ });+ })), a => !is.und(a));+ }++ // Create Instance++ function getInstanceTimings(type, animations, instanceSettings, tweenSettings) {+ const isDelay = (type === 'delay');+ if (animations.length) {+ return (isDelay ? Math.min : Math.max).apply(Math, animations.map(anim => anim[type]));+ } else {+ return isDelay ? tweenSettings.delay : instanceSettings.offset + tweenSettings.delay + tweenSettings.duration;+ }+ }++ function createNewInstance(params) {+ const instanceSettings = replaceObjectProps(defaultInstanceSettings, params);+ const tweenSettings = replaceObjectProps(defaultTweenSettings, params);+ const animatables = getAnimatables(params.targets);+ const properties = getProperties(instanceSettings, tweenSettings, params);+ const animations = getAnimations(animatables, properties);+ return mergeObjects(instanceSettings, {+ children: [],+ animatables: animatables,+ animations: animations,+ duration: getInstanceTimings('duration', animations, instanceSettings, tweenSettings),+ delay: getInstanceTimings('delay', animations, instanceSettings, tweenSettings)+ });+ }++ // Core++ let activeInstances = [];+ let raf = 0;++ const engine = (() => {+ function play() { raf = requestAnimationFrame(step); };+ function step(t) {+ const activeLength = activeInstances.length;+ if (activeLength) {+ let i = 0;+ while (i < activeLength) {+ if (activeInstances[i]) activeInstances[i].tick(t);+ i++;+ }+ play();+ } else {+ cancelAnimationFrame(raf);+ raf = 0;+ }+ }+ return play;+ })();+++ // Public Instance++ function anime(params = {}) {++ let now, startTime, lastTime = 0;++ let resolve = null;++ function makePromise() {+ return window.Promise && new Promise(_resolve => resolve = _resolve);+ }++ let promise = makePromise();++ let instance = createNewInstance(params);++ function toggleInstanceDirection() {+ instance.reversed = !instance.reversed;+ }++ function adjustTime(time) {+ return instance.reversed ? instance.duration - time : time;+ }++ function syncInstanceChildren(time) {+ const children = instance.children;+ const childrenLength = children.length;+ if (time >= instance.currentTime) {+ for (let i = 0; i < childrenLength; i++) children[i].seek(time);+ } else {+ for (let i = childrenLength; i--;) children[i].seek(time);+ }+ }++ function setAnimationsProgress(insTime) {+ let i = 0;+ let transforms = {};+ const animations = instance.animations;+ const animationsLength = animations.length;+ while (i < animationsLength) {+ const anim = animations[i];+ const animatable = anim.animatable;+ const tweens = anim.tweens;+ const tweenLength = tweens.length - 1;+ let tween = tweens[tweenLength];+ // Only check for keyframes if there is more than one tween+ if (tweenLength) tween = filterArray(tweens, t => (insTime < t.end))[0] || tween;+ const elapsed = minMaxValue(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;+ const eased = isNaN(elapsed) ? 1 : tween.easing(elapsed, tween.elasticity);+ const strings = tween.to.strings;+ const round = tween.round;+ let numbers = [];+ let progress;+ const toNumbersLength = tween.to.numbers.length;+ for (let n = 0; n < toNumbersLength; n++) {+ let value;+ const toNumber = tween.to.numbers[n];+ const fromNumber = tween.from.numbers[n];+ if (!tween.isPath) {+ value = fromNumber + (eased * (toNumber - fromNumber));+ } else {+ value = getPathProgress(tween.value, eased * toNumber);+ }+ if (round) {+ if (!(tween.isColor && n > 2)) {+ value = Math.round(value * round) / round;+ }+ }+ numbers.push(value);+ }+ // Manual Array.reduce for better performances+ const stringsLength = strings.length;+ if (!stringsLength) {+ progress = numbers[0];+ } else {+ progress = strings[0];+ for (let s = 0; s < stringsLength; s++) {+ const a = strings[s];+ const b = strings[s + 1];+ const n = numbers[s];+ if (!isNaN(n)) {+ if (!b) {+ progress += n + ' ';+ } else {+ progress += n + b;+ }+ }+ }+ }+ setTweenProgress[anim.type](animatable.target, anim.property, progress, transforms, animatable.id);+ anim.currentValue = progress;+ i++;+ }+ const transformsLength = Object.keys(transforms).length;+ if (transformsLength) {+ for (let id = 0; id < transformsLength; id++) {+ if (!transformString) {+ const t = 'transform';+ transformString = (getCSSValue(document.body, t) ? t : `-webkit-${t}`);+ }+ instance.animatables[id].target.style[transformString] = transforms[id].join(' ');+ }+ }+ instance.currentTime = insTime;+ instance.progress = (insTime / instance.duration) * 100;+ }++ function setCallback(cb) {+ if (instance[cb]) instance[cb](instance);+ }++ function countIteration() {+ if (instance.remaining && instance.remaining !== true) {+ instance.remaining--;+ }+ }++ function setInstanceProgress(engineTime) {+ const insDuration = instance.duration;+ const insOffset = instance.offset;+ const insStart = insOffset + instance.delay;+ const insCurrentTime = instance.currentTime;+ const insReversed = instance.reversed;+ const insTime = adjustTime(engineTime);+ if (instance.children.length) syncInstanceChildren(insTime);+ if (insTime >= insStart || !insDuration) {+ if (!instance.began) {+ instance.began = true;+ setCallback('begin');+ }+ setCallback('run');+ }+ if (insTime > insOffset && insTime < insDuration) {+ setAnimationsProgress(insTime);+ } else {+ if (insTime <= insOffset && insCurrentTime !== 0) {+ setAnimationsProgress(0);+ if (insReversed) countIteration();+ }+ if ((insTime >= insDuration && insCurrentTime !== insDuration) || !insDuration) {+ setAnimationsProgress(insDuration);+ if (!insReversed) countIteration();+ }+ }+ setCallback('update');+ if (engineTime >= insDuration) {+ if (instance.remaining) {+ startTime = now;+ if (instance.direction === 'alternate') toggleInstanceDirection();+ } else {+ instance.pause();+ if (!instance.completed) {+ instance.completed = true;+ setCallback('complete');+ if ('Promise' in window) {+ resolve();+ promise = makePromise();+ }+ }+ }+ lastTime = 0;+ }+ }++ instance.reset = function() {+ const direction = instance.direction;+ const loops = instance.loop;+ instance.currentTime = 0;+ instance.progress = 0;+ instance.paused = true;+ instance.began = false;+ instance.completed = false;+ instance.reversed = direction === 'reverse';+ instance.remaining = direction === 'alternate' && loops === 1 ? 2 : loops;+ setAnimationsProgress(0);+ for (let i = instance.children.length; i--; ){+ instance.children[i].reset();+ }+ }++ instance.tick = function(t) {+ now = t;+ if (!startTime) startTime = now;+ const engineTime = (lastTime + now - startTime) * anime.speed;+ setInstanceProgress(engineTime);+ }++ instance.seek = function(time) {+ setInstanceProgress(adjustTime(time));+ }++ instance.pause = function() {+ const i = activeInstances.indexOf(instance);+ if (i > -1) activeInstances.splice(i, 1);+ instance.paused = true;+ }++ instance.play = function() {+ if (!instance.paused) return;+ instance.paused = false;+ startTime = 0;+ lastTime = adjustTime(instance.currentTime);+ activeInstances.push(instance);+ if (!raf) engine();+ }++ instance.reverse = function() {+ toggleInstanceDirection();+ startTime = 0;+ lastTime = adjustTime(instance.currentTime);+ }++ instance.restart = function() {+ instance.pause();+ instance.reset();+ instance.play();+ }++ instance.finished = promise;++ instance.reset();++ if (instance.autoplay) instance.play();++ return instance;++ }++ // Remove targets from animation++ function removeTargets(targets) {+ const targetsArray = parseTargets(targets);+ for (let i = activeInstances.length; i--;) {+ const instance = activeInstances[i];+ const animations = instance.animations;+ for (let a = animations.length; a--;) {+ if (arrayContains(targetsArray, animations[a].animatable.target)) {+ animations.splice(a, 1);+ if (!animations.length) instance.pause();+ }+ }+ }+ }++ // Timeline++ function timeline(params) {+ let tl = anime(params);+ tl.pause();+ tl.duration = 0;+ tl.add = function(instancesParams) {+ tl.children.forEach(i => { i.began = true; i.completed = true; });+ toArray(instancesParams).forEach(instanceParams => {+ let insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params || {}));+ insParams.targets = insParams.targets || params.targets;+ const tlDuration = tl.duration;+ const insOffset = insParams.offset;+ insParams.autoplay = false;+ insParams.direction = tl.direction;+ insParams.offset = is.und(insOffset) ? tlDuration : getRelativeValue(insOffset, tlDuration);+ tl.began = true;+ tl.completed = true;+ tl.seek(insParams.offset);+ const ins = anime(insParams);+ ins.began = true;+ ins.completed = true;+ if (ins.duration > tlDuration) tl.duration = ins.duration;+ tl.children.push(ins);+ });+ tl.seek(0);+ tl.reset();+ if (tl.autoplay) tl.restart();+ return tl;+ }+ return tl;+ }++ anime.version = '2.2.0';+ anime.speed = 1;+ anime.running = activeInstances;+ anime.remove = removeTargets;+ anime.getValue = getOriginalTargetValue;+ anime.path = getPath;+ anime.setDashoffset = setDashoffset;+ anime.bezier = bezier;+ anime.easings = easings;+ anime.timeline = timeline;+ anime.random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;++ return anime;++}));diff --git a/documentation/assets/js/anime/anime.3.0.0-alpha.js b/documentation/assets/js/anime/anime.3.0.0-alpha.jsnew file mode 100644index 00000000..1dbb7070--- /dev/null+++ b/documentation/assets/js/anime/anime.3.0.0-alpha.js@@ -0,0 +1,1004 @@+/**+ * http://animejs.com+ * JavaScript animation engine+ * @version v3.0.0-alpha+ * @author Julian Garnier+ * @copyright ©2017 Julian Garnier+ * Released under the MIT license+**/++(function(root, factory) {+ if (typeof define === 'function' && define.amd) {+ // AMD. Register as an anonymous module.+ define([], factory);+ } else if (typeof module === 'object' && module.exports) {+ // Node. Does not work with strict CommonJS, but+ // only CommonJS-like environments that support module.exports,+ // like Node.+ module.exports = factory();+ } else {+ // Browser globals (root is window)+ root.anime = factory();+ }+}(this, () => {++ // Defaults++ const defaultInstanceSettings = {+ update: undefined,+ begin: undefined,+ run: undefined,+ complete: undefined,+ loop: 1,+ direction: 'normal',+ autoplay: true,+ timeOffset: 0+ }++ const defaultTweenSettings = {+ duration: 1000,+ delay: 0,+ endDelay: 0,+ easing: 'easeOutElastic',+ elasticity: 500,+ round: 0+ }++ const validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'perspective'];++ // Utils++ function stringContains(str, text) {+ return str.indexOf(text) > -1;+ }++ const is = {+ arr: a => Array.isArray(a),+ obj: a => stringContains(Object.prototype.toString.call(a), 'Object'),+ pth: a => is.obj(a) && a.hasOwnProperty('totalLength'),+ svg: a => a instanceof SVGElement,+ dom: a => a.nodeType || is.svg(a),+ str: a => typeof a === 'string',+ fnc: a => typeof a === 'function',+ und: a => typeof a === 'undefined',+ hex: a => /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a),+ rgb: a => /^rgb/.test(a),+ hsl: a => /^hsl/.test(a),+ col: a => (is.hex(a) || is.rgb(a) || is.hsl(a))+ }++ // BezierEasing https://github.com/gre/bezier-easing++ const bezier = (() => {++ const kSplineTableSize = 11;+ const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);++ function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 };+ function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 };+ function C (aA1) { return 3.0 * aA1 };++ function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT };+ function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) };++ function binarySubdivide (aX, aA, aB, mX1, mX2) {+ let currentX, currentT, i = 0;+ do {+ currentT = aA + (aB - aA) / 2.0;+ currentX = calcBezier(currentT, mX1, mX2) - aX;+ if (currentX > 0.0) { aB = currentT } else { aA = currentT };+ } while (Math.abs(currentX) > 0.0000001 && ++i < 10);+ return currentT;+ }++ function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {+ for (let i = 0; i < 4; ++i) {+ const currentSlope = getSlope(aGuessT, mX1, mX2);+ if (currentSlope === 0.0) return aGuessT;+ const currentX = calcBezier(aGuessT, mX1, mX2) - aX;+ aGuessT -= currentX / currentSlope;+ }+ return aGuessT;+ }++ function bezier(mX1, mY1, mX2, mY2) {++ if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) return;+ let sampleValues = new Float32Array(kSplineTableSize);++ if (mX1 !== mY1 || mX2 !== mY2) {+ for (let i = 0; i < kSplineTableSize; ++i) {+ sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);+ }+ }++ function getTForX(aX) {++ let intervalStart = 0.0;+ let currentSample = 1;+ const lastSample = kSplineTableSize - 1;++ for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {+ intervalStart += kSampleStepSize;+ }++ --currentSample;++ const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);+ const guessForT = intervalStart + dist * kSampleStepSize;+ const initialSlope = getSlope(guessForT, mX1, mX2);++ if (initialSlope >= 0.001) {+ return newtonRaphsonIterate(aX, guessForT, mX1, mX2);+ } else if (initialSlope === 0.0) {+ return guessForT;+ } else {+ return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);+ }++ }++ return x => {+ if (mX1 === mY1 && mX2 === mY2) return x;+ if (x === 0) return 0;+ if (x === 1) return 1;+ return calcBezier(getTForX(x), mY1, mY2);+ }++ }++ return bezier;++ })();++ const easings = (() => {++ const names = ['Quad', 'Cubic', 'Quart', 'Quint', 'Sine', 'Expo', 'Circ', 'Back', 'Elastic'];++ // Elastic easing adapted from jQueryUI http://api.jqueryui.com/easings/++ function elastic(t, p) {+ return t === 0 || t === 1 ? t :+ -Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2.0) * Math.asin(1))) * (Math.PI * 2)) / p );+ }++ // Approximated Penner equations http://matthewlein.com/ceaser/++ const equations = {+ In: [+ [0.550, 0.085, 0.680, 0.530], /* InQuad */+ [0.550, 0.055, 0.675, 0.190], /* InCubic */+ [0.895, 0.030, 0.685, 0.220], /* InQuart */+ [0.755, 0.050, 0.855, 0.060], /* InQuint */+ [0.470, 0.000, 0.745, 0.715], /* InSine */+ [0.950, 0.050, 0.795, 0.035], /* InExpo */+ [0.600, 0.040, 0.980, 0.335], /* InCirc */+ [0.600, -0.280, 0.735, 0.045], /* InBack */+ elastic /* InElastic */+ ], Out: [+ [0.250, 0.460, 0.450, 0.940], /* OutQuad */+ [0.215, 0.610, 0.355, 1.000], /* OutCubic */+ [0.165, 0.840, 0.440, 1.000], /* OutQuart */+ [0.230, 1.000, 0.320, 1.000], /* OutQuint */+ [0.390, 0.575, 0.565, 1.000], /* OutSine */+ [0.190, 1.000, 0.220, 1.000], /* OutExpo */+ [0.075, 0.820, 0.165, 1.000], /* OutCirc */+ [0.175, 0.885, 0.320, 1.275], /* OutBack */+ (t, f) => 1 - elastic(1 - t, f) /* OutElastic */+ ], InOut: [+ [0.455, 0.030, 0.515, 0.955], /* InOutQuad */+ [0.645, 0.045, 0.355, 1.000], /* InOutCubic */+ [0.770, 0.000, 0.175, 1.000], /* InOutQuart */+ [0.860, 0.000, 0.070, 1.000], /* InOutQuint */+ [0.445, 0.050, 0.550, 0.950], /* InOutSine */+ [1.000, 0.000, 0.000, 1.000], /* InOutExpo */+ [0.785, 0.135, 0.150, 0.860], /* InOutCirc */+ [0.680, -0.550, 0.265, 1.550], /* InOutBack */+ (t, f) => t < .5 ? elastic(t * 2, f) / 2 : 1 - elastic(t * -2 + 2, f) / 2 /* InOutElastic */+ ]+ }++ let functions = {+ linear: bezier(0.250, 0.250, 0.750, 0.750)+ }++ for (let type in equations) {+ equations[type].forEach((f, i) => {+ functions['ease'+type+names[i]] = is.fnc(f) ? f : bezier.apply(this, f);+ });+ }++ return functions;++ })();++ // Strings++ function stringToHyphens(str) {+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();+ }++ function selectString(str) {+ try {+ let nodes = document.querySelectorAll(str);+ return nodes;+ } catch(e) {+ return;+ }+ }++ // Arrays++ function filterArray(arr, callback) {+ const len = arr.length;+ const thisArg = arguments.length >= 2 ? arguments[1] : void 0;+ let result = [];+ for (let i = 0; i < len; i++) {+ if (i in arr) {+ const val = arr[i];+ if (callback.call(thisArg, val, i, arr)) {+ result.push(val);+ }+ }+ }+ return result;+ }++ function flattenArray(arr) {+ return arr.reduce((a, b) => a.concat(is.arr(b) ? flattenArray(b) : b), []);+ }++ function toArray(o) {+ if (is.arr(o)) return o;+ if (is.str(o)) o = selectString(o) || o;+ if (o instanceof NodeList || o instanceof HTMLCollection) return [].slice.call(o);+ return [o];+ }++ function arrayContains(arr, val) {+ return arr.some(a => a === val);+ }++ // Objects++ function cloneObject(o) {+ let clone = {};+ for (let p in o) clone[p] = o[p];+ return clone;+ }++ function replaceObjectProps(o1, o2) {+ let o = cloneObject(o1);+ for (let p in o1) o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p];+ return o;+ }++ function mergeObjects(o1, o2) {+ let o = cloneObject(o1);+ for (let p in o2) o[p] = is.und(o1[p]) ? o2[p] : o1[p];+ return o;+ }++ // Colors++ function rgbToRgba(rgbValue) {+ const rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue);+ return rgb ? `rgba(${rgb[1]},1)` : rgbValue;+ }++ function hexToRgba(hexValue) {+ const rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;+ const hex = hexValue.replace(rgx, (m, r, g, b) => r + r + g + g + b + b );+ const rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);+ const r = parseInt(rgb[1], 16);+ const g = parseInt(rgb[2], 16);+ const b = parseInt(rgb[3], 16);+ return `rgba(${r},${g},${b},1)`;+ }++ function hslToRgba(hslValue) {+ const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);+ const h = parseInt(hsl[1], 10) / 360;+ const s = parseInt(hsl[2], 10) / 100;+ const l = parseInt(hsl[3], 10) / 100;+ const a = hsl[4] || 1;+ function hue2rgb(p, q, t) {+ if (t < 0) t += 1;+ if (t > 1) t -= 1;+ if (t < 1/6) return p + (q - p) * 6 * t;+ if (t < 1/2) return q;+ if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;+ return p;+ }+ let r, g, b;+ if (s == 0) {+ r = g = b = l;+ } else {+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;+ const p = 2 * l - q;+ r = hue2rgb(p, q, h + 1/3);+ g = hue2rgb(p, q, h);+ b = hue2rgb(p, q, h - 1/3);+ }+ return `rgba(${r * 255},${g * 255},${b * 255},${a})`;+ }++ function colorToRgb(val) {+ if (is.rgb(val)) return rgbToRgba(val);+ if (is.hex(val)) return hexToRgba(val);+ if (is.hsl(val)) return hslToRgba(val);+ }++ // Units++ function getUnit(val) {+ const split = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val);+ if (split) return split[2];+ }++ function getTransformUnit(propName) {+ if (stringContains(propName, 'translate') || propName === 'perspective') return 'px';+ if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) return 'deg';+ }++ // Values++ function minMaxValue(val, min, max) {+ return Math.min(Math.max(val, min), max);+ }++ function getFunctionValue(val, animatable) {+ if (!is.fnc(val)) return val;+ return val(animatable.target, animatable.id, animatable.total);+ }++ function getCSSValue(el, prop) {+ if (prop in el.style) {+ return el.style[prop] || getComputedStyle(el).getPropertyValue(stringToHyphens(prop)) || '0';+ }+ }++ function getAnimationType(el, prop) {+ if (is.dom(el) && arrayContains(validTransforms, prop)) return 'transform';+ if (is.dom(el) && (el.getAttribute(prop) || (is.svg(el) && el[prop]))) return 'attribute';+ if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) return 'css';+ if (el[prop] != null) return 'object';+ }++ function getElementTransforms(el) {+ if (!is.dom(el)) return;+ const str = el.style.transform || '';+ const reg = /(\w+)\(([^)]*)\)/g;+ const transforms = new Map();+ let m; while (m = reg.exec(str)) transforms.set(m[1], m[2]);+ return transforms;+ }++ function getTransformValue(el, propName, animatable) {+ const defaultVal = stringContains(propName, 'scale') ? 1 : 0 + getTransformUnit(propName);+ const prop = getElementTransforms(el).get(propName) || defaultVal;+ animatable.transforms.list.set(propName, prop);+ animatable.transforms['last'] = propName;+ return prop;+ }++ function getOriginalTargetValue(target, propName, animatable) {+ switch (getAnimationType(target, propName)) {+ case 'transform': return getTransformValue(target, propName, animatable);+ case 'css': return getCSSValue(target, propName);+ case 'attribute': return target.getAttribute(propName);+ default: return target[propName] || 0;+ }+ }++ function getRelativeValue(to, from) {+ const operator = /^(\*=|\+=|-=)/.exec(to);+ if (!operator) return to;+ const u = getUnit(to) || 0;+ const x = parseFloat(from);+ const y = parseFloat(to.replace(operator[0], ''));+ switch (operator[0][0]) {+ case '+': return x + y + u;+ case '-': return x - y + u;+ case '*': return x * y + u;+ }+ }++ function validateValue(val, unit) {+ if (is.col(val)) return colorToRgb(val);+ const originalUnit = getUnit(val);+ const unitLess = originalUnit ? val.substr(0, val.length - originalUnit.length) : val;+ return unit && !/\s/g.test(val) ? unitLess + unit : unitLess;+ }++ // getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes.+ // adapted from https://gist.github.com/SebLambla/3e0550c496c236709744++ function getDistance(p1, p2) {+ return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));+ }++ function getCircleLength(el) {+ return 2 * Math.PI * el.getAttribute('r');+ }++ function getRectLength(el) {+ return (el.getAttribute('width') * 2) + (el.getAttribute('height') * 2);+ }++ function getLineLength(el) {+ return getDistance(+ {x: el.getAttribute('x1'), y: el.getAttribute('y1')},+ {x: el.getAttribute('x2'), y: el.getAttribute('y2')}+ );+ }++ function getPolylineLength(el) {+ const points = el.points;+ let totalLength = 0;+ let previousPos;+ for (let i = 0 ; i < points.numberOfItems; i++) {+ const currentPos = points.getItem(i);+ if (i > 0) totalLength += getDistance(previousPos, currentPos);+ previousPos = currentPos;+ }+ return totalLength;+ }++ function getPolygonLength(el) {+ const points = el.points;+ return getPolylineLength(el) + getDistance(points.getItem(points.numberOfItems - 1), points.getItem(0));+ }++ // Path animation++ function getTotalLength(el) {+ if (el.getTotalLength) return el.getTotalLength();+ switch(el.tagName.toLowerCase()) {+ case 'circle': return getCircleLength(el);+ case 'rect': return getRectLength(el);+ case 'line': return getLineLength(el);+ case 'polyline': return getPolylineLength(el);+ case 'polygon': return getPolygonLength(el);+ }+ }++ function setDashoffset(el) {+ const pathLength = getTotalLength(el);+ el.setAttribute('stroke-dasharray', pathLength);+ return pathLength;+ }++ // Motion path++ function getPath(path, percent) {+ const el = is.str(path) ? selectString(path)[0] : path;+ const p = percent || 100;+ return function(property) {+ return {+ el,+ property,+ totalLength: getTotalLength(el) * (p / 100)+ }+ }+ }++ function getPathProgress(path, progress) {+ function point(offset = 0) {+ const l = progress + offset >= 1 ? progress + offset : 0;+ return path.el.getPointAtLength(l);+ }+ const p = point();+ const p0 = point(-1);+ const p1 = point(+1);+ switch (path.property) {+ case 'x': return p.x;+ case 'y': return p.y;+ case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI;+ }+ }++ // Decompose value++ function decomposeValue(val, unit) {+ const rgx = /-?\d*\.?\d+/g;+ const value = validateValue((is.pth(val) ? val.totalLength : val), unit) + '';+ return {+ original: value,+ numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],+ strings: (is.str(val) || unit) ? value.split(rgx) : []+ }+ }++ // Animatables++ function parseTargets(targets) {+ const targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];+ return filterArray(targetsArray, (item, pos, self) => self.indexOf(item) === pos);+ }++ function getAnimatables(targets) {+ const parsed = parseTargets(targets);+ return parsed.map((t, i) => {+ return {target: t, id: i, total: parsed.length, transforms: { list: getElementTransforms(t) } };+ });+ }++ // Properties++ function normalizePropertyTweens(prop, tweenSettings) {+ let settings = cloneObject(tweenSettings);+ if (is.arr(prop)) {+ const l = prop.length;+ const isFromTo = (l === 2 && !is.obj(prop[0]));+ if (!isFromTo) {+ // Duration divided by the number of tweens+ if (!is.fnc(tweenSettings.duration)) settings.duration = tweenSettings.duration / l;+ } else {+ // Transform [from, to] values shorthand to a valid tween value+ prop = {value: prop};+ }+ }+ const propArray = is.arr(prop) ? prop : [prop];+ return propArray.map((v, i) => {+ // Default delay value should be applied only on the first tween+ const delay = !i ? tweenSettings.delay : 0;+ // Use path object as a tween value+ let obj = is.obj(v) && !is.pth(v) ? v : {value: v};+ // Set default delay value+ if (is.und(obj.delay)) obj.delay = delay;+ return obj;+ }).map(k => mergeObjects(k, settings));+ }++ function getProperties(instanceSettings, tweenSettings, params) {+ let properties = [];+ const settings = mergeObjects(instanceSettings, tweenSettings);+ for (let p in params) {+ if (!settings.hasOwnProperty(p) && p !== 'targets') {+ properties.push({+ name: p,+ offset: settings['timeOffset'],+ tweens: normalizePropertyTweens(params[p], tweenSettings)+ });+ }+ }+ return properties;+ }++ // Tweens++ function normalizeTweenValues(tween, animatable) {+ let t = {};+ for (let p in tween) {+ let value = getFunctionValue(tween[p], animatable);+ if (is.arr(value)) {+ value = value.map(v => getFunctionValue(v, animatable));+ if (value.length === 1) value = value[0];+ }+ t[p] = value;+ }+ t.duration = parseFloat(t.duration);+ t.delay = parseFloat(t.delay);+ return t;+ }++ function normalizeEasing(val) {+ return is.arr(val) ? bezier.apply(this, val) : easings[val];+ }++ function normalizeTweens(prop, animatable) {+ let previousTween;+ return prop.tweens.map(t => {+ let tween = normalizeTweenValues(t, animatable);+ const tweenValue = tween.value;+ const originalValue = getOriginalTargetValue(animatable.target, prop.name, animatable);+ const previousValue = previousTween ? previousTween.to.original : originalValue;+ const from = is.arr(tweenValue) ? tweenValue[0] : previousValue;+ const to = getRelativeValue(is.arr(tweenValue) ? tweenValue[1] : tweenValue, from);+ const unit = getUnit(to) || getUnit(from) || getUnit(originalValue);+ tween.from = decomposeValue(from, unit);+ tween.to = decomposeValue(to, unit);+ tween.start = previousTween ? previousTween.end : prop.offset;+ tween.end = tween.start + tween.delay + tween.duration + tween.endDelay;+ tween.easing = normalizeEasing(tween.easing);+ tween.elasticity = (1000 - minMaxValue(tween.elasticity, 1, 999)) / 1000;+ tween.isPath = is.pth(tweenValue);+ tween.isColor = is.col(tween.from.original);+ if (tween.isColor) tween.round = 1;+ previousTween = tween;+ return tween;+ });+ }++ // Tween progress++ const setProgressValue = {+ css: (t, p, v) => t.style[p] = v,+ attribute: (t, p, v) => t.setAttribute(p, v),+ object: (t, p, v) => t[p] = v,+ transform: (t, p, v, transforms, manual) => {+ transforms.list.set(p, v);+ if (p === transforms.last || manual) {+ let str = '';+ for (let [prop, value] of transforms.list) {+ str += `${prop}(${value}) `;+ }+ t.style.transform = str;+ }+ }+ }++ function setTargetValue(targets, properties) {+ const animatables = getAnimatables(targets);+ animatables.forEach(animatable => {+ for (var property in properties) {+ const value = properties[property];+ const originalValue = getOriginalTargetValue(animatable.target, property, animatable);+ const unit = getUnit(value) || getUnit(originalValue);+ const to = getRelativeValue(validateValue(value, unit), originalValue);+ const animType = getAnimationType(animatable.target, property);+ setProgressValue[animType](animatable.target, property, to, animatable.transforms, true);+ }+ });+ }++ // Animations++ function createAnimation(animatable, prop) {+ const animType = getAnimationType(animatable.target, prop.name);+ if (animType) {+ const tweens = normalizeTweens(prop, animatable);+ return {+ type: animType,+ property: prop.name,+ animatable: animatable,+ tweens: tweens,+ duration: tweens[tweens.length - 1].end,+ delay: tweens[0].delay+ }+ }+ }++ function getAnimations(animatables, properties) {+ return filterArray(flattenArray(animatables.map(animatable => {+ return properties.map(prop => {+ return createAnimation(animatable, prop);+ });+ })), a => !is.und(a));+ }++ // Create Instance++ function getInstanceTimings(type, animations, instanceSettings, tweenSettings) {+ const isDelay = (type === 'delay');+ if (animations.length) {+ return (isDelay ? Math.min : Math.max).apply(Math, animations.map(anim => anim[type]));+ } else {+ return isDelay ? tweenSettings.delay : instanceSettings.timeOffset + tweenSettings.delay + tweenSettings.duration;+ }+ }++ function createNewInstance(params) {+ const instanceSettings = replaceObjectProps(defaultInstanceSettings, params);+ const tweenSettings = replaceObjectProps(defaultTweenSettings, params);+ const animatables = getAnimatables(params.targets);+ const properties = getProperties(instanceSettings, tweenSettings, params);+ const animations = getAnimations(animatables, properties);+ return mergeObjects(instanceSettings, {+ children: [],+ animatables: animatables,+ animations: animations,+ duration: getInstanceTimings('duration', animations, instanceSettings, tweenSettings),+ delay: getInstanceTimings('delay', animations, instanceSettings, tweenSettings)+ });+ }++ // Core++ let activeInstances = [];+ let raf;++ const engine = (() => {+ function play() {+ raf = requestAnimationFrame(step);+ };+ function step(t) {+ if (activeInstances.length) {+ let i = 0;+ while (i < activeInstances.length) {+ const activeInstance = activeInstances[i];+ if (!activeInstance.paused) {+ activeInstance.tick(t);+ } else {+ const instanceIndex = activeInstances.indexOf(activeInstance);+ if (instanceIndex > -1) activeInstances.splice(instanceIndex, 1);+ }+ i++;+ }+ play();+ } else {+ raf = cancelAnimationFrame(raf);+ }+ }+ return play;+ })();+++ // Public Instance++ function anime(params = {}) {++ let now, startTime, lastTime = 0;++ let resolve = null;++ function makePromise() {+ return window.Promise && new Promise(_resolve => resolve = _resolve);+ }++ let promise = makePromise();++ let instance = createNewInstance(params);++ function toggleInstanceDirection() {+ instance.reversed = !instance.reversed;+ const children = instance.children;+ children.forEach(child => child.reversed = instance.reversed);+ }++ function adjustTime(time) {+ return instance.reversed ? instance.duration - time : time;+ }++ function syncInstanceChildren(time, manual) {+ const children = instance.children;+ const childrenLength = children.length;+ if (!manual || time >= instance.currentTime) {+ for (let i = 0; i < childrenLength; i++) children[i].seek(time);+ } else {+ // Manual backward seeking requires looping in reverse+ for (let i = childrenLength; i--;) children[i].seek(time);+ }+ }++ function setAnimationsProgress(insTime) {+ let i = 0;+ const animations = instance.animations;+ const animationsLength = animations.length;+ while (i < animationsLength) {+ const anim = animations[i];+ const animatable = anim.animatable;+ const tweens = anim.tweens;+ const tweenLength = tweens.length - 1;+ let tween = tweens[tweenLength];+ // Only check for keyframes if there is more than one tween+ if (tweenLength) tween = filterArray(tweens, t => (insTime < t.end))[0] || tween;+ const elapsed = minMaxValue(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;+ const eased = isNaN(elapsed) ? 1 : tween.easing(elapsed, tween.elasticity);+ const strings = tween.to.strings;+ const round = tween.round;+ const numbers = [];+ let progress;+ const toNumbersLength = tween.to.numbers.length;+ for (let n = 0; n < toNumbersLength; n++) {+ let value;+ const toNumber = tween.to.numbers[n];+ const fromNumber = tween.from.numbers[n];+ if (!tween.isPath) {+ value = fromNumber + (eased * (toNumber - fromNumber));+ } else {+ value = getPathProgress(tween.value, eased * toNumber);+ }+ if (round) {+ if (!(tween.isColor && n > 2)) {+ value = Math.round(value * round) / round;+ }+ }+ numbers.push(value);+ }+ // Manual Array.reduce for better performances+ const stringsLength = strings.length;+ if (!stringsLength) {+ progress = numbers[0];+ } else {+ progress = strings[0];+ for (let s = 0; s < stringsLength; s++) {+ const a = strings[s];+ const b = strings[s + 1];+ const n = numbers[s];+ if (!isNaN(n)) {+ if (!b) {+ progress += n + ' ';+ } else {+ progress += n + b;+ }+ }+ }+ }+ setProgressValue[anim.type](animatable.target, anim.property, progress, animatable.transforms);+ anim.currentValue = progress;+ i++;+ }+ instance.currentTime = insTime;+ instance.progress = (insTime / instance.duration) * 100;+ }++ function setCallback(cb) {+ if (instance[cb]) instance[cb](instance);+ }++ function countIteration() {+ if (instance.remaining && instance.remaining !== true) {+ instance.remaining--;+ }+ }++ function setInstanceProgress(engineTime, manual) {+ const insOffset = instance.timeOffset;+ const insDuration = instance.duration;+ const insTime = adjustTime(engineTime);+ if (instance.children.length) syncInstanceChildren(insTime, manual);+ if (insTime >= (insOffset + instance.delay) || !insDuration) {+ if (!instance.began) {+ instance.began = true;+ setCallback('begin');+ }+ setCallback('run');+ }+ if (insTime > insOffset && insTime < insDuration) {+ setAnimationsProgress(insTime);+ } else {+ if (insTime <= insOffset && instance.currentTime !== 0) {+ setAnimationsProgress(0);+ if (instance.reversed) countIteration();+ }+ if ((insTime >= insDuration && instance.currentTime !== insDuration) || !insDuration) {+ setAnimationsProgress(insDuration);+ if (!instance.reversed) countIteration();+ }+ }+ setCallback('update');+ if (engineTime >= insDuration) {+ if (instance.remaining) {+ startTime = now;+ if (instance.direction === 'alternate') toggleInstanceDirection();+ } else {+ instance.paused = true;+ if (!instance.completed) {+ instance.completed = true;+ setCallback('complete');+ if ('Promise' in window) {+ resolve();+ promise = makePromise();+ }+ }+ }+ lastTime = 0;+ }+ }++ instance.reset = function() {+ const direction = instance.direction;+ const loops = instance.loop;+ instance.currentTime = 0;+ instance.progress = 0;+ instance.paused = true;+ instance.began = false;+ instance.completed = false;+ instance.reversed = direction === 'reverse';+ instance.remaining = direction === 'alternate' && loops === 1 ? 2 : loops;+ setAnimationsProgress(0);+ for (let i = instance.children.length; i--; ){+ instance.children[i].reset();+ }+ }++ instance.tick = function(t) {+ now = t;+ if (!startTime) startTime = now;+ const engineTime = (lastTime + now - startTime) * anime.speed;+ setInstanceProgress(engineTime);+ }++ instance.seek = function(time) {+ setInstanceProgress(adjustTime(time), true);+ }++ instance.pause = function() {+ instance.paused = true;+ }++ instance.play = function() {+ if (!instance.paused) return;+ instance.paused = false;+ startTime = 0;+ lastTime = adjustTime(instance.currentTime);+ activeInstances.push(instance);+ if (!raf) engine();+ }++ instance.reverse = function() {+ toggleInstanceDirection();+ startTime = 0;+ lastTime = adjustTime(instance.currentTime);+ }++ instance.restart = function() {+ instance.pause();+ instance.reset();+ instance.play();+ }++ instance.finished = promise;++ instance.reset();++ if (instance.autoplay) instance.play();++ return instance;++ }++ // Remove targets from animation++ function removeTargets(targets) {+ const targetsArray = parseTargets(targets);+ for (let i = activeInstances.length; i--;) {+ const instance = activeInstances[i];+ const animations = instance.animations;+ for (let a = animations.length; a--;) {+ if (arrayContains(targetsArray, animations[a].animatable.target)) {+ animations.splice(a, 1);+ if (!animations.length) instance.pause();+ }+ }+ }+ }++ // Timeline++ function timeline(params = {}) {+ let tl = anime(params);+ tl.pause();+ tl.duration = 0;+ tl.add = function(instanceParams, timeOffset) {+ tl.children.forEach(i => { i.began = true; i.completed = true; });+ let insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));+ insParams.targets = insParams.targets || params.targets;+ const tlDuration = tl.duration;+ insParams.autoplay = false;+ insParams.direction = tl.direction;+ insParams.timeOffset = is.und(timeOffset) ? tlDuration : getRelativeValue(timeOffset, tlDuration);+ tl.began = true;+ tl.completed = true;+ tl.seek(insParams.timeOffset);+ const ins = anime(insParams);+ ins.began = true;+ ins.completed = true;+ if (ins.duration > tlDuration) tl.duration = ins.duration;+ tl.children.push(ins);+ tl.seek(0);+ tl.reset();+ if (tl.autoplay) tl.restart();+ return tl;+ }+ return tl;+ }++ anime.version = '3.0.0-alpha';+ anime.speed = 1;+ anime.running = activeInstances;+ anime.remove = removeTargets;+ anime.get = getOriginalTargetValue;+ anime.set = setTargetValue;+ anime.path = getPath;+ anime.setDashoffset = setDashoffset;+ anime.bezier = bezier;+ anime.easings = easings;+ anime.timeline = timeline;+ anime.random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;++ return anime;++}));\ No newline at end of filediff --git a/documentation/assets/js/scripts.js b/documentation/assets/js/documentation.jssimilarity index 72%rename from documentation/assets/js/scripts.jsrename to documentation/assets/js/documentation.jsindex 975153d4..a7f824dc 100644--- a/documentation/assets/js/scripts.js+++ b/documentation/assets/js/documentation.js@@ -1,8 +1,9 @@var navigationEl = document.querySelector('.navigation');var demosEl = document.querySelector('.demos');var articleEls = document.querySelectorAll('article');-var jsOutputEl = document.querySelector('.js-output');-var htmlOutputEl = document.querySelector('.html-output');+var demoInfoEl = document.querySelector('.demo-info');+var descriptionEl = document.querySelector('.info-output');+var descriptionTitleEl = document.querySelector('.demo-info h2');var ulHeight = 20;var demos = [];@@ -43,15 +44,34 @@ function parseHTML(el, parentId) {});}-function outputCode(JScode, HTMLcode) {- var js = document.createTextNode(JScode);- var html = document.createTextNode(HTMLcode);- jsOutputEl.innerHTML = '';- htmlOutputEl.innerHTML = '';- jsOutputEl.appendChild(js);- htmlOutputEl.appendChild(html);- hljs.highlightBlock(jsOutputEl);- hljs.highlightBlock(htmlOutputEl);+function parseJS(demoCode) {+ var split = demoCode.split('/*DEMO*/\n');+ return split[1] || '';+}++function createCodePreview(code) {+ var previewEl = document.createElement('div');+ var preEl = document.createElement('pre');+ var codeEl = document.createElement('code');+ previewEl.classList.add('code-preview');+ previewEl.innerHTML = '<h2>Code example</h2>';+ codeEl.appendChild(code);+ preEl.appendChild(codeEl);+ previewEl.appendChild(preEl);+ return previewEl;+}++function outputCode(demoCode, demoTitle, demoDecription, demoColorClass) {+ var js = document.createTextNode(parseJS(demoCode));+ demoInfoEl.classList.remove(demoInfoEl.classList[2]);+ demoInfoEl.classList.add(demoColorClass);+ descriptionEl.innerHTML = demoDecription;+ descriptionEl.appendChild(createCodePreview(js));+ descriptionTitleEl.innerHTML = demoTitle;+ codeEls = descriptionEl.querySelectorAll('code');+ for (var i = 0; i < codeEls.length; i++) {+ hljs.highlightBlock(codeEls[i]);+ }}function toggleSectionLink(ulEl) {@@ -76,25 +96,46 @@ function toggleSectionLink(ulEl) {});}+function resetDemo() {+ var els = document.querySelectorAll('.el');+ for (var i = 0; i < els.length; i++) {+ anime.remove(els[i]);+ els[i].style = '';+ }+}+function resetDemos() {- demos.forEach(function(demo) {- demo.anim.pause();- demo.anim.seek(0);- });+ for (var i = 0; i < anime.running.length; i++) {+ var anim = anime.running[i];+ anim.pause();+ anim.seek(0);+ }document.body.classList.add('ready');}function createDemo(el) {var demo = {};+ var demoColorClass = el.parentNode.classList[0];var scriptEl = el.querySelector('script');var demoContentEl = el.querySelector('.demo-content');- var title = el.querySelector('h3').innerHTML;+ var descriptionContentEl = el.querySelector('.demo-description');+ var demoTitle = el.querySelector('h3').innerHTML;var id = el.id;var demoAnim = window[id];- var JScode = scriptEl ? scriptEl.innerHTML : '';- var HTMLcode = demoContentEl ? parseHTML(demoContentEl, id) : '';+ var demoCode = scriptEl ? scriptEl.innerHTML : '';+ var demoDescription = descriptionContentEl ? descriptionContentEl.innerHTML : '';+ function restart() {+ resetDemo();+ demoAnim();+ }function highlightDemo(e, push) {- if (e) e.preventDefault();+ var canRestart = !el.classList.contains('controls');+ if (e) {+ e.preventDefault();+ if (e.target.tagName === 'BUTTON' || e.target.tagName === 'INPUT') {+ canRestart = false;+ }+ }if (!el.classList.contains('active')) {resetDemos();var linkEls = document.querySelectorAll('.demo-link');@@ -102,31 +143,30 @@ function createDemo(el) {var d = demos[i];d.el.classList.remove('active');linkEls[i].parentNode.classList.remove('active');- d.anim.pause();+ //d.anim.pause();}- outputCode(JScode, HTMLcode);+ outputCode(demoCode, demoTitle, demoDescription, demoColorClass);var linkEl = document.querySelector('a[href="#'+id+'"]');var ulEl = linkEl.parentNode.parentNode;linkEl.parentNode.classList.add('active');el.classList.add('active');scrollTo('#'+id, 60, function() {toggleSectionLink(ulEl);- if (!el.classList.contains('controls')) demoAnim.restart();+ if (canRestart) restart();});if (push) history.pushState(null, null, '#'+id);} else {- if (!el.classList.contains('controls')) demoAnim.restart();+ if (canRestart) restart();}}function enterDemo() {if (!el.classList.contains('active')) {- demoAnim.restart();+ restart();}}function leaveDemo() {if (!el.classList.contains('active')) {- demoAnim.pause();- demoAnim.seek(0);+ resetDemo();}}el.addEventListener('click', function(e) {@@ -135,7 +175,7 @@ function createDemo(el) {resetDemos();return {el: el,- title: title,+ title: demoTitle,id: id,anim: demoAnim,highlight: highlightDemo@@ -197,7 +237,7 @@ for (var i = 0; i < articleEls.length; i++) {navigationEl.appendChild(fragment);-function updateDemos(e) {+function updateDemos() {var hash = window.location.hash;if (hash) {var id = hash.replace('#','');diff --git a/documentation/assets/js/highlight.pack.js b/documentation/assets/js/highlight.pack.jsdeleted file mode 100644index 11063f6f..00000000--- a/documentation/assets/js/highlight.pack.js+++ /dev/null@@ -1,2 +0,0 @@-/*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */-!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/[&<>]/gm,function(e){return I[e]})}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function i(e){return k.test(e)}function a(e){var n,t,r,a,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return R(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(a=o[n],i(a)||R(a))return a}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,i){for(var a=e.firstChild;a;a=a.nextSibling)3===a.nodeType?i+=a.nodeValue.length:1===a.nodeType&&(n.push({event:"start",offset:i,node:a}),i=r(a,i),t(a).match(/br|hr|img|input/)||n.push({event:"stop",offset:i,node:a}));return i}(e,0),n}function c(e,r,i){function a(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset<r[0].offset?e:r:"start"===r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value)+'"'}l+="<"+t(e)+w.map.call(e.attributes,r).join("")+">"}function u(e){l+="</"+t(e)+">"}function c(e){("start"===e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=a();if(l+=n(i.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=a();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(i.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(i,a){if(!i.compiled){if(i.compiled=!0,i.k=i.k||i.bK,i.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof i.k?c("keyword",i.k):E(i.k).forEach(function(e){c(e,i.k[e])}),i.k=u}i.lR=t(i.l||/\w+/,!0),a&&(i.bK&&(i.b="\\b("+i.bK.split(" ").join("|")+")\\b"),i.b||(i.b=/\B|\b/),i.bR=t(i.b),i.e||i.eW||(i.e=/\B|\b/),i.e&&(i.eR=t(i.e)),i.tE=n(i.e)||"",i.eW&&a.tE&&(i.tE+=(i.e?"|":"")+a.tE)),i.i&&(i.iR=t(i.i)),null==i.r&&(i.r=1),i.c||(i.c=[]);var s=[];i.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"===e?i:e)}),i.c=s,i.c.forEach(function(e){r(e,i)}),i.starts&&r(i.starts,a);var l=i.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([i.tE,i.i]).map(n).filter(Boolean);i.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,i,a){function o(e,n){var t,i;for(t=0,i=n.c.length;i>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!i&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function h(e,n,t,r){var i=r?"":y.classPrefix,a='<span class="'+i,o=t?"":C;return a+=e+'">',a+n+o}function p(){var e,t,r,i;if(!E.k)return n(B);for(i="",t=0,E.lR.lastIndex=0,r=E.lR.exec(B);r;)i+=n(B.substring(t,r.index)),e=g(E,r),e?(M+=e[1],i+=h(e[0],n(r[0]))):i+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(B);return i+n(B.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!x[E.sL])return n(B);var t=e?l(E.sL,B,!0,L[E.sL]):f(B,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(L[E.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){k+=null!=E.sL?d():p(),B=""}function v(e){k+=e.cN?h(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(B+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?B+=n:(t.eB&&(B+=n),b(),t.rB||t.eB||(B=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var i=E;i.skip?B+=n:(i.rE||i.eE||(B+=n),b(),i.eE&&(B=n));do E.cN&&(k+=C),E.skip||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),i.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"<unnamed>")+'"');return B+=n,n.length||1}var N=R(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,E=a||N,L={},k="";for(w=E;w!==N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var B="",M=0;try{for(var I,j,O=0;;){if(E.t.lastIndex=O,I=E.t.exec(t),!I)break;j=m(t.substring(O,I.index),I[0]),O=I.index+j}for(m(t.substr(O)),w=E;w.parent;w=w.parent)w.cN&&(k+=C);return{r:M,value:k,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function f(e,t){t=t||y.languages||E(x);var r={r:0,value:n(e)},i=r;return t.filter(R).forEach(function(n){var t=l(n,e,!1);t.language=n,t.r>i.r&&(i=t),t.r>r.r&&(i=r,r=t)}),i.language&&(r.second_best=i),r}function g(e){return y.tabReplace||y.useBR?e.replace(M,function(e,n){return y.useBR&&"\n"===e?"<br>":y.tabReplace?n.replace(/\t/g,y.tabReplace):void 0}):e}function h(e,n,t){var r=n?L[n]:t,i=[e.trim()];return e.match(/\bhljs\b/)||i.push("hljs"),-1===e.indexOf(r)&&i.push(r),i.join(" ").trim()}function p(e){var n,t,r,o,s,p=a(e);i(p)||(y.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):n=e,s=n.textContent,r=p?l(p,s,!0):f(s),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),s)),r.value=g(r.value),e.innerHTML=r.value,e.className=h(e.className,p,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function d(e){y=o(y,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=x[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function N(){return E(x)}function R(e){return e=(e||"").toLowerCase(),x[e]||x[L[e]]}var w=[],E=Object.keys,x={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="</span>",y={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},I={"&":"&","<":"<",">":">"};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=R,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var i=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return i.c.push(e.PWM),i.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),i},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/</,r:0,c:[{cN:"attr",b:e,r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("<!--","-->",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{name:"style"},c:[t],starts:{e:"</style>",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{name:"script"},c:[t],starts:{e:"</script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("javascript",function(e){var r="[A-Za-z$_][0-9A-Za-z$_]*",t={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:t,c:[]},c={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:t,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:r+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:r,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+r+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});\ No newline at end of filediff --git a/documentation/assets/js/site.js b/documentation/assets/js/site.jsindex b6219b82..6a98f8c6 100644--- a/documentation/assets/js/site.js+++ b/documentation/assets/js/site.js@@ -6,31 +6,25 @@ var createBouncyButtons = (function() {anime.remove([pathEl, spanEl]);anime({targets: pathEl,- d: 'M10,10 C10,10 50,7 90,7 C130,7 170,10 170,10 C170,10 172,20 172,30 C172,40 170,50 170,50 C170,50 130,53 90,53 C50,53 10,50 10,50 C10,50 8,40 8,30 C8,20 10,10 10,10 Z',- elasticity: 700,- offset: 0- });+ d: 'M10,10 C10,10 50,7 90,7 C130,7 170,10 170,10 C170,10 172,20 172,30 C172,40 170,50 170,50 C170,50 130,53 90,53 C50,53 10,50 10,50 C10,50 8,40 8,30 C8,20 10,10 10,10 Z'+ }), 0;anime({targets: spanEl,scale: 1.15,- duration: 800,- offset: 0- });+ duration: 800+ }), 0;}function down() {anime.remove([pathEl, spanEl]);anime({targets: pathEl,- d: 'M10,10 C10,10 50,9.98999977 90,9.98999977 C130,9.98999977 170,10 170,10 C170,10 170.009995,20 170.009995,30 C170.009995,40 170,50 170,50 C170,50 130,50.0099983 90,50.0099983 C50,50.0099983 10,50 10,50 C10,50 9.98999977,40 9.98999977,30 C9.98999977,20 10,10 10,10 Z',- elasticity: 700,- offset: 0- });+ d: 'M10,10 C10,10 50,9.98999977 90,9.98999977 C130,9.98999977 170,10 170,10 C170,10 170.009995,20 170.009995,30 C170.009995,40 170,50 170,50 C170,50 130,50.0099983 90,50.0099983 C50,50.0099983 10,50 10,50 C10,50 9.98999977,40 9.98999977,30 C9.98999977,20 10,10 10,10 Z'+ }), 0;anime({targets: spanEl,scale: 1,- duration: 800,- offset: 0- });+ duration: 800+ }), 0;}el.onmouseenter = hover;el.onmousedown = down;@@ -74,19 +68,17 @@ var logoAnimation = (function() {{ value: 0, duration: 20, delay: 500, easing: 'easeInQuart' },{ value: 1, duration: 200, delay: 1000, easing: 'easeOutQuart' },{ value: 0, duration: 400, delay: 500, easing: 'easeInBack' }- ],- offset: 0- })+ ]+ }, 0).add({targets: '.dot-i',- translateY: { value: [-200, 0], duration: 500, elasticity: 400 },+ translateY: { value: [-200, 0], duration: 500 },scale: [{ value: [0, 1], duration: 100, easing: 'easeOutQuart' },{ value: 0, duration: 400, delay: 1400, easing: 'easeInBack' }],- delay: 1200,- offset: 0- })+ delay: 1200+ }, 0).add({targets: '.fill.in',strokeDashoffset: {@@ -105,9 +97,8 @@ var logoAnimation = (function() {value: 0,duration: 1,delay: function(el, i, t) { return 1900 + ( i * 80 ); },- },- offset: 0- })+ }+ }, 0).add({targets: '.fill.out',strokeDashoffset: [@@ -118,9 +109,8 @@ var logoAnimation = (function() {delay: function(el, i) { return (i * 80); },easing: 'easeInQuart'}- ],- offset: 0- })+ ]+ }, 0).add({targets: '.line.out',strokeDashoffset: {@@ -134,16 +124,14 @@ var logoAnimation = (function() {delay: function(el, i, t) { return 2000 + ( i * 100 ); },duration: 200,easing: 'linear'- },- offset: 0- })+ }+ }, 0).add({targets: '.icon',opacity: { value: 1, duration: 10, delay: 2800, easing: 'linear' },translateY: { value: 60, duration: 800 },- delay: 4200,- offset: 0- })+ delay: 4200+ }, 0).add({targets: '.icon-line',strokeDashoffset: [@@ -161,16 +149,14 @@ var logoAnimation = (function() {duration: 800,delay: 3400,easing: 'easeInQuad'- },- offset: 0- })+ }+ }, 0).add({targets: ['.icon-text path', '.icon-text polygon'],translateY: [50, 0],opacity: { value: [0, 1], duration: 100, easing: 'linear' },- delay: function(el, i, t) { return 4200 + ( i * 20 ); },- offset: 0- })+ delay: function(el, i, t) { return 4200 + ( i * 20 ); }+ }, 0).add({targets: ['.logo-animation', '.description', '.button', '.credits'],translateY: [50, 0],diff --git a/documentation/assets/js/stats.min.js b/documentation/assets/js/stats.min.jsdeleted file mode 100644index 61757f3c..00000000--- a/documentation/assets/js/stats.min.js+++ /dev/null@@ -1,5 +0,0 @@-// stats.js - http://github.com/mrdoob/stats.js-(function(f,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"===typeof define&&define.amd?define(e):f.Stats=e()})(this,function(){var f=function(){function e(a){c.appendChild(a.dom);return a}function u(a){for(var d=0;d<c.children.length;d++)c.children[d].style.display=d===a?"block":"none";l=a}var l=0,c=document.createElement("div");c.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";c.addEventListener("click",function(a){a.preventDefault();-u(++l%c.children.length)},!1);var k=(performance||Date).now(),g=k,a=0,r=e(new f.Panel("FPS","#0ff","#002")),h=e(new f.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var t=e(new f.Panel("MB","#f08","#201"));u(0);return{REVISION:16,dom:c,addPanel:e,showPanel:u,begin:function(){k=(performance||Date).now()},end:function(){a++;var c=(performance||Date).now();h.update(c-k,200);if(c>g+1E3&&(r.update(1E3*a/(c-g),100),g=c,a=0,t)){var d=performance.memory;t.update(d.usedJSHeapSize/-1048576,d.jsHeapSizeLimit/1048576)}return c},update:function(){k=this.end()},domElement:c,setMode:u}};f.Panel=function(e,f,l){var c=Infinity,k=0,g=Math.round,a=g(window.devicePixelRatio||1),r=80*a,h=48*a,t=3*a,v=2*a,d=3*a,m=15*a,n=74*a,p=30*a,q=document.createElement("canvas");q.width=r;q.height=h;q.style.cssText="width:80px;height:48px";var b=q.getContext("2d");b.font="bold "+9*a+"px Helvetica,Arial,sans-serif";b.textBaseline="top";b.fillStyle=l;b.fillRect(0,0,r,h);b.fillStyle=f;b.fillText(e,t,v);-b.fillRect(d,m,n,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d,m,n,p);return{dom:q,update:function(h,w){c=Math.min(c,h);k=Math.max(k,h);b.fillStyle=l;b.globalAlpha=1;b.fillRect(0,0,r,m);b.fillStyle=f;b.fillText(g(h)+" "+e+" ("+g(c)+"-"+g(k)+")",t,v);b.drawImage(q,d+a,m,n-a,p,d,m,n-a,p);b.fillRect(d+n-a,m,a,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d+n-a,m,a,g((1-h/w)*p))}}};return f});diff --git a/documentation/assets/js/beautify-html.js b/documentation/assets/js/vendors/beautify-html.jssimilarity index 100%rename from documentation/assets/js/beautify-html.jsrename to documentation/assets/js/vendors/beautify-html.jsdiff --git a/documentation/assets/js/vendors/highlight.pack.js b/documentation/assets/js/vendors/highlight.pack.jsnew file mode 100644index 00000000..f5c34e85--- /dev/null+++ b/documentation/assets/js/vendors/highlight.pack.js@@ -0,0 +1,2 @@+/*! highlight.js v9.12.0 | BSD3 License | git.io/hljslicense */+!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return w(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset<r[0].offset?e:r:"start"===r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value).replace('"',""")+'"'}s+="<"+t(e)+E.map.call(e.attributes,r).join("")+">"}function u(e){s+="</"+t(e)+">"}function c(e){("start"===e.event?o:u)(e.node)}for(var l=0,s="",f=[];e.length||r.length;){var g=i();if(s+=n(a.substring(l,g[0].offset)),l=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===l);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return s+n(a.substr(l))}function l(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},u=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?u("keyword",a.k):x(a.k).forEach(function(e){u(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return l("self"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var c=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=c.length?t(c.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function l(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":I.classPrefix,i='<span class="'+a,o=t?"":C;return i+=e+'">',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=l(E,r),e?(B+=e[1],a+=p(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!y[E.sL])return n(k);var t=e?f(E.sL,k,!0,x[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(B+=t.r),e&&(x[E.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=null!=E.sL?d():h(),k=""}function v(e){L+=e.cN?p(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(k+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),b(),t.rB||t.eB||(k=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),b(),a.eE&&(k=n));do E.cN&&(L+=C),E.skip||(B+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"<unnamed>")+'"');return k+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var R,E=i||N,x={},L="";for(R=E;R!==N;R=R.parent)R.cN&&(L=p(R.cN,"",!0)+L);var k="",B=0;try{for(var M,j,O=0;;){if(E.t.lastIndex=O,M=E.t.exec(t),!M)break;j=m(t.substring(O,M.index),M[0]),O=M.index+j}for(m(t.substr(O)),R=E;R.parent;R=R.parent)R.cN&&(L+=C);return{r:B,value:L,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function g(e,t){t=t||I.languages||x(y);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function p(e){return I.tabReplace||I.useBR?e.replace(M,function(e,n){return I.useBR&&"\n"===e?"<br>":I.tabReplace?n.replace(/\t/g,I.tabReplace):""}):e}function h(e,n,t){var r=n?L[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function d(e){var n,t,r,o,l,s=i(e);a(s)||(I.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):n=e,l=n.textContent,r=s?f(s,l,!0):g(l),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),l)),r.value=p(r.value),e.innerHTML=r.value,e.className=h(e.className,s,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function b(e){I=o(I,e)}function v(){if(!v.called){v.called=!0;var e=document.querySelectorAll("pre code");E.forEach.call(e,d)}}function m(){addEventListener("DOMContentLoaded",v,!1),addEventListener("load",v,!1)}function N(n,t){var r=y[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function R(){return x(y)}function w(e){return e=(e||"").toLowerCase(),y[e]||y[L[e]]}var E=[],x=Object.keys,y={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="</span>",I={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};return e.highlight=f,e.highlightAuto=g,e.fixMarkup=p,e.highlightBlock=d,e.configure=b,e.initHighlighting=v,e.initHighlightingOnLoad=m,e.registerLanguage=N,e.listLanguages=R,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/</,r:0,c:[{cN:"attr",b:e,r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("<!--","-->",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{name:"style"},c:[t],starts:{e:"</style>",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{name:"script"},c:[t],starts:{e:"</script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("javascript",function(e){var r="[A-Za-z$_][0-9A-Za-z$_]*",t={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:t,c:[]},c={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:t,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:r+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:r,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+r+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});\ No newline at end of filediff --git a/documentation/assets/js/stats.js b/documentation/assets/js/vendors/stats.min.jssimilarity index 100%rename from documentation/assets/js/stats.jsrename to documentation/assets/js/vendors/stats.min.jsdiff --git a/documentation/examples/anime-DOM-stress-test.html b/documentation/examples/anime-DOM-stress-test.htmlindex 44913f64..65061767 100644--- a/documentation/examples/anime-DOM-stress-test.html+++ b/documentation/examples/anime-DOM-stress-test.html@@ -17,13 +17,12 @@<link rel="icon" type="image/png" href="../assets/img/icons/favicon.png" ><link href="../assets/css/anime.css" rel="stylesheet"><script src="../../anime.js"></script>- <!-- <script src="../../anime-dev.js"></script> -->- <!-- <script src="../assets/js/anime.2.0.2.js"></script> -->+ <!-- <script src="../assets/js/anime/anime.2.0.2.js"></script> --><!-- <script src="../assets/js/anime.1.0.js"></script> --><style>body {- overflow: hidden;+ /*background-color: #000;*/}.el {@@ -33,11 +32,7 @@width: 1em;height: 1em;margin: -.5em 0 0 -.5em;- border: 1px solid currentColor;- background-color: currentColor;- font-size: 30px;- border-radius: 50%;- transform: scale(0);+ font-size: 40px;}</style>@@ -45,48 +40,38 @@<body></body><script>+ anime.speed = 1;+const wrapperEl = document.body;- const numberOfEls = 500;- const duration = 2000;- const delay = duration / numberOfEls;+ const numberOfEls = 1000;const radius = window.innerWidth < window.innerHeight ? window.innerWidth : window.innerHeight;- const distance = (radius / 4 <= 150 ? 150 : radius) + 100;-- let tl = anime.timeline({- duration: delay,- complete: function() { tl.restart(); }- });+ const distance = (radius / 4 <= 150 ? 150 : radius / 2.5) / 16;function createEl(i) {let el = document.createElement('div');const hue = Math.round(360 / numberOfEls * i);- // const angle = Math.round(360 / numberOfEls * i * 5);- var angle = Math.random() * Math.PI * 2;+ const angle = i;el.classList.add('el');- el.style.color = 'hsl(' + hue + ', 40%, 60%)';- // el.style.transform = 'scale(0)';- el.style.zIndex = numberOfEls - i;- tl.add({- begin: function() {- anime({- targets: el,- translateX: ['0px', Math.sin(angle) * distance + 'px'],- translateY: ['0px', Math.cos(angle) * distance + 'px'],- // scale: [0, 32],- // scale: [- // {value: [0, 1], duration: duration / 2, easing: 'easeOutBack'},- // {value: 0, duration: duration / 2, easing: 'easeInBack'}- // ],- easing: 'easeInOutSine',- duration: duration- });- }- });+ el.style.border = '5px solid hsl(' + hue + ', 50%, 50%)';wrapperEl.appendChild(el);+ anime({+ targets: el,+ translateX: Math.sin(angle) * distance + 'rem',+ translateY: Math.cos(angle) * distance + 'rem',+ scale: [+ {value: [0, 1]},+ {value: 0}+ ],+ borderRadius: '50%',+ easing: 'easeInOutSine',+ loop: true,+ duration: 1000,+ delay: i * (8000 / numberOfEls)+ });};for (let i = 0; i < numberOfEls; i++) createEl(i);</script>- <script src="../assets/js/stats.js"></script>+ <script src="../assets/js/vendors/stats.min.js"></script></html>diff --git a/documentation/examples/anime-convert-units.html b/documentation/examples/anime-convert-units.htmlnew file mode 100644index 00000000..2f4bc84d--- /dev/null+++ b/documentation/examples/anime-convert-units.html@@ -0,0 +1,63 @@+<!DOCTYPE html>+<html>+<head>+ <title>Convert units | anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <meta property="og:title" content="anime.js">+ <meta property="og:url" content="http://animejs.com">+ <meta property="og:description" content="Javascript Animation Engine">+ <meta property="og:image" content="http://animejs.com/documentation/assets/img/icons/og.png">+ <meta name="twitter:card" content="summary">+ <meta name="twitter:title" content="anime.js">+ <meta name="twitter:site" content="@juliangarnier">+ <meta name="twitter:description" content="Javascript Animation Engine">+ <meta name="twitter:image" content="http://animejs.com/documentation/assets/img/icons/twitter.png">+ <link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png">+ <link rel="icon" type="image/png" href="../assets/img/icons/favicon.png">+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script>+ <!-- <script src="../assets/js/anime.2.0.2.js"></script> -->+ <!-- <script src="../assets/js/anime.1.3.js"></script> -->+ <style>+ <style>+ body {+ display: flex;+ justify-content: center;+ align-items: center;+ min-height: 100vh;+ }+ .item {+ background-color: currentColor;+ margin: 10px;+ }+ .color-01 {+ width: 5vw;+ height: 40px;+ }+ .color-02 {+ width: 10%;+ height: 4rem;+ }+ </style>+</head>+<body>+ <div class="item color-01"></div>+ <div class="item color-02"></div>+ <div class="item color-03"></div>+ <script>+ var obj = {+ data: '30px'+ }+ anime({+ targets: '.color-01',+ width: ['100vw', '2rem'],+ easing: 'linear'+ })+ anime({+ targets: obj,+ data: '2rem'+ })+ </script>+</body>+</html>\ No newline at end of filediff --git a/documentation/examples/anime-demo.html b/documentation/examples/anime-demo.htmlnew file mode 100644index 00000000..af0ccde5--- /dev/null+++ b/documentation/examples/anime-demo.html@@ -0,0 +1,85 @@+<!DOCTYPE html>+<html>+<head>+ <title>domaku | anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <meta property="og:title" content="anime.js">+ <meta property="og:url" content="http://animejs.com">+ <meta property="og:description" content="Javascript Animation Engine">+ <meta property="og:image" content="http://animejs.com/documentation/assets/img/icons/og.png">+ <meta name="twitter:card" content="summary">+ <meta name="twitter:title" content="anime.js">+ <meta name="twitter:site" content="@juliangarnier">+ <meta name="twitter:description" content="Javascript Animation Engine">+ <meta name="twitter:image" content="http://animejs.com/documentation/assets/img/icons/twitter.png">+ <link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png">+ <link rel="icon" type="image/png" href="../assets/img/icons/favicon.png">+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script>+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> -->+ <!-- <script src="../assets/js/anime.2.0.1.js"></script> -->+ <!-- <script src="../assets/js/anime.1.3.js"></script> -->+ <style>+ body {+ overflow: hidden;+ position: absolute;+ width: 100%;+ height: 100%;+ }+ .wrapper {+ position: absolute;+ top: 0;+ left: 0;+ width: 100%;+ height: 100%;+ }+ .particule {+ position: absolute;+ top: 50%;+ left: 50%;+ border-radius: 50%;+ /*border: 2px solid currentColor;*/+ background-color: currentColor;+ }+ </style>+</head>+<body>+ <script>++ var numberOfEls = 500;+ var duration = 1000;+ var midScreenX = window.innerWidth / 2;+ var midScreenY = window.innerHeight / 2;+ var radius = Math.sqrt(midScreenX * midScreenX + midScreenY * midScreenY);+ var fragment = document.createDocumentFragment();++ for (var i = 0; i < numberOfEls; i++) {+ var hue = Math.round(360 / numberOfEls * i);+ var angle = anime.random(0, 360);+ var el = document.createElement('div');+ el.classList.add('particule');+ el.style.color = 'hsl(' + hue + ', 100%, 40%)';+ el.style.width = '20px';+ el.style.height = '20px';+ anime({+ targets: el,+ rotate: [angle, angle],+ translateX: window.innerWidth * .6,+ scale: [0, 7],+ delay: (duration / numberOfEls) * i,+ endDelay: (duration / numberOfEls) * i,+ duration: duration,+ easing: 'easeInExpo',+ // direction: 'reverse',+ loop: true+ });+ fragment.appendChild(el);+ }++ document.body.appendChild(fragment);++ </script>+ <script src="../assets/js/stats.js"></script>+</body>+</html>diff --git a/documentation/examples/anime-easings.html b/documentation/examples/anime-easings.htmlnew file mode 100644index 00000000..900d7c45--- /dev/null+++ b/documentation/examples/anime-easings.html@@ -0,0 +1,105 @@+<!DOCTYPE html>+<html>+<head>+ <title>Easings | anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <meta property="og:title" content="anime.js">+ <meta property="og:url" content="http://animejs.com">+ <meta property="og:description" content="Javascript Animation Engine">+ <meta property="og:image" content="http://animejs.com/documentation/assets/img/icons/og.png">+ <meta name="twitter:card" content="summary">+ <meta name="twitter:title" content="anime.js">+ <meta name="twitter:site" content="@juliangarnier">+ <meta name="twitter:description" content="Javascript Animation Engine">+ <meta name="twitter:image" content="http://animejs.com/documentation/assets/img/icons/twitter.png">+ <link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png">+ <link rel="icon" type="image/png" href="../assets/img/icons/favicon.png">+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script>+ <!-- <script src="../assets/js/anime.2.0.2.js"></script> -->+ <!-- <script src="../assets/js/anime.1.3.js"></script> -->+ <style>+ <style>++ body {+ display: flex;+ justify-content: center;+ align-items: center;+ }++ .item {+ width: 100px;+ height: 100px;+ border-radius: 15%;+ background-color: currentColor;+ margin: 10px;+ }++ .sprite {+ width: 200px;+ height: 300px;+ background-image: url(img/sprite-example.png);+ }++/* .color-02 {+ animation-name: spring;+ animation-duration: 10s;+ animation-timing-function: spring(1 100 10 0);+ }++ .color-04 {+ animation-name: spring;+ animation-duration: 10s;+ animation-timing-function: spring(50 50 50 0);+ }*/++ @keyframes spring {+ to {+ transform: translateX(800px);+ }+ }++ </style>+</head>+<body>+ <div class="sprite"></div>+ <div class="item color-01"></div>+ <div class="item color-02"></div>+ <div class="item color-03"></div>+ <div class="item color-04"></div>+ <div class="item color-05"></div>+ <script>+ // anime.speed = .1;+ var anim01 = anime({+ targets: '.sprite',+ backgroundPosition: '-2000px 0px',+ easing: 'steps(10)',+ duration: 10000,+ loop: true+ })+ var anim02 = anime({+ targets: '.color-01',+ translateX: 10000,+ easing: 'outElastic(2, .1)'+ })+ var anim02 = anime({+ targets: '.color-02',+ translateX: 1000,+ easing: 'spring(100, 100, 1, 0)'+ })+ var anim03 = anime({+ targets: '.color-03',+ translateX: 1000,+ duration: 5000,+ easing: 'cubicBezier(0, -.55, .0, 1.55)'+ })+ // console.log(anim01);+ // anime({+ // targets: '.color-03',+ // translateX: 1000,+ // easing: 'easeOutElastic'+ // })+ </script>+</body>+</html>\ No newline at end of filediff --git a/documentation/examples/anime-infinite-animation.html b/documentation/examples/anime-infinite-animation.htmlnew file mode 100644index 00000000..6ede9d68--- /dev/null+++ b/documentation/examples/anime-infinite-animation.html@@ -0,0 +1,89 @@+<!DOCTYPE html>+<html>+<head>+ <title>domaku | anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <meta property="og:title" content="anime.js">+ <meta property="og:url" content="http://animejs.com">+ <meta property="og:description" content="Javascript Animation Engine">+ <meta property="og:image" content="http://animejs.com/documentation/assets/img/icons/og.png">+ <meta name="twitter:card" content="summary">+ <meta name="twitter:title" content="anime.js">+ <meta name="twitter:site" content="@juliangarnier">+ <meta name="twitter:description" content="Javascript Animation Engine">+ <meta name="twitter:image" content="http://animejs.com/documentation/assets/img/icons/twitter.png">+ <link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png">+ <link rel="icon" type="image/png" href="../assets/img/icons/favicon.png">+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script>+ <!-- <script src="../assets/js/anime.3.0.0-alpha.js"></script> -->+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> -->+ <!-- <script src="../assets/js/anime.2.0.1.js"></script> -->+ <!-- <script src="../assets/js/anime.1.3.js"></script> -->+ <style>+ body {+ overflow: hidden;+ position: absolute;+ width: 100%;+ height: 100%;+ display: flex;+ justify-content: center;+ align-items: center;+ font-size: 50px;+ }+ .wrapper {+ display: flex;+ flex-direction: row;+ }+ .particule {+ width: 1em;+ height: 1em;+ border-radius: 50%;+ }+ </style>+</head>+<body>+ <div class="wrapper"></div>+ <script>++ var rows = 2;+ var numberOfEls = rows * rows;+ var duration = 1000;+ var stagger = 100;+ var midScreenX = window.innerWidth / 2;+ var midScreenY = window.innerHeight / 2;+ var radius = Math.sqrt(midScreenX * midScreenX + midScreenY * midScreenY);+ var fragment = document.createDocumentFragment();+ var wrapperEl = document.querySelector('.wrapper');++ wrapperEl.style.width = numberOfEls + 'em';+ wrapperEl.style.height = rows + 'em';++ for (var i = 0; i < numberOfEls; i++) {+ var hue = 10 + Math.round(40 / numberOfEls * i);+ var el = document.createElement('div');+ el.classList.add('particule');+ el.style.backgroundColor = 'hsl(' + hue + ', 100%, 50%)';++ var anim = anime({+ targets: el,+ translateY: '2em',+ scale: [.9, .1],+ direction: 'alternate',+ loop: true,+ easing: 'easeInOutQuad',+ duration: duration,+ startTime: ((numberOfEls + 1 - (i)) * stagger)+ });++ fragment.appendChild(el);++ }++ wrapperEl.appendChild(fragment);++ </script>+ <!-- <script src="../assets/js/stats.js"></script> -->+</body>+</html>diff --git a/documentation/examples/anime-logo-animation.html b/documentation/examples/anime-logo-animation.htmlindex 5d603106..51a785e0 100644--- a/documentation/examples/anime-logo-animation.html+++ b/documentation/examples/anime-logo-animation.html@@ -17,6 +17,7 @@<link rel="icon" type="image/png" href="../assets/img/icons/favicon.png"><link href="../assets/css/anime.css" rel="stylesheet"><script src="../../anime.js"></script>+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> --><style>body {opacity: 0;@@ -224,9 +225,8 @@{ value: 0, duration: 20, delay: 500, easing: 'easeInQuart' },{ value: 1, duration: 200, delay: 1000, easing: 'easeOutQuart' },{ value: 0, duration: 400, delay: 500, easing: 'easeInBack' }- ],- offset: 0- })+ ]+ }, 0).add({targets: '.dot-i',translateY: { value: [-200, 0], duration: 500, elasticity: 400 },@@ -234,9 +234,8 @@{ value: [0, 1], duration: 100, easing: 'easeOutQuart' },{ value: 0, duration: 400, delay: 1400, easing: 'easeInBack' }],- delay: 1200,- offset: 0- })+ delay: 1200+ }, 0).add({targets: '.fill.in',strokeDashoffset: {@@ -246,7 +245,7 @@easing: 'easeOutQuart'},stroke: {- value: ['#FFF', function(el) { return anime.getValue(el.parentNode, 'stroke') } ],+ value: ['#FFF', function(el) { return anime.get(el.parentNode, 'stroke') } ],duration: 500,delay: 500,easing: 'easeInQuad'@@ -255,9 +254,8 @@value: 0,duration: 1,delay: function(el, i, t) { return 1900 + ( i * 80 ); },- },- offset: 0- })+ }+ }, 0).add({targets: '.fill.out',strokeDashoffset: [@@ -268,9 +266,8 @@delay: function(el, i) { return (i * 80); },easing: 'easeInQuart'}- ],- offset: 0- })+ ]+ }, 0).add({targets: '.line.out',strokeDashoffset: {@@ -284,16 +281,14 @@delay: function(el, i, t) { return 2000 + ( i * 100 ); },duration: 200,easing: 'linear'- },- offset: 0- })+ }+ }, 0).add({targets: '.icon',opacity: { value: 1, duration: 10, delay: 2800, easing: 'linear' },translateY: { value: 60, duration: 800 },- delay: 4200,- offset: 0- })+ delay: 4200+ }, 0).add({targets: '.icon-line',strokeDashoffset: [@@ -307,20 +302,18 @@easing: 'easeInQuad'},stroke: {- value: ['#FFF', function(el) { return anime.getValue(el, 'stroke') } ],+ value: ['#FFF', function(el) { return anime.get(el, 'stroke') } ],duration: 800,delay: 3400,easing: 'easeInQuad'- },- offset: 0- })+ }+ }, 0).add({targets: ['.icon-text path', '.icon-text polygon'],translateY: [50, 0],opacity: { value: [0, 1], duration: 100, easing: 'linear' },- delay: function(el, i, t) { return 4200 + ( i * 20 ); },- offset: 0- })+ delay: function(el, i, t) { return 4200 + ( i * 20 ); }+ }, 0)function init() {document.body.classList.add('ready');diff --git a/documentation/examples/anime-mgs-logo-animation.html b/documentation/examples/anime-mgs-logo-animation.htmlindex 3c47f30e..da5f534c 100644--- a/documentation/examples/anime-mgs-logo-animation.html+++ b/documentation/examples/anime-mgs-logo-animation.html@@ -16,7 +16,7 @@<link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png"><link rel="icon" type="image/png" href="../assets/img/icons/favicon.png"><link href="../assets/css/anime.css" rel="stylesheet">- <script src="../../anime.js"></script>+ <script src="../../anime.min.js"></script><style>html,@@ -175,8 +175,8 @@loop: true});- logoAnimation.add([- {+ logoAnimation+ .add({targets: '.stripes path',translateX: [-1000, 0],opacity: {@@ -187,8 +187,8 @@delay: (el, i) => 2200 + (i * 75),duration: 400,easing: 'easeOutExpo',- offset: 0- }, {+ }, 0)+ .add({targets: '.katakana path',d: (el) => el.getAttribute('data-d'),opacity: {@@ -199,16 +199,16 @@delay: (el, i) => 2400 + (i * 120),duration: 1200,easing: 'easeOutCirc',- offset: 0- }, {+ }, 0)+ .add({targets: '.text-fills path',opacity: [0, 1],fill: '#F9C100',easing: 'easeOutExpo',duration: 200,delay: (t, i) => 3300 + (anime.random(0, 450)),- offset: 0- }, {+ }, 0)+ .add({targets: '.line',translateX: (target) => {let x = 1200;@@ -237,9 +237,7 @@delay: (t, i) => (i * 25),duration: 500,easing: 'easeOutQuart',- offset: 0- }- ]);+ }, 0);</script><script src="../assets/js/stats.js"></script>diff --git a/documentation/examples/anime-speed-test.html b/documentation/examples/anime-speed-test.htmlindex d56b2a82..62a4a775 100644--- a/documentation/examples/anime-speed-test.html+++ b/documentation/examples/anime-speed-test.html@@ -17,7 +17,8 @@<link rel="icon" type="image/png" href="../assets/img/icons/favicon.png"><link href="../assets/css/anime.css" rel="stylesheet"><script src="../../anime.js"></script>- <!-- <script src="../assets/js/anime.2.1.0.js"></script> -->+ <!-- <script src="../assets/js/anime.3.0.0-alpha.js"></script> -->+ <!-- <script src="../assets/js/anime/anime.2.2.0.js"></script> --><!-- <script src="../assets/js/anime.2.0.1.js"></script> --><!-- <script src="../assets/js/anime.1.3.js"></script> --><style>@@ -26,54 +27,69 @@position: absolute;width: 100%;height: 100%;+ display: flex;+ justify-content: center;+ align-items: center;+ padding: 8em;+ font-size: 24px;}.wrapper {- position: absolute;- top: 0;- left: 0;- width: 100%;- height: 100%;+ display: flex;+ flex-direction: column;+ flex-wrap: wrap;}.particule {- position: absolute;+ width: 1px;+ height: 10em;+ margin-left: 1px;+ transform-origin: 50 50%;}</style></head><body><script>- var numberOfEls = 1000;- var duration = 1000;+ var numberOfEls = 500;+ var duration = 4000;var midScreenX = window.innerWidth / 2;var midScreenY = window.innerHeight / 2;var radius = Math.sqrt(midScreenX * midScreenX + midScreenY * midScreenY);var fragment = document.createDocumentFragment();for (var i = 0; i < numberOfEls; i++) {- var hue = Math.round(360 / numberOfEls * i);- var angle = Math.random() * Math.PI * 2;+ var hue = 10 + Math.round(40 / numberOfEls * i);var el = document.createElement('div');el.classList.add('particule');- el.style.backgroundColor = 'hsl(' + hue + ', 40%, 60%)';- el.style.width = '1px';- el.style.height = '1px';+ el.style.backgroundColor = 'hsl(' + hue + ', 100%, 50%)';+ el.style.transform = 'rotate(' + i * 1 + 'deg) translateX(100px)';++ document.body.appendChild(el);+anime({targets: el,- width: ['1px', '20px'],- height: ['1px', '20px'],- left: [midScreenX + 'px', Math.cos(angle) * radius + midScreenX + 'px'],- top: [midScreenY + 'px', Math.sin(angle) * radius + midScreenY + 'px'],- delay: (duration / numberOfEls) * i,+ //rotate: '+=2turn',+ translateX: '1rem',+ // scaleY: [+ // {value: [1, .1]},+ // {value: 1}+ // ],+ // height: [+ // {value: ['10rem', '1rem']},+ // {value: '1rem'}+ // ],+ // height: [+ // {value: '10px'},+ // {value: anime.getValue(el, 'height', 'px')}+ // ],+ easing: 'linear',+ direction: 'alternate',duration: duration,- easing: 'easeInExpo',loop: true});- fragment.appendChild(el);- }- document.body.appendChild(fragment);+ }</script>- <script src="../assets/js/stats.js"></script>+ <script src="../assets/js/vendors/stats.min.js"></script></body></html>diff --git a/documentation/examples/anime-staggered-animations-02.html b/documentation/examples/anime-staggered-animations-02.htmlindex 8e17af57..43402599 100644--- a/documentation/examples/anime-staggered-animations-02.html+++ b/documentation/examples/anime-staggered-animations-02.html@@ -17,7 +17,7 @@<link rel="icon" type="image/png" href="../assets/img/icons/favicon.png"><link href="../assets/css/anime.css" rel="stylesheet"><script src="../../anime.js"></script>- <!-- <script src="../assets/js/anime.2.1.0.js"></script> -->+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> --><!-- <script src="../assets/js/anime.2.0.2.js"></script> --><!-- <script src="../assets/js/anime.1.3.js"></script> --><style>@@ -51,7 +51,7 @@<script>const wrapperEl = document.querySelector('.wrapper');- const numberOfEls = 72;+ const numberOfEls = 400;const duration = 6000;const delay = duration / numberOfEls;const gap = 10;@@ -86,9 +86,9 @@rotate: [0, 90],borderRadius: {value: ['30%', '50%'],- easing: 'easeInOutQuad'+ easing: 'inOutQuad'},- easing: 'easeInOutSine',+ easing: 'inOutSine',direction: 'alternate',duration: duration / 4});diff --git a/documentation/examples/anime-staggered-animations.html b/documentation/examples/anime-staggered-animations.htmlindex beda46de..52468201 100644--- a/documentation/examples/anime-staggered-animations.html+++ b/documentation/examples/anime-staggered-animations.html@@ -17,7 +17,7 @@<link rel="icon" type="image/png" href="../assets/img/icons/favicon.png"><link href="../assets/css/anime.css" rel="stylesheet"><script src="../../anime.js"></script>- <!-- <script src="../assets/js/anime.2.0.2.js"></script> -->+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> --><!-- <script src="../assets/js/anime.1.3.js"></script> --><style>body {@@ -53,7 +53,7 @@<script>const wrapperEl = document.querySelector('.wrapper');- const numberOfEls = 90;+ const numberOfEls = 180;const duration = 6000;const delay = duration / numberOfEls;diff --git a/documentation/examples/anime-states.html b/documentation/examples/anime-states.htmlnew file mode 100644index 00000000..1bd954d4--- /dev/null+++ b/documentation/examples/anime-states.html@@ -0,0 +1,88 @@+<!DOCTYPE html>+<html>+<head>+ <title>Tests | anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <meta property="og:title" content="anime.js">+ <meta property="og:url" content="http://animejs.com">+ <meta property="og:description" content="Javascript Animation Engine">+ <meta property="og:image" content="http://animejs.com/documentation/assets/img/icons/og.png">+ <meta name="twitter:card" content="summary">+ <meta name="twitter:title" content="anime.js">+ <meta name="twitter:site" content="@juliangarnier">+ <meta name="twitter:description" content="Javascript Animation Engine">+ <meta name="twitter:image" content="http://animejs.com/documentation/assets/img/icons/twitter.png">+ <link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png">+ <link rel="icon" type="image/png" href="../assets/img/icons/favicon.png">+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script>+ <!-- <script src="../assets/js/anime.2.0.2.js"></script> -->+ <!-- <script src="../assets/js/anime.1.3.js"></script> -->+ <style>+ <style>+ body {+ display: flex;+ justify-content: center;+ align-items: center;+ min-height: 100vh;+ }+ .item {+ width: 100px;+ height: 100px;+ border-radius: 50%;+ background-color: currentColor;+ margin: 10px;+ }+ </style>+</head>+<body>+ <div class="item color-01"></div>+ <div class="item color-01"></div>+ <div class="item color-03"></div>+ <div class="item color-03"></div>+ <script>++ var animation = anime({+ targets: '.color-01',+ translateX: 0,+ translateY: 0,+ scale: 1,+ duration: 2000,+ easing: 'easeOutExpo',+ autoplay: false,+ update: function() {+ console.log('animation updating')+ }+ })++ animation.states.left = {+ translateX: -100,+ duration: 1000,+ easing: 'easeInOutQuad'+ }++ animation.states.right = {+ translateX: 100+ }++ animation.states.top = {+ translateY: -100+ }++ animation.states.bottom = {+ translateY: 100+ }++ var timeline = anime.timeline({+ targets: '.color-03',+ easing: 'easeOutExpo',+ autoplay: false,+ update: function() {+ console.log('timeline updating')+ }+ })++ </script>+</body>+</html>\ No newline at end of filediff --git a/documentation/examples/anime-tests.html b/documentation/examples/anime-tests.htmlindex de33938e..5377b5fa 100644--- a/documentation/examples/anime-tests.html+++ b/documentation/examples/anime-tests.html@@ -37,27 +37,60 @@</style></head><body>- <div class="item duration-0 color-01"></div>- <div class="item seek-0 color-04"></div>+<svg width="400" height="400" viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg">+ <filter id="displacementFilter">+ <feTurbulence type="turbulence" baseFrequency=".05" numOctaves="2" result="turbulence"/>+ <feDisplacementMap in2="turbulence" in="SourceGraphic" scale="10" xChannelSelector="R" yChannelSelector="G"/>+ </filter>++ <circle cx="80" cy="80" r="80" fill="yellow" style="filter: url(#displacementFilter)"/>+</svg>+ <div class="item color-01"></div>+ <div class="item color-02"></div>+ <div class="item color-03"></div><script>- anime({- targets: '.duration-0',- translateX: 100,- duration: 0,- begin: function() {console.log('duration-0 begin') },- update: function() {console.log('duration-0 update') },- complete: function() {console.log('duration-0 complte') }+ var color01El = document.querySelector('.color-01');+ var color02El = document.querySelector('.color-02');+ color01El.addEventListener('mouseenter', function() {+ anime({ targets: this, scale: 2 });+ }, false);+ color01El.addEventListener('mouseleave', function() {+ anime({ targets: this, scale: 1 });+ }, false);+ var animation = anime({+ targets: '.color-02',+ duration: 500,+ scale: {+ value: 2,+ duration: 700+ },+ loop: true});- var seek0 = anime({- targets: '.seek-0',- translateX: [100, 0],- autoplay: false,- begin: function() {console.log('seek-0 begin') },- update: function() {console.log('seek-0 update') },- complete: function() {console.log('seek-0 complte') }+ anime({+ targets: '.color-03',+ duration: 500,+ width: 400,+ height: 200,+ scale: {+ value: 2,+ duration: 700+ },+ loop: true});-- seek0.seek(0);+ anime({+ targets: 'feTurbulence',+ baseFrequency: [.05, 1],+ direction: 'alternate',+ easing: 'linear',+ loop: true+ })+ anime({+ targets: 'feDisplacementMap',+ scale: 50+ })+ color02El.addEventListener('mouseenter', function() {+ anime.remove(this);+ }, false);</script></body></html>\ No newline at end of filediff --git a/documentation/examples/anime-timeline-stresstest.html b/documentation/examples/anime-timeline-stresstest.htmlnew file mode 100644index 00000000..91d11cea--- /dev/null+++ b/documentation/examples/anime-timeline-stresstest.html@@ -0,0 +1,140 @@+<!DOCTYPE html>+<html>+<head>+ <title>Anime timeline | anime.js</title>+ <meta charset="utf-8">+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">+ <meta property="og:title" content="anime.js">+ <meta property="og:url" content="http://animejs.com">+ <meta property="og:description" content="Javascript Animation Engine">+ <meta property="og:image" content="http://animejs.com/documentation/assets/img/icons/og.png">+ <meta name="twitter:card" content="summary">+ <meta name="twitter:title" content="anime.js">+ <meta name="twitter:site" content="@juliangarnier">+ <meta name="twitter:description" content="Javascript Animation Engine">+ <meta name="twitter:image" content="http://animejs.com/documentation/assets/img/icons/twitter.png">+ <link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png">+ <link rel="icon" type="image/png" href="../assets/img/icons/favicon.png" >+ <link href="../assets/css/anime.css" rel="stylesheet">+ <script src="../../anime.js"></script>+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> -->+ <style>++ body {+ display: flex;+ flex-wrap: wrap;+ position: absolute;+ width: 100%;+ height: 100%;+ }++ .wrapper {+ display: flex;+ flex-wrap: wrap;+ justify-content: space-around;+ align-items: center;+ height: calc(100vh - 100px);+ }++ .el {+ width: 10px;+ height: 10px;+ background: #FFF;+ margin: 10px;+ border-radius: 50%;+ }++ .controls {+ display: flex;+ position: fixed;+ right: 0;+ bottom: 0;+ left: 0;+ height: 100px;+ background: white;+ }++ .buttons {+ display: flex;+ }++ .buttons button {+ width: 100px;+ }++ .timeline {+ display: flex;+ flex-grow: 1;+ padding: 20px;+ }++ .progress {+ flex-grow: 1;+ }++ </style>+</head>+<body>+ <div class="wrapper"></div>+ <div class="controls">+ <div class="buttons">+ <button class="play">Play</button>+ <button class="pause">Pause</button>+ <button class="restart">Restart</button>+ </div>+ <div class="timeline">+ <input class="progress" type="range" min="0" max="100" step=".1" value="0">+ </div>+ </div>+</body>+<script>++ var controlsProgressEl = document.querySelector('.controls .progress');++ var tl = anime.timeline({+ autoplay: false,+ direction: 'alternate',+ update: function(anim) {+ controlsProgressEl.value = anim.progress;+ },+ begin: function(anim) {+ console.log('tl begin');+ },+ complete: function(anim) {+ console.log('tl complete');+ }+ });++ document.querySelector('.controls .play').onclick = tl.play;+ document.querySelector('.controls .pause').onclick = tl.pause;+ document.querySelector('.controls .restart').onclick = tl.restart;++ var wrapperEl = document.querySelector('.wrapper');+ var numberOfEls = 1000;+ var fragment = document.createDocumentFragment();++ function createEl(i) {+ var el = document.createElement('div');+ el.classList.add('el');+ var hue = Math.round(180 / numberOfEls * i);+ el.style.backgroundColor = 'hsl(' + hue + ', 60%, 60%)';+ tl.add({+ targets: el,+ scale: [0, 2],+ duration: 5000,+ easing: 'easeOutElastic(1, .1)',+ }, !i ? 0 : '-=4999');+ fragment.appendChild(el);+ };++ for (let i = 0; i < numberOfEls; i++) createEl(i);++ wrapperEl.appendChild(fragment);++ controlsProgressEl.addEventListener('input', function() {+ tl.seek(tl.duration * (controlsProgressEl.value / 100));+ });++ </script>+ <script src="../assets/js/stats.js"></script>+</html>diff --git a/documentation/examples/anime-timeline.html b/documentation/examples/anime-timeline.htmlindex e1946e3b..2bea64ab 100644--- a/documentation/examples/anime-timeline.html+++ b/documentation/examples/anime-timeline.html@@ -17,7 +17,7 @@<link rel="icon" type="image/png" href="../assets/img/icons/favicon.png" ><link href="../assets/css/anime.css" rel="stylesheet"><script src="../../anime.js"></script>- <!-- <script src="../assets/js/anime.2.0.1.js"></script> -->+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> --><style>body {@@ -33,8 +33,7 @@.el {width: 10px;height: 10px;- background: white;- transform: scale(0);+ background: #FFF;margin: 10px;}@@ -69,13 +68,14 @@</style></head><body>- <div class="el no-offset"></div>- <div class="el relative-offset"></div>- <div class="el absolute-offset"></div>- <div class="el multiple-targets-01"></div>- <div class="el multiple-targets-02"></div>- <div class="el multiple-targets-03"></div>- <div class="el multiple-targets-04"></div>++ <div class="el"></div>+ <div class="el"></div>+ <div class="el"></div>+ <div class="el"></div>+ <div class="el"></div>+ <div class="el"></div>+ <div class="el"></div><div class="controls"><div class="buttons">@@ -84,229 +84,80 @@<button class="restart">Restart</button></div><div class="timeline">- <input class="progress" type="range" min="0" max="100" value="0">+ <input class="progress" type="range" min="0" max="100" step=".1" value="0"></div></div></body><script>- var noOffset = anime.timeline({- autoplay: true- });-- noOffset- .add({- targets: '.no-offset',- translateX: -100,- translateY: -100,- scale: 2,- background: '#FF1461',- begin: function() { console.log('noOffset animation 1 began')},- complete: function() { console.log('noOffset animation 1 completed')}- })- .add({- targets: '.no-offset',- translateX: -100,- translateY: 100,- scale: 3,- background: '#18FF92',- begin: function() { console.log('noOffset animation 2 began')},- complete: function() { console.log('noOffset animation 2 completed')}- })- .add({- targets: '.no-offset',- translateX: 100,- translateY: 100,- rotate: 120,- scale: 4,- background: '#5A87FF',- begin: function() { console.log('noOffset animation 3 began')},- complete: function() { console.log('noOffset animation 3 completed')}- })- .add({- targets: '.no-offset',- translateX: 100,- translateY: -100,- scale: 5,- background: '#FBF38C',- begin: function() { console.log('noOffset animation 4 began')},- complete: function() { console.log('noOffset animation 4 completed')}- })- .add({- targets: '.no-offset',- translateX: 100,- translateY: -100,- scale: '+=8',- background: '#FBF38C',- begin: function() { console.log('noOffset animation 5 began')},- complete: function() { console.log('noOffset animation 5 completed')}- });-- var relativeOffset = anime.timeline({- autoplay: true- });-- relativeOffset- .add({- targets: '.relative-offset',- translateX: -100,- translateY: -100,- scale: 2,- background: '#FF1461',- })- .add({- targets: '.relative-offset',- translateX: -100,- translateY: 100,- scale: 3,- background: '#18FF92',- offset: '-=500'- })- .add({- targets: '.relative-offset',- translateX: 100,- translateY: 100,- rotate: 120,- scale: 4,- background: '#5A87FF',- offset: '-=500'- })- .add({- targets: '.relative-offset',- translateX: 100,- translateY: -100,- scale: 5,- background: '#FBF38C',- offset: '+=500'- })- .add({- targets: '.relative-offset',- translateX: 100,- translateY: -100,- scale: '+=8',- background: '#FBF38C',- offset: '+=500'- });-- var absoluteOffset = anime.timeline({- autoplay: true- });-- absoluteOffset- .add({- targets: '.absolute-offset',- translateX: -100,- translateY: -100,- scale: 2,- background: '#FF1461',- offset: 0- })- .add({- targets: '.absolute-offset',- translateX: -100,- translateY: 100,- scale: 3,- background: '#18FF92',- offset: 1000- })- .add({- targets: '.absolute-offset',- translateX: 100,- translateY: 100,- rotate: 120,- scale: 4,- background: '#5A87FF',- offset: 2000- })- .add({- targets: '.absolute-offset',- translateX: 100,- translateY: -100,- scale: 5,- background: '#FBF38C',- offset: 3000- })- .add({- targets: '.absolute-offset',- translateX: 100,- translateY: -100,- scale: '+=8',- background: '#FBF38C',- offset: 4000- });-+ var els = document.querySelectorAll('.el');var controlsProgressEl = document.querySelector('.controls .progress');- var multipleTargets = anime.timeline({- autoplay: false,- direction: 'reverse',+ var tl = anime.timeline({+ targets: els,+ direction: 'alternate',+ duration: 250,+ delay: function(el, i) { return 75 * i; },update: function(anim) {controlsProgressEl.value = anim.progress;},begin: function(anim) {- console.log('multiple begin');+ console.log('tl begin');},complete: function(anim) {- console.log('multiple complete');+ console.log('tl complete');}});- document.querySelector('.controls .play').onclick = multipleTargets.play;- document.querySelector('.controls .pause').onclick = multipleTargets.pause;- document.querySelector('.controls .restart').onclick = multipleTargets.restart;+ document.querySelector('.controls .play').onclick = tl.play;+ document.querySelector('.controls .pause').onclick = tl.pause;+ document.querySelector('.controls .restart').onclick = tl.restart;++ tl+ .add({+ translateY: -100,+ scale: 8,+ background: '#FF1461',+ begin: function() { console.log('animation 1 began')},+ complete: function() { console.log('animation 1 completed')}+ })+ .add({+ background: '#18FF92',+ rotate: 45,+ begin: function() { console.log('animation 2 began')},+ complete: function() { console.log('animation 2 completed')}+ })+ .add({+ background: '#5A87FF',+ begin: function() { console.log('animation 3 began')},+ complete: function() { console.log('animation 3 completed')}+ })+ .add({+ background: '#FBF38C',+ rotate: 90,+ begin: function() { console.log('animation 4 began')},+ complete: function() { console.log('animation 4 completed')}+ })+ .add({+ scaleX: 3,+ scaleY: .5,+ background: '#FBF38C',+ begin: function() { console.log('animation 5 began')},+ complete: function() { console.log('animation 5 completed')}+ });- multipleTargets- .add({- targets: '.multiple-targets-01',- translateY: -100,- scale: 8,- background: '#FF1461',- duration: 500,- begin: function() { console.log('multipleTargets animation 1 began')},- complete: function() { console.log('multipleTargets animation 1 completed')}- })- .add({- targets: '.multiple-targets-02',- translateY: -100,- scale: 8,- background: '#18FF92',- duration: 500,- begin: function() { console.log('multipleTargets animation 2 began')},- complete: function() { console.log('multipleTargets animation 2 completed')}- })- .add({- targets: '.multiple-targets-03',- translateY: -100,- scale: 8,- background: '#5A87FF',- duration: 500,- begin: function() { console.log('multipleTargets animation 3 began')},- complete: function() { console.log('multipleTargets animation 3 completed')}- })- .add({- targets: '.multiple-targets-04',- translateY: -100,- scale: 8,- background: '#FBF38C',- duration: 500,- begin: function() { console.log('multipleTargets animation 4 began')},- complete: function() { console.log('multipleTargets animation 4 completed')}- })- .add({- targets: ['.multiple-targets-01', '.multiple-targets-02', '.multiple-targets-03', '.multiple-targets-04'],- translateY: -100,- scale: 13,- background: '#FBF38C',- duration: 1000,- begin: function() { console.log('multipleTargets animation 5 began')},- complete: function() { console.log('multipleTargets animation 5 completed')}- });+ controlsProgressEl.addEventListener('input', function() {+ tl.seek(tl.duration * (controlsProgressEl.value / 100));+ });- controlsProgressEl.addEventListener('input', function() {- multipleTargets.seek(multipleTargets.duration * (controlsProgressEl.value / 100));- });+ for (var i = 0; i < els.length; i++) {+ els[i].addEventListener('mouseenter', function() {+ anime.remove(this);+ this.style.backgroundColor = 'red';+ }, false);+ }</script>- <script src="../assets/js/stats.js"></script>+ <!-- <script src="../assets/js/stats.js"></script> --></html>diff --git a/documentation/examples/img/sprite-example.png b/documentation/examples/img/sprite-example.pngnew file mode 100644index 00000000..d556af8dBinary files /dev/null and b/documentation/examples/img/sprite-example.png differdiff --git a/documentation/examples/anime-DOM-stress-test-02.html b/documentation/examples/transforms-animation.htmlsimilarity index 50%rename from documentation/examples/anime-DOM-stress-test-02.htmlrename to documentation/examples/transforms-animation.htmlindex 0090865f..7660a968 100644--- a/documentation/examples/anime-DOM-stress-test-02.html+++ b/documentation/examples/transforms-animation.html@@ -17,12 +17,13 @@<link rel="icon" type="image/png" href="../assets/img/icons/favicon.png" ><link href="../assets/css/anime.css" rel="stylesheet"><script src="../../anime.js"></script>- <!-- <script src="../assets/js/anime.2.0.2.js"></script> -->- <!-- <script src="../assets/js/anime.1.0.js"></script> -->+ <!-- <script src="../assets/js/anime/anime.2.2.0.js"></script> -->+ <!-- <script src="../assets/js/anime/anime.2.0.2.js"></script> -->+ <!-- <script src="../assets/js/anime/anime.1.0.js"></script> --><style>body {- /*background-color: #000;*/+ overflow: hidden;}.el {@@ -32,11 +33,10 @@width: 1em;height: 1em;margin: -.5em 0 0 -.5em;- /*border: .05em solid currentColor;*/- /*background-color: currentColor;*/- font-size: 40px;- /*border-radius: 50%;*/- transform: scale(0);+ border: 1px solid currentColor;+ background-color: currentColor;+ font-size: 20px;+ border-radius: 50%;}</style>@@ -45,40 +45,24 @@<script>const wrapperEl = document.body;- const numberOfEls = 280;- const duration = 3000;- const delay = duration / numberOfEls;- const radius = window.innerWidth < window.innerHeight ? window.innerWidth : window.innerHeight;- const distance = radius / 4 <= 150 ? 150 : radius / 3;-- let tl = anime.timeline({- duration: delay,- complete: function() { tl.restart(); }- });+ const numberOfEls = 500;+ const duration = 2000;function createEl(i) {let el = document.createElement('div');- const hue = Math.round(360 / numberOfEls * i);- const angle = i;+ const hue = Math.round(50 / numberOfEls * i);+ const angle = anime.random(-360, 360);el.classList.add('el');- el.style.backgroundColor = 'hsl(' + hue + ', 40%, 60%)';- tl.add({- begin: function() {- var randomDistance = anime.random(distance - 50, distance + 50);- anime({- targets: el,- // backgroundColor: ['#fff', '#000'],- translateX: [0, Math.sin(angle) * randomDistance],- translateY: [0,Math.cos(angle) * randomDistance],- scale: [- {value: [0, anime.random(5, 10) * .1], easing: 'easeOutBack'},- {value: 0, easing: 'easeInBack'},- ],- easing: 'easeInOutSine',- direction: 'reverse',- duration: duration- });- }+ el.style.color = 'hsl(' + anime.random(0, 50) + ', 70%, 70%)';+ el.style.transform = 'rotate(' + angle + 'deg)';+ anime({+ targets: el,+ translateX: anime.random(300, 350),+ scale: [0, 1],+ delay: i * (duration / numberOfEls),+ loop: true,+ easing: 'easeInOutSine',+ duration: duration});wrapperEl.appendChild(el);};@@ -86,5 +70,5 @@for (let i = 0; i < numberOfEls; i++) createEl(i);</script>- <script src="../assets/js/stats.js"></script>+ <script src="../assets/js/vendors/stats.min.js"></script></html>diff --git a/documentation/index.html b/documentation/index.htmlindex 875951ef..ab20cfed 100644--- a/documentation/index.html+++ b/documentation/index.html@@ -15,11 +15,11 @@<meta name="twitter:image" content="http://animejs.com/documentation/assets/img/icons/twitter.png"><link rel="apple-touch-icon-precomposed" href="assets/img/icons/apple-touch-icon.png"><link rel="icon" type="image/png" href="assets/img/icons/favicon.png" >+ <link href="//cloud.typenetwork.com/projects/2160/fontface.css/" rel="stylesheet" type="text/css"><link href="https://fonts.googleapis.com/css?family=Space+Mono" rel="stylesheet">- <link href="assets/css/anime.css" rel="stylesheet"><link href="assets/css/anime-theme.css" rel="stylesheet"><link href="assets/css/documentation.css" rel="stylesheet">- <script src="../anime.min.js"></script>+ <script src="../anime.js"></script></head><body><div class="content">@@ -28,48 +28,79 @@</header><section class="pane sidebar"><nav class="navigation"></nav>+ <div class="sidebar-info">+ <a class="github-button" href="https://github.com/juliangarnier/anime/archive/master.zip" data-icon="octicon-cloud-download" aria-label="Download juliangarnier/anime on GitHub">Download</a>+ <a class="github-button" href="https://github.com/juliangarnier/anime" data-show-count="true" aria-label="Star juliangarnier/anime on GitHub">Star</a>+ </div></section><section class="pane demos"><!-- TARGETS -->-<article id="targets" class="color-01">+<article id="targets" class="color-targets"><header><h2 class="demos-title">Targets</h2></header><div id="cssSelector" class="demo"><h3 class="demo-title">CSS Selector</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>String</td>+ <td><code>null</code></td>+ <td><code>targets: '.item'</code></td>+ </tr>+ </table>+ <p>Can be any CSS selector except pseudo elements (they can't be animated in JavaScript).</p>+ </div>+ <div class="demo-content css-selector-demo"><div class="line"><div class="square shadow"></div><div class="square el"></div></div></div>-<script>var cssSelector = anime({- targets: '#cssSelector .el',+ <script>var cssSelector = function() {+/*DEMO*/+anime({+ targets: '.css-selector-demo .el',translateX: 250});-</script>+/*DEMO*/+}+ </script>+</div><div id="domNode" class="demo">- <h3 class="demo-title">DOM Node</h3>- <div class="demo-content">- <div class="large square shadow"></div>- <div class="large square el"></div>+ <h3 class="demo-title">DOM Node / NodeList</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>DOM Node</td>+ <td><code>null</code></td>+ <td><code>targets: el.querySelector('.item')</code></td>+ </tr>+ <tr>+ <td>NodeList</td>+ <td><code>null</code></td>+ <td><code>targets: el.querySelectorAll('.item')</code></td>+ </tr>+ </table>+ <p>+ Can be any DOM Node or NodeList.+ </p></div>-<script>var el = document.querySelector('#domNode .el');--var domNode = anime({- targets: el,- translateX: 250-});-</script>-</div>--<div id="nodeList" class="demo">- <h3 class="demo-title">Node List</h3>- <div class="demo-content">+ <div class="demo-content dom-node-demo"><div class="line"><div class="small square shadow"></div><div class="small square el"></div>@@ -83,209 +114,602 @@ var domNode = anime({<div class="small square el"></div></div></div>-<script>var els = document.querySelectorAll('#nodeList .el');+ <script>var domNode = function() {+/*DEMO*/+var elements = document.querySelectorAll('.dom-node-demo .el');-var nodeList = anime({- targets: els,+anime({+ targets: elements,translateX: 250});-</script>+/*DEMO*/+}+ </script></div><div id="JSobject" class="demo"><h3 class="demo-title">JavaScript Object</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Object</td>+ <td><code>null</code></td>+ <td><code>targets: myObjectProp</code></td>+ </tr>+ </table>+ <p>+ A JavaScript Object with at least one property containing a numerical value.+ </p>+ </div><div class="demo-content">- <pre>{"charged":"0"}</pre>+ <pre class="battery-log">{"charged":"0%","cycles":120}</pre></div>-<script>var obj = { charged: '0%' };+ <script>var JSobject = function() {+/*DEMO*/+var logEl = document.querySelector('.battery-log');++var battery = {+ charged: '0%',+ cycles: 120+}-var JSobject = anime({- targets: obj,+anime({+ targets: battery,charged: '100%',+ cycles: 130,round: 1,easing: 'linear',update: function() {- var el = document.querySelector('#JSobject pre');- el.innerHTML = JSON.stringify(obj);+ logEl.innerHTML = JSON.stringify(battery);}});+/*DEMO*/+}+ </script>+<script></script></div>-<div id="JSarray" class="demo">- <h3 class="demo-title">JavaScript Array</h3>- <div class="demo-content">+<div id="array" class="demo">+ <h3 class="demo-title">Array</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Array</td>+ <td><code>null</code></td>+ <td><code>targets: ['.item', el.getElementById('#thing')]</code></td>+ </tr>+ </table>+ <p>+ An array containing different multiple targets.+ </p>+ </div>+ <div class="demo-content mixed-array-demo"><div class="line"><div class="square shadow"></div>- <div class="square el-01"></div>+ <div class="square el el-01"></div></div><div class="line"><div class="square shadow"></div>- <div class="square el-02"></div>+ <div class="square el el-02"></div></div><div class="line"><div class="square shadow"></div>- <div class="square el-03"></div>+ <div class="square el el-03"></div></div></div>-<script>var el = document.querySelector('#JSarray .el-01');+ <script>var array = function() {+/*DEMO*/+var el = document.querySelector('.mixed-array-demo .el-01');-var JSarray = anime({- targets: [el, '#JSarray .el-02', '#JSarray .el-03'],+anime({+ targets: [el, '.mixed-array-demo .el-02', '.mixed-array-demo .el-03'],translateX: 250});-</script>+/*DEMO*/+}+ </script>+</div></article><!-- --><!-- ANIMATABLE PROPERTIES -->-<article id="properties" class="color-02">+<article id="properties" class="color-properties"><header><h2 class="demos-title">Properties</h2></header><div id="cssProperties" class="demo">- <h3 class="demo-title">CSS</h3>- <div class="demo-content">+ <h3 class="demo-title">CSS Properties</h3>+ <div class="demo-description">+ <p>+ Any CSS properties can be animated.+ </p>+ <p class="bubble warning">+ Most CSS properties will cause layout changes or repaint, and will result in choppy animation.+ Prroritize opacity, and Transforms as much as possible.+ </p>+ <table>+ <thead>+ <td>Example</td>+ <td>value</td>+ </thead>+ <tr>+ <td><code>opacity</code></td>+ <td><code>.5</code></td>+ </tr>+ <tr>+ <td><code>left</code></td>+ <td><code>'100px'</code></td>+ </tr>+ </table>+ <p>More details about accepted values in the <a class="color-values" href="#unitlessValue">Values</a> section.</p>+ </div>+ <div class="demo-content css-prop-demo"><div class="large square shadow"></div><div class="large square el"></div></div>-<script>var cssProperties = anime({- targets: '#cssProperties .el',+ <script>var cssProperties = function() {+/*DEMO*/+anime({+ targets: '.css-prop-demo .el',left: '240px',backgroundColor: '#FFF',- borderRadius: 40,+ borderRadius: ['0%', '50%'],easing: 'easeInOutQuad'});-</script>+/*DEMO*/+}+ </script></div><div id="CSStransforms" class="demo"><h3 class="demo-title">CSS Transforms</h3>- <div class="demo-content">+ <div class="demo-description">+ <p>+ Animate CSS transforms properties indivudaly.+ </p>+ <p class="bubble info">+ It's possible to specify different timing for each transforms properties, more details in the <a class="color-properties" href="#specificPropParameters">specific property parameters</a> section.+ </p>+ <table>+ <thead>+ <td>Valid properties</td>+ <td>Default unit</td>+ </thead>+ <tr><td><code>'translateX'</code></td><td><code>'px'</code></td></tr>+ <tr><td><code>'translateY'</code></td><td><code>'px'</code></td></tr>+ <tr><td><code>'translateZ'</code></td><td><code>'px'</code></td></tr>+ <tr><td><code>'rotate'</code></td><td><code>'deg'</code></td></tr>+ <tr><td><code>'rotateX'</code></td><td><code>'deg'</code></td></tr>+ <tr><td><code>'rotateY'</code></td><td><code>'deg'</code></td></tr>+ <tr><td><code>'rotateZ'</code></td><td><code>'deg'</code></td></tr>+ <tr><td><code>'scale'</code></td><td><code>—</code></td></tr>+ <tr><td><code>'scaleX'</code></td><td><code>—</code></td></tr>+ <tr><td><code>'scaleY'</code></td><td><code>—</code></td></tr>+ <tr><td><code>'scaleZ'</code></td><td><code>—</code></td></tr>+ <tr><td><code>'skew'</code></td><td><code>'deg'</code></td></tr>+ <tr><td><code>'skewX'</code></td><td><code>'deg'</code></td></tr>+ <tr><td><code>'skewY'</code></td><td><code>'deg'</code></td></tr>+ <tr><td><code>'perspective'</code></td><td><code>'px'</code></td></tr>+ </table>+ <p>More details about accepted values in the <a class="color-values" href="#unitlessValue">Values</a> section.</p>+ </div>+ <div class="demo-content css-transforms-demo"><div class="square shadow"></div><div class="square el"></div></div>-<script>var CSStransforms = anime({- targets: '#CSStransforms .el',+ <script>var CSStransforms = function() {+/*DEMO*/+anime({+ targets: '.css-transforms-demo .el',translateX: 250,scale: 2,rotate: '1turn'});-</script>+/*DEMO*/+}+ </script></div>-<div id="JSobjectProp" class="demo">+<div id="JSobjProp" class="demo"><h3 class="demo-title">Object properties</h3>-<div class="demo-content"><pre>{"myProperty":"0"}</pre></div>-<script>var myObject = {+ <div class="demo-description">+ <p>+ Any Object property containing a numerical value can be animated.+ </p>+ <table>+ <thead>+ <td>Example</td>+ <td>value</td>+ </thead>+ <tr>+ <td><code>prop1</code></td>+ <td><code>50</code></td>+ </tr>+ <tr>+ <td><code>'prop2'</code></td>+ <td><code>'100%'</code></td>+ </tr>+ </table>+ <p>More details about accepted values in the <a class="color-values" href="#unitlessValue">Values</a> section.</p>+ </div>+ <div class="demo-content">+ <pre class="js-object-log">{"prop1":0,"prop2":"0%"}</pre>+ </div>+ <script>var JSobjProp = function() {+/*DEMO*/+var objPropLogEl = document.querySelector('.js-object-log');++var myObject = {prop1: 0,prop2: '0%'}-var JSobjectProp = anime({++anime({targets: myObject,prop1: 50,prop2: '100%',easing: 'linear',round: 1,update: function() {- var el = document.querySelector('#JSobjectProp pre');- el.innerHTML = JSON.stringify(myObject);+ objPropLogEl.innerHTML = JSON.stringify(myObject);}});-</script>+/*DEMO*/+}+ </script></div>-<div id="domAttributes" class="demo">+<div id="domAttr" class="demo"><h3 class="demo-title">DOM Attributes</h3>- <div class="demo-content">- <input class="text-output" value="0"></input>+ <div class="demo-description">+ <p>+ Any DOM Attribute containing a numerical value can be animated.+ </p>+ <table>+ <thead>+ <td>Example</td>+ <td>value</td>+ </thead>+ <tr>+ <td><code>value</code></td>+ <td><code>1000</code></td>+ </tr>+ <tr>+ <td><code>volume</code></td>+ <td><code>0</code></td>+ </tr>+ <tr>+ <td><code>data-custom</code></td>+ <td><code>'3 dogs'</code></td>+ </tr>+ </table>+ <p>More details about accepted values in the <a class="color-values" href="#unitlessValue">Values</a> section.</p>+ </div>+ <div class="demo-content dom-attribute-demo">+ <input class="el text-output" value="0"></input></div>-<script>var domAttributes = anime({- targets: '#domAttributes input',- value: 1000,+ <script>var domAttr = function() {+/*DEMO*/+anime({+ targets: '.dom-attribute-demo input',+ value: [0, 1000],round: 1,easing: 'easeInOutExpo'});-</script>+/*DEMO*/+}+ </script></div>-<div id="svgAttributes" class="demo">+<div id="svgAttr" class="demo"><h3 class="demo-title">SVG Attributes</h3>- <div class="demo-content align-center">+ <div class="demo-description">+ <p>+ Like any other <a class="color-properties" href="#domAttr">DOM attributes</a>, all SVG attributes containing at least one numerical value can be animated.+ </p>+ <table>+ <thead>+ <td>Example</td>+ <td>value</td>+ </thead>+ <tr>+ <td><code>points</code></td>+ <td><code>'64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100'</code></td>+ </tr>+ <tr>+ <td><code>scale</code></td>+ <td><code>1</code></td>+ </tr>+ <tr>+ <td><code>baseFrequency</code></td>+ <td><code>0</code></td>+ </tr>+ </table>+ <p>More details about accepted values in the <a class="color-values" href="#unitlessValue">Values</a> section and SVG animation in the <a class="color-svg" href="#motionPath">SVG</a> section</p>+ </div>+ <div class="demo-content align-center svg-attributes-demo"><svg width="128" height="128" viewBox="0 0 128 128">- <polygon points="64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100" fill="currentColor"/>+ <filter id="displacementFilter">+ <feTurbulence type="turbulence" baseFrequency=".05" numOctaves="2" result="turbulence"/>+ <feDisplacementMap in2="turbulence" in="SourceGraphic" scale="15" xChannelSelector="R" yChannelSelector="G"/>+ </filter>+ <polygon points="64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100" style="filter: url(#displacementFilter)" fill="currentColor"/></svg></div>-<script>var svgAttributes = anime({- targets: '#svgAttributes polygon',+ <script>var svgAttr = function() {+ // Needed to reset demo+ var polyEl = document.querySelector('.svg-attributes-demo polygon');+ var feTurbulenceEl = document.querySelector('feTurbulence');+ var feDisplacementMap = document.querySelector('feDisplacementMap');+ polyEl.setAttribute('points', '64 68.64 8.574 100 63.446 67.68 64 4 64.554 67.68 119.426 100');+ feTurbulenceEl.setAttribute('baseFrequency', '.05');+ feDisplacementMap.setAttribute('scale', '15');+/*DEMO*/+anime({+ targets: ['.svg-attributes-demo polygon', 'feTurbulence', 'feDisplacementMap'],points: '64 128 8.574 96 8.574 32 64 0 119.426 32 119.426 96',+ baseFrequency: 0,+ scale: 1,+ loop: true,+ direction: 'alternate',easing: 'easeInOutExpo'});-</script>+/*DEMO*/+}+ </script>+</div></article><!-- --><!-- PROPERTY PARAMETERS -->-<article id="propertyParameters" class="color-03">+<article id="propertyParameters" class="color-prop-params"><header><h2 class="demos-title">Property parameters</h2></header><div id="duration" class="demo"><h3 class="demo-title">Duration</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Number</td>+ <td><code>1000</code></td>+ <td><code>duration: 3000</code></td>+ </tr>+ <tr>+ <td>Function</td>+ <td>See <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a> section</td>+ <td><code>duration: (el, i) => i * 500</code></td>+ </tr>+ </table>+ <p>+ Defines the duration in milliseconds of the animation.+ </p>+ </div>+ <div class="demo-content duration-demo">+ <div class="label">3000 ms</div><div class="square shadow"></div><div class="square el"></div></div>-<script>var duration = anime({- targets: '#duration .el',+ <script>var duration = function() {+/*DEMO*/+anime({+ targets: '.duration-demo .el',translateX: 250,duration: 3000});-</script>+/*DEMO*/+}+ </script></div><div id="delay" class="demo"><h3 class="demo-title">Delay</h3>- <div class="demo-content">-<div class="square shadow"></div>-<div class="square el"></div>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Number</td>+ <td><code>0</code></td>+ <td><code>delay: 1000</code></td>+ </tr>+ <tr>+ <td>Function</td>+ <td>See <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a> section</td>+ <td><code>delay: (el, i) => i * 150</code></td>+ </tr>+ </table>+ <p>+ Defines the delay in milliseconds of the animation.+ </p></div>-<script>var delay = anime({- targets: '#delay .el',+ <div class="demo-content delay-demo">+ <div class="label">1000 ms</div>+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+ <script>var delay = function() {+/*DEMO*/+anime({+ targets: '.delay-demo .el',translateX: 250,delay: 1000});-</script>+/*DEMO*/+}+ </script>+</div>++<div id="endDelay" class="demo">+ <h3 class="demo-title">end delay</h3>+ <div class="demo-description">+ <pre><code>endDelay: 2000</code></pre>+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Number</td>+ <td><code>0</code></td>+ <td><code>endDelay: 1000</code></td>+ </tr>+ <tr>+ <td>Function</td>+ <td>See <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a> section</td>+ <td><code>endDelay: (el, i, t) => (t - i) * 150</code></td>+ </tr>+ </table>+ <p>+ Add some extra time in milliseconds at the end of the animation.+ </p>+ </div>+ <div class="demo-content end-delay-demo">+ <div class="label">1000 ms</div>+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+ <script>var endDelay = function() {+/*DEMO*/+anime({+ targets: '.end-delay-demo .el',+ translateX: 250,+ endDelay: 1000,+ direction: 'alternate'+});+/*DEMO*/+}+ </script>+</div><div id="easing" class="demo"><h3 class="demo-title">Easing</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>String</td>+ <td><code>'easeOutElastic(1, .5)'</code></td>+ <td><code>easing: 'easeInOutQuad'</code></td>+ </tr>+ </table>+ <p>+ Defines the timing function of the animation.+ </p>+ <p class="bubble info">+ Check out the <a class="color-easings" href="#linearEasing">Easings</a> section for a complete list of available easing and parameters.+ </p>+ </div>+ <div class="demo-content easing-demo">+ <div class="label">easeInOutExpo</div><div class="square shadow"></div><div class="square el"></div></div>-<script>var easing = anime({- targets: '#easing .el',+ <script>var easing = function() {+/*DEMO*/+anime({+ targets: '.easing-demo .el',translateX: 250,- easing: 'easeInOutQuart'+ easing: 'easeInOutExpo'});-</script>+/*DEMO*/+}+ </script>+</div>-<div id="specificPropertyParameters" class="demo">- <h3 class="demo-title">Specific property parameters</h3>+<div id="round" class="demo">+ <h3 class="demo-title">Round</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Number</td>+ <td><code>0</code></td>+ <td><code>round: 10</code></td>+ </tr>+ </table>+ <p>+ Rounds the value to x decimals.+ </p>+ </div><div class="demo-content">+ <pre class="round-log">0</pre>+ </div>+ <script>var round = function() {+/*DEMO*/+var roundLogEl = document.querySelector('.round-log');++anime({+ targets: roundLogEl,+ innerHTML: [0, 10000],+ easing: 'linear',+ round: 10 // Will round the animated value to 1 decimal+});+/*DEMO*/+}+ </script>+</div>++<div id="specificPropParameters" class="demo">+ <h3 class="demo-title">Specific property parameters</h3>+ <div class="demo-description">+ <p>+ Defines specific parameters to each property of the animation using an Object as value.<br>+ Other properties that aren't specified in the Object are inheritted from the main animation.+ </p>+<pre><code>translateX: {+ value: 250,+ duration: 800+},+rotate: {+ value: 360,+ duration: 1600+}</code></pre>+ </div>+ <div class="demo-content specific-prop-params-demo"><div class="square shadow"></div><div class="square el"></div></div>-<script>var specificPropertyParameters = anime({- targets: '#specificPropertyParameters .el',+ <script>var specificPropParameters = function() {+/*DEMO*/+anime({+ targets: '.specific-prop-params-demo .el',translateX: {value: 250,duration: 800@@ -303,397 +727,767 @@ var JSobjectProp = anime({},delay: 250 // All properties except 'scale' inherit 250ms delay});-</script>-</div>--</article>-<!-- -->+/*DEMO*/+}+ </script>-<!-- FUNCTION BASED PARAMETERS -->-<article id="functionBasedParameters" class="color-04">-<header>- <h2 class="demos-title">Function based parameters</h2>-</header>+</div>-<div id="functionBasedDuration" class="demo">- <h3 class="demo-title">Duration</h3>- <div class="demo-content">+<div id="functionBasedParameters" class="demo">+ <h3 class="demo-title">Function based parameters</h3>+ <div class="demo-description">+ <p>+ Get different values for every target and property of the animation.<br>+ </p>+<pre><code>translateX: function(target, index, targetsLength) {+ return (targetsLength - index) * 200;+}</code></pre>+ <p>+ The function accepts 3 arguments:+ </p>+ <table>+ <thead>+ <td>Arguments</td>+ <td>Infos</td>+ </thead>+ <tr>+ <td><code>target</code></td>+ <td>The curent animated targeted element</td>+ </tr>+ <tr>+ <td><code>index</code></td>+ <td>The index of the animated targeted element</td>+ </tr>+ <tr>+ <td><code>targetsLength</code></td>+ <td>The total number of animated targets</td>+ </tr>+ </table>+ </div>+ <div class="demo-content function-based-params-demo"><div class="line">+ <div class="small label">delay = 0 * 100</div><div class="small square shadow"></div><div class="small square el"></div></div><div class="line">+ <div class="small label">delay = 1 * 100</div><div class="small square shadow"></div><div class="small square el"></div></div><div class="line">+ <div class="small label">delay = 2 * 100</div><div class="small square shadow"></div><div class="small square el"></div></div></div>-<script>var functionBasedDuration = anime({- targets: '#functionBasedDuration .el',+ <script>var functionBasedParameters = function() {+/*DEMO*/+anime({+ targets: '.function-based-params-demo .el',translateX: 250,direction: 'alternate',loop: true,- duration: function(el, i, l) {- return 1000 + (i * 1000);+ delay: function(el, i, l) {+ return i * 100;+ },+ endDelay: function(el, i, l) {+ return (l - i) * 100;}});-</script>+/*DEMO*/+}+ </script>+</div>-<div id="functionBasedDelay" class="demo">- <h3 class="demo-title">Delay</h3>+</article>+<!-- -->++<!-- ANIMATION PARAMETERS -->+<article id="animationParameters" class="color-anim-params">+ <header>+ <h2 class="demos-title">Animation parameters</h2>+ </header>++<div id="direction" class="demo">+ <h3 class="demo-title">Direction</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>String</td>+ <td><code>'normal'</code></td>+ <td><code>direction: 'alternate'</code></td>+ </tr>+ </table>+ <p>+ Defines the direction of the animation.+ </p>+ <table>+ <thead>+ <td>Accepts</td>+ <td>Infos</td>+ </thead>+ <tr>+ <td><code>'normal'</code></td>+ <td>Animation progress goes from 0 to 100%</td>+ </tr>+ <tr>+ <td><code>'reverse'</code></td>+ <td>Animation progress goes from 100% to 0%</td>+ </tr>+ <tr>+ <td><code>'alternate'</code></td>+ <td>Animation progress goes from 0% to 100% then go back to 0%</td>+ </tr>+ </table>+ </div><div class="demo-content"><div class="line">- <div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="label">normal</div>+ <div class="square shadow"></div>+ <div class="square el dir-normal"></div></div><div class="line">- <div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="label">reverse</div>+ <div class="square shadow"></div>+ <div class="square el dir-reverse"></div></div><div class="line">- <div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="label">alternate</div>+ <div class="square shadow"></div>+ <div class="square el dir-alternate"></div></div></div>-<script>var functionBasedDelay = anime({- targets: '#functionBasedDelay .el',+ <script>var direction = function() {+/*DEMO*/+anime({+ targets: '.dir-normal',+ translateX: 250,+ easing: 'easeInOutSine'+});++anime({+ targets: '.dir-reverse',+ translateX: 250,+ direction: 'reverse',+ easing: 'easeInOutSine'+});++anime({+ targets: '.dir-alternate',translateX: 250,direction: 'alternate',- loop: true,- delay: function(el, i, l) {- return i * 100;- }+ easing: 'easeInOutSine'});-</script>+/*DEMO*/+}+ </script>+</div>-<div id="functionBasedElasticity" class="demo">- <h3 class="demo-title">Elasticity</h3>+<div id="loop" class="demo">+ <h3 class="demo-title">Loop</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Number | Boolean</td>+ <td><code>'normal'</code></td>+ <td><code>loop: 3</code></td>+ </tr>+ </table>+ <p>+ Defines the number of iterations of your animation.+ </p>+ <table>+ <thead>+ <td>Accepts</td>+ <td>Infos</td>+ </thead>+ <tr>+ <td><code>Number</code></td>+ <td>The number of iterations</td>+ </tr>+ <tr>+ <td><code>true</code></td>+ <td>Loop indefinitely</td>+ </tr>+ <tr>+ <td><code>Infinity</code></td>+ <td>Loop indefinitely</td>+ </tr>+ </table>+ </div><div class="demo-content"><div class="line">+ <div class="small label">3 times</div><div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="small square el loop"></div></div><div class="line">+ <div class="small label">reverse 3 times</div><div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="small square el loop-reverse"></div></div><div class="line">+ <div class="small label">alternate 3 times</div><div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="small square el loop-alternate"></div></div>- </div>-<script>var functionBasedElasticity = anime({- targets: '#functionBasedElasticity .el',- translateX: 250,- direction: 'alternate',- loop: true,- elasticity: function(el, i, l) {- return (200 + i * 200);- }-});-</script>-</div>--<div id="combinedFunctionBasedProp" class="demo">- <h3 class="demo-title">Combined</h3>- <div class="demo-content"><div class="line">- <div class="square shadow"></div>- <div data-duration="2000" class="square el"></div>+ <div class="small label">inifinite</div>+ <div class="small square shadow"></div>+ <div class="small square el loop-infinity"></div></div><div class="line">- <div class="square shadow"></div>- <div data-duration="1500" class="square el"></div>+ <div class="small label">inifinite reverse</div>+ <div class="small square shadow"></div>+ <div class="small square el loop-reverse-infinity"></div></div><div class="line">- <div class="square shadow"></div>- <div data-duration="1000" class="square el"></div>+ <div class="small label">inifinite alternate</div>+ <div class="small square shadow"></div>+ <div class="small square el loop-alternate-infinity"></div></div></div>-<script>var combinedFunctionBasedProp = anime({- targets: '#combinedFunctionBasedProp .el',- translateX: 100,+ <script>var loop = function() {+/*DEMO*/+anime({+ targets: '.loop',translateX: 250,- rotate: 180,- duration: function(target) {- // Duration based on every div 'data-duration' attribute- return target.getAttribute('data-duration');- },- delay: function(target, index) {- // 100ms delay multiplied by every div index, in ascending order- return index * 100;- },- elasticity: function(target, index, totalTargets) {- // Elasticity multiplied by every div index, in descending order- return 200 + ((totalTargets - index) * 200);- },- direction: 'alternate',- loop: true+ loop: 3,+ easing: 'easeInOutSine'});-</script>-</div>--</article>-<!-- -->-<!-- ANIMATION PARAMETERS -->-<article id="animationParameters" class="color-05">- <header>- <h2 class="demos-title">Animation parameters</h2>- </header>+anime({+ targets: '.loop-infinity',+ translateX: 250,+ loop: true,+ easing: 'easeInOutSine'+});-<div id="alternate" class="demo">- <h3 class="demo-title">Direction alternate</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>- </div>-<script>var alternate = anime({- targets: '#alternate .el',+anime({+ targets: '.loop-reverse',translateX: 250,- direction: 'alternate'+ direction: 'reverse',+ easing: 'easeInOutSine'});-</script>-</div>-<div id="reverse" class="demo">- <h3 class="demo-title">Direction reverse</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>- </div>-<script>var reverse = anime({- targets: '#reverse .el',+anime({+ targets: '.loop-reverse-infinity',translateX: 250,- direction: 'reverse'+ direction: 'reverse',+ loop: true,+ easing: 'easeInOutSine'});-</script>-</div>-<div id="loop" class="demo">- <h3 class="demo-title">Loop (x times)</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>- </div>-<script>var loop = anime({- targets: '#loop .el',+anime({+ targets: '.loop-alternate',translateX: 250,- loop: 3+ direction: 'alternate',+ easing: 'easeInOutSine'});-</script>-</div>-<div id="loopAlternate" class="demo">- <h3 class="demo-title">Loop alternate (x times)</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>- </div>-<script>var loopAlternate = anime({- targets: '#loopAlternate .el',+anime({+ targets: '.loop-alternate-infinity',translateX: 250,- loop: 3,- direction: 'alternate'+ direction: 'alternate',+ loop: true,+ easing: 'easeInOutSine'});-</script>+/*DEMO*/+}+ </script></div>-<div id="loopReverse" class="demo">- <h3 class="demo-title">Loop reverse (x times)</h3>+<div id="autoplay" class="demo">+ <h3 class="demo-title">Autoplay</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Boolean</td>+ <td><code>true</code></td>+ <td><code>autoplay: false</code></td>+ </tr>+ </table>+ <p>+ <p>+ Defines if the animation should automatically start or not.+ </p>+ <table>+ <thead>+ <td>Accepts</td>+ <td>Infos</td>+ </thead>+ <tr>+ <td><code>true</code></td>+ <td>Automatically starts the animation</td>+ </tr>+ <tr>+ <td><code>false</code></td>+ <td>Animation is paused by default</td>+ </tr>+ </table>+ </div><div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="line">+ <div class="label">autoplay: true</div>+ <div class="square shadow"></div>+ <div class="square el autoplay-true"></div>+ </div>+ <div class="line">+ <div class="label">autoplay: false</div>+ <div class="square shadow"></div>+ <div class="square el autoplay-false"></div>+ </div></div>-<script>var loopReverse = anime({- targets: '#loopReverse .el',+ <script>var autoplay = function() {+/*DEMO*/+anime({+ targets: '.autoplay-true',translateX: 250,- loop: 3,- direction: 'reverse'+ autoplay: true,+ easing: 'easeInOutSine'});-</script>-</div>-<div id="infiniteLoop" class="demo">- <h3 class="demo-title">Infinite loop</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>- </div>-<script>var infiniteLoop = anime({- targets: '#infiniteLoop .el',+anime({+ targets: '.autoplay-false',translateX: 250,- loop: true+ autoplay: false,+ easing: 'easeInOutSine'});-</script>+/*DEMO*/+}+ </script></div>-<div id="infiniteLoopAlternate" class="demo">- <h3 class="demo-title">Infinite loop alternate</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>+<div id="startTime" class="demo">+ <h3 class="demo-title">StartTime</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Default</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Number</td>+ <td><code>0</code></td>+ <td><code>startTime: 2000</code></td>+ </tr>+ </table>+ <p>+ Force the animation to start at a certain time in milliseconds.+ </p></div>-<script>var infiniteLoopAlternate = anime({- targets: '#infiniteLoopAlternate .el',- translateX: 250,- direction: 'alternate',- loop: true-});-</script>-</div>--<div id="infiniteLoopReverse" class="demo">- <h3 class="demo-title">Infinite loop reverse</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="demo-content start-time-demo">+ <div class="line">+ <div class="label">startTime: 0</div>+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+ <div class="line">+ <div class="label">startTime: 75</div>+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div>+ <div class="line">+ <div class="label">startTime: 150</div>+ <div class="square shadow"></div>+ <div class="square el"></div>+ </div></div>-<script>var infiniteLoopReverse = anime({- targets: '#infiniteLoopReverse .el',- translateX: 250,- direction: 'reverse',- loop: true-});-</script>+ <script>var startTime = function() {+/*DEMO*/+var els = document.querySelectorAll('.start-time-demo .el');++for (var i = 0; i < els.length; i++) {+ anime({+ targets: els[i],+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'easeOutSine',+ duration: 600,+ startTime: i * 75+ });+}+/*DEMO*/+}+ </script></div></article><!-- --><!-- VALUES -->-<article id="values" class="color-06">+<article id="values" class="color-values"><header><h2 class="demos-title">Values</h2></header><div id="unitlessValue" class="demo"><h3 class="demo-title">Unitless</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Number</td>+ <td><code>translateX: 250</code></td>+ </tr>+ </table>+ <p>+ If the original value has a unit, it will be automatically added to the animated value.+ </p></div>-<script>var unitlessValue = anime({- targets: '#unitlessValue .el',- translateX: 250,- rotate: 540+ <div class="demo-content unitless-values-demo">+ <div class="circle shadow"></div>+ <div class="circle el"></div>+ </div>+ <script>var unitlessValue = function() {+/*DEMO*/+anime({+ targets: '.unitless-values-demo .el',+ translateX: 250, // -> '250px'+ rotate: 540 // -> '540deg'});-</script>+/*DEMO*/+}+ </script>+</div><div id="specificUnitValue" class="demo"><h3 class="demo-title">Specific unit</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>String</td>+ <td><code>width: '100%'</code></td>+ </tr>+ </table>+ <p>+ Force the animation to use a certain unit and will automatically convert the initial target value.+ </p>+ <p class="bubble warning">+ Conversion accuracy can vary depending of the unit used.<br>+ You can also define the initial value of the animation directly using an array, see the <a href="#fromToValues" class="color-values">From To values</a> section.+ </p>+ </div>+ <div class="demo-content specific-unit-values-demo"><div class="square shadow"></div><div class="square el"></div></div>-<script>var specificUnitValue = anime({- targets: '#specificUnitValue .el',- translateX: '20em',- rotate: '1.5turn'+ <script>var specificUnitValue = function() {+/*DEMO*/+anime({+ targets: '.specific-unit-values-demo .el',+ width: '100%', // -> from '28px' to '100%',+ easing: 'easeInOutQuad',+ direction: 'alternate',+ loop: true});-</script>+/*DEMO*/+}+ </script>+</div><div id="relativeValues" class="demo"><h3 class="demo-title">Relative</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Accepts</td>+ <td>Effect</td>+ <td>Example</td>+ </thead>+ <tr>+ <td><code>'+='</code></td>+ <td>Add</td>+ <td><code>'+=100'</code></td>+ </tr>+ <tr>+ <td><code>'-='</code></td>+ <td>Substract</td>+ <td><code>'-=2turn'</code></td>+ </tr>+ <tr>+ <td><code>'*='</code></td>+ <td>Multiply</td>+ <td><code>'*=10'</code></td>+ </tr>+ </table>+ <p>+ Add, substract or multiply the original value.<br>+ Default units are preserved.+ </p>+ </div><div class="demo-content">- <div class="square shadow"></div>- <div class="square el" style="transform: translateX(100px)"></div>+ <div class="circle shadow"></div>+ <div class="circle el relative-values"></div></div>-<script>var relativeValues = anime({- targets: '#relativeValues .el',+ <script>var relativeValues = function() {+/*DEMO*/+var relativeEl = document.querySelector('.el.relative-values');+relativeEl.style.transform = 'translateX(100px)';++anime({+ targets: '.el.relative-values',translateX: {- value: '+=150',+ value: '*=2.5', // 100px * 2.5 = '250px'duration: 1000},width: {- value: '-=10',+ value: '-=20px', // 28 - 20 = '8px'duration: 1800,easing: 'easeInOutSine'},- height: {- value: '*=4',+ rotate: {+ value: '+=2turn', // 0 * 2 = '2turn'duration: 1800,easing: 'easeInOutSine'},direction: 'alternate'});-</script>+/*DEMO*/+}+ </script>+</div><div id="colors" class="demo"><h3 class="demo-title">Colors</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Accepts</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Haxadecimal</td>+ <td><code>'#FFF'</code> or <code>'#FFFFFF'</code></td>+ </tr>+ <tr>+ <td>RGB</td>+ <td><code>'rgb(255, 255, 255)'</code></td>+ </tr>+ <tr>+ <td>RGBA</td>+ <td><code>'rgba(255, 255, 255, 1)'</code></td>+ </tr>+ <tr>+ <td>HSL</td>+ <td><code>'hsl(0, 100%, 100%)'</code></td>+ </tr>+ <tr>+ <td>HSLA</td>+ <td><code>'hsla(0, 100%, 100%, 1)'</code></td>+ </tr>+ </table>+ <p>+ <i>Anime</i> accepts and converts Haxadecimal, RGB, RGBA, HSL, and HSLA color values.+ </p>+ </div>+ <div class="demo-content colors-demo"><div class="line">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="small label">HEX</div>+ <div class="small circle shadow"></div>+ <div class="small circle el color-hex"></div></div><div class="line">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="small label">RGB</div>+ <div class="small circle shadow"></div>+ <div class="small circle el color-rgb"></div></div><div class="line">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="small label">HSL</div>+ <div class="small circle shadow"></div>+ <div class="small circle el color-hsl"></div>+ </div>+ <div class="line">+ <div class="small label">RGBA</div>+ <div class="small circle shadow"></div>+ <div class="small circle el color-rgba"></div>+ </div>+ <div class="line">+ <div class="small label">HSLA</div>+ <div class="small circle shadow"></div>+ <div class="small circle el color-hsla"></div></div></div>-<script>+ <script>var colors = function() {+/*DEMO*/+anime({+ targets: '.color-hex',+ backgroundColor: '#FFF',+ translateX: 250,+ endDelay: 1000,+ easing: 'easeInOutQuad',+ direction: 'alternate',+ loop: true+});-var colors = anime({- targets: '#colors .el',+anime({+ targets: '.color-rgb',+ backgroundColor: 'rgb(255,255,255)',translateX: 250,- backgroundColor: [- {value: '#FFF'}, // Or #FFFFFF- {value: 'rgb(255, 0, 0)'},- {value: 'hsl(100, 60%, 60%)'}- ],- easing: 'linear',+ endDelay: 1000,+ easing: 'easeInOutQuad',direction: 'alternate',- duration: 2000+ loop: true});-</script>++anime({+ targets: '.color-hsl',+ backgroundColor: 'hsl(0, 100%, 100%)',+ translateX: 250,+ endDelay: 1000,+ easing: 'easeInOutQuad',+ direction: 'alternate',+ loop: true+});++anime({+ targets: '.color-rgba',+ backgroundColor: 'rgba(255,255,255, .25)',+ translateX: 250,+ endDelay: 1000,+ easing: 'easeInOutQuad',+ direction: 'alternate',+ loop: true+});++anime({+ targets: '.color-hsla',+ backgroundColor: 'hsla(0, 100%, 100%, .25)',+ translateX: 250,+ endDelay: 1000,+ easing: 'easeInOutQuad',+ direction: 'alternate',+ loop: true+});+/*DEMO*/+}+ </script>+</div>-<div id="specificInitialValue" class="demo">- <h3 class="demo-title">Specific initial value</h3>+<div id="fromToValues" class="demo">+ <h3 class="demo-title">From To</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Example</td>+ </thead>+ <tr>+ <td><code>Array</code></td>+ <td><code>['50%', '100%']</code></td>+ </tr>+ </table>+ <p>+ Force the animation to starts at a specified value.+ </p>+ <p class="bubble warning">+ Values must have identical units <code>['50%', '100%']</code>, or no units <code>[50, 100]</code>.+ </p>+ </div><div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="circle shadow"></div>+ <div class="circle el from-to-values"></div></div>-<script>var specificInitialValue = anime({- targets: '#specificInitialValue .el',- translateX: [100, 250],+ <script>var fromToValues = function() {+/*DEMO*/+anime({+ targets: '.el.from-to-values',+ translateX: [100, 250], // from 100 to 250delay: 500,direction: 'alternate',loop: true});-</script>+/*DEMO*/+}+ </script>+</div><div id="functionBasedPropVal" class="demo"><h3 class="demo-title">Function based values</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Example</td>+ </thead>+ <tr>+ <td>Function</td>+ <td><code>(el, i, t) => (t - i) * 200</code></td>+ </tr>+ </table>+ <p>+ Get different values for every target and property of the animation.<br>+ The function accepts 3 arguments:+ </p>+ <table>+ <thead>+ <td>Arguments</td>+ <td>Infos</td>+ </thead>+ <tr>+ <td><code>target</code></td>+ <td>The curently animated targeted element</td>+ </tr>+ <tr>+ <td><code>index</code></td>+ <td>The index of the animated targeted element</td>+ </tr>+ <tr>+ <td><code>targetsLength</code></td>+ <td>The total number of animated targets</td>+ </tr>+ </table>+ </div>+ <div class="demo-content function-based-values-demo"><div class="line">- <div class="small square shadow"></div>- <div data-x="160" class="small square el"></div>+ <div class="small circle shadow"></div>+ <div data-x="160" class="small circle el"></div></div><div class="line">- <div class="small square shadow"></div>- <div data-x="80" class="small square el"></div>+ <div class="small circle shadow"></div>+ <div data-x="80" class="small circle el"></div></div><div class="line">- <div class="small square shadow"></div>- <div data-x="250" class="small square el"></div>+ <div class="small circle shadow"></div>+ <div data-x="250" class="small circle el"></div></div></div>-<script>var functionBasedPropVal = anime({- targets: '#functionBasedPropVal .el',+ <script>var functionBasedPropVal = function() {+/*DEMO*/+anime({+ targets: '.function-based-values-demo .el',translateX: function(el) {return el.getAttribute('data-x');},@@ -704,37 +1498,76 @@ var colors = anime({return (l - i) + .25;},rotate: function() { return anime.random(-360, 360); },+ borderRadius: function() { return ['50%', anime.random(10, 35) + '%']; },duration: function() { return anime.random(1200, 1800); },- duration: function() { return anime.random(800, 1600); },- delay: function() { return anime.random(0, 1000); },+ delay: function() { return anime.random(0, 400); },direction: 'alternate',loop: true});-</script>+/*DEMO*/+}+ </script>+</div><div id="keyframes" class="demo"><h3 class="demo-title">Keyframes</h3>- <div class="demo-content">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Example</td>+ </thead>+ <tr>+ <td><code>Array</code></td>+ <td><code>[+ {value: 100, easing: 'easeOutExpo'},+ {value: 200, delay: 500},+ {value: 300, duration: 1000}+]</code></td>+ </tr>+ </table>+ <p>+ Keyframes are defined using an Array of property Object.<br>+ More details on Object values in the <a class="color-anim-params" href="#specificPropParameters">Specific property parameters</a>.+ </p>+ <p class="bubble info">+ If their is no duration specified inside the keyframes of one property, each keyframe duration will be equal to the animation total duration divided by the number of keyframes:+ </p>+<pre><code>anime({+ targets: '.el',+ translateX: [+ {value: 100}, // duration -> 2000 / 4 = 500 ms+ {value: 200}, // duration -> 2000 / 4 = 500 ms+ {value: 300}, // duration -> 2000 / 4 = 500 ms+ {value: 400} // duration -> 2000 / 4 = 500 ms+ ],+ duration: 2000+});+</code></pre>+ </div>+ <div class="demo-content keyframes-demo">+ <div class="circle shadow"></div>+ <div class="circle el keyframes"></div></div>-<script>var keyframes = anime({- targets: '#keyframes .el',+ <script>var keyframes = function() {+/*DEMO*/+anime({+ targets: '.el.keyframes',translateX: [- { value: 250, duration: 1000, delay: 500, elasticity: 0 },- { value: 0, duration: 1000, delay: 500, elasticity: 0 }+ { value: 250, duration: 1000, delay: 500 },+ { value: 0, duration: 1000, delay: 500 }],translateY: [- { value: -40, duration: 500, elasticity: 100 },- { value: 40, duration: 500, delay: 1000, elasticity: 100 },- { value: 0, duration: 500, delay: 1000, elasticity: 100 }+ { value: -40, duration: 500 },+ { value: 40, duration: 500, delay: 1000 },+ { value: 0, duration: 500, delay: 1000 }],scaleX: [{ value: 4, duration: 100, delay: 500, easing: 'easeOutExpo' },- { value: 1, duration: 900, elasticity: 300 },+ { value: 1, duration: 900 },{ value: 4, duration: 100, delay: 500, easing: 'easeOutExpo' },- { value: 1, duration: 900, elasticity: 300 }+ { value: 1, duration: 900 }],scaleY: [{ value: [1.75, 1], duration: 500 },@@ -743,61 +1576,75 @@ var colors = anime({{ value: 1.75, duration: 50, delay: 1000, easing: 'easeOutExpo' },{ value: 1, duration: 450 }],+ easing: 'easeOutElastic(1, .8)',loop: true});-</script>+/*DEMO*/+}+ </script>+</div></article><!-- --><!-- TIMELINE -->-<article id="timeline" class="color-07">+<article id="timeline" class="color-tl"><header><h2 class="demos-title">Timeline</h2></header>-<div id="basicTimeline" class="demo">- <h3 class="demo-title">Basic timeline</h3>- <div class="demo-content">- <div class="line">- <div class="square shadow"></div>- <div class="square el"></div>- </div>- <div class="line">- <div class="circle shadow"></div>- <div class="circle el"></div>- </div>- <div class="line">- <div class="triangle shadow"></div>- <div class="triangle el"></div>- </div>+<div id="timelineBasics" class="demo">+ <h3 class="demo-title">Timeline basics</h3>+ <div class="demo-description">+ <p>+ Timelines let you synchronise multiple animations together.<br>+ By default each animation added to the timeline will start after the previous animation ends.+ </p>+ <p>+ Creating a timeline:+ </p>+<pre><code>var myTimeline = anime.timeline(parameters);</code></pre>+ <table>+ <thead>+ <td>Argument</td>+ <td>Type</td>+ <td>Info</td>+ <td>Required</td>+ </thead>+ <tr>+ <td><code>parameters</code></td>+ <td><code>Object</code></td>+ <td>The default parameters of the timeline inherited by children</td>+ <td>No</td>+ </tr>+ </table>+ <p>+ Adding animations to a timeline:+ </p>+<pre><code>myTimeline.add(parameters, offset);</code></pre>+ <table>+ <thead>+ <td>Argument</td>+ <td>Types</td>+ <td>Info</td>+ <td>Required</td>+ </thead>+ <tr>+ <td><code>parameters</code></td>+ <td><code>Object</code></td>+ <td>The child animation parameters, override the timeline default parameters</td>+ <td>Yes</td>+ </tr>+ <tr>+ <td><code>time offset</code></td>+ <td><code>String</code> or <code>Number</code></td>+ <td>Check out the <a class="color-tl" href="#timelineOffsets">Timeline offsets</a> section</td>+ <td>No</td>+ </tr>+ </table></div>-<script>var basicTimeline = anime.timeline();--basicTimeline- .add({- targets: '#basicTimeline .square.el',- translateX: 250,- easing: 'easeOutExpo'- })- .add({- targets: '#basicTimeline .circle.el',- translateX: 250,- easing: 'easeOutExpo'- })- .add({- targets: '#basicTimeline .triangle.el',- translateX: 250,- easing: 'easeOutExpo'- });--</script>-</div>--<div id="relativeOffset" class="demo">- <h3 class="demo-title">Relative offset</h3>- <div class="demo-content">+ <div class="demo-content basic-timeline-demo"><div class="line"><div class="square shadow"></div><div class="square el"></div>@@ -811,120 +1658,137 @@ basicTimeline<div class="triangle el"></div></div></div>-<script>var relativeOffset = anime.timeline();--relativeOffset- .add({- targets: '#relativeOffset .square.el',- translateX: 250,- easing: 'easeOutExpo',- })- .add({- targets: '#relativeOffset .circle.el',- translateX: 250,- easing: 'easeOutExpo',- offset: '-=600' // Starts 600ms before the previous animation ends- })- .add({- targets: '#relativeOffset .triangle.el',- translateX: 250,- easing: 'easeOutExpo',- offset: '-=800' // Starts 800ms before the previous animation ends- });--</script>-</div>+ <script>var timelineBasics = function() {+/*DEMO*/+// Create a timeline with default parameters+var tl = anime.timeline({+ easing: 'easeOutExpo',+ duration: 750+});-<div id="absoluteOffset" class="demo">- <h3 class="demo-title">Absolute offset</h3>- <div class="demo-content">- <div class="line">- <div class="square shadow"></div>- <div class="square el"></div>- </div>- <div class="line">- <div class="circle shadow"></div>- <div class="circle el"></div>- </div>- <div class="line">- <div class="triangle shadow"></div>- <div class="triangle el"></div>- </div>- </div>-<script>var absoluteOffset = anime.timeline();+// Add children+tl+.add({+ targets: '.basic-timeline-demo .el.square',+ translateX: 250,+})+.add({+ targets: '.basic-timeline-demo .el.circle',+ translateX: 250,+})+.add({+ targets: '.basic-timeline-demo .el.triangle',+ translateX: 250,+});-absoluteOffset- .add({- targets: '#absoluteOffset .square.el',- translateX: 250,- easing: 'easeOutExpo',- offset: 1000 // Starts at 1000ms of the timeline- })- .add({- targets: '#absoluteOffset .circle.el',- translateX: 250,- easing: 'easeOutExpo',- offset: 500 // Starts at 500ms of the timeline- })- .add({- targets: '#absoluteOffset .triangle.el',- translateX: 250,- easing: 'easeOutExpo',- offset: 0 // Starts at 0ms of the timeline- });+/*DEMO*/+}+ </script>-</script></div>-<div id="timelineParameters" class="demo">- <h3 class="demo-title">Basic Timeline parameters</h3>- <div class="demo-content">+<div id="timelineOffsets" class="demo">+ <h3 class="demo-title">Time Offsets</h3>+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Offset</td>+ <td>Example</td>+ <td>Infos</td>+ </thead>+ <tr>+ <td>String</td>+ <td><code>'+='</code></td>+ <td><code>'+=200'</code></td>+ <td>Starts 200ms after the previous animation ends</td>+ </tr>+ <tr>+ <td>String</td>+ <td><code>'-='</code></td>+ <td><code>'-=200'</code></td>+ <td>Starts 200ms before the previous animation ends</td>+ </tr>+ <tr>+ <td>Number</td>+ <td><code>Number</code></td>+ <td><code>100</code></td>+ <td>Starts at 100ms, reagardless of the animtion position in the timeline</td>+ </tr>+ </table>+ <p>+ Time offset can be specified as a second optional parameter in the timeline <code>.add()</code> Function.<br>+ It defines when a animation starts in the timeline, if no offset is specifed, the animation will starts after the previous animation ends.<br>+ An offset can be relative to the last animation or absolute to the whole timeline.+ </p>+ </div>+ <div class="demo-content offsets-demo"><div class="line">+ <div class="label">no offset</div><div class="square shadow"></div><div class="square el"></div></div><div class="line">+ <div class="label">relative offset ('-=600')</div><div class="circle shadow"></div><div class="circle el"></div></div><div class="line">+ <div class="label">absolute offset (400)</div><div class="triangle shadow"></div><div class="triangle el"></div></div></div>-<script>var timelineParameters = anime.timeline({- direction: 'alternate',- loop: true+ <script>var timelineOffsets = function() {+/*DEMO*/+// Create a timeline with default parameters+var tl = anime.timeline({+ easing: 'easeOutExpo',+ duration: 750});-timelineParameters- .add({- targets: '#timelineParameters .square.el',- translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],- translateY: [ { value: 30 }, { value: 60 }, { value: 60 } ],- duration: 3000- })- .add({- targets: '#timelineParameters .circle.el',- translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],- translateY: [ { value: 30 }, { value: -30 }, { value: -30 } ],- duration: 3000,- offset: 200- })- .add({- targets: '#timelineParameters .triangle.el',- translateX: [ { value: 80 }, { value: 250 } ],- translateY: [ { value: -60 }, { value: -30 }, { value: -30 } ],- duration: 3000,- offset: 400- });+tl+.add({+ targets: '.offsets-demo .el.square',+ translateX: 250,+})+.add({+ targets: '.offsets-demo .el.circle',+ translateX: 250,+}, '-=600') // relative offset+.add({+ targets: '.offsets-demo .el.triangle',+ translateX: 250,+}, 0); // absolute offset-</script>+/*DEMO*/+}+ </script></div><div id="TLParamsInheritance" class="demo"><h3 class="demo-title">Parameters inheritance</h3>- <div class="demo-content">+ <div class="demo-description">+ <p>+ Write less code by defining default parameters.<br>+ Every timeline child inherits the default parameters.+ </p>+<pre><code>var myTimeline = anime({+ targets: '.el',+ easing: 'linear' // defines '.el' as the targets for each animation child+});++myTimeline+.add({+ translateX: 250 // animtate '.el' to 250px to the right with a 'linear' easing+})+.add({+ rotate: 180,+ easing: 'easeOutExpo' // override the default timeline easing+});+</code></pre>+ </div>+ <div class="demo-content params-inheritance-demo"><div class="line"><div class="square shadow"></div><div class="square el"></div>@@ -938,8 +1802,10 @@ timelineParameters<div class="triangle el"></div></div></div>-<script>var TLParamsInheritance = anime.timeline({- targets: '#TLParamsInheritance .el',+ <script>var TLParamsInheritance = function() {+/*DEMO*/+var tl = anime.timeline({+ targets: '.params-inheritance-demo .el',delay: function(el, i) { return i * 200 },duration: 500,easing: 'easeOutExpo',@@ -947,35 +1813,49 @@ timelineParametersloop: true});-TLParamsInheritance- .add({- translateX: 250,- })- .add({- opacity: .5,- translateX: 250,- scale: 2,- })- .add({- translateX: 0,- scale: 1- });+tl+.add({+ translateX: 250,+ // override the easing parameter+ easing: 'spring',+})+.add({+ opacity: .5,+ scale: 2+})+.add({+ // override the targets parameter+ targets: '.params-inheritance-demo .el.triangle',+ rotate: 180+})+.add({+ translateX: 0,+ scale: 1+});+/*DEMO*/+}+ </script>-</script></div></article><!-- -->-<!-- PLAYBACK -->-<article id="playback" class="color-08">+<!-- CONTROLS -->+<article id="controls" class="color-controls"><header>- <h2 class="demos-title">Playback</h2>+ <h2 class="demos-title">Controls</h2></header>-<div id="playPause" class="demo controls">+<div id="playPause" class="demo"><h3 class="demo-title">Play / Pause</h3>- <div class="demo-content">+ <div class="demo-description">+ <pre><code>animation.play();</code></pre>+ <p>Play a paused animation, or if the animation <code>autoplay</code> parameters is set to <code>true</code>/.</p>+ <pre><code>animation.pause();</code></pre>+ <p>Pause a running animation.</p>+ </div>+ <div class="demo-content play-pause-demo"><div class="line"><div class="small square shadow"></div><div class="small square el"></div>@@ -993,24 +1873,33 @@ TLParamsInheritance<button class="pause">Pause</button></div></div>-<script>var playPause = anime({- targets: '#playPause .el',+ <script>var playPause = function() {+/*DEMO*/+var animation = anime({+ targets: '.play-pause-demo .el',translateX: 250,- delay: function(el, i, l) { return i * 100; },+ delay: function(el, i) { return i * 100; },direction: 'alternate',loop: true,- autoplay: false+ autoplay: false,+ easing: 'easeInOutSine'});-document.querySelector('#playPause .play').onclick = playPause.play;-document.querySelector('#playPause .pause').onclick = playPause.pause;+document.querySelector('.play-pause-demo .play').onclick = animation.play;+document.querySelector('.play-pause-demo .pause').onclick = animation.pause;+/*DEMO*/+}</script></div><div id="restartAnim" class="demo"><h3 class="demo-title">Restart</h3>- <div class="demo-content">+ <div class="demo-description">+ <pre><code>animation.restart();</code></pre>+ <p>Restart an animation from its initial values.</p>+ </div>+ <div class="demo-content restart-demo"><div class="line"><div class="small square shadow"></div><div class="small square el"></div>@@ -1027,22 +1916,31 @@ document.querySelector('#playPause .pause').onclick = playPause.pause;<button class="restart">Restart</button></div></div>-<script>var restartAnim = anime({- targets: '#restartAnim .el',+ <script>var restartAnim = function() {+/*DEMO*/+var animation = anime({+ targets: '.restart-demo .el',translateX: 250,- delay: function(el, i, l) { return i * 100; },+ delay: function(el, i) { return i * 100; },direction: 'alternate',- loop: true+ loop: true,+ easing: 'easeInOutSine'});-document.querySelector('#restartAnim .restart').onclick = restartAnim.restart;+document.querySelector('.restart-demo .restart').onclick = animation.restart;+/*DEMO*/+}+ </script>-</script></div>-<div id="reverseAnim" class="demo controls">+<div id="reverseAnim" class="demo"><h3 class="demo-title">Reverse</h3>- <div class="demo-content">+ <div class="demo-description">+ <pre><code>animation.reverse();</code></pre>+ <p>Reverse the direction of an animation (running or not).</p>+ </div>+ <div class="demo-content reverse-anim-demo"><div class="line"><div class="small square shadow"></div><div class="small square el"></div>@@ -1059,24 +1957,47 @@ document.querySelector('#restartAnim .restart').onclick = restartAnim.restart;<button class="reverse">Reverse</button></div></div>-<script>var reverseAnim = anime({- targets: '#reverseAnim .el',- translateX: 250,- duration: 2000,- delay: function(el, i, l) { return i * 200; }-});-document.querySelector('#reverseAnim .reverse').onclick = function() {- reverseAnim.play();- reverseAnim.reverse();-}+ <script>-</script>-</div>+ var reverseAnimDemo = anime({+ targets: '.reverse-anim-demo .el',+ translateX: 250,+ duration: 2000,+ delay: function(el, i) { return i * 200; }+ });-<div id="seekAnim" class="demo controls">+ document.querySelector('.reverse-anim-demo .reverse').onclick = function() {+ reverseAnimDemo.reverse();+ }++ var reverseAnim = function() {+/*DEMO*/+var animation = anime({+ targets: '.reverse-anim-demo .el',+ translateX: 250,+ loop: true,+ direction: 'alternate',+ delay: function(el, i) { return i * 200; },+ easing: 'easeInOutSine'+});++document.querySelector('.reverse-anim-demo .reverse').onclick = animation.reverse;+/*DEMO*/+}+ </script>++</div>++<div id="seekAnim" class="demo"><h3 class="demo-title">Seek</h3>- <div class="demo-content">+ <div class="demo-description">+ <pre><code>animation.seek(timeStamp);</code></pre>+ <p>Jump to a specific time (in milliseconds).</p>+ <p>Can also be used to control an animation while scrolling:</p>+ <pre><code>animation.seek((scrollPercent / 100) * animation.duration);</code></pre>+ </div>+ <div class="demo-content seek-anim-demo"><div class="line"><div class="small square shadow"></div><div class="small square el"></div>@@ -1093,316 +2014,630 @@ document.querySelector('#reverseAnim .reverse').onclick = function() {<input class="progress" step=".001" type="range" min="0" max="100" value="0"></input></div></div>-<script>var seekAnim = anime({- targets: '#seekAnim .el',+ <script>var seekAnim = function() {+/*DEMO*/+var animation = anime({+ targets: '.seek-anim-demo .el',translateX: 250,- delay: function(el, i, l) { return i * 100; },+ delay: function(el, i) { return i * 100; },elasticity: 200,+ easing: 'easeInOutSine',autoplay: false});-var seekProgressEl = document.querySelector('#seekAnim .progress');-document.querySelector('#seekAnim .progress').oninput = function() {- seekAnim.seek(seekAnim.duration * (seekProgressEl.value / 100));+var seekProgressEl = document.querySelector('.seek-anim-demo .progress');+seekProgressEl.oninput = function() {+ animation.seek(animation.duration * (seekProgressEl.value / 100));};+/*DEMO*/+}+ </script>-</script></div>-<div id="TLcontrols" class="demo controls">+<div id="TLcontrols" class="demo"><h3 class="demo-title">Timeline controls</h3>- <div class="demo-content">+ <div class="demo-description">+<pre><code>timeline.play();+timeline.pause();+timeline.restart();+timeline.seek(timeStamp);+</code></pre>+ <p>Timelines can be controled like any other anime instance.</p>+ </div>+ <div class="demo-content timeline-controls-demo"><div class="line">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="small square shadow"></div>+ <div class="small square el"></div></div><div class="line">- <div class="circle shadow"></div>- <div class="circle el"></div>+ <div class="small circle shadow"></div>+ <div class="small circle el"></div></div><div class="line">- <div class="triangle shadow"></div>- <div class="triangle el"></div>+ <div class="small triangle shadow"></div>+ <div class="small triangle el"></div></div>- <div class="line player align-items">+ <div class="line player"><button class="play">Play</button><button class="pause">Pause</button><button class="restart">Restart</button>- <input class="progress" step="2" type="range" min="0" max="100" value="0"></input>+ <input class="progress" step=".001" type="range" min="0" max="100" value="0"></input></div></div>-<script>var controlsProgressEl = document.querySelector('#TLcontrols .progress');+ <script>var TLcontrols = function() {+/*DEMO*/+var controlsProgressEl = document.querySelector('.timeline-controls-demo .progress');++anime.speed = .1;-var TLcontrols = anime.timeline({+var tl = anime.timeline({direction: 'alternate',loop: true,- easing: 'linear',+ duration: 500,+ easing: 'easeInOutSine',update: function(anim) {- controlsProgressEl.value = anim.progress;+ controlsProgressEl.value = tl.progress;}});-TLcontrols- .add({- targets: '#TLcontrols .square.el',- translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],- translateY: [ { value: 30 }, { value: 60 }, { value: 60 } ],- duration: 3000,- offset: 0- })- .add({- targets: '#TLcontrols .circle.el',- translateX: [ { value: 80 }, { value: 160 }, { value: 250 } ],- translateY: [ { value: 30 }, { value: -30 }, { value: -30 } ],- duration: 3000,- offset: 0- })- .add({- targets: '#TLcontrols .triangle.el',- translateX: [ { value: 80 }, { value: 250 } ],- translateY: [ { value: -60 }, { value: -30 }, { value: -30 } ],- duration: 3000,- offset: 0- });+tl+.add({+ targets: '.timeline-controls-demo .square.el',+ translateX: 250,+})+.add({+ targets: '.timeline-controls-demo .circle.el',+ translateX: 250,+}, '-=100')+.add({+ targets: '.timeline-controls-demo .triangle.el',+ translateX: 250,+}, '-=100');-document.querySelector('#TLcontrols .play').onclick = TLcontrols.play;-document.querySelector('#TLcontrols .pause').onclick = TLcontrols.pause;-document.querySelector('#TLcontrols .restart').onclick = TLcontrols.restart;+document.querySelector('.timeline-controls-demo .play').onclick = tl.play;+document.querySelector('.timeline-controls-demo .pause').onclick = tl.pause;+document.querySelector('.timeline-controls-demo .restart').onclick = tl.restart;controlsProgressEl.addEventListener('input', function() {- TLcontrols.seek(TLcontrols.duration * (controlsProgressEl.value / 100));+ tl.seek(tl.duration * (controlsProgressEl.value / 100));});-</script>+/*DEMO*/+}+ </script>+</div></article><!-- -->-<!-- CALLBACKS -->-<article id="callbacks" class="color-09">+<!-- STATES -->+<article id="states" class="color-states"><header>- <h2 class="demos-title">Callbacks</h2>+ <h2 class="demos-title">States</h2></header>-<div id="allCallbacks" class="demo">- <h3 class="demo-title">All callbacks</h3>- <div class="demo-content">- <div class="logs">- <input class="log update-log"></input>- <input class="log began-log"></input>- <input class="log completed-log"></input>- </div>+<div id="statesInitialisation" class="demo">+ <h3 class="demo-title">Initialisation</h3>+ <div class="demo-description">+ <p>States let you define and store multiple set of properties for one animation.</p>+ <p>Add states using the <code>states</code> object:</p>+<pre><code>var animation = anime({+ targets: '.el',+ easing: 'easeInOutCirc'+});++animation.states.stateName = {+ translateX: 250,+ duration: 1500,+ easing: 'easeOutExpo'+}</pre></code>+ <p>Then go directly to a specific state:</p>+<pre><code>animation.states.goTo(stateName);</pre></code>+ <p>Or animate to a state with optional animation parameters:</p>+<pre><code>animation.states.animateTo(stateName, animationParameters);</pre></code>+ </div>+ <div class="demo-content states-demo"><div class="line">- <div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="large square shadow"></div>+ <div class="large square el"></div></div>- <div class="line">- <div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="line player align-items">+ <button class="state-a-button">Animate to A</button>+ <button class="state-b-button">Animate to B</button></div>+ </div>+ <script>var statesInitialisation = function() {+/*DEMO*/+var animation = anime({+ targets: '.states-demo .el',+ duration: 2000,+ easing: 'easeInOutCirc' // Defines default easing applied to all states+});++animation.states.stateA = {+ translateX: 0,+ borderRadius: '0%'+}++animation.states.stateB = {+ translateX: 250,+ borderRadius: '50%'+}++// Go to state B instantly+animation.goTo('stateB');++document.body.querySelector('.states-demo .state-a-button').onclick = function() {+ // Animate to state A with default parameters+ animation.animateTo('stateA');+}++document.body.querySelector('.states-demo .state-b-button').onclick = function() {+ // Animate to state B with custom easing parameter+ animation.animateTo('stateB', {+ easing: 'easeOutExpo'+ });+}++/*DEMO*/+}+ </script>+</div>++<div id="statesDefaultProperties" class="demo">+ <h3 class="demo-title">Default properties</h3>+ <div class="demo-description">+ <p>The initial animation properties and parameters are inherited by all the animation states.</p>+ <p>Defines default properties and parameters:</p>+<pre><code>var animation = anime({+ targets: '.el',+ translateX: 0, // will be inherited by every states+ rotate: 0, // will be inherited by every states+ easing: 'easeInOutCirc'+});++animation.states.stateA = {+ translateX: 250+}++animation.states.stateB = {+ rotate: 45+}</pre></code>+ <p>Then go directly to a specific state:</p>+<pre><code>animation.states.goTo(stateName);</pre></code>+ <p>Or animate to a state with optional animation parameters:</p>+<pre><code>animation.states.animateTo(stateName, animationParameters);</pre></code>+ </div>+ <div class="demo-content default-states-demo"><div class="line">- <div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="square large shadow"></div>+ <div class="square large el"></div>+ </div>+ <div class="line player align-items">+ <button class="state-moved">Move</button>+ <button class="state-skewed">Skew</button>+ <button class="state-rounded">Round</button>+ <button class="state-default">Default</button></div>- <div class="line player align-items"></div></div>-<script>var updateLogEl2 = document.querySelector('#allCallbacks .update-log');-var beganLogEl2 = document.querySelector('#allCallbacks .began-log');-var completedLogEl2 = document.querySelector('#allCallbacks .completed-log');+ <script>var statesDefaultProperties= function() {+/*DEMO*/+var animation = anime({+ targets: '.default-states-demo .el',+ translateX: 0,+ skew: 0,+ borderRadius: 0,+ easing: 'easeInOutCirc'+});-var allCallbacks = anime({- targets: '#allCallbacks .el',- translateX: 250,- delay: function(el, i) { return 1000 + (i * 100); },- duration: function(el, i) { return 500 + (i * 500); }+animation.states.moved = {+ translateX: 250+}++animation.states.skewed = {+ skew: -45+}++animation.states.rounded = {+ borderRadius: '40%'+}++document.body.querySelector('.default-states-demo .state-moved').onclick = function() {+ animation.animateTo('moved');+}+document.body.querySelector('.default-states-demo .state-skewed').onclick = function() {+ animation.animateTo('skewed');+}+document.body.querySelector('.default-states-demo .state-rounded').onclick = function() {+ animation.animateTo('rounded');+}+document.body.querySelector('.default-states-demo .state-default').onclick = function() {+ animation.animateTo('default');+}+/*DEMO*/+}+ </script>+</div>++<div id="statesParametersInheritance" class="demo">+ <h3 class="demo-title">Parameters inheritance</h3>+ <div class="demo-description">+ <p>+ By default, only the states properties and parameters are animated and previous states changes are not overrided by the new state.+ </p>+ <p>Defines default properties:</p>+<pre><code>var animation = anime({+ targets: '.el',+ easing: 'easeInOutCirc'});-allCallbacks.update = function(anim) {- if (!anim.began) {- updateLogEl2.value = 'begins in ' + Math.round(anim.delay - anim.currentTime) + 'ms';- beganLogEl2.value = '';- } else {- updateLogEl2.value = 'begins in 0ms';- }- if (!anim.completed) {- completedLogEl2.value = '';- }+animation.states.stateA = {+ translateX: 250}-allCallbacks.begin = function() { beganLogEl2.value = 'began'; };-allCallbacks.complete = function() { completedLogEl2.value = 'completed'; };+animation.states.stateB = {+ rotate: 45+}</pre></code>+ <p>Move the element by animating to state A:</p>+<pre><code>animation.states.animateTo(stateA);</pre></code>+ <p>+ Then rotate the element by animating to state B.<br>+ Since state B doesn't override state A properties, the element will keep the initial transformation from state A.+ </p>+<pre><code>animation.states.animateTo(stateB);</pre></code>+ <p class="bubble warning">+ CSS transforms order is relative to the order in which the states are called. If the new states apply a new transform proerty, the first animation will be canceled.+ </p>+ </div>+ <div class="demo-content states-inheritance-demo">+ <div class="line">+ <div class="square large shadow"></div>+ <div class="square large el"></div>+ </div>+ <div class="line player align-items">+ <button class="state-moved">Move</button>+ <button class="state-skewed">Skew</button>+ <button class="state-rounded">Round Corners</button>+ </div>+ </div>+ <script>var statesParametersInheritance= function() {+/*DEMO*/+var animation = anime({+ targets: '.states-inheritance-demo .el',+ easing: 'easeInOutCirc'+});++animation.states.moved = {+ translateX: 250+}-</script>+animation.states.skewed = {+ skew: -45+}++animation.states.rounded = {+ borderRadius: '40%'+}++document.body.querySelector('.states-inheritance-demo .state-moved').onclick = function() {+ animation.animateTo('moved');+}+document.body.querySelector('.states-inheritance-demo .state-skewed').onclick = function() {+ animation.animateTo('skewed');+}+document.body.querySelector('.states-inheritance-demo .state-rounded').onclick = function() {+ animation.animateTo('rounded');+}+/*DEMO*/+}+ </script></div>+</article>+<!-- -->++<!-- CALLBACKS -->+<article id="callbacks" class="color-callbacks">+<header>+ <h2 class="demos-title">Callbacks & Promises</h2>+</header>+<div id="update" class="demo"><h3 class="demo-title">Update</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Parameters</td>+ <td>Info</td>+ </thead>+ <tr>+ <td>Function</td>+ <td>animation</td>+ <td>Return the current animation Object</td>+ </tr>+ </table>+ <p>+ <code>update()</code> callback is triggered on every frame as soon as the animation starts playing.+ </p>+ </div>+ <div class="demo-content update-demo"><div class="logs">- <input class="log current-time-log"></input><input class="log progress-log"></input></div>- <div class="large square shadow"></div>- <div class="large square el"></div>+ <div class="circle shadow"></div>+ <div class="circle el"></div></div>-<script>var updateLogEl = document.querySelector('#update .current-time-log');-var progressLogEl = document.querySelector('#update .progress-log');+ <script>var update = function() {+/*DEMO*/+var progressLogEl = document.querySelector('.update-demo .progress-log');-var update = anime({- targets: '#callbacks .el',+anime({+ targets: '.update-demo .el',translateX: 250,delay: 1000,+ direction: 'alternate',+ loop: true,update: function(anim) {- updateLogEl.value = 'current time : ' + Math.round(anim.currentTime) + 'ms';progressLogEl.value = 'progress : ' + Math.round(anim.progress) + '%';}});-</script>+/*DEMO*/+}+ </script></div><div id="begin" class="demo"><h3 class="demo-title">Begin</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Parameters</td>+ <td>Info</td>+ </thead>+ <tr>+ <td>Function</td>+ <td>animation</td>+ <td>Return the current animation Object</td>+ </tr>+ </table>+ <p>+ <code>begin()</code> callback is triggered when the <code>animation.currentTime</code> is equal or superior to the <code>animation.delay</code>.<br>+ It's also called if the animation <code>duration</code> is <code>0</code>.+ </p>+ </div>+ <div class="demo-content begin-demo"><div class="logs"><input class="log began-log" value="began : false"></input>+ <input class="log progress-log"></input></div>- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="large circle shadow"></div>+ <div class="large circle el"></div></div>-<script>var beganLogEl = document.querySelector('#begin .began-log');+ <script>var begin = function() {+/*DEMO*/+var beganLogEl = document.querySelector('.begin-demo .began-log');+var progressLogEl = document.querySelector('.begin-demo .progress-log');-var begin = anime({- targets: '#begin .el',+anime({+ targets: '.begin-demo .el',translateX: 250,delay: 1000,begin: function(anim) {+ anim.animatables[0].target.style.backgroundColor = '#18FF92';+ },+ update: function (anim) {beganLogEl.value = 'began : ' + anim.began;+ progressLogEl.value = 'progress : ' + Math.round(anim.progress) + '%';}});-</script>-<script>-begin.update = function(anim) {- if (!anim.began) {- beganLogEl.value = 'began : ' + anim.began;- }+/*DEMO*/}-</script>+ </script>+</div><div id="run" class="demo"><h3 class="demo-title">Run</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Parameters</td>+ <td>Info</td>+ </thead>+ <tr>+ <td>Function</td>+ <td>animation</td>+ <td>Return the current animation Object</td>+ </tr>+ </table>+ <p>+ <code>run()</code> callback is triggered on every frame if the <code>animation.currentTime</code> is equal or superior to the <code>animation.delay</code>.+ </p>+ </div>+ <div class="demo-content run-demo"><div class="logs"><input class="log current-time-log" value="not running"></input><input class="log progress-log" value="progress : 0%"></input></div>- <div class="large square shadow"></div>- <div class="large square el"></div>+ <div class="large circle shadow"></div>+ <div class="large circle el"></div></div>-<script>var runLogEl = document.querySelector('#run .current-time-log');-var runProgressLogEl = document.querySelector('#run .progress-log');+ <script>var run = function() {+/*DEMO*/+var runLogEl = document.querySelector('.run-demo .current-time-log');+var runProgressLogEl = document.querySelector('.run-demo .progress-log');-var run = anime({- targets: '#run .el',+anime({+ targets: '.run-demo .el',translateX: 250,delay: 1000,run: function(anim) {- runLogEl.value = 'running';+ anim.animatables[0].target.style.backgroundColor = '#18FF92';+ },+ update: function(anim) {+ if (anim.began) runLogEl.value = 'running';runProgressLogEl.value = 'progress : ' + Math.round(anim.progress) + '%';},complete: function(anim) {+ anim.animatables[0].target.style.backgroundColor = '';runLogEl.value = 'not running';- runProgressLogEl.value = 'progress : 100%';}});-</script>+/*DEMO*/+}+ </script>+</div><div id="complete" class="demo"><h3 class="demo-title">Complete</h3>- <div class="demo-content">+ <div class="demo-description">+ <table>+ <thead>+ <td>Type</td>+ <td>Parameters</td>+ <td>Info</td>+ </thead>+ <tr>+ <td>Function</td>+ <td>animation</td>+ <td>Return the current animation Object</td>+ </tr>+ </table>+ <p>+ <code>complete()</code> callback is triggered when the animation has finished.+ </p>+ </div>+ <div class="demo-content complete-demo"><div class="logs"><input class="log completed-log" value="completed : false"></input></div>- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="circle shadow"></div>+ <div class="circle el"></div></div>-<script>var completedLogEl = document.querySelector('#complete .completed-log');+ <script>var complete = function() {+/*DEMO*/+var completedLogEl = document.querySelector('.completed-log');-var complete = anime({- targets: '#complete .el',+anime({+ targets: '.complete-demo .el',translateX: 250,+ begin: function(anim) {+ completedLogEl.value = 'completed : ' + anim.completed;+ },complete: function(anim) {completedLogEl.value = 'completed : ' + anim.completed;+ anim.animatables[0].target.style.backgroundColor = '#18FF92';}});-</script>-<script>-complete.update = function(anim) {- if (!anim.completed) {- completedLogEl.value = 'completed : ' + anim.completed;- }+/*DEMO*/}-</script>-</div>--</article>-<!-- -->+ </script>-<!-- PROMISES -->-<article id="promises" class="color-10">-<header>- <h2 class="demos-title">Promises</h2>-</header>+</div><div id="finishedPromise" class="demo">- <h3 class="demo-title">Finished</h3>- <div class="demo-content">+ <h3 class="demo-title">Finished promise</h3>+ <div class="demo-description">+<pre><code>animation.finished.then(function() {+ // Do things...+});</code></pre>+ <p>+ Every animation instances return a <code>finished</code> promise when the animation finised.+ </p>+ <p class="bubble warning">+ Promises are not suported in IE < 11.+ </p>+ </div>+ <div class="demo-content promise-demo"><div class="logs"><input class="log finished-log"></input></div>- <div class="large square shadow"></div>- <div class="large square el"></div>+ <div class="circle shadow"></div>+ <div class="circle el"></div></div>-<script>var finishedLogEl = document.querySelector('#finishedPromise .finished-log');--var finishedPromise = anime({- targets: '#promises .el',+ <script>var finishedPromise = function() {+if (window.demoPromiseResetTimeout) clearTimeout(window.demoPromiseResetTimeout);+/*DEMO*/+var promiseEl = document.querySelector('.promise-demo .el');+var finishedLogEl = document.querySelector('.promise-demo .finished-log');+var demoPromiseResetTimeout;++var animation = anime({+ targets: promiseEl,translateX: 250,delay: 1000});-var promise = finishedPromise.finished.then(logFinished);+var promise = animation.finished.then(logFinished);function logFinished() {finishedLogEl.value = 'Promise resolved';-+ promiseEl.style.backgroundColor = '#18FF92';// Rebind the promise, since this demo can be looped.- setTimeout(function() {- promise = finishedPromise.finished.then(logFinished);+ window.demoPromiseResetTimeout = setTimeout(function() {+ promise = animation.finished.then(logFinished);});}-finishedPromise.update = function(anim) {+animation.update = function(anim) {if (!anim.completed) {finishedLogEl.value = '';}}-</script>+/*DEMO*/+}+ </script>+</div></article><!-- --><!-- SVG -->-<article id="svg" class="color-11">+<article id="svg" class="color-svg"><header><h2 class="demos-title">SVG</h2></header><div id="motionPath" class="demo"><h3 class="demo-title">Motion path</h3>- <div class="demo-content">+ <div class="demo-description">+ <p>+ Animate an element relative to the <code>x</code>, <code>y</code> and <code>angle</code> values of an SVG path element.+ </p>+ <pre><code>var myPath = anime.path('svg path');</code></pre>+ <p>+ The path function returns a new Function that returns the specified property:+ </p>+ <table>+ <thead>+ <td>Parameters</td>+ <td>Example</td>+ <td>Info</td>+ </thead>+ <tr>+ <td><code>'x'</code></td>+ <td><code>myPath('x')</code></td>+ <td>Return the current x value in <code>'px'</code> of the SVG path</td>+ </tr>+ <tr>+ <td><code>'y'</code></td>+ <td><code>myPath('y')</code></td>+ <td>Return the current y value in <code>'px'</code> of the SVG path</td>+ </tr>+ <tr>+ <td><code>'angle'</code></td>+ <td><code>myPath('angle')</code></td>+ <td>Return the current angle value in <code>'degres'</code> of the SVG path</td>+ </tr>+ </table>+ </div>+ <div class="demo-content motion-path-demo"><div class="motion-path"><div class="small square shadow follow-path"></div><div class="small square el follow-path"></div>@@ -1411,10 +2646,12 @@ finishedPromise.update = function(anim) {</svg></div></div>-<script>var path = anime.path('#motionPath path');+ <script>var motionPath = function() {+/*DEMO*/+var path = anime.path('.motion-path-demo path');-var motionPath = anime({- targets: '#motionPath .el',+anime({+ targets: '.motion-path-demo .el',translateX: path('x'),translateY: path('y'),rotate: path('angle'),@@ -1422,13 +2659,23 @@ var motionPath = anime({duration: 2000,loop: true});+/*DEMO*/+}+ </script>-</script></div><div id="morphing" class="demo"><h3 class="demo-title">Morphing</h3>- <div class="demo-content align-center">+ <div class="demo-description">+ <p>+ Creates transition between two svg shapes.+ </p>+ <p class="bubble warning">+ Shapes must have the same number of points!+ </p>+ </div>+ <div class="demo-content align-center morphing-demo"><svg width="140" height="140" viewBox="0 0 140 140"><g fill="none" fill-rule="evenodd"><g fill="currentColor" fill-opacity=".15" transform="translate(0 6)">@@ -1441,10 +2688,15 @@ var motionPath = anime({</g></svg></div>-<script>var morphing = anime({- targets: '#morphing .polymorph',+ <script>var morphing = function() {+/*DEMO*/+anime({+ targets: '.morphing-demo .polymorph',points: [- { value: '70 41 118.574 59.369 111.145 132.631 60.855 84.631 20.426 60.369' },+ { value: [+ '70 24 119.574 60.369 100.145 117.631 50.855 101.631 3.426 54.369',+ '70 41 118.574 59.369 111.145 132.631 60.855 84.631 20.426 60.369']+ },{ value: '70 6 119.574 60.369 100.145 117.631 39.855 117.631 55.426 68.369' },{ value: '70 57 136.574 54.369 89.145 100.631 28.855 132.631 38.426 64.369' },{ value: '70 24 119.574 60.369 100.145 117.631 50.855 101.631 3.426 54.369' }@@ -1453,27 +2705,53 @@ var motionPath = anime({duration: 2000,loop: true});+/*DEMO*/+}+ </script>-</script></div><div id="lineDrawing" class="demo"><h3 class="demo-title">Line drawing</h3>- <div class="demo-content align-center">+ <div class="demo-description">+ <p>+ <i>Anime</i> has a built in helper to create path drawing animation with the <code>'stroke-dashoffset'</code> property.<br>+ Set the path <code>'dash-offset'</code> value with <code>anime.setDashoffset()</code> in a <a href="#fromToValues" class="color-values">From To</a> formated value:+ </p>+<pre><code>anime({+ targets: 'svg path',+ strokeDashoffset: [anime.setDashoffset, 0]+});</code></pre>+ <table>+ <thead>+ <td>Accepts</td>+ <td>Parameters</td>+ <td>Info</td>+ </thead>+ <tr>+ <td><code>Function</code></td>+ <td>animation</td>+ <td>Return the current animation Object</td>+ </tr>+ </table>+ </div>+ <div class="demo-content align-center line-drawing-demo"><svg viewBox="0 0 280 100"><g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-width="1" class="lines">- <path d="M58 80V50.12C57.7 41.6 51.14 35 43 35a15 15 0 0 0 0 30h7.5v15H43a30 30 0 1 1 0-60c16.42 0 29.5 13.23 30 29.89V80H58z"/>- <path d="M73 80V20H58v60h15z"/>- <path d="M58 80V49.77C58.5 33.23 71.58 20 88 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80H58zm75 0V20h-15v60h15z"/>- <path d="M118 80V49.77C118.5 33.23 131.58 20 148 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80h-15zm-7.5-60a7.5 7.5 0 1 1-7.48 8v-1c.25-3.9 3.5-7 7.48-7z"/>- <path d="M133 65a15 15 0 0 1-15-15v-7.5h-15V50a30 30 0 0 0 30 30V65zm30 15V49.77C163.5 33.23 176.58 20 193 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80h-15z"/>- <path d="M238 65a15 15 0 0 1 0-30c8.1 0 14.63 6.53 15 15h-15v15h30V49.89C267.5 33.23 254.42 20 238 20a30 30 0 0 0 0 60V65z"/>- <path d="M260.48 65a7.5 7.5 0 1 1-7.48 8v-1c.26-3.9 3.5-7 7.48-7z"/>+ <path class="el" d="M58 80V50.12C57.7 41.6 51.14 35 43 35a15 15 0 0 0 0 30h7.5v15H43a30 30 0 1 1 0-60c16.42 0 29.5 13.23 30 29.89V80H58z"/>+ <path class="el" d="M73 80V20H58v60h15z"/>+ <path class="el" d="M58 80V49.77C58.5 33.23 71.58 20 88 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80H58zm75 0V20h-15v60h15z"/>+ <path class="el" d="M118 80V49.77C118.5 33.23 131.58 20 148 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80h-15zm-7.5-60a7.5 7.5 0 1 1-7.48 8v-1c.25-3.9 3.5-7 7.48-7z"/>+ <path class="el" d="M133 65a15 15 0 0 1-15-15v-7.5h-15V50a30 30 0 0 0 30 30V65zm30 15V49.77C163.5 33.23 176.58 20 193 20a30 30 0 0 1 30 30v30h-15V50a15 15 0 0 0-15-15c-8.14 0-14.7 6.6-15 15.12V80h-15z"/>+ <path class="el" d="M238 65a15 15 0 0 1 0-30c8.1 0 14.63 6.53 15 15h-15v15h30V49.89C267.5 33.23 254.42 20 238 20a30 30 0 0 0 0 60V65z"/>+ <path class="el" d="M260.48 65a7.5 7.5 0 1 1-7.48 8v-1c.26-3.9 3.5-7 7.48-7z"/></g></svg></div>-<script>var lineDrawing = anime({- targets: '#lineDrawing .lines path',+ <script>var lineDrawing = function() {+/*DEMO*/+anime({+ targets: '.line-drawing-demo .lines path',strokeDashoffset: [anime.setDashoffset, 0],easing: 'easeInOutSine',duration: 1500,@@ -1481,386 +2759,598 @@ var motionPath = anime({direction: 'alternate',loop: true});+/*DEMO*/+}+ </script>-</script></div></article><!-- --><!-- EASINGS -->-<article id="easings" class="color-12">+<article id="easings" class="color-easings"><header><h2 class="demos-title">Easings</h2></header>-<div id="penner" class="demo">- <h3 class="demo-title">Built in equations</h3>- <div class="demo-content">- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square linear"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InQuad"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InCubic"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InQuart"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InQuint"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InSine"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InExpo"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InCirc"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InBack"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square OutQuad"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square OutCubic"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square OutQuart"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square OutQuint"></div>- </div>- <div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square OutSine"></div>- </div>+<div id="linearEasing" class="demo">+ <h3 class="demo-title">Linear</h3>+ <div class="demo-description">+ <p>+ <code>'linear'</code> will not apply any easing timing to your animation.<br>+ usefull for opacity and colors animations.+ </p>+ </div>+ <div class="demo-content linear-easing-demo"><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square OutExpo"></div>+ <div class="square shadow"></div>+ <div class="square el"></div></div>+ </div>+ <script>var linearEasing = function() {+/*DEMO*/+anime({+ targets: '.linear-easing-demo .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'linear'+});+/*DEMO*/+}+ </script>++</div>++<div id="pennerFunctions" class="demo">+ <h3 class="demo-title">Penner's functions</h3>+ <div class="demo-description">+ <p>+ Built in <a href="http://robertpenner.com/easing/">Robert Penner's easing functions</a>:+ </p>+ <table>+ <thead>+ <td>in</td>+ <td>out</td>+ <td>in-out</td>+ </thead>+ <tr>+ <td><code>'easeInQuad'</code></td>+ <td><code>'easeOutQuad'</code></td>+ <td><code>'easeInOutQuad'</code></td>+ </tr>+ <tr>+ <td><code>'easeInCubic'</code></td>+ <td><code>'easeOutCubic'</code></td>+ <td><code>'easeInOutCubic'</code></td>+ </tr>+ <tr>+ <td><code>'easeInQuart'</code></td>+ <td><code>'easeOutQuart'</code></td>+ <td><code>'easeInOutQuart'</code></td>+ </tr>+ <tr>+ <td><code>'easeInQuint'</code></td>+ <td><code>'easeOutQuint'</code></td>+ <td><code>'easeInOutQuint'</code></td>+ </tr>+ <tr>+ <td><code>'easeInSine'</code></td>+ <td><code>'easeOutSine'</code></td>+ <td><code>'easeInOutSine'</code></td>+ </tr>+ <tr>+ <td><code>'easeInExpo'</code></td>+ <td><code>'easeOutExpo'</code></td>+ <td><code>'easeInOutExpo'</code></td>+ </tr>+ <tr>+ <td><code>'easeInCirc'</code></td>+ <td><code>'easeOutCirc'</code></td>+ <td><code>'easeInOutCirc'</code></td>+ </tr>+ <tr>+ <td><code>'easeInBack'</code></td>+ <td><code>'easeOutBack'</code></td>+ <td><code>'easeInOutBack'</code></td>+ <tr>+ </table>+ </div>+ <div class="demo-content penner-equations-demo">++ </div>+ <script>var pennerFunctions = function() {+/*DEMO*/+var demoContentEl = document.querySelector('.penner-equations-demo');+var fragment = document.createDocumentFragment();++function createEasingDemo(easing) {+ var demoEl = document.createElement('div');+ demoEl.classList.add('stretched','square','el');+ anime({+ targets: demoEl,+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: easing,+ });+ fragment.appendChild(demoEl);+}++for (var easeName in anime.easings) {+ if (Array.isArray(anime.easings[easeName])) {+ createEasingDemo(easeName);+ }+}++demoContentEl.innerHTML = '';+demoContentEl.appendChild(fragment);+/*DEMO*/+}+ </script>++</div>++<div id="cubicBezier" class="demo">+ <h3 class="demo-title">Cubic Bézier Curve</h3>+ <div class="demo-description">+ <pre><code>easing: 'cubicBezier(.5, .05, .1, .3)'</code></pre>+ <p>+ Use your own custom cubic Bézier curves <code>cubicBezier(x1, y1, x2, y2):</code>+ </p>+ <p class="bubble warning">+ You can use Bézier curves generator like <a href="https://matthewlein.com/tools/ceaser">Ceaser</a>.+ </p>+ </div>+ <div class="demo-content cubic-bezier-demo"><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square OutCirc"></div>+ <div class="square shadow"></div>+ <div class="square el"></div></div>+ </div>+ <script>var cubicBezier = function() {+/*DEMO*/+anime({+ targets: '.cubic-bezier-demo .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'cubicBezier(.5, .05, .1, .3)'+})+/*DEMO*/+}+ </script>++</div>++<div id="springPhysicsEasing" class="demo">+ <h3 class="demo-title">Spring</h3>+ <div class="demo-description">+ <pre><code>easing: 'spring(mass, stiffness, damping, velocity)'</code></pre>+ <p>+ Spring physics based easing.+ </p>+ <p class="bubble warning">+ The duration of a spring animation if defined by the spring parameters.<br>+ The animation <code>duration</code> parameter will not be taken into account.+ </p>+ <table>+ <thead>+ <td>Parameter</td>+ <td>Default</td>+ <td>Min</td>+ <td>Max</td>+ </thead>+ <tr>+ <td>Mass</td>+ <td><code>1</code></td>+ <td><code>0</code></td>+ <td><code>100</code></td>+ </tr>+ <tr>+ <td>Stiffness</td>+ <td><code>100</code></td>+ <td><code>0</code></td>+ <td><code>100</code></td>+ </tr>+ <tr>+ <td>Damping</td>+ <td><code>10</code></td>+ <td><code>0</code></td>+ <td><code>100</code></td>+ </tr>+ <tr>+ <td>Velocity</td>+ <td><code>0</code></td>+ <td><code>0</code></td>+ <td><code>100</code></td>+ </tr>+ </table>+ </div>+ <div class="demo-content spring-physics-demo"><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square OutBack"></div>+ <div class="square shadow"></div>+ <div class="square el"></div></div>+ </div>+ <script>var springPhysicsEasing = function() {+/*DEMO*/+anime({+ targets: '.spring-physics-demo .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'spring(1, 80, 10, 0)'+})+/*DEMO*/+}+ </script>++</div>++<div id="elasticEasing" class="demo">+ <h3 class="demo-title">Elastic</h3>+ <div class="demo-description">+ <pre><code>easing: 'easeOutElastic(amplitude, period)'</code></pre>+ <p>Elastic easing.</p>+ <table>+ <thead>+ <td>in</td>+ <td>out</td>+ <td>in-out</td>+ </thead>+ <tr>+ <td><code>'inElastic'</code></td>+ <td><code>'outElastic'</code></td>+ <td><code>'inOutElastic'</code></td>+ </tr>+ </table>+ <table>+ <thead>+ <td>Parameter</td>+ <td>Default</td>+ <td>Min</td>+ <td>Max</td>+ <td>Info</td>+ </thead>+ <tr>+ <td>Amplitude</td>+ <td><code>1</code></td>+ <td><code>1</code></td>+ <td><code>10</code></td>+ <td>Controls the overshoot of the curve</td>+ </tr>+ <tr>+ <td>Period</td>+ <td><code>.5</code></td>+ <td><code>0.1</code></td>+ <td><code>2</code></td>+ <td>Controls how many times the curve goes back and forth</td>+ </tr>+ </table>+ </div>+ <div class="demo-content elastic-easing-demo"><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InOutQuad"></div>+ <div class="small square shadow"></div>+ <div class="small square el" data-ease="easeInElastic(1, .6)"></div></div><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InOutCubic"></div>+ <div class="small square shadow"></div>+ <div class="small square el" data-ease="easeOutElastic(1, .6)"></div></div><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InOutQuart"></div>+ <div class="small square shadow"></div>+ <div class="small square el" data-ease="easeInOutElastic(1, .6)"></div></div>+ </div>+ <script>var elasticEasing = function() {+/*DEMO*/+anime({+ targets: '.elastic-easing-demo .el',+ translateX: 250,+ easing: function(el) {+ return el.getAttribute('data-ease');+ },+ duration: 1000+})+/*DEMO*/+}+ </script>++</div>++<div id="stepEasing" class="demo">+ <h3 class="demo-title">Steps</h3>+ <div class="demo-description">+ <pre><code>easing: 'steps(numberOfSteps)'</code></pre>+ <p>+ Defines the number of jumps an animation takes to arrive at its end value.+ </p>+ <table>+ <thead>+ <td>Parameter</td>+ <td>Default</td>+ <td>Min</td>+ <td>Max</td>+ </thead>+ <tr>+ <td>Number of steps</td>+ <td><code>10</code></td>+ <td><code>1</code></td>+ <td><code>∞</code></td>+ </tr>+ </table>+ </div>+ <div class="demo-content step-easing-demo"><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InOutQuint"></div>+ <div class="square shadow"></div>+ <div class="square el"></div></div>+ </div>+ <script>var stepEasing = function() {+/*DEMO*/+anime({+ targets: '.step-easing-demo .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'steps(5)'+})+/*DEMO*/+}+ </script>++</div>++</article>+<!-- -->++<!-- HELPERS -->+<article id="easings" class="color-helpers">+ <header>+ <h2 class="demos-title">Helpers</h2>+ </header>++<div id="running" class="demo">+ <h3 class="demo-title">running</h3>+ <div class="demo-description">+ <pre><code>anime.running()</code></pre>+ <p>+ Returns an Array of all active <i>Anime</i> instances currently running.+ </p>+ </div>+ <div class="demo-content running-demo"><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InOutSine"></div>+ <div class="small square shadow"></div>+ <div class="small square el"></div></div><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InOutExpo"></div>+ <div class="small circle shadow"></div>+ <div class="small circle el"></div></div><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InOutCirc"></div>+ <div class="small triangle shadow"></div>+ <div class="small triangle el"></div></div><div class="line">- <div class="small stretched square shadow"></div>- <div class="small stretched square InOutBack"></div>+ <pre class="bottom log running-log"></pre></div></div>-<script>var penner = anime.timeline();-penner- .add({- targets: '#penner .linear', translateX: 250, offset: 0,- easing: 'linear'- })- .add({- targets: '#penner .InQuad', translateX: 250, offset: 0,- easing: 'easeInQuad'- })- .add({- targets: '#penner .InCubic', translateX: 250, offset: 0,- easing: 'easeInCubic'- })- .add({- targets: '#penner .InQuart', translateX: 250, offset: 0,- easing: 'easeInQuart'- })- .add({- targets: '#penner .InQuint', translateX: 250, offset: 0,- easing: 'easeInQuint'- })- .add({- targets: '#penner .InSine', translateX: 250, offset: 0,- easing: 'easeInSine'- })- .add({- targets: '#penner .InExpo', translateX: 250, offset: 0,- easing: 'easeInExpo'- })- .add({- targets: '#penner .InCirc', translateX: 250, offset: 0,- easing: 'easeInCirc'- })- .add({- targets: '#penner .InBack', translateX: 250, offset: 0,- easing: 'easeInBack'- })- .add({- targets: '#penner .OutQuad', translateX: 250, offset: 0,- easing: 'easeOutQuad'- })- .add({- targets: '#penner .OutCubic', translateX: 250, offset: 0,- easing: 'easeOutCubic'- })- .add({- targets: '#penner .OutQuart', translateX: 250, offset: 0,- easing: 'easeOutQuart'- })- .add({- targets: '#penner .OutQuint', translateX: 250, offset: 0,- easing: 'easeOutQuint'- })- .add({- targets: '#penner .OutSine', translateX: 250, offset: 0,- easing: 'easeOutSine'- })- .add({- targets: '#penner .OutExpo', translateX: 250, offset: 0,- easing: 'easeOutExpo'- })- .add({- targets: '#penner .OutCirc', translateX: 250, offset: 0,- easing: 'easeOutCirc'- })- .add({- targets: '#penner .OutBack', translateX: 250, offset: 0,- easing: 'easeOutBack'- })- .add({- targets: '#penner .InOutQuad', translateX: 250, offset: 0,- easing: 'easeInOutQuad'- })- .add({- targets: '#penner .InOutCubic', translateX: 250, offset: 0,- easing: 'easeInOutCubic'- })- .add({- targets: '#penner .InOutQuart', translateX: 250, offset: 0,- easing: 'easeInOutQuart'- })- .add({- targets: '#penner .InOutQuint', translateX: 250, offset: 0,- easing: 'easeInOutQuint'- })- .add({- targets: '#penner .InOutSine', translateX: 250, offset: 0,- easing: 'easeInOutSine'- })- .add({- targets: '#penner .InOutExpo', translateX: 250, offset: 0,- easing: 'easeInOutExpo'- })- .add({- targets: '#penner .InOutCirc', translateX: 250, offset: 0,- easing: 'easeInOutCirc'- })- .add({- targets: '#penner .InOutBack', translateX: 250, offset: 0,- easing: 'easeInOutBack'- });-</script>+ <script>var running = function() {+/*DEMO*/+var runninLogEl = document.querySelector('.running-log');++anime({+ targets: '.running-demo .square.el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'linear'+});++anime({+ targets: '.running-demo .circle.el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'easeInOutCirc'+});++anime({+ targets: '.running-demo .triangle.el',+ translateX: 250,+ direction: 'alternate',+ easing: 'easeInOutQuad',+ loop: true,+ run: function() {+ runninLogEl.innerHTML = 'there are currently ' + anime.running.length + ' instances running';+ }+});++/*DEMO*/+}+ </script>+</div>-<div id="elasticity" class="demo">- <h3 class="demo-title">Elasticity</h3>- <div class="demo-content">- <div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-0"></div>- </div>- <div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-100"></div>- </div>- <div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-200"></div>- </div>+<div id="remove" class="demo">+ <h3 class="demo-title">remove</h3>+ <div class="demo-description">+ <pre><code>anime.remove(targets)</code></pre>+ <p>+ Removes targets from a running animation or timeline.<br>+ The <code>targets</code> parameters accepts the same values as <a class="color-targets" href="#cssSelector">Targets</a> property.+ </p>+ <pre><code>anime.remove(document.querySelector('.item'));</code></pre>+ </div>+ <div class="demo-content remove-demo"><div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-300"></div>+ <div class="small circle shadow"></div>+ <div class="small circle el"></div></div><div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-400"></div>+ <div class="small circle shadow"></div>+ <div class="small circle el"></div></div><div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-500"></div>+ <div class="small circle shadow"></div>+ <div class="small circle el"></div></div>- <div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-600"></div>+ <div class="line player align-items">+ <button class="remove-el-button">Remove second target</button></div>+ </div>+ <script>var remove = function() {+/*DEMO*/+anime({+ targets: '.remove-demo .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'easeInOutQuad'+});++document.querySelector('.remove-el-button').addEventListener('click', function() {+ anime.remove('.remove-demo .line:nth-child(2) .el');+});+/*DEMO*/+}+ </script>++</div>++<div id="getValue" class="demo">+ <h3 class="demo-title">getValue</h3>+ <div class="demo-description">+ <pre><code>anime.getValue(el, propertyName, unit)</code></pre>+ <p>+ Returns the original value of an element.<br>+ Since <i>Anime</i> uses <a href="https://developer.mozilla.org/fr/docs/Web/API/Window/getComputedStyle">getComputedStyle</a> to access original CSS, the values are almost always returned in <code>'px'</code>, the third (optional) argument converts the value in the desired unit.+ </p>+ <pre><code>anime.getValue(domNode, 'width', 'rem');</code></pre>+ <p class="bubble warning">+ Only inlined transforms values can be accessed.+ </p>+ </div>+ <div class="demo-content get-value-demo"><div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-700"></div>+ <div class="large circle shadow"></div>+ <div class="large circle el"></div>+ <div class="log get-value-demo-log"></div></div>+ </div>+ <script>var getValue = function() {+/*DEMO*/+var logEl = document.querySelector('.get-value-demo-log');+var el = document.querySelector('.get-value-demo .el');++logEl.innerHTML = '".el" width is "' + anime.getValue(el, 'width', 'rem') + 'rem"';+/*DEMO*/+}+ </script>++</div>++<div id="random" class="demo">+ <h3 class="demo-title">random</h3>+ <div class="demo-description">+ <pre><code>anime.random(minValue, maxValue)</code></pre>+ <p>+ Returns a random integer within a specific range.+ </p>+ <pre><code>var randomValue = anime.random(-100, 100);</code></pre>+ </div>+ <div class="demo-content random-demo"><div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-800"></div>+ <div class="small circle shadow"></div>+ <div class="small circle el"></div></div><div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-900"></div>+ <div class="small circle shadow"></div>+ <div class="small circle el"></div></div><div class="line">- <div class="stretched square shadow"></div>- <div class="stretched square elasticity-1000"></div>+ <div class="small circle shadow"></div>+ <div class="small circle el"></div></div></div>-<script>var elasticity = anime.timeline();-elasticity.add({- targets: '#elasticity .elasticity-0', translateX: 250, offset: 0,- duration: 3000,- elasticity: 0,-})-.add({- targets: '#elasticity .elasticity-100', translateX: 250, offset: 0,- duration: 3000,- elasticity: 100,-})-.add({- targets: '#elasticity .elasticity-200', translateX: 250, offset: 0,- duration: 3000,- elasticity: 200,-})-.add({- targets: '#elasticity .elasticity-300', translateX: 250, offset: 0,- duration: 3000,- elasticity: 300,-})-.add({- targets: '#elasticity .elasticity-400', translateX: 250, offset: 0,- duration: 3000,- elasticity: 400,-})-.add({- targets: '#elasticity .elasticity-500', translateX: 250, offset: 0,- duration: 3000,- elasticity: 500,-})-.add({- targets: '#elasticity .elasticity-600', translateX: 250, offset: 0,- duration: 3000,- elasticity: 600,-})-.add({- targets: '#elasticity .elasticity-700', translateX: 250, offset: 0,- duration: 3000,- elasticity: 700,-})-.add({- targets: '#elasticity .elasticity-800', translateX: 250, offset: 0,- duration: 3000,- elasticity: 800,-})-.add({- targets: '#elasticity .elasticity-900', translateX: 250, offset: 0,- duration: 3000,- elasticity: 900,-})-.add({- targets: '#elasticity .elasticity-1000', translateX: 250, offset: 0,- duration: 3000,- elasticity: 1000,-});-</script>+ <script>var random = function() {+/*DEMO*/+function randomValues() {+ anime({+ targets: '.random-demo .el',+ translateX: function() {+ return anime.random(0, 250);+ },+ easing: 'easeInOutQuad',+ duration: 750,+ complete: randomValues+ });+}++randomValues();+/*DEMO*/+}+ </script>+</div>-<div id="customBezier" class="demo">- <h3 class="demo-title">Custom Bézier curves</h3>- <div class="demo-content">- <div class="square large shadow"></div>- <div class="square large el"></div>+<div id="tick" class="demo">+ <h3 class="demo-title">tick</h3>+ <div class="demo-description">+ <pre><code>animation.tick(time)</code></pre>+ <p>+ Let you use an external requestAnimationFrame loop.<br>+ </p>+ <p class="bubble warning">+ Don't forget to set the <code>autoplay</code> parameter to <code>false</code> to prevent the <i>Anime</i> built-in RAF loop to start.+ </p>+ </div>+ <div class="demo-content tick-demo">+ <div class="line">+ <div class="circle shadow"></div>+ <div class="circle el"></div>+ </div></div>-<script>var customBezier = anime({- targets: '#customBezier .el',+ <script>+var customRAF = null;+var tick = function() {+if (customRAF) cancelAnimationFrame(customRAF);+/*DEMO*/+var animation = anime({+ targets: '.tick-demo .el',translateX: 250,- easing: [.91,-0.54,.29,1.56]+ direction: 'alternate',+ loop: true,+ easing: 'easeInOutQuad',+ autoplay: false});-</script>-</div>-<div id="customEasingFunction" class="demo">- <h3 class="demo-title">Custom easing function</h3>- <div class="demo-content">- <div class="square large shadow"></div>- <div class="square large el"></div>- </div>-<script>anime.easings['myCustomEasingName'] = function(t) {- return Math.pow(Math.sin(t * 3), 3);+function loop(t) {+ animation.tick(t);+ customRAF = requestAnimationFrame(loop);}-var customEasingFunction = anime({- targets: '#customEasingFunction .el',- translateX: 250,- easing: 'myCustomEasingName'-});-</script>+requestAnimationFrame(loop);+/*DEMO*/+}+ </script>+</div></article><!-- --></section>- <section class="pane code-examples">- <div class="code-pane code-pane-js">- <header class="code-header">- <h2>JavaScript</h2>- </header>- <pre class="code-output js-output"></pre>- </div>- <div class="code-pane code-pane-html">- <header class="code-header">- <h2>HTML</h2>- </header>- <pre class="code-output html-output"></pre>- </div>+ <section class="pane demo-info">+ <header class="description-header">+ <h2><span></span></h2>+ </header>+ <div class="info-output"></div></section></div>+ <script async defer src="https://buttons.github.io/buttons.js"></script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),@@ -1869,8 +3359,8 @@ var customEasingFunction = anime({ga('create', 'UA-79927007-1', 'auto');ga('send', 'pageview');</script>- <script src="assets/js/highlight.pack.js"></script>- <script src="assets/js/beautify-html.js"></script>- <script src="assets/js/scripts.js"></script>+ <script src="assets/js/vendors/highlight.pack.js"></script>+ <script src="assets/js/vendors/beautify-html.js"></script>+ <script src="assets/js/documentation.js"></script></body></html>diff --git a/package.json b/package.jsonindex 3ab38144..4b2bddaf 100644--- a/package.json+++ b/package.json@@ -27,6 +27,6 @@"anime.min.js"],"devDependencies": {- "google-closure-compiler-js": "^20170124.0.0"+ "google-closure-compiler-js": "^20171203.0.0"}}