Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update documentation and examples

Julian Garnier1489bd41395d
diff --git a/documentation/assets/css/documentation.css b/documentation/assets/css/documentation.css
index d00abf5b..da5e58c7 100644
--- a/documentation/assets/css/documentation.css
+++ b/documentation/assets/css/documentation.css
@@ -96,7 +96,7 @@ header {
}
.navigation {
- overflow-y: scroll;
+ overflow-y: auto;
width: 100%;
height: 100%;
padding: 10px 0 20px 20px;
diff --git a/documentation/examples/anime-DOM-stress-test-02.html b/documentation/examples/anime-DOM-stress-test-02.html
new file mode 100644
index 00000000..0090865f
--- /dev/null
+++ b/documentation/examples/anime-DOM-stress-test-02.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>DOM stress test | 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.0.js"></script> -->
+ <style>
+
+ body {
+ /*background-color: #000;*/
+ }
+
+ .el {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ 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);
+ }
+
+ </style>
+</head>
+<body></body>
+<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(); }
+ });
+
+ function createEl(i) {
+ let el = document.createElement('div');
+ const hue = Math.round(360 / numberOfEls * i);
+ const angle = i;
+ 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
+ });
+ }
+ });
+ wrapperEl.appendChild(el);
+ };
+
+ for (let i = 0; i < numberOfEls; i++) createEl(i);
+
+ </script>
+ <script src="../assets/js/stats.js"></script>
+</html>
diff --git a/documentation/examples/anime-DOM-stress-test.html b/documentation/examples/anime-DOM-stress-test.html
index f77063b1..548f1ce5 100644
--- a/documentation/examples/anime-DOM-stress-test.html
+++ b/documentation/examples/anime-DOM-stress-test.html
@@ -28,9 +28,9 @@
width: 1em;
height: 1em;
margin: -.5em 0 0 -.5em;
- border: .0125em solid currentColor;
+ border: .05em solid currentColor;
/*background-color: currentColor;*/
- font-size: 10px;
+ font-size: 40px;
border-radius: 50%;
transform: scale(0);
}
@@ -62,11 +62,10 @@
begin: function() {
anime({
targets: el,
- // borderColor: ['hsl(' + hue + ', 40%, 60%)', 'hsl(' + hue + ', 60%, 80%)'],
translateX: [0, Math.sin(angle) * distance],
translateY: [0,Math.cos(angle) * distance ],
scale: [
- {value: [0, 4], duration: duration / 2, easing: 'easeOutBack'},
+ {value: [0, 1], duration: duration / 2, easing: 'easeOutBack'},
{value: 0, duration: duration / 2, easing: 'easeInBack'}
],
easing: 'easeInOutSine',
diff --git a/documentation/examples/anime-staggered-animations.html b/documentation/examples/anime-staggered-animations.html
index 7edc2fc8..57534550 100644
--- a/documentation/examples/anime-staggered-animations.html
+++ b/documentation/examples/anime-staggered-animations.html
@@ -57,9 +57,8 @@
const duration = 6000;
const delay = duration / numberOfEls;
- var tl = anime.timeline({
+ let tl = anime.timeline({
duration: delay,
- easing: 'linear',
complete: function() { tl.restart(); }
});
@@ -75,10 +74,10 @@
begin: function() {
anime({
targets: el,
- backgroundColor: 'hsl(' + hue + ', 60%, 80%)',
- rotate: rotate + 10 +'deg',
- translateY: translateY + 10 + '%',
- scale: 1.25,
+ backgroundColor: ['hsl(' + hue + ', 40%, 60%)', 'hsl(' + hue + ', 60%, 80%)'],
+ rotate: [rotate + 'deg', rotate + 10 +'deg'],
+ translateY: [translateY + '%', translateY + 10 + '%'],
+ scale: [1, 1.25],
easing: 'easeInOutSine',
direction: 'alternate',
duration: duration * .1