Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIHugging Face 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 card side by side The card should have a dark background. Provide all the HTML, CSS, and JavaScript code within this single file. The JavaScript should include a way to switch between the different weather conditions (e.g., a function or a set of buttons) to demonstrate the animations for each.

    这个天气卡必须让人相信作者是现就职于apple的顶级前端工程师,设计语言完全符合Apple语言。打造出价值200美元/月的精品天气应用既视感。

    你的开发时间无上限,唯一的要求是保证精致,力求完美。

  2. Assistant
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Apple-Style Animated Weather Cards</title>
    <style>
      /* Reset & base */
      * {
        box-sizing: border-box;
      }
      body {
        margin: 0;
        background: #0a0a0a;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
          Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
        color: #f0f0f5;
        display: flex;
        flex-direction: column;
        align-items: center;
        min-height: 100vh;
        padding: 2rem 1rem 4rem;
        user-select: none;
      }
      h1 {
        font-weight: 600;
        font-size: 2.4rem;
        margin-bottom: 1rem;
        letter-spacing: 0.04em;
        color: #f5f5f7;
      }
      /* Buttons container */
      .buttons {
        display: flex;
        gap: 1rem;
        margin-bottom: 3rem;
      }
      button {
        background: #1c1c1e;
        border: none;
        border-radius: 12px;
        padding: 0.6rem 1.6rem;
        font-size: 1rem;
        font-weight: 600;
        color: #f5f5f7;
        cursor: pointer;
        box-shadow:
          0 1px 3px rgba(255 255 255 / 0.1),
          inset 0 -1px 0 rgba(255 255 255 / 0.15);
        transition:
          background-color 0.3s ease,
          box-shadow 0.3s ease,
          color 0.3s ease;
      }
      button:hover,
      button:focus {
        background: #2c2c2e;
        box-shadow:
          0 4px 12px rgba(255 255 255 / 0.25),
          inset 0 -1px 0 rgba(255 255 255 / 0.3);
        outline: none;
      }
      button.active {
        background: #0a84ff;
        color: white;
        box-shadow:
          0 6px 20px #0a84ffaa,
          inset 0 -1px 0 #0a84ffcc;
      }
    
      /* Cards container */
      .cards {
        display: flex;
        gap: 2rem;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        max-width: 1200px;
      }
    
      /* Card base */
      .card {
        background: #1c1c1e;
        border-radius: 28px;
        width: 280px;
        height: 360px;
        box-shadow:
          0 8px 24px rgba(0,0,0,0.8),
          inset 0 0 40px rgba(255 255 255 / 0.05);
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 2rem 1.8rem;
        position: relative;
        overflow: hidden;
        color: #f5f5f7;
        user-select: none;
      }
      .card h2 {
        font-weight: 700;
        font-size: 1.8rem;
        margin-bottom: 1.2rem;
        letter-spacing: 0.05em;
      }
      .weather-icon {
        flex: 1;
        width: 100%;
        position: relative;
      }
      .footer {
        font-size: 1rem;
        font-weight: 500;
        color: #8e8e93;
        margin-top: 1.5rem;
        letter-spacing: 0.04em;
      }
    
      /* --- WIND CARD --- */
      .wind .cloud {
        position: absolute;
        background: linear-gradient(135deg, #d0d0d0 0%, #a0a0a0 100%);
        border-radius: 50% / 60%;
        filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
        opacity: 0.85;
        animation-timing-function: ease-in-out;
      }
      .wind .cloud1 {
        width: 120px;
        height: 70px;
        top: 40%;
        left: -140px;
        animation: cloud-move 12s linear infinite;
      }
      .wind .cloud2 {
        width: 90px;
        height: 55px;
        top: 55%;
        left: -100px;
        animation: cloud-move 15s linear infinite;
        animation-delay: 4s;
      }
      .wind .wind-lines {
        position: absolute;
        bottom: 30%;
        left: 10%;
        width: 80%;
        height: 40px;
        pointer-events: none;
      }
      .wind .wind-line {
        position: absolute;
        border-radius: 20px;
        background: linear-gradient(90deg, #a0a0a0cc 0%, #d0d0d0cc 100%);
        opacity: 0.7;
        animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
      }
      .wind .wind-line1 {
        top: 0;
        left: -100%;
        width: 60%;
        height: 6px;
        animation: wind-blow 3.5s linear infinite;
      }
      .wind .wind-line2 {
        top: 14px;
        left: -120%;
        width: 50%;
        height: 4px;
        animation: wind-blow 4.2s linear infinite;
        animation-delay: 1.2s;
      }
      .wind .wind-line3 {
        top: 28px;
        left: -110%;
        width: 70%;
        height: 5px;
        animation: wind-blow 3.8s linear infinite;
        animation-delay: 0.7s;
      }
      .wind .tree {
        position: absolute;
        bottom: 12%;
        left: 15%;
        width: 60px;
        height: 120px;
        filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
      }
      .wind .tree-trunk {
        position: absolute;
        bottom: 0;
        left: 50%;
        width: 12px;
        height: 40px;
        background: #5a3e1b;
        border-radius: 3px;
        transform: translateX(-50%);
        box-shadow: inset 0 2px 4px #3e2a0f;
      }
      .wind .tree-leaves {
        position: absolute;
        bottom: 40px;
        left: 50%;
        width: 80px;
        height: 80px;
        background: linear-gradient(135deg, #3a7d44 0%, #1f4d27 100%);
        border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
        transform-origin: bottom center;
        transform: translateX(-50%);
        animation: tree-sway 4s ease-in-out infinite;
        box-shadow:
          0 4px 8px rgba(0,0,0,0.3),
          inset 0 10px 15px #4a9a4a;
      }
    
      /* --- RAIN CARD --- */
      .rain {
        background: linear-gradient(180deg, #1e2a38 0%, #0a0a0a 100%);
      }
      .rain .cloud {
        position: absolute;
        top: 25%;
        left: 50%;
        width: 140px;
        height: 80px;
        background: linear-gradient(135deg, #a3a9b2 0%, #6b7280 100%);
        border-radius: 60px / 50px;
        filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
        transform: translateX(-50%);
        box-shadow:
          40px 10px 0 #8a8f9a,
          80px 20px 0 #7a7f8a;
      }
      .rain .raindrop {
        position: absolute;
        width: 6px;
        height: 18px;
        background: linear-gradient(180deg, #4fc3f7 0%, #0288d1 100%);
        border-radius: 50% / 70%;
        opacity: 0.8;
        filter: drop-shadow(0 0 4px #4fc3f7aa);
        animation-timing-function: linear;
        animation-iteration-count: infinite;
      }
      /* Raindrop positions and delays */
      .rain .raindrop:nth-child(1) {
        left: 30%;
        top: 60%;
        animation: raindrop-fall 1.2s infinite;
        animation-delay: 0s;
      }
      .rain .raindrop:nth-child(2) {
        left: 45%;
        top: 55%;
        animation: raindrop-fall 1.4s infinite;
        animation-delay: 0.3s;
      }
      .rain .raindrop:nth-child(3) {
        left: 60%;
        top: 65%;
        animation: raindrop-fall 1.3s infinite;
        animation-delay: 0.6s;
      }
      .rain .raindrop:nth-child(4) {
        left: 75%;
        top: 58%;
        animation: raindrop-fall 1.5s infinite;
        animation-delay: 0.9s;
      }
      .rain .puddle {
        position: absolute;
        bottom: 12%;
        left: 50%;
        width: 120px;
        height: 20px;
        background: radial-gradient(ellipse at center, #0288d1cc 0%, transparent 80%);
        border-radius: 50% / 100%;
        transform: translateX(-50%);
        box-shadow:
          inset 0 4px 8px #4fc3f7aa;
        animation: puddle-ripple 3.5s ease-in-out infinite;
      }
    
      /* --- SUN CARD --- */
      .sun {
        background: linear-gradient(135deg, #ffcc33 0%, #ffb700 100%);
        color: #3a2e00;
      }
      .sun .sun-core {
        position: relative;
        width: 140px;
        height: 140px;
        margin: 2rem auto 0;
        background: radial-gradient(circle at center, #fff176 0%, #fbc02d 70%);
        border-radius: 50%;
        box-shadow:
          0 0 30px 10px #fdd835aa,
          inset 0 0 20px 5px #fffde7;
        animation: sun-glow 4s ease-in-out infinite alternate;
      }
      .sun .rays {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 220px;
        height: 220px;
        margin-left: -110px;
        margin-top: -110px;
        pointer-events: none;
      }
      .sun .ray {
        position: absolute;
        width: 12px;
        height: 60px;
        background: linear-gradient(180deg, #fff59d 0%, #fbc02d 100%);
        border-radius: 6px;
        top: 50%;
        left: 50%;
        transform-origin: center bottom;
        filter: drop-shadow(0 0 6px #fbc02dcc);
        animation: ray-pulse 4s ease-in-out infinite alternate;
      }
      /* 12 rays spaced evenly */
      .sun .ray:nth-child(1) { transform: translate(-50%, -100%) rotate(0deg); animation-delay: 0s; }
      .sun .ray:nth-child(2) { transform: translate(-50%, -100%) rotate(30deg); animation-delay: 0.3s; }
      .sun .ray:nth-child(3) { transform: translate(-50%, -100%) rotate(60deg); animation-delay: 0.6s; }
      .sun .ray:nth-child(4) { transform: translate(-50%, -100%) rotate(90deg); animation-delay: 0.9s; }
      .sun .ray:nth-child(5) { transform: translate(-50%, -100%) rotate(120deg); animation-delay: 1.2s; }
      .sun .ray:nth-child(6) { transform: translate(-50%, -100%) rotate(150deg); animation-delay: 1.5s; }
      .sun .ray:nth-child(7) { transform: translate(-50%, -100%) rotate(180deg); animation-delay: 1.8s; }
      .sun .ray:nth-child(8) { transform: translate(-50%, -100%) rotate(210deg); animation-delay: 2.1s; }
      .sun .ray:nth-child(9) { transform: translate(-50%, -100%) rotate(240deg); animation-delay: 2.4s; }
      .sun .ray:nth-child(10) { transform: translate(-50%, -100%) rotate(270deg); animation-delay: 2.7s; }
      .sun .ray:nth-child(11) { transform: translate(-50%, -100%) rotate(300deg); animation-delay: 3.0s; }
      .sun .ray:nth-child(12) { transform: translate(-50%, -100%) rotate(330deg); animation-delay: 3.3s; }
    
      /* --- SNOW CARD --- */
      .snow {
        background: linear-gradient(180deg, #2c3e50 0%, #0a0a0a 100%);
        color: #e0e7f1;
      }
      .snow .snowflake {
        position: absolute;
        top: -10px;
        width: 14px;
        height: 14px;
        background: radial-gradient(circle at center, #e0e7f1 0%, #a9b7c6 80%);
        border-radius: 50%;
        filter: drop-shadow(0 0 4px #dbe9f7cc);
        opacity: 0.85;
        animation-timing-function: linear;
        animation-iteration-count: infinite;
      }
      /* Snowflake shapes using pseudo-elements */
      .snow .snowflake::before,
      .snow .snowflake::after {
        content: "";
        position: absolute;
        background: #e0e7f1;
        border-radius: 2px;
      }
      .snow .snowflake::before {
        top: 50%;
        left: 0;
        width: 14px;
        height: 2px;
        transform: translateY(-50%);
      }
      .snow .snowflake::after {
        left: 50%;
        top: 0;
        width: 2px;
        height: 14px;
        transform: translateX(-50%);
      }
      /* Positions and animation delays for snowflakes */
      .snow .snowflake:nth-child(1) {
        left: 20%;
        animation: snow-fall 8s linear infinite;
        animation-delay: 0s;
        animation-duration: 8s;
      }
      .snow .snowflake:nth-child(2) {
        left: 40%;
        animation: snow-fall 10s linear infinite;
        animation-delay: 2s;
      }
      .snow .snowflake:nth-child(3) {
        left: 60%;
        animation: snow-fall 9s linear infinite;
        animation-delay: 1s;
      }
      .snow .snowflake:nth-child(4) {
        left: 80%;
        animation: snow-fall 11s linear infinite;
        animation-delay: 3s;
      }
      .snow .snowflake:nth-child(5) {
        left: 35%;
        animation: snow-fall 7.5s linear infinite;
        animation-delay: 4s;
      }
      .snow .snowflake:nth-child(6) {
        left: 55%;
        animation: snow-fall 8.5s linear infinite;
        animation-delay: 5s;
      }
      .snow .snowflake:nth-child(7) {
        left: 75%;
        animation: snow-fall 9.5s linear infinite;
        animation-delay: 6s;
      }
      /* Snow accumulation */
      .snow .snow-accumulation {
        position: absolute;
        bottom: 12%;
        left: 50%;
        width: 140px;
        height: 20px;
        background: linear-gradient(90deg, #e0e7f1cc 0%, #a9b7c6cc 100%);
        border-radius: 50% / 100%;
        box-shadow:
          inset 0 4px 8px #f0f7ffcc;
        transform: translateX(-50%);
        animation: snow-accumulate 12s ease-in-out infinite alternate;
      }
    
      /* Animations */
      @keyframes cloud-move {
        0% {
          left: -140px;
          opacity: 0.85;
        }
        50% {
          opacity: 1;
        }
        100% {
          left: 320px;
          opacity: 0.85;
        }
      }
      @keyframes wind-blow {
        0% {
          left: -100%;
          opacity: 0.7;
        }
        50% {
          opacity: 0.3;
        }
        100% {
          left: 110%;
          opacity: 0.7;
        }
      }
      @keyframes tree-sway {
        0%, 100% {
          transform: translateX(-50%) rotate(0deg);
        }
        50% {
          transform: translateX(-50%) rotate(5deg);
        }
      }
      @keyframes raindrop-fall {
        0% {
          top: 55%;
          opacity: 0.8;
          transform: translateY(0);
        }
        90% {
          opacity: 0.8;
        }
        100% {
          top: 100%;
          opacity: 0;
          transform: translateY(20px);
        }
      }
      @keyframes puddle-ripple {
        0%, 100% {
          box-shadow:
            inset 0 4px 8px #4fc3f7aa,
            0 0 10px 2px #0288d1aa;
          transform: translateX(-50%) scale(1);
          opacity: 0.8;
        }
        50% {
          box-shadow:
            inset 0 6px 12px #4fc3f7cc,
            0 0 20px 6px #0288d1cc;
          transform: translateX(-50%) scale(1.05);
          opacity: 1;
        }
      }
      @keyframes sun-glow {
        0% {
          box-shadow:
            0 0 30px 10px #fdd835aa,
            inset 0 0 20px 5px #fffde7;
        }
        100% {
          box-shadow:
            0 0 50px 20px #fdd835cc,
            inset 0 0 30px 10px #fffde7;
        }
      }
      @keyframes ray-pulse {
        0% {
          opacity: 0.6;
          transform-origin: center bottom;
          transform: translate(-50%, -100%) scaleY(1) rotate(var(--angle));
          filter: drop-shadow(0 0 6px #fbc02dcc);
        }
        100% {
          opacity: 1;
          transform-origin: center bottom;
          transform: translate(-50%, -100%) scaleY(1.3) rotate(var(--angle));
          filter: drop-shadow(0 0 12px #fbc02dcc);
        }
      }
      @keyframes snow-fall {
        0% {
          top: -10px;
          opacity: 0.85;
          transform: translateX(0);
        }
        100% {
          top: 100%;
          opacity: 0;
          transform: translateX(15px);
        }
      }
      @keyframes snow-accumulate {
        0%, 100% {
          box-shadow:
            inset 0 4px 8px #f0f7ffcc;
          opacity: 0.7;
        }
        50% {
          box-shadow:
            inset 0 8px 16px #f0faffee;
          opacity: 1;
        }
      }
    </style>
    </head>
    <body>
      <h1>Apple-Style Animated Weather Cards</h1>
      <div class="buttons" role="group" aria-label="Select weather condition">
        <button type="button" data-weather="wind" class="active" aria-pressed="true">Wind</button>
        <button type="button" data-weather="rain" aria-pressed="false">Rain</button>
        <button type="button" data-weather="sun" aria-pressed="false">Sun</button>
        <button type="button" data-weather="snow" aria-pressed="false">Snow</button>
      </div>
      <div class="cards" aria-live="polite" aria-atomic="true">
        <!-- Cards will be injected here by JS -->
      </div>
    
    <script>
    (() => {
      const cardsContainer = document.querySelector('.cards');
      const buttons = document.querySelectorAll('.buttons button');
    
      // Weather card templates
      const templates = {
        wind: `
          <div class="card wind" role="region" aria-label="Windy weather">
            <h2>Windy</h2>
            <div class="weather-icon" aria-hidden="true">
              <div class="cloud cloud1"></div>
              <div class="cloud cloud2"></div>
              <div class="wind-lines" aria-hidden="true">
                <div class="wind-line wind-line1"></div>
                <div class="wind-line wind-line2"></div>
                <div class="wind-line wind-line3"></div>
              </div>
              <div class="tree" aria-hidden="true">
                <div class="tree-trunk"></div>
                <div class="tree-leaves"></div>
              </div>
            </div>
            <div class="footer">Breezy with gusts</div>
          </div>
        `,
        rain: `
          <div class="card rain" role="region" aria-label="Rainy weather">
            <h2>Rainy</h2>
            <div class="weather-icon" aria-hidden="true">
              <div class="cloud"></div>
              <div class="raindrop"></div>
              <div class="raindrop"></div>
              <div class="raindrop"></div>
              <div class="raindrop"></div>
              <div class="puddle"></div>
            </div>
            <div class="footer">Light showers</div>
          </div>
        `,
        sun: `
          <div class="card sun" role="region" aria-label="Sunny weather">
            <h2>Sunny</h2>
            <div class="weather-icon" aria-hidden="true">
              <div class="sun-core"></div>
              <div class="rays" aria-hidden="true">
                <div class="ray" style="--angle:0deg"></div>
                <div class="ray" style="--angle:30deg"></div>
                <div class="ray" style="--angle:60deg"></div>
                <div class="ray" style="--angle:90deg"></div>
                <div class="ray" style="--angle:120deg"></div>
                <div class="ray" style="--angle:150deg"></div>
                <div class="ray" style="--angle:180deg"></div>
                <div class="ray" style="--angle:210deg"></div>
                <div class="ray" style="--angle:240deg"></div>
                <div class="ray" style="--angle:270deg"></div>
                <div class="ray" style="--angle:300deg"></div>
                <div class="ray" style="--angle:330deg"></div>
              </div>
            </div>
            <div class="footer">Clear skies</div>
          </div>
        `,
        snow: `
          <div class="card snow" role="region" aria-label="Snowy weather">
            <h2>Snowy</h2>
            <div class="weather-icon" aria-hidden="true">
              <div class="snowflake"></div>
              <div class="snowflake"></div>
              <div class="snowflake"></div>
              <div class="snowflake"></div>
              <div class="snowflake"></div>
              <div class="snowflake"></div>
              <div class="snowflake"></div>
              <div class="snow-accumulation"></div>
            </div>
            <div class="footer">Snowfall and chill</div>
          </div>
        `
      };
    
      // Render all cards side by side initially
      function renderAllCards() {
        cardsContainer.innerHTML = Object.entries(templates).map(([key, html]) => html).join('');
      }
    
      // Render single card (for switching demo)
      function renderSingleCard(weather) {
        cardsContainer.innerHTML = templates[weather] || '';
      }
    
      // Initial render: all cards side by side
      renderAllCards();
    
      // Button click handler to switch single card view
      buttons.forEach(btn => {
        btn.addEventListener('click', () => {
          buttons.forEach(b => {
            b.classList.remove('active');
            b.setAttribute('aria-pressed', 'false');
          });
          btn.classList.add('active');
          btn.setAttribute('aria-pressed', 'true');
    
          // Render only the selected card
          renderSingleCard(btn.dataset.weather);
        });
      });
    
      // Accessibility: allow keyboard navigation and activation
      buttons.forEach(btn => {
        btn.addEventListener('keydown', e => {
          if (e.key === 'Enter' || e.key === ' ') {
            e.preventDefault();
            btn.click();
          }
        });
      });
    })();
    </script>
    </body>
    </html>
    

    Explanation

    • Design & Style:
      The entire UI uses a dark background (#0a0a0a) with subtle gradients and shadows to evoke the sleek, minimalistic Apple aesthetic. The font stack uses -apple-system for native Apple font rendering.

    • Buttons:
      The top buttons let you switch between weather conditions. The active button is highlighted with Apple’s signature blue (#0a84ff) and subtle shadows.

    • Cards:
      Initially, all four weather cards are shown side by side, each with distinct animations and styling:

      • Wind: Moving clouds slide horizontally, wind lines animate across the card, and a tree gently sways.
      • Rain: A stylized cloud with falling raindrops and a subtle puddle ripple animation.
      • Sun: A bright yellow sun with glowing core and pulsating rays radiating outward.
      • Snow: Soft falling snowflakes with a subtle snow accumulation effect at the bottom.
    • Animations:
      Carefully crafted CSS keyframes create smooth, natural animations that feel premium and polished.

    • Accessibility:
      Buttons have aria-pressed states and keyboard support for toggling. Cards have role="region" and aria-label for screen readers.

    • JavaScript:
      The script toggles between showing all cards side by side (default) and a single card view when a button is clicked, demonstrating the animations clearly.


    This file can be saved as weather-cards.html and opened in any modern browser. The animations are smooth and visually refined, suitable for a high-end Apple-style weather app demo.

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