Browse Source

blabla

master
david subr 4 years ago
parent
commit
070e132e93
  1. BIN
      img/img/e1.jpg
  2. BIN
      img/img/e10.jpg
  3. BIN
      img/img/e11.jpg
  4. BIN
      img/img/e12.jpg
  5. BIN
      img/img/e13.jpg
  6. BIN
      img/img/e2.jpg
  7. BIN
      img/img/e3.jpg
  8. BIN
      img/img/e4.jpg
  9. BIN
      img/img/e5.jpg
  10. BIN
      img/img/e6.jpg
  11. BIN
      img/img/e7.jpg
  12. BIN
      img/img/e8.jpg
  13. BIN
      img/img/e9.jpg
  14. BIN
      img/img/stars.jpg
  15. 52
      index.html

BIN
img/img/e1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
img/img/e10.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
img/img/e11.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
img/img/e12.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
img/img/e13.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
img/img/e2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/img/e3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/img/e4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/img/e5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
img/img/e6.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
img/img/e7.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
img/img/e8.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
img/img/e9.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
img/img/stars.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

52
index.html

@ -4,17 +4,35 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>vesmir</title>
<title>Vesmír</title>
<style> <style>
section{ section{
height: 100vh; height: 100vh;
} }
#hvezdy{ #hvezdy{
color: white; color: white;
} }
.earth-fixed{
position: fixed;
width: 200px;
opacity: 0;
}
#zjeveni{
color: white;
}
#rotace{
color: white;
}
</style> </style>
</head> </head>
<body> <body>
<div id="earth">
<img class="earth-fixed" src="img/img/e1.jpg" alt="">
</div>
<section id="uvod"> <section id="uvod">
void void
</section> </section>
@ -22,33 +40,43 @@
dark dark
</section> </section>
<section id="hvezdy"> <section id="hvezdy">
hvezdy
hvězdy
</section>
<section id="zjeveni">
zjeveni
</section> </section>
<section id="rotace">
rotace
</section>
<script> <script>
function handler() {
function handler () {
let dark = document.querySelector('#dark'); let dark = document.querySelector('#dark');
let dark_rect = dark.getBoundingClientRect(); let dark_rect = dark.getBoundingClientRect();
console.log(dark_rect.top);
console.log("dark: " + dark_rect.top);
let value = Math.ceil(255 * (dark_rect.top / dark_rect.height)); let value = Math.ceil(255 * (dark_rect.top / dark_rect.height));
if (value >= 0 && value <= 255) { if (value >= 0 && value <= 255) {
document.body.style.backgroundColor = "rgb(" + value + "," + value + "," + value + ")"; document.body.style.backgroundColor = "rgb(" + value + "," + value + "," + value + ")";
} }
let hvezdy = document.querySelector("#hvezdy");
let hvezdy = document.querySelector('#hvezdy');
let hvezdy_rect = hvezdy.getBoundingClientRect(); let hvezdy_rect = hvezdy.getBoundingClientRect();
console.log("hvezdy: " + (hvezdy_rect.height - hvezdy_rect.top)); console.log("hvezdy: " + (hvezdy_rect.height - hvezdy_rect.top));
if (hvezdy_rect.height - hvezdy_rect.top > 0) { if (hvezdy_rect.height - hvezdy_rect.top > 0) {
let opacity = (hvezdy_rect.top / hvezdy_rect.height); let opacity = (hvezdy_rect.top / hvezdy_rect.height);
if (opacity >= 0 && opacity <= 1){
console.log("opacity: " + opacity);
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 = (zjeveni_rect.top / zjeveni_rect.height);
console.log("zjeveni opacity: " + opacity)
zeme_img.style.opacity = opacity;
} }
} }
//cisla v konzoli
window.addEventListener('load', handler, false); window.addEventListener('load', handler, false);
window.addEventListener('scroll', handler, false); window.addEventListener('scroll', handler, false);
window.addEventListener('resize', handler, false); window.addEventListener('resize', handler, false);

Loading…
Cancel
Save