Skip to content
The Chat Archive
o3-mini· OpenAI LMArena Human Preference 140K

Create a single HTML file containing CSS and JavaScript to generate an animated weather…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-sonnet-4-20250514’s answer.
  1. User

    Create a single HTML file containing CSS and JavaScript to generate an animated weather card. The card should visually represent the following weather conditions with distinct animations: Wind: (e.g., moving clouds, swaying trees, or wind lines) Rain: (e.g., falling raindrops, puddles forming) Sun: (e.g., shining rays, bright background) Snow: (e.g., falling snowflakes, snow accumulating) Show all the weather cards side by side. Include a speed toggle to control how fast the animation is for each card.

  2. Assistant

    Below is a complete HTML file that embeds CSS and JavaScript to display four weather cards (Wind, Rain, Sun, Snow) side by side. Each card has its own CSS animations (for example, moving clouds and wind lines for Wind, falling raindrops and a ripple puddle for Rain, shining rays for Sun, and falling snowflakes with accumulation for Snow). A speed slider lets you control the overall animation speed by modifying a CSS custom property used within the animation durations.

    Simply save the code as an HTML file (e.g. weather.html) and open it in your browser.


    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>Animated Weather Cards</title>
      <style>
        /* Global Styles */
        body {
          font-family: sans-serif;
          background: #f0f0f0;
          text-align: center;
          padding: 20px;
          margin: 0;
        }
        h1 {
          margin-bottom: 20px;
        }
        .container {
          display: flex;
          justify-content: center;
          gap: 20px;
          flex-wrap: wrap;
        }
        .card {
          position: relative;
          width: 220px;
          height: 220px;
          background: #fff;
          border-radius: 10px;
          box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
          overflow: hidden;
        }
        .card h2 {
          margin-top: 10px;
          font-size: 1.2em;
        }
        
        /* The CSS variable "--speed" controls the animation speed.
           Increasing --speed makes the animations faster since durations are
           divided by --speed. */
        :root {
          --speed: 1;
        }
        
        /* ======================
           WIND CARD STYLES
           Background with moving clouds and a wind line that sways.
        ====================== */
        .wind {
          background: linear-gradient(to top, #a1c4fd, #c2e9fb);
        }
        .wind .cloud {
          position: absolute;
          top: 40px;
          left: -100px;
          width: 80px;
          height: 50px;
          background: #fff;
          border-radius: 50%;
          box-shadow: 20px 10px 0 0 #fff, 40px 0 0 0 #fff;
          animation: moveClouds calc(10s / var(--speed)) linear infinite;
        }
        @keyframes moveClouds {
          0%   { transform: translateX(0); }
          100% { transform: translateX(300px); }
        }
        .wind .wind-line {
          position: absolute;
          top: 120px;
          left: 20px;
          width: 40px;
          height: 2px;
          background: #fff;
          opacity: 0.7;
          animation: moveWind calc(6s / var(--speed)) ease-in-out infinite;
        }
        @keyframes moveWind {
          0%, 100% { transform: translate(0, 0); }
          50% { transform: translate(20px, 5px); }
        }
        
        /* ======================
           RAIN CARD STYLES
           Background with falling raindrops and a ripple puddle.
        ====================== */
        .rain {
          background: linear-gradient(to top, #4facfe, #00f2fe);
        }
        .rain .raindrop {
          position: absolute;
          top: -10px;
          width: 2px;
          height: 10px;
          background: #a3d5ff;
          border-radius: 50%;
          animation: fall calc(1.5s / var(--speed)) linear infinite;
        }
        /* Each raindrop instance can have its own left position and delay */
        @keyframes fall {
          0%   { top: -10px; opacity: 1; }
          80%  { opacity: 1; }
          100% { top: 220px; opacity: 0; }
        }
        .rain .puddle {
          position: absolute;
          bottom: 0;
          left: 50%;
          width: 60px;
          height: 10px;
          background: rgba(255, 255, 255, 0.8);
          border-radius: 50%;
          transform: translateX(-50%);
          animation: ripple calc(2.5s / var(--speed)) ease-in-out infinite;
        }
        @keyframes ripple {
          0%   { transform: scaleX(1) translateX(-50%); }
          50%  { transform: scaleX(1.5) translateX(-50%); }
          100% { transform: scaleX(1) translateX(-50%); }
        }
        
        /* ======================
           SUN CARD STYLES
           Background with a central sun and pulsing rays.
        ====================== */
        .sun {
          background: linear-gradient(to top, #ffecd2, #fcb69f);
        }
        .sun .sun-core {
          position: absolute;
          top: 60px;
          left: 50%;
          width: 60px;
          height: 60px;
          background: #ffd700;
          border-radius: 50%;
          transform: translateX(-50%);
          box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
          animation: pulse calc(3s / var(--speed)) ease-in-out infinite;
        }
        @keyframes pulse {
          0%   { box-shadow: 0 0 10px rgba(255, 215, 0, 0.6); }
          50%  { box-shadow: 0 0 25px rgba(255, 215, 0, 1); }
          100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.6); }
        }
        /* Create eight rays by reusing the same HTML element multiple times */
        .sun .ray {
          position: absolute;
          top: 30px;
          left: 50%;
          width: 8px;
          height: 40px;
          background: #ffd700;
          border-radius: 4px;
          transform-origin: center bottom;
          animation: rotateRay calc(4s / var(--speed)) linear infinite;
        }
        /* Position each ray at different angles */
        .sun .ray:nth-child(2) { transform: translateX(-50%) rotate(0deg); }
        .sun .ray:nth-child(3) { transform: translateX(-50%) rotate(45deg); }
        .sun .ray:nth-child(4) { transform: translateX(-50%) rotate(90deg); }
        .sun .ray:nth-child(5) { transform: translateX(-50%) rotate(135deg); }
        .sun .ray:nth-child(6) { transform: translateX(-50%) rotate(180deg); }
        .sun .ray:nth-child(7) { transform: translateX(-50%) rotate(225deg); }
        .sun .ray:nth-child(8) { transform: translateX(-50%) rotate(270deg); }
        .sun .ray:nth-child(9) { transform: translateX(-50%) rotate(315deg); }
        @keyframes rotateRay {
          0%   { opacity: 0.5; }
          50%  { opacity: 1; }
          100% { opacity: 0.5; }
        }
        
        /* ======================
           SNOW CARD STYLES
           Background with falling snowflakes and a growing snow accumulation.
        ====================== */
        .snow {
          background: linear-gradient(to top, #e0f7fa, #80deea);
        }
        .snow .snowflake {
          position: absolute;
          top: -10px;
          color: #fff;
          font-size: 16px;
          animation: snowFall calc(4s / var(--speed)) linear infinite;
        }
        @keyframes snowFall {
          0%   { top: -10px; opacity: 0; }
          20%  { opacity: 1; }
          80%  { opacity: 1; }
          100% { top: 220px; opacity: 0; }
        }
        .snow .accumulation {
          position: absolute;
          bottom: 0;
          left: 0;
          width: 100%;
          height: 0;
          background: #fff;
          animation: accumulate calc(10s / var(--speed)) forwards;
        }
        @keyframes accumulate {
          0%   { height: 0; }
          100% { height: 30px; }
        }
        
        /* Slider styling */
        input[type="range"] {
          margin: 10px;
        }
      </style>
    </head>
    <body>
      <h1>Animated Weather Cards</h1>
      
      <!-- Speed Control -->
      <div>
        <label for="speedRange">Animation Speed:</label>
        <input type="range" id="speedRange" min="0.5" max="3" step="0.1" value="1">
        <span id="speedValue">1x</span>
      </div>
      
      <!-- Weather Cards Container -->
      <div class="container">
        
        <!-- Wind Card -->
        <div class="card wind">
          <h2>Wind</h2>
          <div class="cloud"></div>
          <div class="wind-line"></div>
        </div>
        
        <!-- Rain Card -->
        <div class="card rain">
          <h2>Rain</h2>
          <!-- Creating several raindrops with varying delays and positions -->
          <div class="raindrop" style="left: 30px; animation-delay: 0s;"></div>
          <div class="raindrop" style="left: 60px; animation-delay: 0.3s;"></div>
          <div class="raindrop" style="left: 90px; animation-delay: 0.6s;"></div>
          <div class="raindrop" style="left: 120px; animation-delay: 0.9s;"></div>
          <div class="puddle"></div>
        </div>
        
        <!-- Sun Card -->
        <div class="card sun">
          <h2>Sun</h2>
          <div class="sun-core"></div>
          <!-- Eight rays -->
          <div class="ray"></div>
          <div class="ray"></div>
          <div class="ray"></div>
          <div class="ray"></div>
          <div class="ray"></div>
          <div class="ray"></div>
          <div class="ray"></div>
          <div class="ray"></div>
        </div>
        
        <!-- Snow Card -->
        <div class="card snow">
          <h2>Snow</h2>
          <div class="snowflake" style="left: 20px; animation-delay: 0s;">❄</div>
          <div class="snowflake" style="left: 70px; animation-delay: 1s;">❄</div>
          <div class="snowflake" style="left: 120px; animation-delay: 0.5s;">❄</div>
          <div class="snowflake" style="left: 170px; animation-delay: 1.5s;">❄</div>
          <div class="accumulation"></div>
        </div>
      </div>
      
      <script>
        // When the slider value changes, update the CSS custom property "--speed"
        const speedRange = document.getElementById('speedRange');
        const speedValue = document.getElementById('speedValue');
        
        speedRange.addEventListener('input', function() {
          const speed = this.value;
          document.documentElement.style.setProperty('--speed', speed);
          speedValue.textContent = speed + 'x';
        });
      </script>
    </body>
    </html>
    

    How It Works

    1. CSS Variables & Animations:

      • A CSS variable --speed is declared in the :root selector.
      • Each animation uses a duration defined as calc(duration / var(--speed)) so that increasing the slider value (speed) decreases the actual duration, making the animations faster.
    2. Weather Cards:

      • The four cards are styled differently using background gradients and unique animation keyframes.
      • Each card has extra inner elements (like .cloud, .raindrop, etc.) that are animated.
    3. Speed Toggle:

      • The HTML range input updates the CSS variable --speed on every change, and a small span displays the current speed multiplier.

    Enjoy customizing and experimenting with your animated weather cards!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.