Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update tests examples

Julian Garnier05b17a493bdf
diff --git a/documentation/examples/anime-DOM-stress-test.html b/documentation/examples/anime-DOM-stress-test.html
index 1e01f96e..092f2719 100644
--- a/documentation/examples/anime-DOM-stress-test.html
+++ b/documentation/examples/anime-DOM-stress-test.html
@@ -17,7 +17,7 @@
<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.1.3.js"></script> -->
+ <!-- <script src="../assets/js/anime.2.0.2.js"></script> -->
<!-- <script src="../assets/js/anime.1.0.js"></script> -->
<style>
@@ -29,6 +29,7 @@
height: 1rem;
margin: -.5rem 0 0 -.5rem;
border: 1px solid currentColor;
+ border-radius: 50%;
transform: scale(0);
}
@@ -38,7 +39,7 @@
<script>
var maxElements = Number(location.href.split('?')[1]) || 300;
- var duration = 1500;
+ var duration = 2000;
var toAnimate = [];
var radius = window.innerWidth < window.innerHeight ? window.innerWidth : window.innerHeight;
var distance = radius / 4 <= 150 ? 150 : radius / 4;
@@ -48,8 +49,11 @@
var fragment = document.createDocumentFragment();
for (var i = 0; i < maxElements; i++) {
var el = document.createElement('div');
+ var color = Math.round((i/maxElements)*(colors.length-1));
el.classList.add('particule');
- el.style.color = colors[anime.random(0, 3)];
+ // el.style.color = colors[anime.random(0, 3)];
+ el.style.color = colors[color];
+ el.style.zIndex = i;
toAnimate.push(el);
fragment.appendChild(el);
}
@@ -57,16 +61,19 @@
})();
var animate = function(el, i) {
- var angle = Math.random() * Math.PI * 2;
- anime({
+ // var angle = (i * .05) * Math.PI;
+ // var angle = anime.easings['easeInOutExpo'](i);
+ var angle = i * 2;
+ var delay = ((duration * 2) / maxElements) * i;
+ var a = anime({
targets: el,
translateX: [0, Math.cos(angle) * distance],
translateY: [0, Math.sin(angle) * distance],
scale: [
- {value: [0, 1], duration: 400, easing: 'easeOutBack'},
- {value: 0, duration: 400, delay: duration - 800, easing: 'easeInBack'}
+ {value: [0, 2], duration: duration / 2, easing: 'easeOutBack'},
+ {value: 0, duration: duration / 2, delay: duration / 4, easing: 'easeInBack'}
],
- offset: (duration / maxElements) * i,
+ offset : delay,
duration: duration,
easing: 'easeOutSine',
loop: true
diff --git a/documentation/examples/anime-tests.html b/documentation/examples/anime-tests.html
index 53bec26a..24e94b95 100644
--- a/documentation/examples/anime-tests.html
+++ b/documentation/examples/anime-tests.html
@@ -41,17 +41,20 @@
<div></div>
<script>
- anime({
+ var seekAnim = anime({
targets: 'div',
- // width: '600px',
- duration: 0,
- perspective: 20,
- rotateY: 30,
+ translateX: [10, 250],
+ duration: 1000,
+ delay: 0,
+ direction: 'normal',
+ autoplay: false,
+ update: function() { console.log('update') },
begin: function() { console.log('begin') },
run: function() { console.log('run') },
- update: function() { console.log('update') },
complete: function() { console.log('complete') }
- })
+ });
+
+ seekAnim.seek(0);
// var tl = anime.timeline({
// autoplay: true