Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update documentation

Julian Garnier42d85e33fafd
diff --git a/documentation/assets/css/documentation.css b/documentation/assets/css/documentation.css
index 6bf2988e..c21b6d1c 100644
--- a/documentation/assets/css/documentation.css
+++ b/documentation/assets/css/documentation.css
@@ -183,10 +183,7 @@ header {
.code-examples {
width: 50%;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -ms-flex-direction: column;
- flex-direction: column;
+ flex-direction: column;
border-left: 1px solid rgba(0,0,0,.35);
}
@@ -195,7 +192,7 @@ header {
border-bottom: 1px solid rgba(0,0,0,.35);
}
-.code-pane-api { height: 40%; }
+.code-pane-description { height: 40%; }
.code-pane-js { height: 40%; }
.code-pane-html { height: 20%; }
@@ -205,15 +202,20 @@ header {
top: -60px;
}
-.code-header:hover {
+.gutter {
cursor: ns-resize;
+ transition: background-color .25s ease;
+}
+
+.gutter:hover {
+ background-color: rgba(255,255,255,.05)
}
.gutter {
z-index: 1;
}
-.code-pane-api .code-header {
+.code-pane-description .code-header {
top: 0;
}
@@ -227,74 +229,84 @@ code {
font-size: 14px;
line-height: 20px;
white-space: pre-wrap;
- white-space: -moz-pre-wrap;
- white-space: -o-pre-wrap;
}
-.api-output {
- color: #C5C2CB;
+.code-pane-description {
+ color: rgba(255,255,255,.8);
font-size: 15px;
line-height: 20px;
}
-.api-output p {
+.code-pane-description p {
margin-bottom: 20px;
+ letter-spacing: .5px;
}
-.api-output code.hljs {
+p.warning {
+ color: #FF7C72;
+ display: inline-block;
+ position: relative;
+ padding: 8px 12px;
+}
+
+p.warning:after {
+ content: "";
+ color: #FBF38C;
+ display: inline-block;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: currentColor;
+ border-radius: 3px;
+ opacity: .1;
+}
+
+.code-pane-description code.hljs {
display: inline-block;
font-size: 14px;
}
-.api-output pre {
+.code-pane-description pre {
margin-bottom: 20px;
}
-.api-output pre code {
+.code-pane-description pre code {
display: inline-block;
position: relative;
padding: 8px 12px;
- background-color: rgba(0,0,0,.1);
- border: 1px solid rgba(0,0,0,.3);
- border-radius: 0px;
+ background-color: rgba(0,0,0,.3);
+ border: 1px solid rgba(0,0,0,.5);
+ border-radius: 3px;
}
-.api-output p code {
+.code-pane-description p code {
display: inline;
position: relative;
- padding: 0 3px;
- background-color: rgba(0,0,0,.2);
-}
-
-.api-output p code:after {
- content: "";
- opacity: .3;
- position: absolute;
- left: 0px;
- bottom: -1px;
- right: 0px;
- top: -1px;
- border: 1px solid currentColor;
+ padding: 0px 3px;
+ background-color: rgba(0,0,0,.3);
+ border: 1px solid rgba(0,0,0,.5);
border-radius: 3px;
}
-.api-output table {
+.code-pane-description table {
margin-bottom: 20px;
}
-.api-output thead {
+.code-pane-description thead {
font-size: 12px;
line-height: 20px;
text-transform: uppercase;
opacity: .6;
}
-.api-output tr, .api-output td {
+.code-pane-description tr, .code-pane-description td {
border: 1px solid #6e6d72;
padding: 6px 8px;
}
-.api-output a:visited {
+.code-pane-description a:visited {
color: currentColor;
}
@@ -306,12 +318,13 @@ code {
width: 100%;
height: 100%;
padding: 20px;
- background-color: rgba()
+ background-color: rgba(0,0,0,.3);
}
-.code-pane-api .code-output {
+.code-pane-description .code-output {
top: 60px;
height: calc(100% - 60px);
+ background-color: rgba(0,0,0,0);
}
/* Demos */
@@ -324,21 +337,11 @@ code {
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 {
@@ -348,15 +351,10 @@ 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;
diff --git a/documentation/assets/js/documentation.js b/documentation/assets/js/documentation.js
index 9074b5b1..c4a05669 100644
--- a/documentation/assets/js/documentation.js
+++ b/documentation/assets/js/documentation.js
@@ -2,17 +2,17 @@ var navigationEl = document.querySelector('.navigation');
var demosEl = document.querySelector('.demos');
var articleEls = document.querySelectorAll('article');
var APIOutputEl = document.querySelector('.api-output');
-var APITitleEl = document.querySelector('.code-pane-api h2');
+var APITitleEl = document.querySelector('.code-pane-description h2');
var jsOutputEl = document.querySelector('.js-output');
var htmlOutputEl = document.querySelector('.html-output');
var ulHeight = 20;
var demos = [];
-Split(['.code-pane-api', '.code-pane-js', '.code-pane-html'], {
+Split(['.code-pane-description', '.code-pane-js', '.code-pane-html'], {
direction: 'vertical',
gutterSize: 60,
snapOffset: 0,
- sizes: [48, 48, 4],
+ sizes: [58, 38, 4],
minSize: [60, 0, 0]
})
@@ -97,15 +97,12 @@ function toggleSectionLink(ulEl) {
});
}
-function resetDemo(demoEl) {
- var els = demoEl.querySelectorAll('.el');
+function resetDemos() {
+ 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);
@@ -125,7 +122,7 @@ function createDemo(el) {
var HTMLcode = demoContentEl ? parseHTML(demoContentEl, id) : '';
var APIdescription = descriptionContentEl ? descriptionContentEl.innerHTML : '';
function restart() {
- resetDemo(el);
+ resetDemos();
demoAnim();
}
function highlightDemo(e, push) {
@@ -166,7 +163,7 @@ function createDemo(el) {
}
function leaveDemo() {
if (!el.classList.contains('active')) {
- resetDemo(el);
+ resetDemos();
}
}
el.addEventListener('click', function(e) {
diff --git a/documentation/assets/js/vendors/highlight.pack.js b/documentation/assets/js/vendors/highlight.pack.js
index 11063f6f..f5c34e85 100644
--- a/documentation/assets/js/vendors/highlight.pack.js
+++ b/documentation/assets/js/vendors/highlight.pack.js
@@ -1,2 +1,2 @@
-/*! 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={"&":"&amp;","<":"&lt;",">":"&gt;"};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 file
+/*! 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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}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('"',"&quot;")+'"'}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 file
diff --git a/documentation/index.html b/documentation/index.html
index cf73649d..ee701fa1 100644
--- a/documentation/index.html
+++ b/documentation/index.html
@@ -1731,7 +1731,8 @@ var animation = anime({
delay: function(el, i) { return i * 100; },
direction: 'alternate',
loop: true,
- autoplay: false
+ autoplay: false,
+ easing: 'easeInOutSine'
});
document.querySelector('.play-pause-demo .play').onclick = animation.play;
@@ -1780,7 +1781,8 @@ var animation = anime({
translateX: 250,
delay: function(el, i) { return i * 100; },
direction: 'alternate',
- loop: true
+ loop: true,
+ easing: 'easeInOutSine'
});
document.querySelector('.restart-demo .restart').onclick = animation.restart;
@@ -1790,7 +1792,7 @@ document.querySelector('.restart-demo .restart').onclick = animation.restart;
</div>
-<div id="reverseAnim" class="demo controls">
+<div id="reverseAnim" class="demo">
<h3 class="demo-title">Reverse</h3>
<div class="demo-description">
<p>Reverse the animation direction</p>
@@ -1828,12 +1830,10 @@ animation.reverse();
targets: '.reverse-anim-demo .el',
translateX: 250,
duration: 2000,
- direction: 'reverse',
delay: function(el, i) { return i * 200; }
});
document.querySelector('.reverse-anim-demo .reverse').onclick = function() {
- reverseAnimDemo.play();
reverseAnimDemo.reverse();
}
@@ -1842,8 +1842,10 @@ animation.reverse();
var animation = anime({
targets: '.reverse-anim-demo .el',
translateX: 250,
- duration: 2000,
- delay: function(el, i) { return i * 200; }
+ loop: true,
+ direction: 'alternate',
+ delay: function(el, i) { return i * 200; },
+ easing: 'easeInOutSine'
});
document.querySelector('.reverse-anim-demo .reverse').onclick = animation.reverse;
@@ -1891,6 +1893,7 @@ var animation = anime({
translateX: 250,
delay: function(el, i) { return i * 100; },
elasticity: 200,
+ easing: 'easeInOutSine',
autoplay: false
});
@@ -1937,6 +1940,7 @@ var tl = anime.timeline({
direction: 'alternate',
loop: true,
duration: 500,
+ easing: 'easeInOutSine',
update: function(anim) {
controlsProgressEl.value = tl.progress;
}
@@ -1978,124 +1982,198 @@ controlsProgressEl.addEventListener('input', function() {
<h2 class="demos-title">States</h2>
</header>
-<div id="addStates" class="demo">
- <h3 class="demo-title">Adding states</h3>
+<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>Define a state 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="square shadow"></div>
+ <div class="square el"></div>
+ </div>
+ </div>
+ <script>var statesInitialisation = function() {
+/*DEMO*/
+var animation = anime({
+ targets: '.states-demo .el',
+ easing: 'easeInOutCirc' // defin default easing applied to all states
+});
+
+animation.states.alignedRight = { translateX: 250 };
+animation.states.alignedLeft = { translateX: 0 };
+
+// Go to state A instantly
+animation.goTo('alignedRight');
+
+// Animate to state B with a duration of 2000
+animation.animateTo('alignedLeft', {
+ duration: 2000
+});
+
+/*DEMO*/
+}
+ </script>
+</div>
+
+<div id="statesParametersInheritance" class="demo">
+ <h3 class="demo-title">Parameters inheritance</h3>
<div class="demo-description">
<p>
- States let you define and store multiple set of properties for one animation.<br>
+ 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'
+});
+
+animation.states.stateA = {
+ translateX: 250
+}
+
+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>
- Go directly to a specific state :
+ 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.goTo(stateName);</pre></code>
- <p>
- Or animate to a state :
+<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>
-<pre><code>animation.states.animateTo(stateName);</pre></code>
</div>
- <div class="demo-content add-states-demo">
+ <div class="demo-content states-inheritance-demo">
<div class="line">
- <div class="square shadow"></div>
- <div class="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-animate-outline">Outline</button>
- <button class="state-animate-fill">Fill</button>
- <button class="state-animate-middle">Middle</button>
- <button class="state-animate-right">Right</button>
+ <button class="state-moved">Move</button>
+ <button class="state-rotated">Rotate</button>
+ <button class="state-rounded">Round Corners</button>
</div>
</div>
- <script>var addStates = function() {
+ <script>var statesParametersInheritance= function() {
/*DEMO*/
var animation = anime({
- targets: '.add-states-demo .el'
+ targets: '.states-inheritance-demo .el',
+ easing: 'easeInOutCirc'
});
-animation.states.outline = {
- backgroundColor: 'rgba(97,195,255,0)',
- borderColor: 'rgb(97,195,255)',
- easing: 'linear'
-}
-
-animation.states.fill = {
- backgroundColor: 'rgb(97,195,255)',
- borderColor: 'rgba(97,195,255,0)',
- easing: 'linear'
+animation.states.moved = {
+ translateX: 250
}
-animation.states.middle = {
- translateX: 120,
- easing: 'easeOutQuad'
+animation.states.rotated = {
+ rotate: 45
}
-animation.states.right = {
- translateX: 240,
- easing: 'easeOutQuad'
+animation.states.rounded = {
+ borderRadius: '40%'
}
-//animation.animateTo('rotated');
-
-document.body.querySelector('.state-animate-outline').onclick = function() {
- animation.animateTo('outline');
-}
-document.body.querySelector('.state-animate-fill').onclick = function() {
- animation.animateTo('fill');
+document.body.querySelector('.states-inheritance-demo .state-moved').onclick = function() {
+ animation.animateTo('moved');
}
-document.body.querySelector('.state-animate-middle').onclick = function() {
- animation.animateTo('middle');
+document.body.querySelector('.states-inheritance-demo .state-rotated').onclick = function() {
+ animation.animateTo('rotated');
}
-document.body.querySelector('.state-animate-right').onclick = function() {
- animation.animateTo('right');
+document.body.querySelector('.states-inheritance-demo .state-rounded').onclick = function() {
+ animation.animateTo('rounded');
}
/*DEMO*/
}
</script>
</div>
-<div id="stateParameters" 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 properties specified in the state will be changed.<br>
- You can specify default properties that all states will inherit.<br>
- You can override these properties when defining or animating a state.
- </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 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 state-parameters-demo">
+ <div class="demo-content default-states-demo">
<div class="line">
- <div class="square shadow"></div>
- <div class="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-animate-move">Move</button>
- <button class="state-animate-rotate">Rotate</button>
+ <button class="state-moved">Move</button>
+ <button class="state-rotated">Rotate</button>
+ <button class="state-rounded">Round</button>
+ <button class="state-default">Default</button>
</div>
</div>
- <script>var stateParameters = function() {
+ <script>var statesDefaultProperties= function() {
/*DEMO*/
var animation = anime({
- targets: '.state-parameters-demo .el',
+ targets: '.default-states-demo .el',
translateX: 0,
rotate: 0,
- easing: 'easeOutExpo',
- autoplay: false // needed if you don't want the default animation to trigger
+ borderRadius: 0,
+ easing: 'easeInOutCirc'
});
-animation.states.move = {
+animation.states.moved = {
translateX: 250
}
-animation.states.rotate = {
- rotate: 315
+animation.states.rotated = {
+ rotate: 45
}
-//animation.animateTo('rotated');
+animation.states.rounded = {
+ borderRadius: '40%'
+}
-document.body.querySelector('.state-animate-move').onclick = function() {
- animation.animateTo('move');
+document.body.querySelector('.default-states-demo .state-moved').onclick = function() {
+ animation.animateTo('moved');
}
-document.body.querySelector('.state-animate-rotate').onclick = function() {
- animation.animateTo('rotate');
+document.body.querySelector('.default-states-demo .state-rotated').onclick = function() {
+ animation.animateTo('rotated');
+}
+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*/
}
@@ -2854,20 +2932,20 @@ anime({
</section>
<section class="pane code-examples">
- <div class="code-pane code-pane-api">
+ <div class="code-pane code-pane-description">
<header class="code-header">
<h2><span></span></h2>
</header>
<div class="code-output"><div class="api-output"></div></div>
</div>
<div class="code-pane code-pane-js">
- <header class="code-header">
+ <header class="code-header is-draggable">
<h2>JS Example</h2>
</header>
<pre class="code-output"><code class="js-output"></code></pre>
</div>
<div class="code-pane code-pane-html">
- <header class="code-header">
+ <header class="code-header is-draggable">
<h2>HTML Example</h2>
</header>
<pre class="code-output"><code class="html-output"></code></pre>