@ -0,0 +1,41 @@ |
|||||
|
section{ |
||||
|
color: white; |
||||
|
text-align: center; |
||||
|
height: 100vh; |
||||
|
} |
||||
|
|
||||
|
#uvod{ |
||||
|
color: black; |
||||
|
} |
||||
|
|
||||
|
#dark{ |
||||
|
color: gray; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#earth{ |
||||
|
text-align: right; |
||||
|
} |
||||
|
|
||||
|
.stars{ |
||||
|
position: fixed; |
||||
|
top: 9.8%; |
||||
|
left: 34.5%; |
||||
|
opacity: 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.earth-fixed{ |
||||
|
position: fixed; |
||||
|
bottom: 35%; |
||||
|
right: 65%; |
||||
|
opacity: 0; |
||||
|
} |
||||
|
|
||||
|
.evolvedtext{ |
||||
|
position: fixed; |
||||
|
bottom: 20%; |
||||
|
right: 71.8%; |
||||
|
opacity: 0; |
||||
|
} |
||||
|
|
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 38 KiB |
@ -0,0 +1,82 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta charset="UTF-8"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
<link rel="stylesheet" href="css/main.css"> |
||||
|
<title>Document</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<section id="earth"> |
||||
|
<img class="earth-fixed" src="img/e1.jpg" alt=""> |
||||
|
There was Earth |
||||
|
</section> |
||||
|
<section id="uvod"> |
||||
|
Before Void |
||||
|
</section> |
||||
|
<section id="dark"> |
||||
|
There was Dark |
||||
|
</section> |
||||
|
<section id="after"> |
||||
|
<img class="stars" src="img/stars.jpg" alt=""> |
||||
|
After Dark |
||||
|
</section> |
||||
|
<section id="zjeveni"> |
||||
|
THERE WAS EARTH |
||||
|
</section> |
||||
|
<section id="rotace"> |
||||
|
<p class="evolvedtext">EVOLVED INTO WHAT WE SEE TODAY</p> |
||||
|
</section> |
||||
|
|
||||
|
|
||||
|
<script> |
||||
|
function handler() { |
||||
|
let dark = document.querySelector('#dark'); |
||||
|
let dark_rect = dark.getBoundingClientRect(); |
||||
|
console.log(dark_rect.top); |
||||
|
let value = Math.ceil(255 * (dark_rect.top / dark_rect.height)); |
||||
|
if (value >= 0 && value <= 255 ){ |
||||
|
document.body.style.backgroundColor = "rgb(" + value + "," + value + "," + value + ")"; |
||||
|
} |
||||
|
// document.body.style.backgroundColor = "rgb(" + value + "," + value + "," + value + ")"; |
||||
|
|
||||
|
|
||||
|
let after = document.querySelector("#after"); |
||||
|
let after_rect = after.getBoundingClientRect(); |
||||
|
let after_img = document.querySelector(".stars") |
||||
|
if (after_rect.height - after_rect.top > 0){ |
||||
|
let opacity = (after_rect.top / after_rect.height); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
let zjeveni = document.querySelector('#zjeveni'); |
||||
|
let zjeveni_rect = zjeveni.getBoundingClientRect(); |
||||
|
let zeme_img = document.querySelector(".earth-fixed"); |
||||
|
let evolvedtext_appear = document.querySelector(".evolvedtext") |
||||
|
if (zjeveni_rect.height - zjeveni_rect.top > 0){ |
||||
|
let opacity = 1 -(zjeveni_rect.top / zjeveni_rect.height); |
||||
|
zeme_img.style.opacity = opacity; |
||||
|
after_img.style.opacity = opacity; |
||||
|
evolvedtext_appear.style.opacity = opacity; |
||||
|
} |
||||
|
|
||||
|
let rotace = document.querySelector('#rotace'); |
||||
|
let rotace_rect = rotace.getBoundingClientRect(); |
||||
|
if (rotace_rect.height - rotace_rect.top > 0){ |
||||
|
let cislo = Math.ceil(13* (1 - (rotace_rect.top / rotace_rect.height))); |
||||
|
if (cislo >= 1 && cislo <= 13 ){ |
||||
|
zeme_img.setAttribute("src", "img/e" + cislo + ".jpg") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
window.addEventListener('load', handler, false) |
||||
|
window.addEventListener('scroll', handler, false) |
||||
|
window.addEventListener('resize', handler, false) |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |