JavaScript animation engine
Clean up examples
Julian Garnierab52ef76c251
diff --git a/examples/dom-performance-test.html b/examples/1000-DOM-elements.htmlsimilarity index 74%rename from examples/dom-performance-test.htmlrename to examples/1000-DOM-elements.htmlindex a12aaeb4..49132239 100644--- a/examples/dom-performance-test.html+++ b/examples/1000-DOM-elements.html@@ -1,11 +1,11 @@<!DOCTYPE html><html><head>- <title>DOM Performances test | anime.js</title>+ <title>1000 DOM elements animations | anime.js</title><meta charset="utf-8">- <link href="../assets/css/styles.css" rel="stylesheet">- <script src="../assets/js/stats.min.js"></script>- <script src="../../anime.js"></script>+ <link rel="icon" type="image/png" href="assets/img/favicon.png" />+ <link href="assets/css/styles.css" rel="stylesheet">+ <script src="../anime.js"></script><style>.particule {@@ -25,15 +25,11 @@<body></body><script>- var stats = new Stats();- stats.showPanel(0);- document.body.appendChild(stats.dom);-var maxElements = 1000;var duration = 3000;var toAnimate = [];var w = window.innerWidth > window.innerHeight ? window.innerWidth : window.innerHeight;- var colors = ['#5E89FB', '#B1FF92', '#FB0B5A', '#FFC073'];+ var colors = ['#FF1461', '#18FF92', '#5A87FF', '#FBF38C'];var createElements = (function() {var fragment = document.createDocumentFragment();@@ -64,13 +60,6 @@toAnimate.forEach(animate);- anime({- update: function() {- stats.begin();- stats.end();- },- duration: Infinity- });-</script>+ <script src="assets/js/stats.js"></script></html>diff --git a/examples/anime-logo-animation.html b/examples/anime-logo-animation.htmlindex d81a19a6..c26c69c2 100644--- a/examples/anime-logo-animation.html+++ b/examples/anime-logo-animation.html@@ -3,53 +3,10 @@<head><title>Anime logo animation | anime.js</title><meta charset="utf-8">- <link href="../assets/css/styles.css" rel="stylesheet">- <script src="../../anime.js"></script>+ <link rel="icon" type="image/png" href="assets/img/favicon.png" />+ <link href="assets/css/styles.css" rel="stylesheet">+ <script src="../anime.js"></script><style>- body {- letter-spacing: 1px;- text-align: center;- }- .info {- position: absolute;- z-index: 1;- width: 100%;- height: 180px;- top: 50%;- margin-top: 20px;- }- .info p {- opacity: 0;- font-size: 16px;- margin: 0 20px 30px 20px;- }- .credits {- color: rgba(255,255,255,.6);- }- .credits a {- text-decoration: none;- color: inherit;- }- .credits a:hover {- text-decoration: underline;- color: rgba(255,255,255,1);- }- .link {- opacity: 0;- display: inline-block;- margin: 0 10px 30px 10px;- padding: 10px 20px;- border-radius: 2px;- line-height: 20px;- text-decoration: none;- color: white;- }- .link.white {- border: 1px solid rgba(255,255,255,1);- }- .link.blue {- background-color: #5E89FB;- }.logo-animation {display: flex;align-items: center;@@ -68,7 +25,7 @@position: relative;width: 162px;height: 162px;- /*mix-blend-mode: lighten;*/+ mix-blend-mode: lighten;}.letter:not(:first-child) {margin-left: -42px;@@ -115,16 +72,6 @@.icon-text polygon {opacity: 0;}- .player {- display: none;- position: fixed;- top: 0;- left: 0;- width: 100%;- }- .player .progress {- width: calc(100% - 200px);- }</style></head><body>@@ -153,7 +100,7 @@</div><div class="letter letter-i"><svg viewBox="0 0 82 162">- <g fill="none" fill-rule="evenodd" stroke="#B1FF92">+ <g fill="none" fill-rule="evenodd" stroke="#18FF92"><path class="fill in" stroke-width="40" d="M21 61v20a60 60 0 0 0 60 60"/><path class="fill out" stroke-width="40" d="M81 141a60 60 0 0 1-60-60V61"/><path class="line out" stroke-width="2" d="M81 121a40 40 0 0 1-40-40V61H1v20a80 80 0 0 0 80 80v-40z"/>@@ -183,7 +130,7 @@</div><div class="letter letter-e"><svg viewBox="0 0 162 162">- <g fill="none" fill-rule="evenodd" stroke="#B1FF92">+ <g fill="none" fill-rule="evenodd" stroke="#18FF92"><path class="fill in" stroke-width="40" d="M81 101h60V81c-1-33.14-26.86-60-60-60a60 60 0 1 0 0 120"/><path class="fill out" stroke-width="40" d="M81 141a60 60 0 1 1 0-120c33.14 0 59 26.86 60 60v20H81"/><path class="line out" stroke-width="2" d="M81 81v40h80V80.7C159.66 36.27 124.8 1 81 1a80 80 0 1 0 0 160v-40a40 40 0 1 1 0-80c21.6 0 39.01 17.42 39.99 40H81z"/>@@ -196,7 +143,7 @@<g fill="none" fill-rule="evenodd" stroke-width="2" transform="translate(1 1)"><path stroke="#FF1554" d="M0 16a80.88 80.88 0 0 1 44 44"/><path class="icon-line" stroke="#5E89FB" d="M4 0h54a2 2 0 0 1 2 2.01V58A2 2 0 0 1 58 60H2a2 2 0 0 1-2-2.01V2A2 2 0 0 1 2 0h2z"/>- <rect width="40" height="40" x="10" y="10" stroke="#B1FF92" rx="20"/>+ <rect width="40" height="40" x="10" y="10" stroke="#18FF92" rx="20"/></g></svg></div>@@ -228,23 +175,8 @@</div></div></div>- <div class="info">- <p class="tagline">~10 kB JavasScript animation library</p>- <a class="link white" href="#">Examples on<br>CodePen</a>- <a class="link blue" href="#">Examples on<br>GitHub</a>- <p class="credits"><span class="date"></span> © <a href="juliangarnier.com">Julian Garnier</a></p>- </div>- <div class="player">- <button class="play">PLAY</button>- <button class="pause">PAUSE</button>- <button class="restart">RESTART</button>- <input class="progress" type="range" value="0" min="0" max="100" step=".001">- </div><script>- var dateEl = document.querySelector('.date');- dateEl.innerHTML = ('2016 - ' + (new Date()).getFullYear());-var dotE = anime({targets: '.dot-e',translateX: [@@ -353,40 +285,14 @@delay: function(el, i, t) { return 4200 + ( i * 20 ); }});- var infoBlock = anime({- targets: ['.logo-icon', '.tagline', '.white', '.blue', '.credits'],- translateY: '-40px',- opacity: 1,- easing: 'easeOutExpo',- duration: 2200,- delay: function(el, i, t) { return 5000 + ( (t - i) * 100 ); }- });-- var singlePlayButton = document.querySelector('.play');- var singlePauseButton = document.querySelector('.pause');- var singleRestartButton = document.querySelector('.restart');- var singleProgressEl = document.querySelector('.progress');-var logoAnimation = anime.timeline({loop: false,- autoplay: true,- update: function(anim) {- singleProgressEl.value = anim.progress;- }- });-- anime.speed = 1;-- logoAnimation.add([dotE, dotI, fillsIn, fillsOut, linesOut, icon, iconLine, iconText, infoBlock]);-- singlePlayButton.addEventListener('click', function() { logoAnimation.play(); });- singlePauseButton.addEventListener('click', function() { logoAnimation.pause(); });- singleRestartButton.addEventListener('click', function() { logoAnimation.restart(); });- singleProgressEl.addEventListener('input', function() {- logoAnimation.seek(logoAnimation.duration * (singleProgressEl.value / 100));+ autoplay: true});+ logoAnimation.add([dotE, dotI, fillsIn, fillsOut, linesOut, icon, iconLine, iconText]);</script>+ <script src="assets/js/stats.js"></script></body></html>diff --git a/examples/anime-mgs-logo-animation.html b/examples/anime-mgs-logo-animation.htmlnew file mode 100644index 00000000..c02988ac--- /dev/null+++ b/examples/anime-mgs-logo-animation.html@@ -0,0 +1,238 @@+<!DOCTYPE html>+<html>+<head>+ <title>Anime MGS logo animation | anime.js</title>+ <meta charset="utf-8">+ <link rel="icon" type="image/png" href="assets/img/favicon.png" />+ <link href="assets/css/styles.css" rel="stylesheet">+ <script src="../anime.js"></script>+ <style>++ html,+ body {+ background-color: black;+ }++ section {+ position: absolute;+ width: 100%;+ height: 100%;+ display: flex;+ justify-content: center;+ }++ .logo { margin: auto; }+ .vert { transform-origin: center bottom; }+ .hori { transform-origin: 0% 50%; }+ .diag-left { transform-origin: 100% 100%; }+ .diag-right { transform-origin: 100% 0%; }++ </style>+</head>+<body>+ <section>+ <svg class="logo" width="100%" height="448" viewBox="0 0 1024 448">+ <g class="stripes" transform="translate(321.000000, 160.000000)" fill="#FFF">+ <path d="M8,20 L12,16 L92,16 L88,20 L8,20 L8,20 L8,20 L8,20 Z" class="stripe stripe-left"></path>+ <path d="M4,24 L0,28 L80,28 L84,24 L4,24 L4,24 L4,24 L4,24 Z" class="stripe stripe-left"></path>+ <path d="M16,12 L20,8 L100,8 L96,12 L16,12 L16,12 L16,12 L16,12 Z" class="stripe stripe-left"></path>+ <path d="M24,4 L28,0 L108,7.10542736e-15 L104,4 L24,4 L24,4 L24,4 L24,4 Z" class="stripe stripe-left"></path>+ </g>+ <g class="stripes" transform="translate(592.000000, 160.000000)" fill="#FFF">+ <path d="M8,20 L12,16 L92,16 L88,20 L8,20 L8,20 L8,20 L8,20 Z" class="stripe stripe-right"></path>+ <path d="M4,24 L0,28 L80,28 L84,24 L4,24 L4,24 L4,24 L4,24 Z" class="stripe stripe-right"></path>+ <path d="M16,12 L20,8 L100,8 L96,12 L16,12 L16,12 L16,12 L16,12 Z" class="stripe stripe-right"></path>+ <path d="M24,4 L28,0 L108,7.10542736e-15 L104,4 L24,4 L24,4 L24,4 L24,4 Z" class="stripe stripe-right"></path>+ </g>+ <g class="katakana" transform="translate(202.000000, 128.000000)" fill="#FFF">+ <path d="M55,33 L56,32 L136,32 L135,33 L55,33 Z" data-d="M0,92 L60,32 L140,32 L80,92 L0,92 Z"></path>+ <path d="M28,28 L29,28 L1,0 L0,0 L28,28 Z" data-d="M32,28 L230,28 L202,0 L4,0 L32,28 Z"></path>+ <path d="M232,28 L204,0 L205,0 L233,28 L232,28 Z" data-d="M236,28 L208,0 L388,0 L416,28 L236,28 Z"></path>+ <path d="M169,92 L197,64 L199,64 L171,92 L169,92 Z" data-d="M173,92 L201,64 L381,64 L353,92 L173,92 Z"></path>+ <path d="M435,92 L355,92 L356,91 L436,91 L435,92 Z" data-d="M439,92 L359,92 L387,64 L467,64 L439,92 Z"></path>+ <path d="M497,28 L498,28 L470,0 L469,0 L497,28 Z" data-d="M422,28 L502,28 L474,0 L394,0 L422,28 Z"></path>+ <path d="M476,65 L556,65 L555,64 L475,64 L476,65 Z" data-d="M507,92 L587,92 L559,64 L479,64 L507,92 Z"></path>+ <path d="M554,59 L553,60 L473,60 L474,59 L554,59 Z" data-d="M617,0 L557,60 L477,60 L537,0 L617,0 Z"></path>+ </g>+ <g class="text-fills" transform="translate(128.000000, 240.000000)" fill="#FFF">+ <path d="M0,48 L0,68 L16,84 L96,84 L112,68 L112,16 L96,0 L20,0 L0,20 L92,20 L92,64 L20,64 L20,52 L60,52 L80,32 L16,32 L0,48 Z" id="a"></path>+ <path d="M216,84 L236,84 L236,16 L220,0 L140,0 L124,16 L124,84 L144,84 L144,20 L216,20 L216,84 L216,84 Z" id="n"></path>+ <path d="M248,0 L268,0 L268,84 L248,84 L248,0 Z" id="i"></path>+ <path d="M300,20 L300,84 L280,84 L280,16 L296,0 L408,0 L424,16 L424,84 L404,84 L404,20 L362,20 L362,84 L342,84 L342,20 L300,20 Z" id="m"></path>+ <path d="M548,36 L548,16 L532,2.55795385e-13 L452,2.4158453e-13 L436,16 L436,68 L452,84 L528,84 L548,64 L456,64 L456,20 L528,20 L528,32 L488,32 L468,52 L532,52 L548,36 L548,36 Z" id="e"></path>+ <path d="M562,64 L582,84 L626,84 L642,68 L642,0 L622,0 L622,64 L562,64 Z" id="j"></path>+ <path d="M674,20 L766,20 L746,0 L670,0 L654,16 L654,36 L670,52 L746,52 L746,64 L654,64 L674,84 L750,84 L766,68 L766,48 L750,32 L674,32 L674,20 Z" id="s"></path>+ </g>+ <g stroke="#FFF" stroke-width="2" fill="none" fill-rule="evenodd">+ <path d="M148,292 L148,304" class="line vert" stroke-linecap="square"></path>+ <path d="M128,288 L128,308" class="line vert" stroke-linecap="square"></path>+ <path d="M148,240 L128,260" class="line diag-right"></path>+ <path d="M128,308 L144,324" class="line diag-left"></path>+ <path d="M144,272 L128,288" class="line diag-right"></path>+ <path d="M148,240 L224,240" class="line hori" stroke-linecap="square"></path>+ <path d="M144,272 L208,272" class="line hori" stroke-linecap="square"></path>+ <path d="M148,292 L188,292" class="line hori" stroke-linecap="square"></path>+ <path d="M148,304 L220,304" class="line hori" stroke-linecap="square"></path>+ <path d="M144,324 L224,324" class="line hori" stroke-linecap="square"></path>+ <path d="M129,260 L220,260" class="line hori" stroke-linecap="square"></path>+ <path d="M208,272 L188,292" class="line diag-right"></path>+ <path d="M220,260 L220,304" class="line vert" stroke-linecap="square"></path>+ <path d="M224,240 L240,256" class="line diag-left"></path>+ <path d="M240,308 L224,324" class="line diag-right"></path>+ <path d="M240,256 L240,308" class="line vert" stroke-linecap="square"></path>+ <path d="M252,256 L252,324" class="line vert" stroke-linecap="square"></path>+ <path d="M268,240 L252,256" class="line diag-right"></path>+ <path d="M252,324 L272,324" class="line hori" stroke-linecap="square"></path>+ <path d="M272,260 L272,324" class="line vert" stroke-linecap="square"></path>+ <path d="M268,240 L348,240" class="line hori" stroke-linecap="square"></path>+ <path d="M272,260 L344,260" class="line hori" stroke-linecap="square"></path>+ <path d="M344,260 L344,324" class="line vert" stroke-linecap="square"></path>+ <path d="M348,240 L364,256" class="line diag-left"></path>+ <path d="M344,324 L364,324" class="line hori" stroke-linecap="square"></path>+ <path d="M364,256 L364,324" class="line vert" stroke-linecap="square"></path>+ <path d="M376,240 L376,324" class="line vert" stroke-linecap="square"></path>+ <path d="M376,324 L396,324" class="line hori" stroke-linecap="square"></path>+ <path d="M376,240 L396,240" class="line hori" stroke-linecap="square"></path>+ <path d="M396,240 L396,324" class="line vert" stroke-linecap="square"></path>+ <path d="M408,256 L408,324" class="line vert" stroke-linecap="square"></path>+ <path d="M424,240 L408,256" class="line diag-right"></path>+ <path d="M408,324 L428,324" class="line hori" stroke-linecap="square"></path>+ <path d="M428,261 L428,323" class="line vert" stroke-linecap="square"></path>+ <path d="M424,240 L536,240" class="line hori" stroke-linecap="square"></path>+ <path d="M428,260 L470,260" class="line hori" stroke-linecap="square"></path>+ <path d="M470,261 L470,323" class="line vert" stroke-linecap="square"></path>+ <path d="M470,324 L490,324" class="line hori" stroke-linecap="square"></path>+ <path d="M490,261 L490,323" class="line vert" stroke-linecap="square"></path>+ <path d="M490,260 L532,260" class="line hori" stroke-linecap="square"></path>+ <path d="M532,261 L532,323" class="line vert" stroke-linecap="square"></path>+ <path d="M536,240 L552,256" class="line diag-left"></path>+ <path d="M532,324 L552,324" class="line hori" stroke-linecap="square"></path>+ <path d="M552,256 L552,324" class="line vert" stroke-linecap="square"></path>+ <path d="M564,256 L564,308" class="line vert" stroke-linecap="square"></path>+ <path d="M564,308 L580,324" class="line diag-left"></path>+ <path d="M580,240 L564,256" class="line diag-right"></path>+ <path d="M584,260 L584,304" class="line vert" stroke-linecap="square"></path>+ <path d="M616,272 L596,292" class="line diag-right"></path>+ <path d="M580,240 L660,240" class="line hori" stroke-linecap="square"></path>+ <path d="M584,260 L656,260" class="line hori" stroke-linecap="square"></path>+ <path d="M580,324 L656,324" class="line hori" stroke-linecap="square"></path>+ <path d="M596,292 L660,292" class="line hori" stroke-linecap="square"></path>+ <path d="M616,272 L656,272" class="line hori" stroke-linecap="square"></path>+ <path d="M656,260 L656,272" class="line vert" stroke-linecap="square"></path>+ <path d="M660,240 L676,256" class="line diag-left"></path>+ <path d="M676,304 L656,324" class="line diag-right"></path>+ <path d="M676,276 L660,292" class="line diag-right"></path>+ <path d="M584,304 L676,304" class="line hori" stroke-linecap="square"></path>+ <path d="M676,256 L676,276" class="line vert" stroke-linecap="square"></path>+ <path d="M690,304 L710,324" class="line diag-left"></path>+ <path d="M690,304 L750,304" class="line hori" stroke-linecap="square"></path>+ <path d="M710,324 L754,324" class="line hori" stroke-linecap="square"></path>+ <path d="M750,240 L750,304" class="line vert" stroke-linecap="square"></path>+ <path d="M770,308 L754,324" class="line diag-right"></path>+ <path d="M750,240 L770,240" class="line hori" stroke-linecap="square"></path>+ <path d="M770,240 L770,308" class="line vert" stroke-linecap="square"></path>+ <path d="M782,256 L782,276" class="line vert" stroke-linecap="square"></path>+ <path d="M782,276 L798,292" class="line diag-left"></path>+ <path d="M782,304 L802,324" class="line diag-left"></path>+ <path d="M798,240 L782,256" class="line diag-right"></path>+ <path d="M802,260 L802,272" class="line vert" stroke-linecap="square"></path>+ <path d="M798,240 L874,240" class="line hori" stroke-linecap="square"></path>+ <path d="M802,272 L878,272" class="line hori" stroke-linecap="square"></path>+ <path d="M802,324 L878,324" class="line hori" stroke-linecap="square"></path>+ <path d="M798,292 L874,292" class="line hori" stroke-linecap="square"></path>+ <path d="M782,304 L874,304" class="line hori" stroke-linecap="square"></path>+ <path d="M874,292 L874,304" class="line vert" stroke-linecap="square"></path>+ <path d="M878,272 L894,288" class="line diag-left"></path>+ <path d="M874,240 L894,260" class="line diag-left"></path>+ <path d="M894,308 L878,324" class="line diag-right"></path>+ <path d="M802,260 L894,260" class="line hori" stroke-linecap="square"></path>+ <path d="M894,288 L894,308" class="line vert" stroke-linecap="square"></path>+ </g>+ </svg>+ </section>+ <script>++ var katakanaStripes = anime({+ targets: '.stripes path',+ translateX: [-1000, 0],+ opacity: {+ value: 1,+ duration: 100+ },+ fill: '#F9C100',+ delay: (el, i) => 2200 + (i * 75),+ duration: 400,+ easing: 'easeOutExpo'+ });++ var katakanaFills = anime({+ targets: '.katakana path',+ d: (el) => el.getAttribute('data-d'),+ opacity: {+ value: [0, 1],+ duration: 100+ },+ fill: '#F9C100',+ delay: (el, i) => 2400 + (i * 120),+ duration: 1200,+ easing: 'easeOutCirc'+ });++ var textFills = anime({+ targets: '.text-fills path',+ opacity: [0, 1],+ fill: '#F9C100',+ easing: 'easeOutExpo',+ duration: 200,+ delay: (t, i) => 3300 + (anime.random(0, 450)),+ complete: function() {+ anime({+ targets: '.line',+ opacity: 0,+ duration: 1500+ })+ }+ });++ var textPaths = anime({+ targets: '.line',+ translateX: (target) => {+ let x = 1200;+ let translate;+ if (target.classList.contains('hori')) translate = anime.random(0, 1) ? x : -x;+ if (target.classList.contains('diag-right') || target.classList.contains('diag-left')) translate = x / 3;+ return [translate, 0];+ },+ translateY: (target) => {+ let y = 1200;+ let translate;+ if (target.classList.contains('vert')) translate = anime.random(0, 1) ? y : -y;+ if (target.classList.contains('diag-right')) translate = -y / 3;+ if (target.classList.contains('diag-left')) translate = y / 3;+ return [translate, 0];+ },+ scale: {+ value: [6, 1],+ duration: 500,+ },+ stroke: '#F9C100',+ opacity: {+ value: [0, 1],+ duration: 100,+ },+ delay: (t, i) => (i * 25),+ duration: 500,+ easing: 'easeOutQuart'+ });++ var logoAnimation = anime.timeline({+ direction: 'alternate',+ loop: true+ });++ logoAnimation.add([katakanaStripes, katakanaFills, textFills, textPaths]);++ </script>+ <script src="assets/js/stats.js"></script>+</body>+</html>diff --git a/examples/assets/css/styles.css b/examples/assets/css/styles.cssnew file mode 100644index 00000000..7e7eecd4--- /dev/null+++ b/examples/assets/css/styles.css@@ -0,0 +1,34 @@+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}++* {+ margin: 0;+ padding: 0;+ box-sizing: border-box;+}++html,+body {+ background-color: #17151C;+}++body {+ position: absolute;+ width: 100%;+ height: 100%;+ color: white;+ font-family: sans-serif;+ -webkit-font-smoothing: antialiased;+}++.color-01 { color: #FF1461; } /* Red */+.color-02 { color: #FF7C72; } /* Orange */+.color-03 { color: #FBF38C; } /* Yellow */+.color-04 { color: #A6FF8F; } /* Citrus */+.color-05 { color: #18FF92; } /* Green */+.color-06 { color: #1CE2B2; }+.color-07 { color: #5EF3FB; }+.color-08 { color: #61C3FF; }+.color-09 { color: #5A87FF; } /* Blue */+.color-10 { color: #B08CFF; }+.color-11 { color: #FB89FB; }+.color-12 { color: #FF48AB; }diff --git a/examples/assets/img/favicon.png b/examples/assets/img/favicon.pngnew file mode 100644index 00000000..b0a48cefBinary files /dev/null and b/examples/assets/img/favicon.png differdiff --git a/examples/assets/js/stats.js b/examples/assets/js/stats.jsnew file mode 100644index 00000000..1407abae--- /dev/null+++ b/examples/assets/js/stats.js@@ -0,0 +1,17 @@+// 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});++var stats = new Stats();+stats.showPanel(0);+document.body.appendChild(stats.dom);++anime({+ update: function() {+ stats.begin();+ stats.end();+ },+ duration: Infinity+});