Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update documentation layout

Julian Garnier92802576c8fd
diff --git a/documentation/assets/css/documentation.css b/documentation/assets/css/documentation.css
index 0daa6982..29d362c9 100644
--- a/documentation/assets/css/documentation.css
+++ b/documentation/assets/css/documentation.css
@@ -87,13 +87,16 @@ header {
}
.logo, h2 {
- opacity: .6;
font-size: 22px;
letter-spacing: 2px;
text-transform: uppercase;
font-weight: 200;
}
+.logo {
+ opacity: .6;
+}
+
.logo:hover {
opacity: 1;
}
@@ -204,91 +207,70 @@ header {
color: currentColor;
}
-/* Code */
+/* Info pane */
-.code-examples {
- width: 50%;
+.demo-info {
flex-direction: column;
+ width: 50%;
+ 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 rgba(0,0,0,.25);
-}
-
-.code-pane-description { height: 40%; }
-.code-pane-js { height: 40%; }
-.code-pane-html { height: 20%; }
-
-.code-header {
- position: absolute;
- z-index: 0;
- top: -60px;
-}
-
-.gutter {
- cursor: ns-resize;
- transition: background-color .25s ease;
-}
-
-.gutter:hover {
- background-color: rgba(255,255,255,.05)
-}
-
-.gutter {
- z-index: 1;
-}
-
-.code-pane-description .code-header {
top: 0;
+ width: 100%;
+ height: calc(100% - 60px);
+ padding: 20px;
}
-pre {
+.demo-info pre {
font-variant-ligatures: none;
-webkit-font-variant-ligatures: none;
}
-code {
+.demo-info code {
font-family: "Input Mono Reg", "Space Mono", monospace;
font-size: 14px;
line-height: 25px;
white-space: pre-wrap;
}
-.code-pane-description {
- font-size: 15px;
- line-height: 25px;
- color: rgba(255,255,255,.7);
+.demo-info p {
+ margin-bottom: 20px;
}
-.code-pane-description p {
- margin-bottom: 20px;
+.demo-info p,
+.demo-info td {
+ color: rgba(255,255,255,.7);
}
-.code-pane-description i {
+.demo-info i {
font-style: italic;
}
-a[href^="http"]:visited {
+.demo-info a[href^="http"]:visited {
color: currentColor;
}
-p.bubble {
+.demo-info p.bubble {
display: inline-block;
position: relative;
padding: 8px 12px;
}
-p.bubble.warning {
+.demo-info p.bubble.warning {
color: #FBF38C;
}
-p.bubble.info {
+.demo-info p.bubble.info {
color: #61C3FF;
}
-p.bubble:after {
+.demo-info p.bubble:after {
content: "";
pointer-events: none;
color: currentColor;
@@ -303,25 +285,26 @@ p.bubble:after {
opacity: .05;
}
-.code-pane-description code.hljs {
+.demo-info code.hljs {
display: inline-block;
font-size: 14px;
}
-.code-pane-description pre {
+.demo-info pre {
margin-bottom: 20px;
}
-.code-pane-description pre code {
- display: inline-block;
+.demo-info pre code {
position: relative;
+ display: inline-block;
+ width: 100%;
padding: 8px 12px;
background-color: rgba(0,0,0,.2);
border: 1px solid rgba(0,0,0,.4);
border-radius: 3px;
}
-.code-pane-description p code {
+.demo-info p code {
position: relative;
padding: 0 2px;
height: 24px;
@@ -330,51 +313,42 @@ p.bubble:after {
border-radius: 3px;
}
-.code-pane-description table {
+.demo-info table {
margin-bottom: 20px;
border: 1px solid #2E2E33;
border-spacing: 0;
border-radius: 3px;
}
-.code-pane-description thead {
+.demo-info thead {
font-weight: 200;
text-transform: uppercase;
letter-spacing: .15em;
color: rgba(255,255,255,.5);
}
-.code-pane-description td {
+.demo-info td {
vertical-align: middle;
padding: 8px 12px;
border-left: 1px solid #2E2E33;
border-top: 1px solid #2E2E33;
- color: currentColor;
}
-.code-pane-description thead td {
+.demo-info thead td {
border-top: none;
}
-.code-pane-description td:first-child {
+.demo-info td:first-child {
border-left: none;
}
-.code-output {
- overflow-x: hidden;
- overflow-y: auto;
- position: relative;
- top: 0;
+.code-preview {
width: 100%;
- height: 100%;
- padding: 20px;
- background-color: rgba(0,0,0,.2);
+ padding-top: 40px;
}
-.code-pane-description .code-output {
- top: 60px;
- height: calc(100% - 60px);
- background-color: rgba(0,0,0,0);
+.code-preview h2 {
+ margin-bottom: 20px;
}
/* Demos */
@@ -412,6 +386,10 @@ article {
cursor: pointer;
}
+.demo-description {
+ display: none;
+}
+
.demo.controls {
padding-top: 50px;
}
@@ -439,34 +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%;
}
-.demo-description {
- display: none;
-}
-
-#penner .demo-content {
- padding: 25px 0;
-}
-
-#timeline .demo-content,
-#motionpath .demo-content {
- padding: 40px 0;
-}
-
.demo-title {
position: absolute;
top: 0;
@@ -492,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;
}
@@ -684,7 +636,6 @@ input.progress[value]::-webkit-slider-thumb {
opacity: .2;
}
-
.small.label {
height: 18px;
padding-left: 28px;
@@ -708,9 +659,7 @@ input.progress[value]::-webkit-slider-thumb {
}
.align-center {
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
+ align-items: center;
}
.add-states-demo .el {
@@ -718,8 +667,7 @@ input.progress[value]::-webkit-slider-thumb {
}
#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/documentation.js b/documentation/assets/js/documentation.js
index 1ef28384..a7f824dc 100644
--- a/documentation/assets/js/documentation.js
+++ b/documentation/assets/js/documentation.js
@@ -1,21 +1,12 @@
var navigationEl = document.querySelector('.navigation');
var demosEl = document.querySelector('.demos');
var articleEls = document.querySelectorAll('article');
-var APIOutputEl = document.querySelector('.api-output');
-var APITitleEl = document.querySelector('.code-pane-description h2');
-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 = [];
-Split(['.code-pane-description', '.code-pane-js', '.code-pane-html'], {
- direction: 'vertical',
- gutterSize: 60,
- snapOffset: 0,
- sizes: [68, 28, 4],
- minSize: [60, 0, 0]
-})
-
function getScrollTop() {
return document.body.scrollTop || document.documentElement.scrollTop;
}
@@ -53,26 +44,34 @@ function parseHTML(el, parentId) {
});
}
-function parseJS(JScode) {
- var split = JScode.split('/*DEMO*/\n');
+function parseJS(demoCode) {
+ var split = demoCode.split('/*DEMO*/\n');
return split[1] || '';
}
-function outputCode(JScode, HTMLcode, title, APIdecription) {
- var js = document.createTextNode(parseJS(JScode));
- var html = document.createTextNode(HTMLcode);
- jsOutputEl.innerHTML = '';
- htmlOutputEl.innerHTML = '';
- jsOutputEl.appendChild(js);
- htmlOutputEl.appendChild(html);
- APIOutputEl.innerHTML = APIdecription;
- APITitleEl.innerHTML = title;
- APIOutputCodeEls = APIOutputEl.querySelectorAll('code');
- for (var i = 0; i < APIOutputCodeEls.length; i++) {
- hljs.highlightBlock(APIOutputCodeEls[i]);
+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]);
}
- hljs.highlightBlock(jsOutputEl);
- hljs.highlightBlock(htmlOutputEl);
}
function toggleSectionLink(ulEl) {
@@ -116,15 +115,15 @@ function resetDemos() {
function createDemo(el) {
var demo = {};
+ var demoColorClass = el.parentNode.classList[0];
var scriptEl = el.querySelector('script');
var demoContentEl = el.querySelector('.demo-content');
var descriptionContentEl = el.querySelector('.demo-description');
- var title = el.querySelector('h3').innerHTML;
+ 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 APIdescription = descriptionContentEl ? descriptionContentEl.innerHTML : '';
+ var demoCode = scriptEl ? scriptEl.innerHTML : '';
+ var demoDescription = descriptionContentEl ? descriptionContentEl.innerHTML : '';
function restart() {
resetDemo();
demoAnim();
@@ -146,7 +145,7 @@ function createDemo(el) {
linkEls[i].parentNode.classList.remove('active');
//d.anim.pause();
}
- outputCode(JScode, HTMLcode, title, APIdescription);
+ outputCode(demoCode, demoTitle, demoDescription, demoColorClass);
var linkEl = document.querySelector('a[href="#'+id+'"]');
var ulEl = linkEl.parentNode.parentNode;
linkEl.parentNode.classList.add('active');
@@ -176,7 +175,7 @@ function createDemo(el) {
resetDemos();
return {
el: el,
- title: title,
+ title: demoTitle,
id: id,
anim: demoAnim,
highlight: highlightDemo
diff --git a/documentation/assets/js/vendors/split.min.js b/documentation/assets/js/vendors/split.min.js
deleted file mode 100644
index 2954e152..00000000
--- a/documentation/assets/js/vendors/split.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! Split.js - v1.3.5 */
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Split=t()}(this,function(){"use strict";var e=window,t=e.document,n="addEventListener",i="removeEventListener",r="getBoundingClientRect",s=function(){return!1},o=e.attachEvent&&!e[n],a=["","-webkit-","-moz-","-o-"].filter(function(e){var n=t.createElement("div");return n.style.cssText="width:"+e+"calc(9px)",!!n.style.length}).shift()+"calc",l=function(e){return"string"==typeof e||e instanceof String?t.querySelector(e):e};return function(u,c){function z(e,t,n){var i=A(y,t,n);Object.keys(i).forEach(function(t){return e.style[t]=i[t]})}function h(e,t){var n=B(y,t);Object.keys(n).forEach(function(t){return e.style[t]=n[t]})}function f(e){var t=E[this.a],n=E[this.b],i=t.size+n.size;t.size=e/this.size*i,n.size=i-e/this.size*i,z(t.element,t.size,this.aGutterSize),z(n.element,n.size,this.bGutterSize)}function m(e){var t;this.dragging&&((t="touches"in e?e.touches[0][b]-this.start:e[b]-this.start)<=E[this.a].minSize+M+this.aGutterSize?t=E[this.a].minSize+this.aGutterSize:t>=this.size-(E[this.b].minSize+M+this.bGutterSize)&&(t=this.size-(E[this.b].minSize+this.bGutterSize)),f.call(this,t),c.onDrag&&c.onDrag())}function g(){var e=E[this.a].element,t=E[this.b].element;this.size=e[r]()[y]+t[r]()[y]+this.aGutterSize+this.bGutterSize,this.start=e[r]()[G]}function d(){var t=this,n=E[t.a].element,r=E[t.b].element;t.dragging&&c.onDragEnd&&c.onDragEnd(),t.dragging=!1,e[i]("mouseup",t.stop),e[i]("touchend",t.stop),e[i]("touchcancel",t.stop),t.parent[i]("mousemove",t.move),t.parent[i]("touchmove",t.move),delete t.stop,delete t.move,n[i]("selectstart",s),n[i]("dragstart",s),r[i]("selectstart",s),r[i]("dragstart",s),n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",r.style.userSelect="",r.style.webkitUserSelect="",r.style.MozUserSelect="",r.style.pointerEvents="",t.gutter.style.cursor="",t.parent.style.cursor=""}function S(t){var i=this,r=E[i.a].element,o=E[i.b].element;!i.dragging&&c.onDragStart&&c.onDragStart(),t.preventDefault(),i.dragging=!0,i.move=m.bind(i),i.stop=d.bind(i),e[n]("mouseup",i.stop),e[n]("touchend",i.stop),e[n]("touchcancel",i.stop),i.parent[n]("mousemove",i.move),i.parent[n]("touchmove",i.move),r[n]("selectstart",s),r[n]("dragstart",s),o[n]("selectstart",s),o[n]("dragstart",s),r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",o.style.userSelect="none",o.style.webkitUserSelect="none",o.style.MozUserSelect="none",o.style.pointerEvents="none",i.gutter.style.cursor=j,i.parent.style.cursor=j,g.call(i)}function v(e){e.forEach(function(t,n){if(n>0){var i=F[n-1],r=E[i.a],s=E[i.b];r.size=e[n-1],s.size=t,z(r.element,r.size,i.aGutterSize),z(s.element,s.size,i.bGutterSize)}})}function p(){F.forEach(function(e){e.parent.removeChild(e.gutter),E[e.a].element.style[y]="",E[e.b].element.style[y]=""})}void 0===c&&(c={});var y,b,G,E,w=l(u[0]).parentNode,D=e.getComputedStyle(w).flexDirection,U=c.sizes||u.map(function(){return 100/u.length}),k=void 0!==c.minSize?c.minSize:100,x=Array.isArray(k)?k:u.map(function(){return k}),L=void 0!==c.gutterSize?c.gutterSize:10,M=void 0!==c.snapOffset?c.snapOffset:30,O=c.direction||"horizontal",j=c.cursor||("horizontal"===O?"ew-resize":"ns-resize"),C=c.gutter||function(e,n){var i=t.createElement("div");return i.className="gutter gutter-"+n,i},A=c.elementStyle||function(e,t,n){var i={};return"string"==typeof t||t instanceof String?i[e]=t:i[e]=o?t+"%":a+"("+t+"% - "+n+"px)",i},B=c.gutterStyle||function(e,t){return n={},n[e]=t+"px",n;var n};"horizontal"===O?(y="width","clientWidth",b="clientX",G="left","paddingLeft"):"vertical"===O&&(y="height","clientHeight",b="clientY",G="top","paddingTop");var F=[];return E=u.map(function(e,t){var i,s={element:l(e),size:U[t],minSize:x[t]};if(t>0&&(i={a:t-1,b:t,dragging:!1,isFirst:1===t,isLast:t===u.length-1,direction:O,parent:w},i.aGutterSize=L,i.bGutterSize=L,i.isFirst&&(i.aGutterSize=L/2),i.isLast&&(i.bGutterSize=L/2),"row-reverse"===D||"column-reverse"===D)){var a=i.a;i.a=i.b,i.b=a}if(!o&&t>0){var c=C(t,O);h(c,L),c[n]("mousedown",S.bind(i)),c[n]("touchstart",S.bind(i)),w.insertBefore(c,s.element),i.gutter=c}0===t||t===u.length-1?z(s.element,s.size,L/2):z(s.element,s.size,L);var f=s.element[r]()[y];return f<s.minSize&&(s.minSize=f),t>0&&F.push(i),s}),o?{setSizes:v,destroy:p}:{setSizes:v,getSizes:function(){return E.map(function(e){return e.size})},collapse:function(e){if(e===F.length){var t=F[e-1];g.call(t),o||f.call(t,t.size-t.bGutterSize)}else{var n=F[e];g.call(n),o||f.call(n,n.aGutterSize)}},destroy:p}}});
\ No newline at end of file
diff --git a/documentation/index.html b/documentation/index.html
index a1be24ac..28375e20 100644
--- a/documentation/index.html
+++ b/documentation/index.html
@@ -3315,7 +3315,6 @@ var customRAF = null;
var tick = function() {
if (customRAF) cancelAnimationFrame(customRAF);
/*DEMO*/
-
var animation = anime({
targets: '.tick-demo .el',
translateX: 250,
@@ -3341,25 +3340,11 @@ requestAnimationFrame(loop);
<!-- -->
</section>
- <section class="pane code-examples">
- <div class="code-pane code-pane-description">
- <header class="code-header">
- <h2><span></span></h2>
- </header>
- <div class="code-output"><div class="api-output"></div></div>
- </div>
- <div class="code-pane code-pane-js">
- <header class="code-header is-draggable">
- <h2>JS Example</h2>
- </header>
- <pre class="code-output"><code class="js-output"></code></pre>
- </div>
- <div class="code-pane code-pane-html">
- <header class="code-header is-draggable">
- <h2>HTML Example</h2>
- </header>
- <pre class="code-output"><code class="html-output"></code></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>
@@ -3371,7 +3356,6 @@ requestAnimationFrame(loop);
ga('create', 'UA-79927007-1', 'auto');
ga('send', 'pageview');
</script>
- <script src="assets/js/vendors/split.min.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>