diff options
-rw-r--r-- | index.html | 3 | ||||
-rw-r--r-- | petunientopf.png | bin | 0 -> 14360 bytes | |||
-rw-r--r-- | script.js | 35 | ||||
-rw-r--r-- | styles.css | 10 |
4 files changed, 29 insertions, 19 deletions
@@ -13,7 +13,8 @@ <div id="starBackground" class="starBackground"></div> -<img src="pottwal.png" id="whaleParty" class="spermWhale"> +<img src="pottwal.png" id="whaleParty" class="spermWhale fallingObject"> +<img src="petunientopf.png" id="petuniaBowlParty" class="bowlOfPetunia fallingObject"> <div class="contentWrapper"> <div class="content"> diff --git a/petunientopf.png b/petunientopf.png Binary files differnew file mode 100644 index 0000000..6c75fe3 --- /dev/null +++ b/petunientopf.png @@ -107,7 +107,6 @@ particlesJS("starBackground", { /* Whale Partyy! */ -const timeout = 10000; const whaleDialog = "Ah … ! What’s happening? it thought.\n" + "\n" + @@ -137,16 +136,32 @@ const whaleDialog = "\n" + "And the rest, after a sudden wet thud, was silence."; const flowerPotDialog = "Not again..."; +const timeout = 5000; setTimeout(() => { - let whale = document.getElementById("whaleParty"); - whale.classList.add("dropWhale"); - console.log(whaleDialog); + generateObject(); setInterval(() => { - let randomNumber = Math.floor(Math.random() * 70) + 1; - whale = document.getElementById("whaleParty"); // update - whale.style.left = randomNumber.toString() + "%"; - const newWhale = whale.cloneNode(true); - whale.parentNode.replaceChild(newWhale, whale); - }, timeout); + generateObject() + }, timeout) }, timeout); + +function generateObject() { + let whale = document.getElementById("whaleParty"); + let petuniaBowl = document.getElementById("petuniaBowlParty"); + let randomLeftOffset = Math.floor(Math.random() * 70) + 1, + randomSelector = Math.floor(Math.random() * 2) + 1, + current, + newObject; + + if (randomSelector === 1) { + current = whale; + console.log(whaleDialog); + } else { + current = petuniaBowl; + console.log(flowerPotDialog); + } + newObject = current.cloneNode(true); + current.parentNode.replaceChild(newObject, current); + newObject.classList.add("dropObject"); + newObject.style.left = randomLeftOffset.toString() + "%"; +}
\ No newline at end of file @@ -54,23 +54,17 @@ canvas { } } -@media only screen and (max-height: 1000px) and (max-width: 600px) { - .content { - font-size: 2.5vh; - } -} - /* Whale falling down */ -.spermWhale { +.fallingObject { position: absolute; display: none; width: auto; height: 30vw; } -.dropWhale { +.dropObject { display: block; z-index: 1; bottom: 0; |