Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update documentation

Julian Garnier7bf56454d9c5
diff --git a/documentation/assets/js/documentation.js b/documentation/assets/js/documentation.js
index c54beba4..9074b5b1 100644
--- a/documentation/assets/js/documentation.js
+++ b/documentation/assets/js/documentation.js
@@ -129,7 +129,13 @@ function createDemo(el) {
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');
@@ -146,11 +152,11 @@ function createDemo(el) {
el.classList.add('active');
scrollTo('#'+id, 60, function() {
toggleSectionLink(ulEl);
- if (!el.classList.contains('controls')) restart();
+ if (canRestart) restart();
});
if (push) history.pushState(null, null, '#'+id);
} else {
- if (!el.classList.contains('controls')) restart();
+ if (canRestart) restart();
}
}
function enterDemo() {
diff --git a/documentation/index.html b/documentation/index.html
index fe69d9d9..5e0a78c8 100644
--- a/documentation/index.html
+++ b/documentation/index.html
@@ -1904,7 +1904,7 @@ seekProgressEl.oninput = function() {
</div>
-<div id="TLcontrols" class="demo controls">
+<div id="TLcontrols" class="demo">
<h3 class="demo-title">Timeline controls</h3>
<div class="demo-description">
<p>Timelines can be controled like any other anime instance</p>
@@ -1961,7 +1961,6 @@ document.querySelector('.timeline-controls-demo .pause').onclick = tl.pause;
document.querySelector('.timeline-controls-demo .restart').onclick = tl.restart;
controlsProgressEl.addEventListener('input', function() {
- console.log('seek');
tl.seek(tl.duration * (controlsProgressEl.value / 100));
});
/*DEMO*/
@@ -1972,6 +1971,12 @@ controlsProgressEl.addEventListener('input', function() {
<div id="animStates" class="demo controls">
<h3 class="demo-title">States</h3>
+ <div class="demo-description">
+ <p>
+ You can add states to your animations.<br>
+ Each states inherit the first animation parameters but can be overrided.
+ </p>
+ </div>
<div class="demo-content">
<div class="line">
<div class="square shadow"></div>