Cookie Consent by Free Privacy Policy Generator 📌 Created a simple Earth simulation-like with a message with CSS only.


✅ Created a simple Earth simulation-like with a message with CSS only.


💡 Newskategorie: Programmierung
🔗 Quelle: dev.to

This is a submission for Frontend Challenge v24.04.17, CSS Art: Earth Day.

Hey there!
I built a Earth showing it's transition from being natural to dreadfulness with CSS animations.
This simply highlights the immediate need of protecting the earth before it's gone.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Earth Day - Protect Our Planet</title>
  <style>
body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(to bottom, #e0e0e0 0%, #ececec 30%, #f0f0f0 60%);
}

.earth {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  position: relative; /* Make Earth the reference point for message positioning */
  background: conic-gradient(#2c9bff 0%, #43a047 60%); /* Healthy Earth colors */
  box-shadow: inset 4px 4px 10px rgba(0, 0, 0, 0.2), 0 0 15px rgba(255, 255, 255, 0.4);
  animation: earth-state 10s linear infinite alternate;
}

@keyframes earth-state {
from {
    background: conic-gradient(#2c9bff 0%, #43a047 60%); /* Healthy Earth colors (0%) */
  }
  /* No intermediate keyframes needed as messages control visibility */
  to {
    background: conic-gradient(#333 0%, #555 60%); /* Deteriorated Earth colors (100%) */
  }
}



.message {
  position: absolute;
  transform: translateX(-50%); /* Center horizontally */
  white-space: nowrap;
  font-size: 20px;
  color: #fff;
  text-shadow: 0 0 5px #000;
  opacity: 0; /* Initially invisible */
}

.message.before {
  top: calc(50% - 60px); /* Position above Earth with offset */
  transform: translateX(-50%); /* Center horizontally */
  animation: message-fade-before 10s linear infinite alternate; /* Separate fade animation */
}

.message.after {
  top: calc(50% + 60px); /* Position below Earth with offset */
  transform: translateX(-50%); /* Center horizontally */
  animation: message-fade-after 10s linear infinite alternate; /* Separate fade animation */
}

@keyframes message-fade-before {
  /* Fade out slightly before the full color transition of Earth (around 70%) */
  0% {
    opacity: 1; /* Visible when Earth is healthy (before message) */
  }
  8 0% {
    opacity: 0; /* Fade out before Earth deteriorates */
  }
  100% {
    opacity: 0; /* Remain invisible during deteriorated state */
  }
}

@keyframes message-fade-after {
  /* Fade in when Earth is fully deteriorated (100%) */
  0% {
    opacity: 0; /* Remain invisible until fully deteriorated */
  }
  100% {
    opacity: 1; /* Visible only at 100% (deteriorated state) */
  }
}
  </style>
</head>
<body>
  <div class="earth"></div>
 <div class="message before">Protect Our Planet Before...</div>
  <div class="message after">It's Gone...</div>
</body>
</html>

This was pretty challenging to implement the idea of Earth transition from a natural state(blue & green) to it's deteriorated and dreadful state(gloomy grey)using pure CSS.
I mustered myself on completing this challenge and finished with what I could.
The takeaway from this was learning about keyframes in CSS and not relying on Javascript to enhance the visual outlook of the prototype.
Thanks for this challenge DEV team!
I hope everybody who participated had learnt something regardless of how you feel about it.

Earth at it's healthy state
Earth at it's deteriorated state

...

✅ Submission for Frontend Challenge Earth-Day-Edition: Earth's Rotation: Rotating with CSS on Earth Day


📈 38.56 Punkte

✅ Introduction of CSS, What is CSS, Why we use CSS and How CSS describe the HTML elements


📈 33.41 Punkte

✅ Submission for Frontend Challenge Earth-Day-Edition: different elements of Earth: CSS Card animation


📈 28.49 Punkte

✅ Submission for Frontend Challenge Earth-Day-Edition: Elements of Earth: CSS Card animation


📈 28.49 Punkte

✅ Earth Day Celebration "CSS only - NO JavaScript


📈 26.14 Punkte

✅ Earth rescue - A CSS only game


📈 26.14 Punkte

✅ CSS Grid: Moving From CSS Frameworks To CSS Grid (2018 and beyond)


📈 25.06 Punkte

✅ Choosing the Right CSS Approach: Tailwind CSS vs Bootstrap vs Vanilla CSS


📈 25.06 Punkte

✅ A BRIEF REVIEW OF CSS CASCADING, CSS SELECTORS and CSS SPECIFICITY.


📈 25.06 Punkte

✅ Stylify CSS: Automagic CSS bundles splitting into CSS layers in Astro.build


📈 25.06 Punkte

✅ css-shape.com: The Ultimate Collection of CSS-only Shapes ⚡️


📈 24.43 Punkte

✅ Could Our Entire Reality Be Part of a Simulation Created by Some Other Beings?


📈 23.95 Punkte

✅ Make A Simple Login Form in HTML and CSS only


📈 23.43 Punkte

✅ Simple Flight Slider HTML & CSS Only


📈 23.43 Punkte

✅ Do you need a Tooltip or a Speech Bubble? I have created 100 using CSS 😲


📈 20.19 Punkte

✅ [Mkhtml] I created a tool to populate html/css files


📈 20.19 Punkte

✅ A Look at Earth Archive, a Project To Produce Detailed Maps of All the Land on Earth Through Laser Scanning


📈 20.14 Punkte

✅ I made a Earth Day Challenge website that calls for Humanity for Earth


📈 20.14 Punkte

✅ Google Earth ist nicht mehr Chrome-exklusiv: Google Earth ist jetzt in allen Browsern als Preview verfügbar


📈 20.14 Punkte

✅ Earth Challenge 🌍 Earth Day !


📈 20.14 Punkte

✅ Google Earth's New Tool Lets You Measure Distance Between Anything On Earth


📈 20.14 Punkte

✅ Earth Day Frontend Challenge landing page: Hugging Earth


📈 20.14 Punkte

✅ Google Earth's New Tool Measures The Distance and Area of Locations on Earth


📈 20.14 Punkte

✅ "Code for Earth: Uniting Tech & Nature on Earth Day"


📈 20.14 Punkte

✅ Large Near-Earth Astroid Will Fly Past Earth On April 19


📈 20.14 Punkte

✅ Submission For Front-end Challenge 2024 Earth Day Edition 🌎: "Earth's Future In Our Hands"


📈 20.14 Punkte

✅ Google Earth's Timelapses Offer a 32-Year Look At Earth's Changing Surface


📈 20.14 Punkte

✅ Google Earth Pro 7.3.6.9326 - Advanced business tools for Google Earth.


📈 20.14 Punkte

✅ Google Earth VR: Neuer Virtual Reality-Flugsimulator in der Welt von Google Earth


📈 20.14 Punkte

✅ Apple TV+ debuts “The Year Earth Changed” to herald Earth Day 2021


📈 20.14 Punkte











matomo

Datei nicht gefunden!