Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

New examples

Julian Garnier515181f6314a
diff --git a/documentation/examples/anime-speed-test.html b/documentation/examples/anime-speed-test.html
index 2e3cb446..581dced4 100644
--- a/documentation/examples/anime-speed-test.html
+++ b/documentation/examples/anime-speed-test.html
@@ -24,6 +24,7 @@
position: absolute;
width: 100%;
height: 100%;
+ overflow: hidden;
}
.particule {
position: absolute;
@@ -43,7 +44,7 @@
var duration = 2000;
var width = window.innerWidth;
var height = window.innerHeight;
- var distance = (width > height ? height : width) / 4;
+ var distance = (width > height ? height : width);
var fragment = document.createDocumentFragment();
var colors = ['#FF1461', '#18FF92', '#5A87FF'];
var i = 0;
@@ -57,13 +58,10 @@
el.classList.add('particule');
anime({
targets: el,
+ width: ['0px', '20px'],
+ height: ['0px', '20px'],
left: [width/2+'px', Math.cos(angle) * distance + (width/2) + 'px'],
top: [height/2+'px', Math.sin(angle) * distance + (height/2) + 'px'],
- // scale: [
- // {value: [.5, 1.5], duration: duration * .8},
- // {value: 1.5, duration: duration * .1},
- // {value: 0, duration: duration * .1}
- // ],
color: ['#FF1461', '#5A87FF'],
delay: (duration / maxElements) * i,
duration: duration,
diff --git a/documentation/examples/anime-staggered-animations-02.html b/documentation/examples/anime-staggered-animations-02.html
new file mode 100644
index 00000000..e3210fb7
--- /dev/null
+++ b/documentation/examples/anime-staggered-animations-02.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Staggered loops | 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.3.js"></script> -->
+ <style>
+ body {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+ height: 100vh;
+ }
+
+ .wrapper {
+ position: absolute;
+ width: 100%;
+ height: 100vh;
+ overflow: hidden;
+ }
+
+ .el {
+ position: absolute;
+ border-radius: 50%;
+ top: 50%;
+ left: 50%;
+ border: 2px solid currentColor;
+ /*background-color: currentColor;*/
+ }
+ </style>
+</head>
+<body>
+ <div class="wrapper"></div>
+ <script>
+
+ const wrapperEl = document.querySelector('.wrapper');
+ const numberOfEls = 40;
+ const duration = 8000;
+ const delay = duration / numberOfEls;
+ const gap = 30;
+
+ let tl = anime.timeline({
+ duration: delay / 2,
+ complete: function() { tl.restart(); }
+ });
+
+ function createEl(i) {
+ let el = document.createElement('div');
+ const rotate = (360 / numberOfEls) * i;
+ const translateY = -150 - (numberOfEls - i);
+ const hue = Math.round(180 / numberOfEls * i);
+ const diameter = 20 + (i * gap);
+ const scale = (diameter + gap) / diameter;
+ el.classList.add('el');
+ el.style.zIndex = numberOfEls - i;
+ el.style.width = diameter + 'px';
+ el.style.height = diameter + 'px';
+ el.style.marginTop = -(diameter / 2) + 'px';
+ el.style.marginLeft = -(diameter / 2) + 'px';
+ el.style.opacity = 0;
+ el.style.color = 'hsl(' + hue + ', 30%, 30%)';
+ tl.add({
+ begin: function() {
+ anime({
+ targets: el,
+ opacity: [0, 1],
+ color: ['hsl(' + hue + ', 30%, 30%)', 'hsl(' + hue + ', 50%, 50%)'],
+ translateY: [0, translateY],
+ // scale: [1, 2],
+ // rotate: [0, 45],
+ // borderRadius: ['50%', '40%'],
+ easing: 'easeInOutSine',
+ direction: 'alternate',
+ duration: duration / 4
+ });
+ }
+ });
+ wrapperEl.appendChild(el);
+ };
+
+ for (let i = 0; i < numberOfEls; i++) createEl(i);
+
+ </script>
+ <script src="../assets/js/stats.js"></script>
+</body>
+</html>
diff --git a/documentation/examples/anime-staggered-timeline-animations.html b/documentation/examples/anime-staggered-timeline-animations.html
deleted file mode 100644
index 4d3e7cb5..00000000
--- a/documentation/examples/anime-staggered-timeline-animations.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Staggered loops | 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.3.js"></script> -->
- <style>
- body {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
- height: 100vh;
- }
-
- .wrapper {
- position: relative;
- display: flex;
- flex-direction: column;
- flex-wrap: wrap;
- width: 1px;
- height: 80vh;
- }
-
- .el {
- margin: 0 20px;
- opacity: 1;
- width: 2px;
- height: 30%;
- transform-origin: 0% 100%;
- background: white;
- }
- </style>
-</head>
-<body>
- <div class="el el-01"></div>
- <div class="el el-02"></div>
- <div class="el el-03"></div>
- <div class="el el-04"></div>
- <div class="el el-05"></div>
- <script>
-
- var tl = anime.timeline({
- duration: 100,
- easing: 'linear',
- complete: function() { tl.restart(); }
- });
-
- tl.add({
- begin: function() {
- anime({
- targets: '.el-01',
- translateY: [0, 50]
- });
- },
- }).add({
- begin: function() {
- anime({
- targets: '.el-02',
- translateY: [0, 50]
- });
- },
- }).add({
- begin: function() {
- anime({
- targets: '.el-03',
- translateY: [0, 50]
- });
- },
- }).add({
- begin: function() {
- anime({
- targets: '.el-04',
- translateY: [0, 50]
- });
- },
- }).add({
- begin: function() {
- anime({
- targets: '.el-05',
- translateY: [0, 50]
- });
- },
- })
-
- </script>
- <script src="../assets/js/stats.js"></script>
-</body>
-</html>