Browse Source

vesmir

master
Lukáš Helcl 4 years ago
parent
commit
42ca28b5b5
  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. 97
      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

97
index.html

@ -0,0 +1,97 @@
<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>
<style>
section{
height: 100vh;
}
#hvezdy{
color: white;
}
.earth-fixed{
position: fixed;
width: 200px;
opacity: 0;
}
#zjeveni{
color: white;
}
#rotace{
color: white;
}
</style>
</head>
<body>
<div id="earth">
<img class="earth-fixed" src="img/e1.jpg" alt="">
</div>
<section id="uvod">
void
</section>
<section id="dark">
dark
</section>
<section id="hvezdy">
hvězdy
</section>
<section id="zjeveni">
zjeveni
</section>
<section id="rotace">
rotace
</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));
if (value >= 0 && value <= 255) {
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));
if (hvezdy_rect.height - hvezdy_rect.top > 0) {
let opacity = (hvezdy_rect.top / hvezdy_rect.height);
console.log("Opacity: " + opacity);
}
let zjeveni = document.querySelector('#zjeveni');
let zjeveni_rect = zjeveni.getBoundingClientRect();
let zeme_img = document.querySelector(".earth-fixed");
console.log("zjeveni: " + (zjeveni_rect.height - zjeveni_rect.top));
if (zjeveni_rect.height - zjeveni_rect.top > 0) {
let opacity = 1 - (zjeveni_rect.top / zjeveni_rect.height);
console.log("zjeveni opacity: " + opacity)
zeme_img.style.opacity = opacity;
}
let rotace = document.querySelector('#rotace');
let rotace_rect = rotace.getBoundingClientRect();
console.log("rotace: " + (rotace_rect.height - rotace_rect.top));
if (rotace_rect.height - rotace_rect.top > 0) {
let cislo = Math.ceil(13 * (1 - (rotace_rect.top / rotace_rect.height)));
console.log("cislo: " + cislo);
if (cislo >= 1 && cislo <= 13) {
zeme_img.setAttribute("src", "img/e" + cislo + ".jpg");
}
}
}
//cisla v konzoli
window.addEventListener('load', handler, false);
window.addEventListener('scroll', handler, false);
window.addEventListener('resize', handler, false);
</script>
</body>
</html>
Loading…
Cancel
Save