Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update animation

Julian Garnier0e168ae170ac
diff --git a/index.html b/index.html
index 3a3bf187..127caed1 100644
--- a/index.html
+++ b/index.html
@@ -99,7 +99,7 @@
</svg>
<div class="bounce">
<svg viewBox="0 0 720 288" width="720" height="288" fill="none">
- <path d="M448 256c0-95.547-15.14-191.447-71.885-191.447C319.371 64.553 304 156.038 304 240"/>
+ <path d="M448 268c0-131.066-15.14-203.447-71.885-203.447C319.371 64.553 304 156.038 304 240"/>
<rect class="dot" fill="#FFF" x="-12" y="-12" width="24" height="24"></rect>
</svg>
</div>
@@ -110,9 +110,9 @@
<div class="logo-nav">
<nav class="logo-links">
- <a href="/documentation">Documentation</a>
- <a href="https://codepen.io/collection/XLebem/">CodePen</a>
- <a href="https://github.com/juliangarnier/anime">GitHub</a>
+ <a href="/documentation"><span>Documentation</span></a>
+ <a href="https://codepen.io/collection/XLebem/"><span>CodePen</span></a>
+ <a href="https://github.com/juliangarnier/anime"><span>GitHub</span></a>
</nav>
</div>
diff --git a/website/css/styles.css b/website/css/styles.css
index a65a00b2..b2f3fd65 100644
--- a/website/css/styles.css
+++ b/website/css/styles.css
@@ -110,7 +110,7 @@ a {
.line {
stroke-width: 2;
- stroke: #FFF;
+ /*stroke: #FFF;*/
}
.letter-a .line:nth-child(1) { stroke: #1CE2B2; }
@@ -173,25 +173,35 @@ a {
font-weight: bold;
line-height: 41px;
letter-spacing: .05em;
- border: 1px solid currentColor;
+ border: 1px solid #FFF;
color: #FFF;
+ transition: color .2s ease-in-out;
}
-.logo-links a:after {
+.logo-links a span {
+ z-index: 1;
+ position: relative;
+}
+
+.logo-links a:hover {
+ color: #000;
+}
+
+.logo-links a:before {
content: "";
position: absolute;
+ z-index: 0;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #FFF;
- mix-blend-mode: difference;
transform-origin: 100% 50%;
transform: scaleX(0);
- transition: transform .4s ease-in-out;
+ transition: transform .2s ease-in-out;
}
-.logo-links a:hover:after {
+.logo-links a:hover:before {
transform: scaleX(1);
transform-origin: 0% 50%;
}
diff --git a/website/img/bounce.svg b/website/img/bounce.svg
new file mode 100644
index 00000000..79feb7a1
--- /dev/null
+++ b/website/img/bounce.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 288">
+ <g id="Page-2" fill="none" fill-rule="evenodd">
+ <path id="bounce" stroke="#FF0000" d="M448 268c0-131.066-15.14-203.447-71.885-203.447C319.371 64.553 304 156.038 304 240"/>
+ </g>
+</svg>
diff --git a/website/img/letter-m-2-2.svg b/website/img/letter-m-2-2.svg
new file mode 100644
index 00000000..cf29ddfe
--- /dev/null
+++ b/website/img/letter-m-2-2.svg
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 124">
+ <g id="Page-2" fill="none" fill-rule="evenodd">
+ <g id="letter-m-2-2" stroke-width="6">
+ <path id="line" stroke="#61C3FF" d="M64 120V32C64 18.745 74.745 8 88 8c24 0 8 53.1 40 53.1S144 8 168 8c13.255 0 24 10.745 24 24v88"/>
+ <path id="line" stroke="#1CE2B2" d="M184 120V32c-.014-8.752-7.168-16-16-16-16 0-4.741 51.1-40 51.1S104 16 88 16c-8.837 0-16 7.158-16 16v88"/>
+ <path id="line" stroke="#FF1461" d="M80 120V32c0-4.421 3.582-8 8-8 13.397 0 1.066 49.1 40 49.1S154.73 24 168 24c4.424 0 8 3.65 8 8v88"/>
+ </g>
+ </g>
+</svg>
diff --git a/website/js/scripts.js b/website/js/scripts.js
index 392940e0..30489e70 100644
--- a/website/js/scripts.js
+++ b/website/js/scripts.js
@@ -1,13 +1,13 @@
var logoAnimation = (function() {
- var logoAnimationEl = document.querySelector('.logo-animation');
- var bouncePath = anime.path('.bounce path');
- var spherePathEls = logoAnimationEl.querySelectorAll('.sphere path');
-
function getPathDuration(el, speed) {
return anime.setDashoffset(el) * speed;
}
+ var logoAnimationEl = document.querySelector('.logo-animation');
+ var bouncePath = anime.path('.bounce path');
+ var spherePathEls = logoAnimationEl.querySelectorAll('.sphere path');
+
anime.set('.fill', {opacity: 0});
anime.set(['.letter-a', '.letter-n', '.letter-i'], {translateX: 56});
anime.set('.letter-e', {translateX: -56});
@@ -16,7 +16,6 @@ var logoAnimation = (function() {
translateY: -100
});
anime.set('.sphere path', {opacity: 0});
- anime.set('.logo-links a span', {opacity: 0});
function sphereAnimation() {
@@ -95,18 +94,19 @@ var logoAnimation = (function() {
}, '-=100')
.add({
targets: '.dot',
- easing: 'easeOutSine',
- duration: 300,
- translateY: 260,
+ easing: 'cubicBezier(0.350, 0.560, 0.305, 1)',
+ duration: 380,
+ translateY: 268,
translateZ: 0,
- scaleY: [4, 1]
+ scaleY: [4, .7],
+ scaleX: { value: 1.3, delay: 100, duration: 200},
}, '-=100')
.add({
targets: '.letter-m .line',
easing: 'easeOutElastic(1, .8)',
duration: 600,
d: function(el) { return el.dataset.d2 }
- }, '-=120')
+ }, '-=190')
.add({
targets: ['.letter-a', '.letter-n', '.letter-i'],
translateX: 0,
@@ -126,11 +126,21 @@ var logoAnimation = (function() {
translateY: bouncePath('y'),
translateZ: 0,
rotate: 360,
+ scaleX: [
+ { value: 1, duration: 50, easing: 'easeOutSine' }
+ ],
+ scaleY: [
+ { value: [1, 1.5], duration: 50, easing: 'easeInSine' },
+ { value: 1, duration: 50, easing: 'easeOutSine' }
+ ],
+ // easing: 'cubicBezier(0.000, 0.740, 1.000, 0.255)',
easing: 'cubicBezier(0.000, 0.740, 1.000, 0.255)',
- duration: 600,
- }, '-=350')
+ duration: 800,
+ }, '-=650')
.add({
targets: '.dot',
+ scaleY: 1,
+ scaleX: 1,
translateY: [
{value: 262, duration: 100, easing: 'easeOutSine'},
{value: 244, duration: 1000, easing: 'easeOutElastic(1, .8)'}
@@ -138,9 +148,9 @@ var logoAnimation = (function() {
})
.add({
targets: '.letter-m .line',
- easing: 'spring(1, 80, 10, 30)',
+ easing: 'spring(.2, 200, 5, 60)',
d: function(el) { return el.dataset.d3 }
- }, '-=1700')
+ }, '-=1904')
.add({
targets: ['.letter-i .fill', '.letter-n .fill', '.letter-m .fill', '.letter-a .fill', '.letter-e .fill'],
opacity: { value: [0, 1], duration: 1},
@@ -210,6 +220,9 @@ var logoAnimation = (function() {
easing: 'easeOutCubic'
}, '-=1000')
+ // logoAnimationTL.seek(1600);
+ // anime.speed = .1;
+
logoAnimationEl.classList.add('is-visible');
return logoAnimationTL;