Browse Source

commit

master
Stanislav Platil 4 years ago
commit
457e93ca55
  1. BIN
      img/e1.jpg
  2. BIN
      img/e10.jpg
  3. BIN
      img/e11.jpg
  4. BIN
      img/e12.jpg
  5. BIN
      img/e13.jpg
  6. BIN
      img/e2.jpg
  7. BIN
      img/e3.jpg
  8. BIN
      img/e4.jpg
  9. BIN
      img/e5.jpg
  10. BIN
      img/e6.jpg
  11. BIN
      img/e7.jpg
  12. BIN
      img/e8.jpg
  13. BIN
      img/e9.jpg
  14. BIN
      img/stars.jpg
  15. 124
      index.html

BIN
img/e1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
img/e10.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
img/e11.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
img/e12.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
img/e13.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
img/e2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/e3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/e4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/e5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
img/e6.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
img/e7.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
img/e8.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
img/e9.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
img/stars.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

124
index.html

@ -0,0 +1,124 @@
<!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">
<title>Vesmír</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs/ZVWx6oOypYoCJhGGScy+8" crossorigin="anonymous"></script>
<style>
section{
height: 100vh;
text-align: center;
}
#hvezdy{
color: white;
}
.zeme-fixed{
width: 300px;
position: fixed;
opacity: 0;
margin-left: 50px;
margin-top: 100px;
}
.hvezdy_img{
position: fixed;
opacity: 0;
z-index: 0;
}
#zjeveni, #rotace, #end{
color: white;
position: relative;
z-index: 1;
}
</style>
</head>
<body>
<div id="stars">
<img class="hvezdy_img" src="img/stars.jpg" alt="">
</div>
<div id="zeme">
<img class="zeme-fixed" src="img/e1.jpg" alt="">
</div>
<section id="uvod">
<h2>Before the scroll,<br>
there was a void...</h2>
</section>
<section id="dark">
<h2>...then came<br>
the dark</h2>
</section>
<section id="hvezdy">
<h2>few milions years later,<br>
the stars emerged</h2>
</section>
<section id="zjeveni">
<h2>and finally,<br> the planet</h2>
</section>
<section id="rotace">
<h2>Earth formed</h2>
</section>
<section id="end">
<h2 style="padding-top: 250px;">this was the begining</h2>
</section>
<script>
function handler(){
let dark = document.querySelector('#dark');
let dark_rect = dark.getBoundingClientRect();
//console.log("dark:" + dark_rect.top);
let value = Math.ceil(255 * (dark_rect.top / dark_rect.height));
document.body.style.backgroundColor = "rgb(" + value + "," + value + "," + value + ")";
let hvezdy = document.querySelector("#hvezdy");
let hvezdy_rect = hvezdy.getBoundingClientRect();
//console.log("hvezdy: " + (hvezdy_rect.height - hvezdy_rect.top));
let hvezdy_img = document.querySelector(".hvezdy_img")
let opacity_hvezdy = 1 - (hvezdy_rect.top / hvezdy_rect.height);
hvezdy_img.style.opacity = opacity_hvezdy
let zjeveni = document.querySelector("#zjeveni");
let zjeveni_rect = zjeveni.getBoundingClientRect();
//console.log("hvezdy: " + (zjeveni_rect.height - zjeveni_rect.top));
let zeme = document.querySelector(".zeme-fixed")
let opacity = 1 - (zjeveni_rect.top / zjeveni_rect.height);
zeme.style.opacity = opacity;
let rotace = document.querySelector("#rotace")
let rotace_rect = rotace.getBoundingClientRect();
let cislo = Math.ceil(13 * (1 - (rotace_rect.top / rotace_rect.height)));
if(cislo >= 1 && cislo <=13 ){
//console.log("rotace:" + cislo)
zeme.src = ("img/e" + cislo + ".jpg");
}
let end = document.querySelector("#end");
let end_rect = end.getBoundingClientRect();
if(end_rect.height > end_rect.top ){
opacity = (end_rect.top / end_rect.height);
zeme.style.opacity = opacity;
}
}
window.addEventListener('load', handler, false);
window.addEventListener('scroll', handler, false);
window.addEventListener('resize', handler, false);
</script>
</body>
</html>
Loading…
Cancel
Save