aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--index.html3
-rw-r--r--petunientopf.pngbin0 -> 14360 bytes
-rw-r--r--script.js35
-rw-r--r--styles.css10
4 files changed, 29 insertions, 19 deletions
diff --git a/index.html b/index.html
index 1ccf761..6a64e39 100644
--- a/index.html
+++ b/index.html
@@ -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
new file mode 100644
index 0000000..6c75fe3
--- /dev/null
+++ b/petunientopf.png
Binary files differ
diff --git a/script.js b/script.js
index 977cd58..6f8d050 100644
--- a/script.js
+++ b/script.js
@@ -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
diff --git a/styles.css b/styles.css
index 0206f74..1848fdf 100644
--- a/styles.css
+++ b/styles.css
@@ -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;