Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update build script + documentation

Julian Garnier67e115e56dfd
diff --git a/build.js b/build.js
index 62cedfe5..981782d7 100644
--- a/build.js
+++ b/build.js
@@ -15,7 +15,7 @@ fs.unlink(fileOut, (err) => {
const out = compile(flags);
fs.writeFile(fileOut, out.compiledCode, function(err) {
if (err) throw err;
- console.info('Compilation was a success! 😎 🍺');
+ console.info('Compilation was a success! 😎');
});
});
});
\ No newline at end of file
diff --git a/documentation/assets/js/scripts.js b/documentation/assets/js/documentation.js
similarity index 100%
rename from documentation/assets/js/scripts.js
rename to documentation/assets/js/documentation.js
diff --git a/documentation/examples/anime-DOM-stress-test.html b/documentation/examples/anime-DOM-stress-test.html
index 44913f64..24c6de16 100644
--- a/documentation/examples/anime-DOM-stress-test.html
+++ b/documentation/examples/anime-DOM-stress-test.html
@@ -17,6 +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.2.2.0.js"></script> -->
<!-- <script src="../../anime-dev.js"></script> -->
<!-- <script src="../assets/js/anime.2.0.2.js"></script> -->
<!-- <script src="../assets/js/anime.1.0.js"></script> -->
@@ -37,7 +38,6 @@
background-color: currentColor;
font-size: 30px;
border-radius: 50%;
- transform: scale(0);
}
</style>
@@ -46,7 +46,7 @@
<script>
const wrapperEl = document.body;
- const numberOfEls = 500;
+ const numberOfEls = 1000;
const duration = 2000;
const delay = duration / numberOfEls;
const radius = window.innerWidth < window.innerHeight ? window.innerWidth : window.innerHeight;
@@ -64,23 +64,44 @@
var angle = Math.random() * Math.PI * 2;
el.classList.add('el');
el.style.color = 'hsl(' + hue + ', 40%, 60%)';
- // el.style.transform = 'scale(0)';
+ // el.style.left = anime.random(0, window.innerWidth) + 'px';
el.style.zIndex = numberOfEls - i;
- tl.add({
- begin: function() {
- anime({
- targets: el,
- translateX: ['0px', Math.sin(angle) * distance + 'px'],
- translateY: ['0px', Math.cos(angle) * distance + 'px'],
- // scale: [0, 32],
- // scale: [
- // {value: [0, 1], duration: duration / 2, easing: 'easeOutBack'},
- // {value: 0, duration: duration / 2, easing: 'easeInBack'}
- // ],
- easing: 'easeInOutSine',
- duration: duration
- });
- }
+ console.log(el);
+ // tl.add({
+ // begin: function() {
+ // anime({
+ // targets: el,
+ // //translateX: ['0px', Math.sin(angle) * distance + 'px'],
+ // //translateY: ['0px', Math.cos(angle) * distance + 'px'],
+ // width: [200, 400],
+ // height: [200, 400],
+ // // scale: [0, 32],
+ // // scale: [
+ // // {value: [0, 1], duration: duration / 2, easing: 'easeOutBack'},
+ // // {value: 0, duration: duration / 2, easing: 'easeInBack'}
+ // // ],
+ // easing: 'easeInOutSine',
+ // duration: duration
+ // });
+ // }
+ // });
+ anime({
+ targets: el,
+ translateX: ['0px', Math.sin(angle) * distance + 'px'],
+ translateY: ['0px', Math.cos(angle) * distance + 'px'],
+ // width: [200, 400],
+ // height: [200, 400],
+ // scale: [0, 32],
+ // scale: [
+ // {value: [0, 1], duration: duration / 2, easing: 'easeOutBack'},
+ // {value: 0, duration: duration / 2, easing: 'easeInBack'}
+ // ],
+ delay: function(el, i) {
+ return anime.random(0, duration);
+ },
+ loop: true,
+ easing: 'easeInOutSine',
+ duration: duration
});
wrapperEl.appendChild(el);
};
diff --git a/documentation/examples/anime-logo-animation.html b/documentation/examples/anime-logo-animation.html
index 5d603106..8d179738 100644
--- a/documentation/examples/anime-logo-animation.html
+++ b/documentation/examples/anime-logo-animation.html
@@ -17,6 +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.2.2.0.js"></script> -->
<style>
body {
opacity: 0;
diff --git a/documentation/examples/anime-speed-test.html b/documentation/examples/anime-speed-test.html
index d56b2a82..e2876b76 100644
--- a/documentation/examples/anime-speed-test.html
+++ b/documentation/examples/anime-speed-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.2.1.0.js"></script> -->
+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> -->
<!-- <script src="../assets/js/anime.2.0.1.js"></script> -->
<!-- <script src="../assets/js/anime.1.3.js"></script> -->
<style>
@@ -36,13 +36,16 @@
}
.particule {
position: absolute;
+ top: 50%;
+ left: 50%;
+ border-radius: 50%;
}
</style>
</head>
<body>
<script>
- var numberOfEls = 1000;
+ var numberOfEls = 500;
var duration = 1000;
var midScreenX = window.innerWidth / 2;
var midScreenY = window.innerHeight / 2;
@@ -51,21 +54,22 @@
for (var i = 0; i < numberOfEls; i++) {
var hue = Math.round(360 / numberOfEls * i);
- var angle = Math.random() * Math.PI * 2;
+ var angle = anime.random(0, 360);
var el = document.createElement('div');
el.classList.add('particule');
el.style.backgroundColor = 'hsl(' + hue + ', 40%, 60%)';
- el.style.width = '1px';
- el.style.height = '1px';
+ el.style.width = '10px';
+ el.style.height = '10px';
anime({
targets: el,
- width: ['1px', '20px'],
- height: ['1px', '20px'],
- left: [midScreenX + 'px', Math.cos(angle) * radius + midScreenX + 'px'],
- top: [midScreenY + 'px', Math.sin(angle) * radius + midScreenY + 'px'],
+ rotate: [angle, angle],
+ translateX: window.innerWidth * .65,
+ scale: [0, 7],
delay: (duration / numberOfEls) * i,
+ endDelay: (duration / numberOfEls) * i,
duration: duration,
easing: 'easeInExpo',
+ // direction: 'reverse',
loop: true
});
fragment.appendChild(el);
diff --git a/documentation/examples/anime-staggered-animations-02.html b/documentation/examples/anime-staggered-animations-02.html
index 8e17af57..1305e9c7 100644
--- a/documentation/examples/anime-staggered-animations-02.html
+++ b/documentation/examples/anime-staggered-animations-02.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.2.1.0.js"></script> -->
+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> -->
<!-- <script src="../assets/js/anime.2.0.2.js"></script> -->
<!-- <script src="../assets/js/anime.1.3.js"></script> -->
<style>
diff --git a/documentation/examples/anime-staggered-animations.html b/documentation/examples/anime-staggered-animations.html
index beda46de..52468201 100644
--- a/documentation/examples/anime-staggered-animations.html
+++ b/documentation/examples/anime-staggered-animations.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.2.0.2.js"></script> -->
+ <!-- <script src="../assets/js/anime.2.2.0.js"></script> -->
<!-- <script src="../assets/js/anime.1.3.js"></script> -->
<style>
body {
@@ -53,7 +53,7 @@
<script>
const wrapperEl = document.querySelector('.wrapper');
- const numberOfEls = 90;
+ const numberOfEls = 180;
const duration = 6000;
const delay = duration / numberOfEls;
diff --git a/documentation/examples/anime-tests-2.html b/documentation/examples/anime-tests-2.html
new file mode 100644
index 00000000..a8f40487
--- /dev/null
+++ b/documentation/examples/anime-tests-2.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Tests | 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>
+ <style>
+ body {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ min-height: 100vh;
+ }
+ .item {
+ width: 100px;
+ height: 100px;
+ border-radius: 15%;
+ background-color: currentColor;
+ margin: 10px;
+ }
+ </style>
+</head>
+<body>
+ <div class="item color-01" style="transform: translateX(45px) translateY(200px);"></div>
+ <div class="item color-02"></div>
+ <div class="item color-03" style="transform: translateX(85px) translateY(300px);"></div>
+ <script>
+ function mouseenter() {
+ var animation = anime({
+ targets: this,
+ scale: 2
+ });
+ console.log(animation.animations[0].tweens[0].from);
+ }
+ function mouseleave() {
+ var animation = anime({
+ targets: this,
+ scale: 1
+ });
+ console.log(animation.animations[0].tweens[0].from);
+ }
+ // anime({
+ // targets: '.color-03',
+ // scale: 1.5,
+ // duration: 1000
+ // })
+ // var animation = anime({
+ // targets: '.color-03',
+ // scale: 2,
+ // translateX: 100,
+ // translateY: 50,
+ // rotate: 50,
+ // skew: 45,
+ // duration: 3000,
+ // autoplay: false
+ // });
+
+ anime.timeline({
+ targets: '.color-02',
+ easing: 'easeInOutSine',
+ loop: true,
+ direction: 'alternate'
+ }).add({
+ translateX: 300
+ }).add({
+ translateY: 300
+ }).add({
+ rotate: 360
+ }).add({
+ scale: 0
+ })
+
+ var el01 = document.querySelector('.color-01');
+ el01.addEventListener('mouseenter', mouseenter, false);
+ el01.addEventListener('mouseleave', mouseleave, false);
+ </script>
+</body>
+</html>
\ No newline at end of file
diff --git a/documentation/index.html b/documentation/index.html
index 254380aa..01de1e3e 100644
--- a/documentation/index.html
+++ b/documentation/index.html
@@ -1886,6 +1886,6 @@ var customEasingFunction = anime({
</script>
<script src="assets/js/highlight.pack.js"></script>
<script src="assets/js/beautify-html.js"></script>
- <script src="assets/js/scripts.js"></script>
+ <script src="assets/js/documentation.js"></script>
</body>
</html>
diff --git a/package.json b/package.json
index 3ab38144..4b2bddaf 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,6 @@
"anime.min.js"
],
"devDependencies": {
- "google-closure-compiler-js": "^20170124.0.0"
+ "google-closure-compiler-js": "^20171203.0.0"
}
}