Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Update website

Julian Garniera2f3a72224f5
diff --git a/index.html b/index.html
index 127caed1..86893ec7 100644
--- a/index.html
+++ b/index.html
@@ -30,7 +30,7 @@
</filter>
</defs>
</svg>
- <header class="logo-animation">
+ <div class="logo-animation">
<div class="anime-logo">
<svg class="sphere" viewBox="0 0 1500 1500" width="100%" height="100%" fill="none" fill-rule="evenodd" stroke-width="2">
@@ -107,6 +107,8 @@
<h2>Javascript Animation Engine</h2>
</div>
+ </div>
+
<div class="logo-nav">
<nav class="logo-links">
@@ -117,8 +119,6 @@
</div>
- </header>
-
<p class="credits">
v<span class="version">0.0</span> © <span class="date">2016</span> <a href="http://juliangarnier.com">Julian Garnier</a>
</p>
diff --git a/website/css/styles.css b/website/css/styles.css
index b2f3fd65..48289092 100644
--- a/website/css/styles.css
+++ b/website/css/styles.css
@@ -13,7 +13,11 @@ body {
overflow-x: hidden;
display: flex;
flex-direction: column;
+ justify-content: center;
align-items: center;
+ position: absolute;
+ width: 100%;
+ min-height: 100vh;
color: #FFF;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
/* Anime is a lightweig: */
@@ -23,6 +27,10 @@ body {
-webkit-font-smoothing: antialiased;
}
+svg {
+ overflow: visible;
+}
+
a {
text-decoration: none;
color: currentColor;
@@ -44,6 +52,7 @@ a {
/* Logo animation */
.logo-animation {
+ flex-shrink: 0;
position: relative;
visibility: hidden;
display: flex;
@@ -51,9 +60,8 @@ a {
overflow: hidden;
justify-content: center;
align-items: center;
- width: 100%;
- height: 90vh;
- min-height: 580px;
+ width: 740px;
+ height: 480px;
}
.logo-animation.is-visible {
@@ -150,16 +158,33 @@ a {
flex-direction: column;
justify-content: space-between;
position: relative;
- top: 128px;
width: 100%;
max-width: 600px;
+ margin-bottom: 32px;
+}
+
+.logo-nav {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ position: relative;
+ width: 100%;
+ max-width: 600px;
+ margin-bottom: 32px;
}
.logo-links {
display: flex;
+ flex-direction: column;
width: 100%;
}
+@media (min-width: 800px) {
+ .logo-links {
+ flex-direction: row;
+ }
+}
+
.logo-links a {
flex: 1;
display: block;
diff --git a/website/js/scripts.js b/website/js/scripts.js
index 30489e70..25b01fa7 100644
--- a/website/js/scripts.js
+++ b/website/js/scripts.js
@@ -1,3 +1,14 @@
+function fitToScreen(el, margins) {
+ var elWidth = el.offsetWidth;
+ var screenWidth = window.innerWidth;
+ var limitWidth = screenWidth - margins;
+ if (elWidth > limitWidth) {
+ var scaleRatio = limitWidth / elWidth;
+ console.log(scaleRatio);
+ anime.set(el, { scale: scaleRatio });
+ }
+}
+
var logoAnimation = (function() {
function getPathDuration(el, speed) {
@@ -8,6 +19,8 @@ var logoAnimation = (function() {
var bouncePath = anime.path('.bounce path');
var spherePathEls = logoAnimationEl.querySelectorAll('.sphere path');
+ fitToScreen(logoAnimationEl, 64);
+
anime.set('.fill', {opacity: 0});
anime.set(['.letter-a', '.letter-n', '.letter-i'], {translateX: 56});
anime.set('.letter-e', {translateX: -56});
@@ -148,7 +161,7 @@ var logoAnimation = (function() {
})
.add({
targets: '.letter-m .line',
- easing: 'spring(.2, 200, 5, 60)',
+ easing: 'spring(.2, 200, 3, 60)',
d: function(el) { return el.dataset.d3 }
}, '-=1904')
.add({