Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Migrate documentation / website

Julian Garnier2ab0da721c84
diff --git a/documentation/assets/css/anime.css b/documentation/assets/css/anime.css
index 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.css
index 543f3fe7..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,47 +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;
}
-.code-pane-js {
- height: 66%;
+.demo-info code {
+ font-family: "Input Mono Reg", "Space Mono", monospace;
+ font-size: 14px;
+ line-height: 25px;
+ white-space: pre-wrap;
}
-.code-pane-html {
- height: 34%;
+.demo-info p {
+ margin-bottom: 20px;
}
-.code-header {
+.demo-info p,
+.demo-info td {
+ color: rgba(255,255,255,.7);
+}
+
+.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;
}
-pre {
- overflow: auto;
- font-family: 'Space Mono', monospace;
- font-variant-ligatures: none;
- -webkit-font-variant-ligatures: none;
- line-height: 22px;
+.demo-info code.hljs {
+ display: inline-block;
+ font-size: 14px;
+}
+
+.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 */
@@ -231,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 {
@@ -255,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;
}
@@ -298,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;
@@ -347,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;
}
@@ -412,7 +509,7 @@ article {
.log {
width: 100%;
- height: 22px;
+ height: 100%;
background: transparent;
color: currentColor;
border: none;
@@ -420,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%;
@@ -445,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;
@@ -475,6 +601,10 @@ input.progress {
height: 18px;
}
+.small.triangle {
+ border-width: 0 10px 17px 10px;
+}
+
.large {
width: 48px;
height: 48px;
@@ -489,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;
@@ -502,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.js
similarity index 100%
rename from documentation/assets/js/anime.1.0.js
rename to documentation/assets/js/anime/anime.1.0.js
diff --git a/documentation/assets/js/anime.1.3.js b/documentation/assets/js/anime/anime.1.3.js
similarity index 100%
rename from documentation/assets/js/anime.1.3.js
rename to documentation/assets/js/anime/anime.1.3.js
diff --git a/documentation/assets/js/anime.2.0.0.js b/documentation/assets/js/anime/anime.2.0.0.js
similarity index 100%
rename from documentation/assets/js/anime.2.0.0.js
rename to documentation/assets/js/anime/anime.2.0.0.js
diff --git a/documentation/assets/js/anime.2.0.1.js b/documentation/assets/js/anime/anime.2.0.1.js
similarity index 100%
rename from documentation/assets/js/anime.2.0.1.js
rename to documentation/assets/js/anime/anime.2.0.1.js
diff --git a/documentation/assets/js/anime.2.0.2.js b/documentation/assets/js/anime/anime.2.0.2.js
similarity index 100%
rename from documentation/assets/js/anime.2.0.2.js
rename to documentation/assets/js/anime/anime.2.0.2.js
diff --git a/documentation/assets/js/anime.2.1.0.js b/documentation/assets/js/anime/anime.2.1.0.js
similarity index 100%
rename from documentation/assets/js/anime.2.1.0.js
rename to documentation/assets/js/anime/anime.2.1.0.js
diff --git a/documentation/assets/js/anime.2.2.0.js b/documentation/assets/js/anime/anime.2.2.0.js
similarity index 100%
rename from documentation/assets/js/anime.2.2.0.js
rename to documentation/assets/js/anime/anime.2.2.0.js
diff --git a/documentation/assets/js/anime/anime.3.0.0-alpha.js b/documentation/assets/js/anime/anime.3.0.0-alpha.js
new file mode 100644
index 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 file
diff --git a/documentation/assets/js/documentation.js b/documentation/assets/js/documentation.js
index 975153d4..a7f824dc 100644
--- a/documentation/assets/js/documentation.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.js
deleted file mode 100644
index 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={"&":"&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
diff --git a/documentation/assets/js/site.js b/documentation/assets/js/site.js
index 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.js
deleted file mode 100644
index 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.js
similarity index 100%
rename from documentation/assets/js/beautify-html.js
rename to documentation/assets/js/vendors/beautify-html.js
diff --git a/documentation/assets/js/vendors/highlight.pack.js b/documentation/assets/js/vendors/highlight.pack.js
new file mode 100644
index 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,"&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/assets/js/stats.js b/documentation/assets/js/vendors/stats.min.js
similarity index 100%
rename from documentation/assets/js/stats.js
rename to documentation/assets/js/vendors/stats.min.js
diff --git a/documentation/examples/anime-DOM-stress-test.html b/documentation/examples/anime-DOM-stress-test.html
index 04351595..6fe29653 100644
--- a/documentation/examples/anime-DOM-stress-test.html
+++ b/documentation/examples/anime-DOM-stress-test.html
@@ -17,14 +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="../assets/js/anime.2.2.0.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 {
@@ -34,10 +32,7 @@
width: 1em;
height: 1em;
margin: -.5em 0 0 -.5em;
- border: 1px solid currentColor;
- background-color: currentColor;
- font-size: 30px;
- border-radius: 50%;
+ font-size: 40px;
}
</style>
@@ -45,69 +40,36 @@
<body></body>
<script>
- const wrapperEl = document.body;
- const numberOfEls = 500;
- const duration = 2000;
- const delay = duration / numberOfEls;
- const radius = window.innerWidth < window.innerHeight ? window.innerWidth : window.innerHeight;
- const distance = (radius / 4 <= 150 ? 150 : radius) + 100;
+ var wrapperEl = document.body;
+ var numberOfEls = 1000;
+ var radius = window.innerWidth < window.innerHeight ? window.innerWidth : window.innerHeight;
+ var distance = (radius / 4 <= 150 ? 150 : radius / 2.5) / 16;
- let tl = anime.timeline({
- duration: delay,
- complete: function() { tl.restart(); }
+ function createEl(i) {
+ var el = document.createElement('div');
+ var hue = Math.round(360 / numberOfEls * i);
+ var angle = i;
+ el.classList.add('el');
+ 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)
});
+ };
- 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;
- el.classList.add('el');
- el.style.color = 'hsl(' + hue + ', 40%, 60%)';
- // el.style.left = anime.random(0, window.innerWidth) + 'px';
- el.style.zIndex = numberOfEls - i;
- console.log(el);
- // tl.add({
- // begin: function() {
- // anime({
- // targets: el,
- // //translateX: ['0px', Math.sin(angle) * distance + 'px'],
- // //translateY: ['0px', Math.cos(angle) * distance + 'px'],
- // width: [200, 400],
- // height: [200, 400],
- // // scale: [0, 32],
- // // scale: [
- // // {value: [0, 1], duration: duration / 2, easing: 'easeOutBack'},
- // // {value: 0, duration: duration / 2, easing: 'easeInBack'}
- // // ],
- // easing: 'easeInOutSine',
- // duration: duration
- // });
- // }
- // });
- anime({
- targets: el,
- translateX: ['0px', Math.sin(angle) * distance + 'px'],
- translateY: ['0px', Math.cos(angle) * distance + 'px'],
- // width: [200, 400],
- // height: [200, 400],
- // scale: [0, 32],
- // scale: [
- // {value: [0, 1], duration: duration / 2, easing: 'easeOutBack'},
- // {value: 0, duration: duration / 2, easing: 'easeInBack'}
- // ],
- delay: function(el, i) {
- return anime.random(0, duration);
- },
- loop: true,
- easing: 'easeInOutSine',
- duration: duration
- });
- wrapperEl.appendChild(el);
- };
-
- for (let i = 0; i < numberOfEls; i++) createEl(i);
+ for (var 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.html
new file mode 100644
index 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 file
diff --git a/documentation/examples/anime-tests-2.html b/documentation/examples/anime-easings.html
similarity index 54%
rename from documentation/examples/anime-tests-2.html
rename to documentation/examples/anime-easings.html
index a8f40487..900d7c45 100644
--- a/documentation/examples/anime-tests-2.html
+++ b/documentation/examples/anime-easings.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>Tests | anime.js</title>
+ <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">
@@ -21,12 +21,13 @@
<!-- <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;
@@ -34,61 +35,71 @@
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="item color-01" style="transform: translateX(45px) translateY(200px);"></div>
+ <div class="sprite"></div>
+ <div class="item color-01"></div>
<div class="item color-02"></div>
- <div class="item color-03" style="transform: translateX(85px) translateY(300px);"></div>
+ <div class="item color-03"></div>
+ <div class="item color-04"></div>
+ <div class="item color-05"></div>
<script>
- function mouseenter() {
- var animation = anime({
- targets: this,
- scale: 2
- });
- console.log(animation.animations[0].tweens[0].from);
- }
- function mouseleave() {
- var animation = anime({
- targets: this,
- scale: 1
- });
- console.log(animation.animations[0].tweens[0].from);
- }
+ // 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',
- // scale: 1.5,
- // duration: 1000
+ // translateX: 1000,
+ // easing: 'easeOutElastic'
// })
- // var animation = anime({
- // targets: '.color-03',
- // scale: 2,
- // translateX: 100,
- // translateY: 50,
- // rotate: 50,
- // skew: 45,
- // duration: 3000,
- // autoplay: false
- // });
-
- anime.timeline({
- targets: '.color-02',
- easing: 'easeInOutSine',
- loop: true,
- direction: 'alternate'
- }).add({
- translateX: 300
- }).add({
- translateY: 300
- }).add({
- rotate: 360
- }).add({
- scale: 0
- })
-
- var el01 = document.querySelector('.color-01');
- el01.addEventListener('mouseenter', mouseenter, false);
- el01.addEventListener('mouseleave', mouseleave, false);
</script>
</body>
</html>
\ No newline at end of file
diff --git a/documentation/examples/anime-infinite-animation.html b/documentation/examples/anime-infinite-animation.html
new file mode 100644
index 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-mgs-logo-animation.html b/documentation/examples/anime-mgs-logo-animation.html
index 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.html
index 7a4c10da..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.2.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,19 +27,22 @@
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;
- top: 50%;
- left: 50%;
- border-radius: 50%;
+ width: 1px;
+ height: 10em;
+ margin-left: 1px;
+ transform-origin: 50 50%;
}
</style>
</head>
@@ -46,43 +50,46 @@
<script>
var numberOfEls = 500;
- var duration = 1500;
+ 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 = 180 + Math.round(90 / numberOfEls * i);
- var angle = anime.random(-360, 360);
+ var hue = 10 + Math.round(40 / numberOfEls * i);
var el = document.createElement('div');
el.classList.add('particule');
- el.style.backgroundColor = 'hsl(' + hue + ', 100%, 40%)';
- el.style.width = '25px';
- el.style.height = '25px';
+ el.style.backgroundColor = 'hsl(' + hue + ', 100%, 50%)';
+ el.style.transform = 'rotate(' + i * 1 + 'deg) translateX(100px)';
+
+ document.body.appendChild(el);
+
anime({
targets: el,
- rotate: [angle, angle],
- translateX: window.innerWidth * .65,
- // rotate: [anime.random(-360, 360), anime.random(-360, 360)],
- scale: {
- value: [0, 1],
- duration: 100,
- endDelay: duration
- },
- delay: (duration / numberOfEls) * i,
- endDelay: (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: 'easeInQuad',
- direction: 'reverse',
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.html
index 1305e9c7..43402599 100644
--- a/documentation/examples/anime-staggered-animations-02.html
+++ b/documentation/examples/anime-staggered-animations-02.html
@@ -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-states.html b/documentation/examples/anime-states.html
new file mode 100644
index 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 file
diff --git a/documentation/examples/anime-tests.html b/documentation/examples/anime-tests.html
index 1a5e65ba..5377b5fa 100644
--- a/documentation/examples/anime-tests.html
+++ b/documentation/examples/anime-tests.html
@@ -37,14 +37,60 @@
</style>
</head>
<body>
+<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>
- var tl = anime.timeline();
- tl.add({
- translateX: 100
+ 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
+ });
+ anime({
+ targets: '.color-03',
+ duration: 500,
+ width: 400,
+ height: 200,
+ scale: {
+ value: 2,
+ duration: 700
+ },
+ loop: true
+ });
+ 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 file
diff --git a/documentation/examples/anime-timeline-stresstest.html b/documentation/examples/anime-timeline-stresstest.html
new file mode 100644
index 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.html
index 25df225c..2bea64ab 100644
--- a/documentation/examples/anime-timeline.html
+++ b/documentation/examples/anime-timeline.html
@@ -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,223 +84,79 @@
<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: false
- });
-
- 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: false
- });
-
- 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: false
- });
-
- absoluteOffset
- .add({
- targets: '.absolute-offset',
- translateX: -100,
- translateY: -100,
- scale: 2,
- background: '#FF1461',
- }, 0)
- .add({
- targets: '.absolute-offset',
- translateX: -100,
- translateY: 100,
- scale: 3,
- background: '#18FF92',
- }, 1000)
- .add({
- targets: '.absolute-offset',
- translateX: 100,
- translateY: 100,
- rotate: 120,
- scale: 4,
- background: '#5A87FF',
- }, 2000)
- .add({
- targets: '.absolute-offset',
- translateX: 100,
- translateY: -100,
- scale: 5,
- background: '#FBF38C',
- }, 3000)
- .add({
- targets: '.absolute-offset',
- translateX: 100,
- translateY: -100,
- scale: '+=8',
- background: '#FBF38C',
- }), 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', '.multiple-targets-02', '.multiple-targets-03', '.multiple-targets-04'],
- 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-01', '.multiple-targets-02', '.multiple-targets-03', '.multiple-targets-04'],
- translateY: -100,
- scale: 8,
- background: '#18FF92',
- duration: 500,
- begin: function() { console.log('multipleTargets animation 2 began')},
- complete: function() { console.log('multipleTargets animation 2 completed')}
- }, '-=250')
- .add({
- targets: ['.multiple-targets-01', '.multiple-targets-02', '.multiple-targets-03', '.multiple-targets-04'],
- translateY: -100,
- scale: 8,
- background: '#5A87FF',
- duration: 500,
- begin: function() { console.log('multipleTargets animation 3 began')},
- complete: function() { console.log('multipleTargets animation 3 completed')}
- }, '-=250')
- .add({
- targets: ['.multiple-targets-01', '.multiple-targets-02', '.multiple-targets-03', '.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')}
- }, '-=250')
- .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')}
- }, '-=250');
+ 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> -->
diff --git a/documentation/examples/img/sprite-example.png b/documentation/examples/img/sprite-example.png
new file mode 100644
index 00000000..d556af8d
Binary files /dev/null and b/documentation/examples/img/sprite-example.png differ
diff --git a/documentation/examples/anime-DOM-stress-test-02.html b/documentation/examples/transforms-animation.html
similarity index 50%
rename from documentation/examples/anime-DOM-stress-test-02.html
rename to documentation/examples/transforms-animation.html
index 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.html
index 01de1e3e..9f553a33 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="../lib/anime.min.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,224 +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: ['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-content">
-<div class="square shadow"></div>
-<div class="square el"></div>
+ <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 = anime({
- targets: '#endDelay .el',
+ <script>var endDelay = function() {
+/*DEMO*/
+anime({
+ targets: '.end-delay-demo .el',
translateX: 250,
endDelay: 1000,
direction: 'alternate'
});
-</script>
+/*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
@@ -318,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 250
delay: 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');
},
@@ -719,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>
-<script>var keyframes = anime({
- targets: '#keyframes .el',
+ <div class="demo-content keyframes-demo">
+ <div class="circle shadow"></div>
+ <div class="circle el keyframes"></div>
+ </div>
+ <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 },
@@ -758,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>
@@ -826,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>
@@ -953,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',
@@ -962,35 +1813,49 @@ timelineParameters
loop: 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>
@@ -1008,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>
@@ -1042,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>
@@ -1074,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>
-</div>
+ <script>
-<div id="seekAnim" class="demo controls">
+ var reverseAnimDemo = anime({
+ targets: '.reverse-anim-demo .el',
+ translateX: 250,
+ duration: 2000,
+ delay: function(el, i) { return i * 200; }
+ });
+
+ 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>
@@ -1108,316 +2014,628 @@ 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');
-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'
+});
-</script>
+animation.states.moved = {
+ translateX: 250
+}
+
+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>
@@ -1426,10 +2644,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'),
@@ -1437,13 +2657,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)">
@@ -1456,10 +2686,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' }
@@ -1468,27 +2703,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,
@@ -1496,386 +2757,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),
@@ -1884,8 +3357,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/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/index.html b/index.html
index ad65889b..e6e90fa0 100644
--- a/index.html
+++ b/index.html
@@ -156,7 +156,7 @@
ga('create', 'UA-79927007-1', 'auto');
ga('send', 'pageview');
</script>
- <script src="anime.min.js"></script>
+ <script src="lib/anime.min.js"></script>
<script src="documentation/assets/js/fireworks.js"></script>
<script src="documentation/assets/js/site.js"></script>
</body>