Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update examples

Julian Garnier0d3001783707
diff --git a/documentation/examples/anime-advanced-stagerring.html b/documentation/examples/anime-advanced-stagerring.html
new file mode 100644
index 00000000..54ec4206
--- /dev/null
+++ b/documentation/examples/anime-advanced-stagerring.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>stagger | 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/documentation.css" rel="stylesheet">
+ <style>
+
+ :root {
+ font-size: 20px;
+ }
+
+ body {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ background-color: #F6F4F2;
+ }
+
+ .stagger-visualizer {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ width: 16rem;
+ height: 16rem;
+ }
+
+ .stagger-visualizer div {
+ position: relative;
+ width: .8rem;
+ height: .8rem;
+ margin: .1rem;
+ border: 2px solid currentColor;
+ background-color: #F6F4F2;
+ color: #373535;
+ border-radius: 50%;
+ }
+
+ </style>
+</head>
+<body>
+
+ <div class="stagger-visualizer"></div>
+
+</body>
+<script type="module">
+
+ import anime from '../../src/index.js';
+
+ const staggerVisualizerEl = document.querySelector('.stagger-visualizer');
+ const fragment = document.createDocumentFragment();
+ const numberOfElements = 256;
+
+ for (let i = 0; i < numberOfElements; i++) {
+ fragment.appendChild(document.createElement('div'));
+ }
+
+ staggerVisualizerEl.appendChild(fragment);
+
+ function animateGrid() {
+ const index = anime.random(0, 256);
+ anime.setValue('.stagger-visualizer div', { zIndex: anime.stagger(1, {grid: [16, 16], from: index, direction: 'reverse'}) });
+ anime({
+ targets: '.stagger-visualizer div',
+ translateX: [
+ {value: anime.stagger('-.15rem', {grid: [16, 16], from: 'center', axis: 'x'}), duration: 300 },
+ {value: anime.stagger('.125rem', {grid: [16, 16], from: 'center', axis: 'x'}), duration: 500 },
+ {value: 0, duration: 600},
+ ],
+ translateY: [
+ {value: anime.stagger('-.25rem', {grid: [16, 16], from: 'center', axis: 'y'}), duration: 300 },
+ {value: anime.stagger('.125rem', {grid: [16, 16], from: 'center', axis: 'y'}), duration: 500 },
+ {value: 0, duration: 600},
+ ],
+ color: [
+ {value: '#FF4B4B', duration: 500},
+ {value: '#373535', duration: 500},
+ ],
+ delay: anime.stagger(1),
+ delay: anime.stagger(1, {direction: 'reverse'}),
+ delay: anime.stagger(1, {from: 'center'}),
+ delay: anime.stagger(4, {easing: 'easeOutQuad', from: 'last'}),
+ delay: anime.stagger(50, {grid: [16, 16], from: 'last'}),
+ easing: 'easeInOutQuad',
+ complete: animateGrid
+ });
+ }
+
+ animateGrid();
+
+</script>
+</html>
diff --git a/documentation/examples/anime-easings.html b/documentation/examples/anime-easings.html
index d3c916e0..79e02413 100644
--- a/documentation/examples/anime-easings.html
+++ b/documentation/examples/anime-easings.html
@@ -23,6 +23,7 @@
flex-wrap: wrap;
justify-content: center;
align-items: center;
+ background-color: #F6F4F2;
}
.easing-visualizer {
@@ -37,9 +38,8 @@
width: 2px;
height: 2px;
margin: 0 0 0 0;
- background-color: #FFF;
+ background-color: #373535;
transform-origin: 50% 100%;
- //border-radius: 50%;
}
</style>
@@ -63,15 +63,15 @@
easingVisualizerEl.appendChild(fragment);
+ const easings = [];
+ for (let ease in anime.penner) easings.push(ease);
+ easings.push('steps(10)');
+ easings.push('cubicBezier(0.545, 0.475, 0.145, 1)');
+
anime({
targets: '.easing-visualizer div',
scaleY: (() => {
- const keyframes = [];
- for (let ease in anime.penner) {
- keyframes.push({value: anime.stagger([1, 200], {easing: ease}), easing: ease});
- };
- keyframes.push({ value: anime.stagger([1, 200], {easing: 'steps(10)'}), easing: 'steps(10)' });
- keyframes.push({ value: anime.stagger([1, 200], {easing: 'cubicBezier(0.545, 0.475, 0.145, 1)'}) });
+ const keyframes = easings.map(ease => { return {value: anime.stagger([1, 200], {easing: ease}), easing: ease}; });
keyframes.push({ value: 1 });
return keyframes;
})(),
diff --git a/documentation/examples/anime-stagger-demo.html b/documentation/examples/anime-stagger-demo.html
index ae455d22..9f127f05 100644
--- a/documentation/examples/anime-stagger-demo.html
+++ b/documentation/examples/anime-stagger-demo.html
@@ -23,6 +23,7 @@
flex-wrap: wrap;
justify-content: center;
align-items: center;
+ background-color: #F6F4F2;
}
.stagger-visualizer {
@@ -38,8 +39,8 @@
/*position: absolute;*/
width: 64px;
height: 128px;
- border: 1px solid #FFF;
- background-color: #191C1E;
+ border: 1px solid #373535;
+ background-color: #F6F4F2;
}
</style>
diff --git a/documentation/examples/anime-stagger-grid-demo.html b/documentation/examples/anime-stagger-grid-demo.html
index 66afa6cd..9494446d 100644
--- a/documentation/examples/anime-stagger-grid-demo.html
+++ b/documentation/examples/anime-stagger-grid-demo.html
@@ -27,6 +27,7 @@
flex-wrap: wrap;
justify-content: center;
align-items: center;
+ background-color: #FF4B4B;
}
.stagger-visualizer {
@@ -43,7 +44,7 @@
width: 1rem;
height: 1rem;
border: 1px solid #FFF;
- background-color: #191C1E;
+ background-color: #FFF;
}
</style>