sorta working #WIP

This commit is contained in:
Jeppe Ernst 2018-01-22 16:30:08 +01:00
parent 39fa3d27e1
commit 56e45454d7
7 changed files with 167 additions and 103 deletions

View file

@ -2,24 +2,26 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0""> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0">
<!-- <meta name="viewport" content="width=700"> -->
<title>{% if page.title %}{{ page.title }}{% else %}{{ site.name }}{% endif %}</title> <title>{% if page.title %}{{ page.title }}{% else %}{{ site.name }}{% endif %}</title>
<link rel="stylesheet" href="{{ site.baseurl }}/assets/style/main.css?{{ site.time | date: '%s' }}"> <link rel="stylesheet" href="{{ site.baseurl }}/assets/style/main.css?{{ site.time | date: '%s' }}">
<link rel="alternate" type="application/rss+xml" title="RSS Feed for {{ site.name }}" href="{{ site.baseurl }}/feed.xml" /> <link rel="alternate" type="application/rss+xml" title="RSS Feed for {{ site.name }}" href="{{ site.baseurl }}/feed.xml" />
{% seo %} {% seo %}
</head> </head>
<body data-env="{{ jekyll.environment }}"> <body data-env="{{ jekyll.environment }}" class="no-js">
{% include security-camera-svgrepo-com.svg %} {% include security-camera-svgrepo-com.svg %}
<div {% if page.containerId %} id="{{ page.containerId }}" {% endif %} class="container"> <div {% if page.containerId %} id="{{ page.containerId }}" {% endif %} class="container">
{{ content }} {{ content }}
</div> </div>
<footer> <!-- <footer>
Last generated at {{ site.time | date_to_rfc822 }} Last generated at {{ site.time | date_to_rfc822 }}
</footer> </footer> -->
<script src="{{ site.baseurl }}/assets/js/vendor/ScrollMagic.min.js"></script> <script src="{{ site.baseurl }}/assets/js/vendor/ScrollMagic.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/vendor/TweenMax.min.js"></script> <script src="{{ site.baseurl }}/assets/js/vendor/TweenMax.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/vendor/animation.gsap.js"></script> <script src="{{ site.baseurl }}/assets/js/vendor/animation.gsap.js"></script>
<script src="{{ site.baseurl }}/assets/js/vendor/debug.addIndicators.min.js"></script> <script src="{{ site.baseurl }}/assets/js/vendor/debug.addIndicators.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/vendor/mobile-detect.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/main.js"></script> <script src="{{ site.baseurl }}/assets/js/main.js"></script>
</body> </body>
</html> </html>

View file

@ -1,12 +1,18 @@
body, html { body, html {
//min-height: 100%; //min-height: 100%;
height: 100%; height: 100%;
height: 100vh;
} }
body { body {
background: #2A2A2A; background: #2A2A2A;
color: #FFF; color: #FFF;
height: 100%; //height: 100%;
//overflow-y: scroll;
//-webkit-overflow-scrolling: touch;
&[data-env="development"] {
background: red;
}
} }
footer { footer {

View file

@ -10,7 +10,7 @@ h1, h2, h3, h4, h5, h6 {
h1 { h1 {
font-size: 4rem; font-size: 4rem;
text-shadow: 4px 3px 0px rgb(90, 85, 81); text-shadow: 4px 3px 0px rgb(90, 85, 81);
margin: 3rem 0; margin: 4rem 0 1rem;
display: block; display: block;
width: 90vw; width: 90vw;
.even & { .even & {

View file

@ -6,19 +6,21 @@
z-index: 1000; z-index: 1000;
pointer-events: none; pointer-events: none;
.redLight { .redLight {
animation: redLigth 1s ease infinite; animation: redLight 1s ease infinite;
} }
.glare { .glare {
transform-origin: 80% 80%; transform-origin: 80% 80%;
transform-box: fill-box;
animation: glare 4s linear infinite; animation: glare 4s linear infinite;
} }
.outerRing { .outerRing {
transform-origin: 50% 50%; transform-origin: 50% 50%;
transform-box: fill-box;
animation: outerRing 4s linear infinite; animation: outerRing 4s linear infinite;
} }
} }
@keyframes redLigth { @keyframes redLight {
0% { 0% {
fill-opacity: 1; fill-opacity: 1;
} }

View file

@ -1,25 +1,51 @@
#pinContainer { body[data-scrollmagicPanes="enabled"] {
#pinContainer {
height: 100% !important; height: 100% !important;
width: 100% !important; width: 100% !important;
overflow: hidden; overflow: hidden;
}
section {
position: absolute;
top: 100%;
margin-top: 30px;
&:first-child {
margin-top: 0;
}
}
} }
body.js {
h1 {
transition: all .5s linear;
}
#butwhy {
h1 {
opacity: 0;
transform: translateX(-100vw);
}
&.appear h1 {
opacity: 1;
transform: translateX(0);
}
}
}
section { section {
min-height: 100vh; min-height: 100vh;
width: 100%; width: 100%;
position: absolute; position: relative;
top: 100%; //position: -webkit-sticky;
//position: sticky;
//overflow-y: auto;
//top: 0px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
//position: relative;
background: $body-bg; background: $body-bg;
margin-top: 30px;
padding-bottom: 30px; padding-bottom: 30px;
&:first-child { &:first-child {
//top: 0;
margin-top: 0;
padding-bottom: 0; padding-bottom: 0;
} }
&:not(:first-child):before { &:not(:first-child):before {
@ -28,13 +54,12 @@ section {
height: 30px; height: 30px;
position: absolute; position: absolute;
top: -30px; top: -30px;
background: linear-gradient(to left bottom, $alternate-bg 0%,$alternate-bg 49%,$body-bg 50%,$body-bg 100%); right: 0;
background: linear-gradient(to left bottom, transparent 0%,transparent 49%,$body-bg 50%,$body-bg 100%); background: linear-gradient(to left bottom, transparent 0%,transparent 49%,$body-bg 50%,$body-bg 100%);
} }
&.even { &.even {
background: $alternate-bg; background: $alternate-bg;
&:before { &:before {
background: linear-gradient(to left bottom, $body-bg 0%,$body-bg 49%,$alternate-bg 50%,$alternate-bg 100%);
background: linear-gradient(to left bottom, transparent 0%,transparent 49%,$alternate-bg 50%,$alternate-bg 100%); background: linear-gradient(to left bottom, transparent 0%,transparent 49%,$alternate-bg 50%,$alternate-bg 100%);
} }
} }

View file

@ -1,17 +1,21 @@
document.body.className = "js";
//are we running in dev mode? //are we running in dev mode?
var debug = document.body.getAttribute("data-env") === "development" ? true : false; var debug = document.body.getAttribute("data-env") === "development" ? true : false;
document.body.style.height = document.body.offsetHeight + "px";
var controllerPanes = new ScrollMagic.Controller({ var controllerPanes = new ScrollMagic.Controller({
globalSceneOptions: { globalSceneOptions: {
//triggerHook: 'onLeave' //triggerHook: 'onLeave'
} }
}); });
var controllerAnimations = new ScrollMagic.Controller({ // var controllerAnimations = new ScrollMagic.Controller({
globalSceneOptions: { // globalSceneOptions: {
//triggerHook: 'onLeave' // //triggerHook: 'onLeave'
} // }
}); // });
var md = new MobileDetect(window.navigator.userAgent);
var isDesktop = md.mobile() === null ? true : false;
function calculateOffset(){ function calculateOffset(){
var containerHeight = document.getElementById("pinContainer").offsetHeight; var containerHeight = document.getElementById("pinContainer").offsetHeight;
@ -32,8 +36,10 @@ function createTween(section, duration ,index){
} }
var tween = TweenMax.fromTo(section, duration, { var tween = TweenMax.fromTo(section, duration, {
y: startY, y: startY,
force3D: true,
}, { }, {
y: "-100%", y: "-100%",
force3D: true
}) })
return tween; return tween;
} }
@ -59,12 +65,19 @@ function createTweenTimeline(){
}; };
} }
wipeAnimation = createTweenTimeline(); function toggleDataAttr(attribute, toggle){
if (toggle) {
document.body.setAttribute("data-" + attribute, "enabled");
} else {
document.body.setAttribute("data-" + attribute, "disabled");
}
}
//only use the pane animations on desktop
if (isDesktop) {
toggleDataAttr("scrollmagicPanes", true);
wipeAnimation = createTweenTimeline();
// create scene for every slide
//for (var i = 0; i < sections.length - 1; i++) {
var triggerElement = document.getElementsByClassName("container")[0]; var triggerElement = document.getElementsByClassName("container")[0];
var panelScene = new ScrollMagic.Scene({ var panelScene = new ScrollMagic.Scene({
triggerElement: triggerElement, triggerElement: triggerElement,
@ -77,18 +90,31 @@ wipeAnimation = createTweenTimeline();
if (debug) { if (debug) {
panelScene.addIndicators() panelScene.addIndicators()
} }
wipeAnimation.tweens[0].updateTo({startAt: {y: calculateOffset()}}, false);
window.addEventListener('resize', function(){ window.addEventListener('resize', function(){
wipeAnimation.tweens[0].updateTo({startAt: {y: calculateOffset()}}, false) //document.body.style.height = document.body.offsetHeight + "px";
console.log("pinContainer " + document.getElementById("pinContainer").offsetHeight)
console.log("body " + document.body.offsetHeight)
console.log("resize fired!")
// if (document.body.offsetHeight - document.getElementById("pinContainer").offsetHeight > 100) {
// console.log("adjusting offset!");
// wipeAnimation.tweens[0].updateTo({startAt: {y: calculateOffset()}}, false)
// }
}) })
//} } else {
toggleDataAttr("scrollmagicPanes", false);
}
// for (var i = 0; i < sections.length; i++) { var controllerAnimations = new ScrollMagic.Controller({});
// new ScrollMagic.Scene({ var sections = document.querySelectorAll("section");
// triggerElement: sections[i] for (var i = 0; i < sections.length; i++) {
// }) sectionScene = new ScrollMagic.Scene({
// .setClassToggle(sections[i], "appear") triggerElement: sections[i]
// .addIndicators({name: "1 - add a class"}) // add indicators (requires plugin) })
// .addTo(controllerAnimations); .setClassToggle(sections[i], "appear")
// } .addTo(controllerAnimations);
if (debug) {
sectionScene.addIndicators({name: "1 - add a class"}) // add indicators (requires plugin)
}
}

3
assets/js/vendor/mobile-detect.min.js vendored Normal file

File diff suppressed because one or more lines are too long