JavaScript animation engine
Update documentation
Julian Garnierffa6c01ca967
diff --git a/documentation/assets/css/documentation.css b/documentation/assets/css/documentation.cssindex 0ff633b9..851030fa 100644--- a/documentation/assets/css/documentation.css+++ b/documentation/assets/css/documentation.css@@ -234,6 +234,10 @@ code {font-style: italic;}+a[href^="http"]:visited {+ color: currentColor;+}+p.warning {display: inline-block;position: relative;@@ -243,6 +247,7 @@ p.warning {p.warning:after {content: "";+ pointer-events: none;color: currentColor;display: inline-block;position: absolute;@@ -275,7 +280,7 @@ p.warning:after {.code-pane-description p code {position: relative;- padding: 0 4px;+ padding: 0 2px;height: 19px;background-color: rgba(0,0,0,.2);box-shadow: inset 0 0 1px rgba(0,0,0,.4);@@ -603,6 +608,10 @@ input.progress[value]::-webkit-slider-thumb {height: 18px;}+.small.triangle {+ border-width: 0 10px 17px 10px;+}+.large {width: 48px;height: 48px;diff --git a/documentation/index.html b/documentation/index.htmlindex f3212fb2..f3dc3a18 100644--- a/documentation/index.html+++ b/documentation/index.html@@ -144,7 +144,7 @@ anime({<td>Example</td></thead><tr>- <td>Object</td>+ <td><code>Object</code></td><td><code>const obj = { prop: '0%' }</code></td></tr><tr>@@ -185,7 +185,7 @@ anime({<h3 class="demo-title">Mixed Array</h3><div class="demo-description"><p>- An array containing different type of targets+ An array containing different type of targets.</p><table><thead>@@ -531,7 +531,7 @@ anime({<h3 class="demo-title">Delay</h3><div class="demo-description"><p>- Defines the delay in Milliseconds of the animation, default: <code>0</code>.+ Defines the delay in milliseconds of the animation, default: <code>0</code>.</p><table><thead>@@ -572,7 +572,7 @@ anime({<h3 class="demo-title">end delay</h3><div class="demo-description"><p>- Add some extra time in Milliseconds at the end of the animation, default: <code>0</code>.+ Add some extra time in milliseconds at the end of the animation, default: <code>0</code>.</p><table><thead>@@ -1011,7 +1011,7 @@ anime({<h3 class="demo-title">StartTime</h3><div class="demo-description"><p>- Force the animation to start at a certain time in Milliseconds, default: <code>0</code>.+ Force the animation to start at a certain time in milliseconds, default: <code>0</code>.</p><table><thead>@@ -1104,7 +1104,7 @@ anime({</p><p class="warning"><i>Anime</i> will not automatically convert units!<br>- For example, if the target initial value is <code>'100px'</code> and your animation value is <code>'3rem'</code>, the animation will starts at <code>'100rem'</code>.+ For example if the target initial value is <code>'100px'</code> and the animation end value is <code>'3rem'</code>, <code>'100px'</code> will be converted to <code>'100rem'</code>.</p><p>If you need your animation to starts from a specific value, check out the <a href="#fromToValues" class="color-values">From To values</a> section.@@ -1138,18 +1138,22 @@ anime({<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></div>@@ -1165,11 +1169,11 @@ relativeEl.style.transform = 'translateX(100px)';anime({targets: '.el.relative-values',translateX: {- value: '+=150', // 100 + 150 = '250px'+ value: '*=2.5', // 100px * 2.5 = '250px'duration: 1000},width: {- value: '-=20', // 28 - 20 = '8px'+ value: '-=20px', // 28 - 20 = '8px'duration: 1800,easing: 'easeInOutSine'},@@ -1189,6 +1193,9 @@ anime({<div id="colors" class="demo"><h3 class="demo-title">Colors</h3><div class="demo-description">+ <p>+ <i>Anime</i> accepts and can converts Haxadecimal, RGB, RGBA, HSL, and HSLA color values.+ </p><table><thead><td>Accepts</td>@@ -1301,6 +1308,9 @@ anime({<p>Force the animation to starts at a specified value.</p>+ <p class="warning">+ Units must be identical for both values.+ </p><table><thead><td>Type</td>@@ -1401,22 +1411,39 @@ anime({<h3 class="demo-title">Keyframes</h3><div class="demo-description"><p>- Keyframes are defined using an Array of property Object.<br>- Instance's <code>duration</code> is divided by the number of keyframes of each properties if not specified.+ Keyframes are defined using an Array of property Object.</p><table><thead><td>Type</td>- <td>Info</td>+ <td>Example</td></thead><tr><td><code>Array</code></td>- <td><code>[{value: val01}, {value: val02}, {value: val03}]</code></td>+ <td><code>[+ {value: 100, easing: 'easeOutExpo'},+ {value: 200, delay: 500},+ {value: 300, duration: 1000}+]</code></td></tr></table><p>More details on Object values in the <a class="color-anim-params" href="#specificPropParameters">Sspecific property parameters</a>.</p>+ <p class="warning">+ 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>@@ -1427,19 +1454,19 @@ anime({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 },@@ -1466,16 +1493,17 @@ anime({<h2 class="demos-title">Timeline</h2></header>-<div id="basicTimeline" class="demo">- <h3 class="demo-title">Basic timeline</h3>+<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 child animation will start after the previous one ends.+ 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>+<pre><code>var myTimeline = anime.timeline(parameters);</code></pre><table><thead><td>Argument</td>@@ -1487,12 +1515,13 @@ anime({<td><code>parameters</code></td><td><code>Object</code></td><td>The default parameters of the timeline inherited by children</td>- <td>Optional</td>+ <td>No</td></tr></table>- <pre>-<code>myTimeline.add(parameters, offset);</code>- </pre>+ <p>+ Adding animations to a timeline:+ </p>+<pre><code>myTimeline.add(parameters, offset);</code></pre><table><thead><td>Argument</td>@@ -1504,20 +1533,15 @@ anime({<td><code>parameters</code></td><td><code>Object</code></td><td>The child animation parameters, override the timeline default parameters</td>- <td>Required</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>Optional</td>+ <td>No</td></tr></table>- <pre>-<code>var myTimeline = anime.timeline(parameters);-myTimeline.add(parameters);-</code>- </pre></div><div class="demo-content basic-timeline-demo"><div class="line">@@ -1533,7 +1557,7 @@ myTimeline.add(parameters);<div class="triangle el"></div></div></div>- <script>var basicTimeline = function() {+ <script>var timelineBasics = function() {/*DEMO*/// Create a timeline with default parametersvar tl = anime.timeline({@@ -1566,28 +1590,30 @@ tl<h3 class="demo-title">Time Offsets</h3><div class="demo-description"><p>- Defines when the child aniamtion starts.+ 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><table><thead>+ <td>Type</td><td>Offset</td><td>Example</td>- <td>Info</td></thead><tr>+ <td>Relative</td><td><code>'+='</code></td>- <td><code>'+=200'</code></td>- <td>Starts 200ms after the previous animation ends</td>+ <td><code>'+=200'</code> (Starts 200ms after the previous animation ends)</td></tr><tr>+ <td>Relative</td><td><code>'-='</code></td>- <td><code>'-=200'</code></td>- <td>Starts 200ms before the previous animation ends</td>+ <td><code>'-=200'</code> (Starts 200ms before the previous animation ends)</td></tr><tr>+ <td>Absolute</td><td><code>Number</code></td>- <td><code>100</code></td>- <td>Starts at 100ms, reagardless of the animtion position in the timeline</td>+ <td><code>100</code> (Starts at 100ms, reagardless of the animtion position in the timeline)</td></tr></table></div>@@ -1640,9 +1666,22 @@ tl<div class="demo-description"><p>Write less code by defining default parameters.<br>- Every child inherits the default parameters of the timeline.<br>- Default parameters can be overrided.+ 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">@@ -1707,17 +1746,10 @@ tl<h3 class="demo-title">Play / Pause</h3><div class="demo-description"><p>Manualy play or pause the animation.</p>-<pre>-<code>var animation = anime({- targets: '.item',- translate: 250,- autoplay: false-});--animation.play();-animation.pause();-</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.play();</code></pre>+ <p>Pause a running animation:</p>+<pre><code>animation.pause();</code></pre></div><div class="demo-content play-pause-demo"><div class="line">@@ -1760,16 +1792,8 @@ document.querySelector('.play-pause-demo .pause').onclick = animation.pause;<div id="restartAnim" class="demo"><h3 class="demo-title">Restart</h3><div class="demo-description">- <p>Restart the animation from the default values</p>-<pre>-<code>var animation = anime({- targets: '.item',- translate: 250-});--animation.restart();-</code>-</pre>+ <p>Restart an animation from its initial values:</p>+<pre><code>animation.restart();</code></pre></div><div class="demo-content restart-demo"><div class="line">@@ -1809,16 +1833,8 @@ document.querySelector('.restart-demo .restart').onclick = animation.restart;<div id="reverseAnim" class="demo"><h3 class="demo-title">Reverse</h3><div class="demo-description">- <p>Reverse the animation direction</p>-<pre>-<code>var animation = anime({- targets: '.item',- translate: 250-});--animation.reverse();-</code>-</pre>+ <p>Reverse the direction of an animation (running or not):</p>+<pre><code>animation.reverse();</code></pre></div><div class="demo-content reverse-anim-demo"><div class="line">@@ -1872,16 +1888,10 @@ document.querySelector('.reverse-anim-demo .reverse').onclick = animation.revers<div id="seekAnim" class="demo"><h3 class="demo-title">Seek</h3><div class="demo-description">- <p>Jump to a specific time of the animation</p>-<pre>-<code>var animation = anime({- targets: '.item',- translate: 250-});--animation.seek(500);-</code>-</pre>+ <p>Jump to a specific time (in milliseconds):</p>+<pre><code>animation.seek(500);</code></pre>+ <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">@@ -1928,16 +1938,16 @@ seekProgressEl.oninput = function() {</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"><button class="play">Play</button>@@ -2000,7 +2010,7 @@ controlsProgressEl.addEventListener('input', function() {<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>Define a state using the <code>states</code> object:</p>+ <p>Define states using the <code>states</code> object:</p><pre><code>var animation = anime({targets: '.el',easing: 'easeInOutCirc'@@ -2018,8 +2028,8 @@ animation.states.stateName = {</div><div class="demo-content states-demo"><div class="line">- <div class="square shadow"></div>- <div class="square el"></div>+ <div class="large square shadow"></div>+ <div class="large square el"></div></div></div><script>var statesInitialisation = function() {@@ -2045,15 +2055,15 @@ animation.animateTo('alignedLeft', {</script></div>-<div id="statesParametersInheritance" class="demo">- <h3 class="demo-title">Parameters inheritance</h3>+<div id="statesDefaultProperties" class="demo">+ <h3 class="demo-title">Default properties</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>+ <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 stateseasing: 'easeInOutCirc'});@@ -2064,18 +2074,12 @@ animation.states.stateA = {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="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>+ <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-inheritance-demo">+ <div class="demo-content default-states-demo"><div class="line"><div class="square large shadow"></div><div class="square large el"></div>@@ -2083,13 +2087,17 @@ animation.states.stateB = {<div class="line player align-items"><button class="state-moved">Move</button><button class="state-rotated">Rotate</button>- <button class="state-rounded">Round Corners</button>+ <button class="state-rounded">Round</button>+ <button class="state-default">Default</button></div></div>- <script>var statesParametersInheritance= function() {+ <script>var statesDefaultProperties= function() {/*DEMO*/var animation = anime({- targets: '.states-inheritance-demo .el',+ targets: '.default-states-demo .el',+ translateX: 0,+ rotate: 0,+ borderRadius: 0,easing: 'easeInOutCirc'});@@ -2105,29 +2113,32 @@ animation.states.rounded = {borderRadius: '40%'}-document.body.querySelector('.states-inheritance-demo .state-moved').onclick = function() {+document.body.querySelector('.default-states-demo .state-moved').onclick = function() {animation.animateTo('moved');}-document.body.querySelector('.states-inheritance-demo .state-rotated').onclick = function() {+document.body.querySelector('.default-states-demo .state-rotated').onclick = function() {animation.animateTo('rotated');}-document.body.querySelector('.states-inheritance-demo .state-rounded').onclick = function() {+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="statesDefaultProperties" class="demo">- <h3 class="demo-title">Default properties</h3>+<div id="statesParametersInheritance" class="demo">+ <h3 class="demo-title">Parameters inheritance</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>+ <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',- translateX: 0, // will be inherited by every states- rotate: 0, // will be inherited by every stateseasing: 'easeInOutCirc'});@@ -2138,12 +2149,18 @@ animation.states.stateA = {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>+ <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="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 default-states-demo">+ <div class="demo-content states-inheritance-demo"><div class="line"><div class="square large shadow"></div><div class="square large el"></div>@@ -2151,17 +2168,13 @@ animation.states.stateB = {<div class="line player align-items"><button class="state-moved">Move</button><button class="state-rotated">Rotate</button>- <button class="state-rounded">Round</button>- <button class="state-default">Default</button>+ <button class="state-rounded">Round Corners</button></div></div>- <script>var statesDefaultProperties= function() {+ <script>var statesParametersInheritance= function() {/*DEMO*/var animation = anime({- targets: '.default-states-demo .el',- translateX: 0,- rotate: 0,- borderRadius: 0,+ targets: '.states-inheritance-demo .el',easing: 'easeInOutCirc'});@@ -2177,18 +2190,15 @@ animation.states.rounded = {borderRadius: '40%'}-document.body.querySelector('.default-states-demo .state-moved').onclick = function() {+document.body.querySelector('.states-inheritance-demo .state-moved').onclick = function() {animation.animateTo('moved');}-document.body.querySelector('.default-states-demo .state-rotated').onclick = function() {+document.body.querySelector('.states-inheritance-demo .state-rotated').onclick = function() {animation.animateTo('rotated');}-document.body.querySelector('.default-states-demo .state-rounded').onclick = function() {+document.body.querySelector('.states-inheritance-demo .state-rounded').onclick = function() {animation.animateTo('rounded');}-document.body.querySelector('.default-states-demo .state-default').onclick = function() {- animation.animateTo('default');-}/*DEMO*/}</script>@@ -2218,7 +2228,7 @@ document.body.querySelector('.default-states-demo .state-default').onclick = fun<tr><td><code>Function</code></td><td>animation</td>- <td>Return the current animation <code>Object</code></td>+ <td>Return the current animation Object</td></tr></table></div>@@ -2264,7 +2274,7 @@ anime({<tr><td><code>Function</code></td><td>animation</td>- <td>Return the current animation <code>Object</code></td>+ <td>Return the current animation Object</td></tr></table></div>@@ -2314,7 +2324,7 @@ anime({<tr><td><code>Function</code></td><td>animation</td>- <td>Return the current animation <code>Object</code></td>+ <td>Return the current animation Object</td></tr></table></div>@@ -2368,7 +2378,7 @@ anime({<tr><td><code>Function</code></td><td>animation</td>- <td>Return the current animation <code>Object</code></td>+ <td>Return the current animation Object</td></tr></table></div>@@ -2406,8 +2416,8 @@ anime({<p>Every animation instances return a <code>finished</code> promise when the animation finised.</p>- <p>- Note that <code>Promises</code> are not suported in IE < 11.+ <p class="warning">+ <code>Promises</code> are not suported in IE < 11.</p></div><div class="demo-content promise-demo">@@ -2418,27 +2428,30 @@ anime({<div class="circle el"></div></div><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 finishedPromise = anime({- targets: '.promise-demo .el',+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 = '';}@@ -2462,25 +2475,28 @@ finishedPromise.update = function(anim) {<h3 class="demo-title">Motion path</h3><div class="demo-description"><p>- <code>var path = anime.path(pathEl)</code> return an <code>Function</code> that converts svg path data into animatable values.<br>+ Returns a Function that converts svg path data into animatable values:</p>+<pre><code>var myPath = anime.path('svg path');</code></pre><table><thead>- <td>Type</td><td>Parameters</td>+ <td>Example</td><td>Info</td></thead><tr>- <td rowspan="3"><code>Function</code></td><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>@@ -2517,7 +2533,10 @@ anime({<h3 class="demo-title">Morphing</h3><div class="demo-description"><p>- You can morph multiple svg shapes togerther as long as they have the same number of point.+ Creates transition between two svg shapes.+ </p>+ <p class="warning">+ Shapes must have the same number of points!</p></div><div class="demo-content align-center morphing-demo">@@ -2560,8 +2579,13 @@ anime({<h3 class="demo-title">Line drawing</h3><div class="demo-description"><p>- <code>anime.setDashoffset(pathEl)</code> will set the <code>'dash-offset'</code> attribute value of an SVG path element to the path length.+ <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>@@ -2571,7 +2595,7 @@ anime({<tr><td><code>Function</code></td><td>animation</td>- <td>Return the current animation <code>Object</code></td>+ <td>Return the current animation Object</td></tr></table></div>@@ -2619,7 +2643,7 @@ anime({<div class="demo-description"><p><code>'linear'</code> will not apply any easing timing to your animation.<br>- Works best with opacity and colors values.+ usefull for opacity and colors animations.</p></div><div class="demo-content linear-easing-demo">@@ -2647,7 +2671,7 @@ anime({<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>.+ Built in <a href="http://robertpenner.com/easing/">Robert Penner's easing functions</a>:</p><table><thead>@@ -2736,18 +2760,11 @@ demoContentEl.appendChild(fragment);<h3 class="demo-title">Cubic Bézier Curve</h3><div class="demo-description"><p>- Use your own custom cubic Bézier curves <code>cubicBezier(x1, y1, x2, y2)</code>+ Use your own custom cubic Bézier curves <code>cubicBezier(x1, y1, x2, y2):</code>+ </p>+ <p class="warning">+ You can use Bézier curves generator like <a href="https://matthewlein.com/tools/ceaser">Ceaser</a>.</p>- <table>- <thead>- <td>Head 1</td>- <td>Head 2</td>- </thead>- <tr>- <td><code>'code'</code></td>- <td>Description</td>- </tr>- </table></div><div class="demo-content cubic-bezier-demo"><div class="line">@@ -2770,15 +2787,15 @@ anime({</div>-<div id="springPhysics" class="demo">+<div id="springPhysicsEasing" class="demo"><h3 class="demo-title">Spring</h3><div class="demo-description"><p>- Physics based easing, can accepts 4 parameters <code>spring(mass, stiffness, damping, velocity)</code>+ Spring physics based easing. It accepts 4 parameters: <code>spring(mass, stiffness, damping, velocity)</code></p>- <p>- Spring easing will override the <code>duration</code> parameter- Spring easing uses easing doesn't rely on dur inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js<br>+ <p class="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>@@ -2819,7 +2836,7 @@ anime({<div class="square el"></div></div></div>- <script>var springPhysics = function() {+ <script>var springPhysicsEasing = function() {/*DEMO*/anime({targets: '.spring-physics-demo .el',@@ -2834,13 +2851,24 @@ anime({</div>-<div id="stepEasing" class="demo">- <h3 class="demo-title">Steps</h3>+<div id="elasticEasing" class="demo">+ <h3 class="demo-title">Elastic</h3><div class="demo-description"><p>- Defines the number of jumps an animation takes to arrive at its end value+ Creates a similar effect to <a class="color-easings" href="#springPhysicsEasing">Spring easing</a> but with simplier parameters, and works with the <code>duration</code> parameter.</p>- <pre><code>steps(numberOfSteps)</code></pre>+ <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>@@ -2849,27 +2877,55 @@ anime({<td>Max</td></thead><tr>- <td>Number of steps</td>- <td><code>10</code></td>+ <td>Amplitude</td><td><code>1</code></td>- <td><code>∞</code></td>+ <td><code>0</code></td>+ <td><code>100</code></td>+ </tr>+ <tr>+ <td>Period</td>+ <td><code>100</code></td>+ <td><code>0</code></td>+ <td><code>100</code></td></tr></table></div>- <div class="demo-content step-easing-demo">+ <div class="demo-content elastic-easing-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 in-elastic"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el out-elastic"></div>+ </div>+ <div class="line">+ <div class="small square shadow"></div>+ <div class="small square el in-out-elastic"></div></div></div>- <script>var stepEasing = function() {+ <script>var elasticEasing = function() {/*DEMO*/anime({- targets: '.step-easing-demo .el',+ targets: '.in-elastic',translateX: 250,direction: 'alternate',loop: true,- easing: 'steps(5)'+ easing: 'easeInElastic(1, .5)'+})+anime({+ targets: '.out-elastic',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'easeOutElastic(1, .5)'+})+anime({+ targets: '.in-out-elastic',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'easeInOutElastic(1, .5)'})/*DEMO*/}@@ -2877,64 +2933,43 @@ anime({</div>-<div id="demoName" class="demo">- <h3 class="demo-title">Demo Name</h3>- <div class="demo-description">- <p>- <code>var path = anime.path(pathEl)</code> return an <code>Function</code> that converts svg path data into animatable values.<br>- </p>- <table>- <thead>- <td>Head 1</td>- <td>Head 2</td>- </thead>- <tr>- <td><code>'code'</code></td>- <td>Description</td>- </tr>- </table>- </div>- <div class="demo-content demo-name-demo">- <div class="line">- <div class="small square shadow"></div>- <div class="small square el"></div>- </div>- </div>- <script>var demoName = function() {-/*DEMO*/--/*DEMO*/-}- </script>--</div>--<div id="demoName" class="demo">- <h3 class="demo-title">Demo Name</h3>+<div id="stepEasing" class="demo">+ <h3 class="demo-title">Steps</h3><div class="demo-description"><p>- <code>var path = anime.path(pathEl)</code> return an <code>Function</code> that converts svg path data into animatable values.<br>+ Defines the number of jumps an animation takes to arrive at its end value</p>+ <pre><code>steps(numberOfSteps)</code></pre><table><thead>- <td>Head 1</td>- <td>Head 2</td>+ <td>Parameter</td>+ <td>Default</td>+ <td>Min</td>+ <td>Max</td></thead><tr>- <td><code>'code'</code></td>- <td>Description</td>+ <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 demo-name-demo">+ <div class="demo-content step-easing-demo"><div class="line">- <div class="small square shadow"></div>- <div class="small square el"></div>+ <div class="square shadow"></div>+ <div class="square el"></div></div></div>- <script>var demoName = function() {+ <script>var stepEasing = function() {/*DEMO*/-+anime({+ targets: '.step-easing-demo .el',+ translateX: 250,+ direction: 'alternate',+ loop: true,+ easing: 'steps(5)'+})/*DEMO*/}</script>