JavaScript animation engine
Update documentation
Julian Garnierebce6a3f7f97
diff --git a/documentation/assets/css/anime.css b/documentation/assets/css/anime.cssindex 11528b89..6429033b 100644--- a/documentation/assets/css/anime.css+++ b/documentation/assets/css/anime.css@@ -1,8 +1,6 @@-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;}@@ -25,12 +23,12 @@ body {.color-targets { color: #FF1461; } /* Red */.color-properties { color: #FF7C72; } /* Orange */.color-prop-params { color: #FBF38C; } /* Yellow */-.color-04 { color: #A6FF8F; } /* Citrus */-.color-anim-params { color: #18FF92; } /* Green */-.color-values { color: #1CE2B2; } /* Darkgreen */-.color-tl { color: #5EF3FB; } /* Turquoise */-.color-08 { color: #61C3FF; } /* Lightblue */-.color-09 { color: #5A87FF; } /* Blue */-.color-10 { color: #8453E3; } /* Purple */-.color-11 { color: #C26EFF; } /* Lavender */-.color-easings { color: #FB89FB; } /* Pink */+.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-misc { color: #FB89FB; } /* Pink */diff --git a/documentation/assets/css/documentation.css b/documentation/assets/css/documentation.cssindex c21b6d1c..7f3d4bae 100644--- a/documentation/assets/css/documentation.css+++ b/documentation/assets/css/documentation.css@@ -1,13 +1,8 @@.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;@@ -28,12 +23,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;@@ -46,27 +37,17 @@ 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 rgba(0,0,0,.35);+ border-bottom: 1px solid rgba(0,0,0,.25);}.logo, h2 {@@ -91,9 +72,17 @@ header {/* Sidebar */.sidebar {+ display: flex;+ flex-direction: column;width: 240px;padding-top: 60px;- border-right: 1px solid rgba(0,0,0,.35);+ border-right: 1px solid rgba(0,0,0,.25);+}++.sidebar-info {+ display: flex;+ justify-content: space-between;+ padding: 20px;}.navigation {@@ -184,12 +173,12 @@ header {.code-examples {width: 50%;flex-direction: column;- border-left: 1px solid rgba(0,0,0,.35);+ border-left: 1px solid rgba(0,0,0,.25);}.code-pane {position: relative;- border-bottom: 1px solid rgba(0,0,0,.35);+ border-bottom: 1px solid rgba(0,0,0,.25);}.code-pane-description { height: 40%; }@@ -232,26 +221,25 @@ code {}.code-pane-description {- color: rgba(255,255,255,.8);font-size: 15px;line-height: 20px;+ color: rgba(255,255,255,.7);}.code-pane-description p {margin-bottom: 20px;- letter-spacing: .5px;}p.warning {- color: #FF7C72;display: inline-block;position: relative;padding: 8px 12px;+ color: #FBF38C;}p.warning:after {content: "";- color: #FBF38C;+ color: currentColor;display: inline-block;position: absolute;top: 0;@@ -260,7 +248,7 @@ p.warning:after {bottom: 0;background-color: currentColor;border-radius: 3px;- opacity: .1;+ opacity: .05;}.code-pane-description code.hljs {@@ -276,8 +264,8 @@ p.warning:after {display: inline-block;position: relative;padding: 8px 12px;- background-color: rgba(0,0,0,.3);- border: 1px solid rgba(0,0,0,.5);+ background-color: rgba(0,0,0,.2);+ border: 1px solid rgba(0,0,0,.4);border-radius: 3px;}@@ -285,29 +273,39 @@ p.warning:after {display: inline;position: relative;padding: 0px 3px;- background-color: rgba(0,0,0,.3);- border: 1px solid rgba(0,0,0,.5);+ background-color: rgba(0,0,0,.2);+ border: 1px solid rgba(0,0,0,.4);border-radius: 3px;}.code-pane-description table {margin-bottom: 20px;+ border: 1px solid #2E2E33;+ border-spacing: 0;+ border-radius: 3px;}.code-pane-description thead {- font-size: 12px;- line-height: 20px;+ font-weight: 200;text-transform: uppercase;- opacity: .6;+ letter-spacing: .15em;+ color: rgba(255,255,255,.5);+}++.code-pane-description td {+ vertical-align: middle;+ padding: 8px 12px;+ border-left: 1px solid #2E2E33;+ border-top: 1px solid #2E2E33;+ color: currentColor;}-.code-pane-description tr, .code-pane-description td {- border: 1px solid #6e6d72;- padding: 6px 8px;+.code-pane-description thead td {+ border-top: none;}-.code-pane-description a:visited {- color: currentColor;+.code-pane-description td:first-child {+ border-left: none;}.code-output {@@ -318,7 +316,7 @@ p.warning:after {width: 100%;height: 100%;padding: 20px;- background-color: rgba(0,0,0,.3);+ background-color: rgba(0,0,0,.2);}.code-pane-description .code-output {@@ -358,7 +356,7 @@ article {width: 100%;min-height: 200px;padding-top: 35px;- border-bottom: 1px solid rgba(0,0,0,.35);+ border-bottom: 1px solid rgba(0,0,0,.25);cursor: pointer;}diff --git a/documentation/assets/js/documentation.js b/documentation/assets/js/documentation.jsindex c4a05669..d7ecb698 100644--- a/documentation/assets/js/documentation.js+++ b/documentation/assets/js/documentation.js@@ -97,12 +97,15 @@ function toggleSectionLink(ulEl) {});}-function resetDemos() {+function resetDemo(demoEl) {var els = document.querySelectorAll('.el');for (var i = 0; i < els.length; i++) {anime.remove(els[i]);els[i].style = '';}+}++function resetDemos() {anime.running.forEach(function(anim) {anim.pause();anim.seek(0);@@ -122,7 +125,7 @@ function createDemo(el) {var HTMLcode = demoContentEl ? parseHTML(demoContentEl, id) : '';var APIdescription = descriptionContentEl ? descriptionContentEl.innerHTML : '';function restart() {- resetDemos();+ resetDemo();demoAnim();}function highlightDemo(e, push) {@@ -163,7 +166,7 @@ function createDemo(el) {}function leaveDemo() {if (!el.classList.contains('active')) {- resetDemos();+ resetDemo();}}el.addEventListener('click', function(e) {diff --git a/documentation/index.html b/documentation/index.htmlindex ee701fa1..25ead610 100644--- a/documentation/index.html+++ b/documentation/index.html@@ -29,6 +29,10 @@</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">@@ -41,14 +45,12 @@<div id="cssSelector" class="demo"><h3 class="demo-title">CSS Selector</h3><div class="demo-description">- <p>- Can be any CSS selector.<br>- Note that pseudo elements cannot be animated in JavaScript.- </p>+ <p>Can be any CSS selector.</p>+ <p class="warning">Pseudo elements cannot be animated in JavaScript.</p><table><thead><td>Accepts</td>- <td>Examples</td>+ <td>Example</td></thead><tr><td>string</td>@@ -87,7 +89,7 @@ anime({<table><thead><td>Accepts</td>- <td>Examples</td>+ <td>Example</td></thead><tr><td>DOM Node</td>@@ -134,12 +136,12 @@ anime({<h3 class="demo-title">JavaScript Object</h3><div class="demo-description"><p>- A javascript Object with at least one property containing a numerical value.+ A JavaScript Object with at least one property containing a numerical value.</p><table><thead><td>Accepts</td>- <td>Examples</td>+ <td>Example</td></thead><tr><td>Object</td>@@ -188,7 +190,7 @@ anime({<table><thead><td>Accepts</td>- <td>Examples</td>+ <td>Example</td></thead><tr><td>array</td>@@ -238,8 +240,10 @@ anime({<div class="demo-description"><p>Any CSS properties can be animated.- Note that most CSS properties will cause layout changes or repaint, and will result in choppy animation.- Prroritize <code>'opacity'</code>, <code>'translate'</code>, <code>'rotate'</code>, <code>'scale'</code> as much as possible.+ </p>+ <p class="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>@@ -252,10 +256,10 @@ anime({</tr><tr><td><code>'left'</code></td>- <td><code>100</code></td>+ <td><code>'100px'</code></td></tr></table>- <p>More details about accepted values in the <a class="color-06" href="#unitlessValue">Values</a> section.</p>+ <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>@@ -279,7 +283,10 @@ anime({<h3 class="demo-title">CSS Transforms</h3><div class="demo-description"><p>- Animate CSS transforms properties indivudaly+ Animate CSS transforms properties indivudaly.+ </p>+ <p>+ Unlike CSS animations or the Web animation API, 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>@@ -302,7 +309,7 @@ anime({<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-06" href="#unitlessValue">Values</a> section.</p>+ <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>@@ -341,7 +348,7 @@ anime({<td><code>'100%'</code></td></tr></table>- <p>More details about accepted values in the <a class="color-06" href="#unitlessValue">Values</a> section.</p>+ <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">{"myProperty":"0"}</pre>@@ -388,8 +395,12 @@ anime({<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-06" href="#unitlessValue">Values</a> section.</p>+ <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>@@ -411,7 +422,7 @@ anime({<h3 class="demo-title">SVG Attributes</h3><div class="demo-description"><p>- Like any other <a class="color-properties" href="#domAttr">DOM Attribute</a> all SVG attributes can be animated.+ 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>@@ -428,10 +439,10 @@ anime({</tr><tr><td><code>baseFrequency</code></td>- <td><code>1</code></td>+ <td><code>0</code></td></tr></table>- <p>More details about accepted values in the <a class="color-06" href="#unitlessValue">Values</a> section.</p>+ <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="#svg">SVG</a> section</p></div><div class="demo-content align-center svg-attributes-demo"><svg width="128" height="128" viewBox="0 0 128 128">@@ -479,7 +490,7 @@ anime({<h3 class="demo-title">Duration</h3><div class="demo-description"><p>- Defines the duration of the animation.+ Defines the duration in milliseconds of the animation.</p><table><thead>@@ -488,7 +499,7 @@ anime({</thead><tr><td><code>1000</code></td>- <td><code>ms</code></td>+ <td>Milliseconds</td></tr></table><table>@@ -500,12 +511,12 @@ anime({<tr><td><code>Number</code></td><td><code>2000</code></td>- <td></td>+ <td>Milliseconds</td></tr><tr><td><code>Function</code></td><td><code>(el, i, t) => i * 200</code></td>- <td>More info on <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a></td>+ <td>See <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a> section</td></tr></table></div>@@ -539,7 +550,7 @@ anime({</thead><tr><td><code>0</code></td>- <td><code>ms</code></td>+ <td>Milliseconds</td></tr></table><table>@@ -551,12 +562,12 @@ anime({<tr><td><code>Number</code></td><td><code>1000</code></td>- <td></td>+ <td>Milliseconds</td></tr><tr><td><code>Function</code></td><td><code>(el, i, t) => i * 200</code></td>- <td>More info on <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a></td>+ <td>See <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a> section</td></tr></table></div>@@ -581,7 +592,7 @@ anime({<h3 class="demo-title">end delay</h3><div class="demo-description"><p>- Add some time at the end of the animation.<br>+ Add some extra time at the end of the animation.<br></p><table><thead>@@ -590,7 +601,7 @@ anime({</thead><tr><td><code>0</code></td>- <td><code>ms</code></td>+ <td>Milliseconds</td></tr></table><table>@@ -602,12 +613,12 @@ anime({<tr><td><code>Number</code></td><td><code>2000</code></td>- <td></td>+ <td>Milliseconds</td></tr><tr><td><code>Function</code></td><td><code>(el, i, t) => i * 200</code></td>- <td>More info on <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a></td>+ <td>See <a class="color-prop-params" href="#functionBasedParameters">Function based parameters</a> section</td></tr></table></div>@@ -634,7 +645,7 @@ anime({<h3 class="demo-title">Easing</h3><div class="demo-description"><p>- Defines the easing of the animation.+ Defines the timing function of the animation.</p><table><thead>@@ -647,7 +658,7 @@ anime({</tr></table><p>- Check out the <a class="color-07" href="#PennerEasings">Easings</a> section for a complete list of available easing and parameters.+ 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">@@ -672,10 +683,22 @@ anime({<h3 class="demo-title">Specific property parameters</h3><div class="demo-description"><p>- Define unique parameters to each properties of the animation using an <code>Object</code> as value.<br>+ Define unique parameters to each property of the animation.<br>+ using an <code>Object</code> as value.<br>The property value is set using the <code>value</code> property.<br>Other properties that aren't specified in the <code>Object</code> will be inheritted from the main parameters.</p>+<pre><code>anime({+ targets: '.specific-prop-params-demo .el',+ translateX: {+ value: 250,+ duration: 800 // overrides duration+ // Since no easing is specified, the animation will inherits 'easeOutExpo'+ },+ rotate: 360,+ duration: 2000,+ easing: 'easeOutExpo'+});</code></pre></div><div class="demo-content specific-prop-params-demo"><div class="square shadow"></div>@@ -715,6 +738,12 @@ anime({Get different values for every target and property of the animation.<br>The function accepts 3 arguments:</p>+<pre><code>anime({+ targets: '.specific-prop-params-demo .el',+ translateX: function(element, index, totalLength) {+ return (totalLength - index) * 200;+ }+});</code></pre><table><thead><td>Arguments</td>@@ -722,7 +751,7 @@ anime({</thead><tr><td><code>target</code></td>- <td>The curently animated targeted element</td>+ <td>The curent animated targeted element</td></tr><tr><td><code>index</code></td>@@ -1684,7 +1713,7 @@ tl<!-- --><!-- CONTROLS -->-<article id="controls" class="color-08">+<article id="controls" class="color-controls"><header><h2 class="demos-title">Controls</h2></header>@@ -1977,7 +2006,7 @@ controlsProgressEl.addEventListener('input', function() {<!-- --><!-- STATES -->-<article id="states" class="color-09">+<article id="states" class="color-states"><header><h2 class="demos-title">States</h2></header>@@ -2184,7 +2213,7 @@ document.body.querySelector('.default-states-demo .state-default').onclick = fun<!-- --><!-- CALLBACKS -->-<article id="callbacks" class="color-09">+<article id="callbacks" class="color-callbacks"><header><h2 class="demos-title">Callbacks & Promises</h2></header>@@ -2439,7 +2468,7 @@ finishedPromise.update = function(anim) {<!-- --><!-- SVG -->-<article id="svg" class="color-11">+<article id="svg" class="color-svg"><header><h2 class="demos-title">SVG</h2></header>@@ -2952,6 +2981,7 @@ anime({</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),