• Updated 3 Dec, 05:00 UTC
  • Next run 4 Dec, 05:17 UTCNext 4 Dec 05:17
  • Last 7 days: 4 new models · 73 runs7 d: 4 models · 73 runs
Wristwatch that shows the current time

GLM 5.4Z.ai

Network offOpen alone (new tab)

Run details

Model
z-ai/glm-5.4
Route
OpenRouter API
Served by
Modal
Effort
max (OpenRouter default)
Limits
60 min · 681,818 output tokens ($3.00 cap at $4.40/M)
Date
2 Dec 2026
Time
3 min 13 s
Size
23 kB
Tokens
87 in, 47,606 out (38,751 thinking)
List price
$0.21 at today's price ($1.40 in / $4.40 out per M)
Paid
$0.21

Raw: output · meta.json

Prompt

Draw a mechanical wristwatch that shows the current local time, with a sweeping seconds hand and a date window. Make it look expensive.

It must be one complete, self-contained HTML file: inline all CSS and JavaScript, and make no network requests of any kind (no CDNs, web fonts or remote images). Reply with the file in a single ```html code block.

Source

23 kB 474 lines Raw

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#0a0b0d">
<title>Aubert Frères — Calibre AF-12</title>
<style>
/* ---------- base ---------- */
*{margin:0;padding:0;box-sizing:border-box}
:root{
  --S:min(62vmin,560px);
  --serif:"Didot","Bodoni MT","Playfair Display","Cormorant Garamond",Georgia,"Times New Roman",serif;
  --sans:"Helvetica Neue",Helvetica,"Segoe UI",sans-serif;
}
html,body{height:100%}
body{
  font-family:var(--sans);
  color:#e7e9ec;
  background:radial-gradient(58% 46% at 50% 42%,#17191d 0%,#0d0e11 52%,#050607 100%);
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  user-select:none;
}
.stage{position:relative;min-height:100svh;display:grid;place-items:center}
.grain{position:fixed;inset:0;z-index:30;pointer-events:none;opacity:.05;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E")}
.vignette{position:fixed;inset:0;z-index:15;pointer-events:none;
  background:radial-gradient(120% 92% at 50% 45%,transparent 52%,rgba(0,0,0,.55) 100%)}

/* ---------- corner copy ---------- */
.corner{position:fixed;z-index:16;pointer-events:none}
.tl{top:clamp(16px,3.2vw,44px);left:clamp(16px,3.2vw,44px)}
.tr{top:clamp(16px,3.2vw,44px);right:clamp(16px,3.2vw,44px);text-align:right}
.bl{bottom:clamp(16px,3.2vw,44px);left:clamp(16px,3.2vw,44px)}
.br{bottom:clamp(16px,3.2vw,44px);right:clamp(16px,3.2vw,44px);text-align:right}
.brandword{font-family:var(--serif);font-weight:400;font-size:clamp(15px,1.6vw,19px);
  letter-spacing:.32em;color:#e9ebef}
.brandword::after{content:"";display:block;width:3.4em;height:1px;margin:.85em 0 0;
  background:linear-gradient(90deg,#b39a63,transparent)}
.brandline{margin-top:.8em;font-size:9px;letter-spacing:.34em;color:#767b82}
.refline{font-size:10px;letter-spacing:.3em;color:#b9bdc3}
.refsub{margin-top:.7em;font-size:9px;letter-spacing:.28em;color:#6d7278}
.model{font-family:var(--serif);font-style:italic;font-size:clamp(15px,1.5vw,18px);color:#e0e3e7}
.specline{margin-top:.7em;font-size:9px;letter-spacing:.26em;color:#767b82}
.price{margin-top:.85em;font-family:var(--serif);font-size:15px;letter-spacing:.14em;color:#c9b078}
.hint{font-size:9px;letter-spacing:.28em;color:#6f747b;max-width:250px;line-height:1.9;
  transition:opacity .3s,color .3s}
body.setting .hint{color:#a9a06a}

/* ---------- watch scaffold ---------- */
.tilt{transform-style:preserve-3d;will-change:transform}
.tilt::before{content:"";position:absolute;inset:-10%;border-radius:50%;z-index:0;
  background:radial-gradient(circle,rgba(125,145,175,.09),transparent 62%)}
.watch{position:relative;width:100em;height:100em;font-size:calc(var(--S)/100)}

/* ---------- straps ---------- */
.strap{position:absolute;left:calc(50% - 24em);width:48em;z-index:1;
  background-image:
    linear-gradient(90deg,rgba(0,0,0,.6),rgba(0,0,0,0) 26%,rgba(255,255,255,.05) 40%,rgba(255,255,255,.10) 50%,rgba(255,255,255,.04) 62%,rgba(0,0,0,.55) 84%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='18'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23201711'/%3E%3Cstop offset='1' stop-color='%23100b07'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='28' height='18' fill='%230b0705'/%3E%3Cg fill='url(%23g)'%3E%3Crect x='.7' y='.7' width='12.6' height='7' rx='3.2'/%3E%3Crect x='14.7' y='.7' width='12.6' height='7' rx='3.2'/%3E%3Crect x='-5.3' y='9.7' width='12.6' height='7' rx='3.2'/%3E%3Crect x='7.7' y='9.7' width='12.6' height='7' rx='3.2'/%3E%3Crect x='20.7' y='9.7' width='12.6' height='7' rx='3.2'/%3E%3C/g%3E%3C/svg%3E");
  background-size:auto,3.2em 2.06em}
.strap::before{content:"";position:absolute;inset:0}
.strap::after{content:"";position:absolute;inset:0;background:
  repeating-linear-gradient(180deg,rgba(228,206,164,0) 0 .62em,rgba(228,206,164,.55) .62em 1.24em) 3.4em 0/.32em 100% no-repeat,
  repeating-linear-gradient(180deg,rgba(228,206,164,0) 0 .62em,rgba(228,206,164,.55) .62em 1.24em) calc(100% - 3.72em) 0/.32em 100% no-repeat}
.strap-top{bottom:14em;height:72vh;clip-path:polygon(6% 0,94% 0,100% 100%,0 100%);
  -webkit-mask:linear-gradient(to top,#000 52%,transparent 94%);mask:linear-gradient(to top,#000 52%,transparent 94%)}
.strap-top::before{background:linear-gradient(to top,rgba(0,0,0,.7),transparent 26%)}
.strap-bottom{top:86em;height:72vh;clip-path:polygon(0 0,100% 0,94% 100%,6% 100%);
  -webkit-mask:linear-gradient(to bottom,#000 52%,transparent 94%);mask:linear-gradient(to bottom,#000 52%,transparent 94%)}
.strap-bottom::before{background:linear-gradient(to bottom,rgba(0,0,0,.7),transparent 26%)}

/* ---------- lugs ---------- */
.lug{position:absolute;width:9.5em;height:12em;border-radius:2.4em;z-index:2;
  background:linear-gradient(180deg,#eff1f3,#a7adb4 45%,#5d626a);
  box-shadow:0 .6em 1.2em rgba(0,0,0,.55),inset 0 .2em .3em rgba(255,255,255,.6)}
.lug-a{top:-2.8em;left:calc(50% - 22.5em);transform:rotate(17deg)}
.lug-b{top:-2.8em;left:calc(50% + 13em);transform:rotate(-17deg)}
.lug-c{bottom:-2.8em;left:calc(50% - 22.5em);transform:rotate(-17deg)}
.lug-d{bottom:-2.8em;left:calc(50% + 13em);transform:rotate(17deg)}

/* ---------- crown ---------- */
.crown{position:absolute;z-index:3;top:calc(50% - 4.6em);right:-4.6em;width:7.6em;height:9.2em;
  border:0;cursor:pointer;font:inherit;
  border-radius:1.1em 4em 4em 1.1em / 1.2em 4.6em 4.6em 1.2em;
  background-image:
    repeating-linear-gradient(180deg,rgba(255,255,255,.28) 0 .42em,rgba(0,0,0,.45) .42em .84em),
    linear-gradient(90deg,#3f444b,#cfd4d9 38%,#f6f8fa 58%,#6f757d 100%);
  background-blend-mode:soft-light,normal;
  box-shadow:0 .5em 1em rgba(0,0,0,.55),inset 0 .25em .4em rgba(255,255,255,.5),inset 0 -.3em .5em rgba(0,0,0,.4);
  transition:transform .35s cubic-bezier(.3,1.6,.5,1)}
.crown::before{content:"";position:absolute;left:-2.6em;top:calc(50% - 1.2em);width:4.4em;height:2.4em;
  background:linear-gradient(180deg,#d7dbdf,#7a8087 50%,#4a4f55)}
.crown::after{content:"";position:absolute;inset:-1.8em} /* generous hit area */
.crown:focus-visible{outline:2px solid #b39a63;outline-offset:5px}
.crown.pulled{transform:translateX(3.4em)}

/* ---------- case & bezel ---------- */
.case{position:absolute;inset:0;border-radius:50%;z-index:4;touch-action:none;
  background:
    radial-gradient(circle at 50% 38%,rgba(255,255,255,.08),rgba(0,0,0,.16) 72%),
    conic-gradient(from calc(128deg + var(--shine,0deg)),
      #fcfdfe,#c2c7cd 7%,#6e747c 15%,#eef0f3 24%,#ffffff 30%,#a6acb3 42%,
      #585d65 54%,#e2e6ea 64%,#8f959c 74%,#f4f6f8 85%,#b4b9c0 93%,#fcfdfe);
  box-shadow:
    0 2.6em 5em rgba(0,0,0,.6),
    0 .8em 1.6em rgba(0,0,0,.55),
    0 0 0 .3em rgba(0,0,0,.35),
    inset 0 .35em .6em rgba(255,255,255,.75),
    inset 0 -.7em 1.4em rgba(0,0,0,.5)}
.stepring{position:absolute;inset:4em;border-radius:50%;
  box-shadow:inset 0 .3em .5em rgba(255,255,255,.55),inset 0 -.35em .6em rgba(0,0,0,.65),
    0 .12em .25em rgba(255,255,255,.35)}

/* ---------- dial ---------- */
.dial{position:absolute;inset:6em;border-radius:50%;
  background:
    radial-gradient(circle at 37% 30%,rgba(150,180,220,.10),transparent 55%),
    radial-gradient(circle at 50% 46%,#131924 0%,#0b1018 46%,#05080d 76%,#020304 100%);
  box-shadow:inset 0 1.3em 2.4em rgba(0,0,0,.9),inset 0 -.5em 1.1em rgba(0,0,0,.55),inset 0 0 .5em rgba(0,0,0,.9)}
.dial::before{ /* fine sunray brushing */
  content:"";position:absolute;inset:0;border-radius:50%;opacity:.55;
  background:repeating-conic-gradient(from 0deg,
    rgba(255,255,255,.05) 0 .75deg,transparent .75deg 1.5deg,
    rgba(0,0,0,.06) 1.5deg 2.25deg,transparent 2.25deg 3deg)}
.sheen{position:absolute;inset:0;border-radius:50%;pointer-events:none;
  background:conic-gradient(from calc(150deg + var(--shine,0deg)),
    transparent 0deg,rgba(255,255,255,.05) 55deg,transparent 110deg,
    rgba(0,0,0,.12) 195deg,transparent 250deg,
    rgba(140,170,215,.05) 305deg,transparent 360deg)}

/* minute track ("chemin de fer") */
.rail{position:absolute;inset:8.6em;border-radius:50%;border:.2em solid rgba(200,206,212,.5)}
.tick{position:absolute;inset:4em;border-radius:50%}
.tick-min{background:repeating-conic-gradient(from -.3deg,rgba(196,202,209,.85) 0 .55deg,transparent .55deg 6deg);
  -webkit-mask:radial-gradient(circle,transparent 0 89.4%,#000 90%);mask:radial-gradient(circle,transparent 0 89.4%,#000 90%)}
.tick-maj{background:repeating-conic-gradient(from -.8deg,#e6eaee 0 1.6deg,transparent 1.6deg 30deg);
  -webkit-mask:radial-gradient(circle,transparent 0 87%,#000 88%);mask:radial-gradient(circle,transparent 0 87%,#000 88%)}

/* applied indices */
.idx{position:absolute;inset:0}
.idx .bar{position:absolute;left:calc(50% - .85em);top:11em;width:1.7em;height:7em;border-radius:.4em;
  background:linear-gradient(90deg,#4e545b 0%,#b9bfc6 32%,#f8fafc 50%,#9aa0a8 68%,#3d434a 100%);
  box-shadow:0 .35em .7em rgba(0,0,0,.55),inset 0 .18em .25em rgba(255,255,255,.6),inset 0 -.28em .4em rgba(0,0,0,.35)}
.idx.p0 .bar{left:calc(50% - 2.45em);width:4.9em;background:none;box-shadow:none}
.idx.p0 .bar::before,.idx.p0 .bar::after{content:"";position:absolute;top:0;width:1.7em;height:7em;border-radius:.4em;
  background:linear-gradient(90deg,#4e545b 0%,#b9bfc6 32%,#f8fafc 50%,#9aa0a8 68%,#3d434a 100%);
  box-shadow:0 .35em .7em rgba(0,0,0,.55),inset 0 .18em .25em rgba(255,255,255,.6),inset 0 -.28em .4em rgba(0,0,0,.35)}
.idx.p0 .bar::before{left:0}
.idx.p0 .bar::after{right:0}

/* dial printing */
.brandblock{position:absolute;left:0;right:0;top:21.5%;display:flex;flex-direction:column;align-items:center;gap:1.15em}
.emblem{width:4.4em;height:4.4em;filter:drop-shadow(0 .25em .35em rgba(0,0,0,.6))}
.dial-brand{font-family:var(--serif);font-size:3.05em;letter-spacing:.13em;text-indent:.13em;
  color:#dde1e5;text-shadow:0 .12em .35em rgba(0,0,0,.9)}
.dial-sub{font-family:var(--serif);font-size:1.75em;letter-spacing:.55em;text-indent:.55em;color:#9aa0a7}
.dial-auto{position:absolute;left:0;right:0;top:63.5%;text-align:center;
  font-family:var(--serif);font-size:1.7em;letter-spacing:.5em;text-indent:.5em;color:#8e949b}
.swissmade{position:absolute;inset:0;pointer-events:none}
.swissmade text{font-family:var(--serif);font-size:2.2px;letter-spacing:.9px;fill:#7e848b}

/* date window */
.datewin{position:absolute;left:calc(50% + 23.6em);top:calc(50% - 3.5em);width:9.6em;height:7em;padding:.6em;
  border-radius:1em;
  background:linear-gradient(180deg,#f2f4f6,#9ba1a8 42%,#4c5157 100%);
  box-shadow:0 .45em 1em rgba(0,0,0,.6),inset 0 .18em .25em rgba(255,255,255,.7),inset 0 -.2em .3em rgba(0,0,0,.4)}
.datewin .disc{width:100%;height:100%;border-radius:.55em;background:#f3efe4;display:grid;place-items:center;
  box-shadow:inset 0 .4em .7em rgba(0,0,0,.38),inset 0 -.15em .3em rgba(0,0,0,.2)}
.datewin .disc span{font-family:"Times New Roman",Times,serif;font-size:3.6em;line-height:1;color:#1b1c1e}

/* hands */
.hand{position:absolute;inset:0;will-change:transform}
.hand svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.hand.hour,.hand.minute{filter:drop-shadow(.45em .8em .55em rgba(0,0,0,.38)) drop-shadow(.1em .18em .2em rgba(0,0,0,.5))}
.hand.second{filter:drop-shadow(.35em .6em .5em rgba(0,0,0,.4))}
.cap{position:absolute;left:calc(50% - 1.35em);top:calc(50% - 1.35em);width:2.7em;height:2.7em;border-radius:50%;
  background:radial-gradient(circle at 34% 28%,#ffffff,#cbd0d6 38%,#6f757c 72%,#33373c);
  box-shadow:0 .3em .5em rgba(0,0,0,.6),inset 0 -.2em .3em rgba(0,0,0,.35)}

/* crystal: traveling glare + faint AR-coating flash */
.crystal{position:absolute;inset:5em;border-radius:50%;pointer-events:none;
  background:
    radial-gradient(46em 30em at var(--gx,32%) var(--gy,26%),rgba(255,255,255,.13),transparent 70%),
    linear-gradient(128deg,transparent 42%,rgba(96,140,220,.05) 52%,rgba(180,120,255,.04) 58%,transparent 68%),
    radial-gradient(120% 55% at 50% -12%,rgba(255,255,255,.09),transparent 55%),
    radial-gradient(120% 50% at 50% 112%,rgba(255,255,255,.05),transparent 55%)}

/* setting-mode cursors */
.watch.setting .case{cursor:grab}
.watch.setting.dragging .case{cursor:grabbing}

@media (max-width:640px){
  .tr,.specline{display:none}
  .brandword{letter-spacing:.22em}
  .hint{max-width:180px}
}
</style>
</head>
<body>
<main class="stage">

  <header class="corner tl">
    <h1 class="brandword">AUBERT FR&Egrave;RES</h1>
    <p class="brandline">MANUFACTURE D'HORLOGERIE &middot; GEN&Egrave;VE</p>
  </header>

  <div class="corner tr">
    <p class="refline">R&Eacute;F. 1187-G</p>
    <p class="refsub">PI&Egrave;CE UNIQUE &middot; N&ordm; 07 / 50</p>
  </div>

  <div class="tilt" id="tilt">
    <div class="watch" id="watch" role="img" aria-label="Mechanical wristwatch showing the current local time">

      <div class="strap strap-top" aria-hidden="true"></div>
      <div class="strap strap-bottom" aria-hidden="true"></div>

      <div class="lug lug-a" aria-hidden="true"></div>
      <div class="lug lug-b" aria-hidden="true"></div>
      <div class="lug lug-c" aria-hidden="true"></div>
      <div class="lug lug-d" aria-hidden="true"></div>

      <button class="crown" id="crown" aria-label="Pull the crown to set the time"></button>

      <div class="case" id="case">
        <div class="stepring" aria-hidden="true"></div>

        <div class="dial">
          <div class="sheen" aria-hidden="true"></div>

          <div class="rail" aria-hidden="true"></div>
          <div class="tick tick-min" aria-hidden="true"></div>
          <div class="tick tick-maj" aria-hidden="true"></div>

          <div id="indices" aria-hidden="true"></div>

          <svg class="swissmade" viewBox="0 0 100 100" aria-hidden="true">
            <defs><path id="smArc" d="M2.3,50 A47.7,47.7 0 0 0 97.3,50" fill="none"/></defs>
            <text text-anchor="middle"><textPath href="#smArc" startOffset="50%">SWISS&#160;&#160;MADE</textPath></text>
          </svg>

          <div class="brandblock" aria-hidden="true">
            <svg class="emblem" viewBox="-6 -6 12 12">
              <defs>
                <linearGradient id="gem" x1="0" y1="0" x2="1" y2="1">
                  <stop offset="0" stop-color="#f4f6f8"/><stop offset=".55" stop-color="#aab0b7"/><stop offset="1" stop-color="#565c63"/>
                </linearGradient>
              </defs>
              <path d="M0,-4.6 L4.2,0 L0,4.6 L-4.2,0 Z" fill="url(#gem)"/>
              <path d="M0,-4.6 L0,4.6" stroke="rgba(255,255,255,.55)" stroke-width=".22"/>
            </svg>
            <div class="dial-brand">AUBERT FR&Egrave;RES</div>
            <div class="dial-sub">GEN&Egrave;VE</div>
          </div>

          <div class="dial-auto" aria-hidden="true">AUTOMATIC</div>

          <div class="datewin" aria-hidden="true">
            <div class="disc"><span id="dateNum"></span></div>
          </div>

          <div class="hand hour" id="handHour">
            <svg viewBox="-44 -44 88 88">
              <defs>
                <linearGradient id="gHL" x1="0" y1="0" x2="1" y2="0">
                  <stop offset="0" stop-color="#f7f9fb"/><stop offset=".55" stop-color="#d3d8dd"/><stop offset="1" stop-color="#a7adb4"/>
                </linearGradient>
                <linearGradient id="gHR" x1="0" y1="0" x2="1" y2="0">
                  <stop offset="0" stop-color="#7c828a"/><stop offset=".6" stop-color="#4c5158"/><stop offset="1" stop-color="#33383e"/>
                </linearGradient>
              </defs>
              <path d="M0 4.6 L0.95 4.6 L1.45 -7.5 L0 -23.5 Z" fill="url(#gHR)"/>
              <path d="M0 4.6 L-0.95 4.6 L-1.45 -7.5 L0 -23.5 Z" fill="url(#gHL)"/>
              <path d="M0 -23.5 L0 4.6" stroke="rgba(255,255,255,.5)" stroke-width=".16"/>
            </svg>
          </div>

          <div class="hand minute" id="handMin">
            <svg viewBox="-44 -44 88 88">
              <defs>
                <linearGradient id="gML" x1="0" y1="0" x2="1" y2="0">
                  <stop offset="0" stop-color="#f7f9fb"/><stop offset=".55" stop-color="#d3d8dd"/><stop offset="1" stop-color="#a7adb4"/>
                </linearGradient>
                <linearGradient id="gMR" x1="0" y1="0" x2="1" y2="0">
                  <stop offset="0" stop-color="#7c828a"/><stop offset=".6" stop-color="#4c5158"/><stop offset="1" stop-color="#33383e"/>
                </linearGradient>
              </defs>
              <path d="M0 4.9 L0.6 4.9 L1.1 -10 L0 -34.5 Z" fill="url(#gMR)"/>
              <path d="M0 4.9 L-0.6 4.9 L-1.1 -10 L0 -34.5 Z" fill="url(#gML)"/>
              <path d="M0 -34.5 L0 4.9" stroke="rgba(255,255,255,.5)" stroke-width=".14"/>
            </svg>
          </div>

          <div class="cap" aria-hidden="true"></div>

          <div class="hand second" id="handSec">
            <svg viewBox="-44 -44 88 88">
              <defs>
                <linearGradient id="gS" x1="0" y1="1" x2="0" y2="0">
                  <stop offset="0" stop-color="#0d2451"/><stop offset=".45" stop-color="#2c5cb4"/><stop offset="1" stop-color="#7aa5e6"/>
                </linearGradient>
              </defs>
              <path d="M-.26 10.6 L-.13 -38.5 L.13 -38.5 L.26 10.6 Z" fill="url(#gS)"/>
              <circle cy="12.1" r="1.5" fill="url(#gS)"/>
              <circle r=".85" fill="#1a3a74"/>
              <path d="M-.04 -37 L-.04 -8" stroke="rgba(255,255,255,.35)" stroke-width=".1"/>
            </svg>
          </div>
        </div>

        <div class="crystal" aria-hidden="true"></div>
      </div>
    </div>
  </div>

  <div class="corner bl">
    <p class="model">Calibre AF-12</p>
    <p class="specline">AUTOMATIC &middot; 38.5 MM &middot; 72 H RESERVE &middot; 28,800 VPH</p>
    <p class="price">CHF 24,700</p>
  </div>

  <div class="corner br">
    <p class="hint" id="hint">CLICK THE CROWN TO SET THE TIME &middot; CLICK AGAIN TO RETURN</p>
  </div>

</main>

<div class="vignette" aria-hidden="true"></div>
<div class="grain" aria-hidden="true"></div>

<script>
(function(){
  'use strict';
  const watch   = document.getElementById('watch');
  const tilt    = document.getElementById('tilt');
  const caseEl  = document.getElementById('case');
  const crown   = document.getElementById('crown');
  const hint    = document.getElementById('hint');
  const dateEl  = document.getElementById('dateNum');
  const hEl     = document.getElementById('handHour');
  const mEl     = document.getElementById('handMin');
  const sEl     = document.getElementById('handSec');
  const HINT_IDLE = 'CLICK THE CROWN TO SET THE TIME \u00B7 CLICK AGAIN TO RETURN';
  const HINT_SET  = 'DRAG AROUND THE DIAL TO SET \u00B7 PUSH THE CROWN TO RESTART';
  const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;

  /* applied indices — the 3 o'clock marker yields to the date window */
  const idxWrap = document.getElementById('indices');
  for (let i = 0; i < 12; i++) {
    if (i === 3) continue;
    const w = document.createElement('div');
    w.className = 'idx' + (i === 0 ? ' p0' : '');
    w.style.transform = 'rotate(' + (i * 30) + 'deg)';
    w.innerHTML = '<div class="bar"></div>';
    idxWrap.appendChild(w);
  }

  /* ---------- movement ---------- */
  let mode = 'running';          // running | set | returning
  let frozen = 0;                 // epoch ms while the crown is pulled (hacking)
  let animFrom = 0, animStart = 0, animDur = 1;

  function render(ms) {
    const d = new Date(ms);
    const s = d.getSeconds() + d.getMilliseconds() / 1000;
    const m = d.getMinutes() + s / 60;
    const h = (d.getHours() % 12) + m / 60;
    sEl.style.transform = 'rotate(' + (s * 6).toFixed(3) + 'deg)';
    mEl.style.transform = 'rotate(' + (m * 6).toFixed(3) + 'deg)';
    hEl.style.transform = 'rotate(' + (h * 30).toFixed(3) + 'deg)';
    const day = String(d.getDate());
    if (dateEl.textContent !== day) dateEl.textContent = day; // date flips past midnight, even while setting
  }
  render(Date.now());

  /* ---------- crown: pull to hack, push to run ---------- */
  crown.addEventListener('click', () => {
    if (mode === 'running') {
      mode = 'set';
      frozen = Date.now();                    // balance stops — hacking seconds
      crown.classList.add('pulled');
      watch.classList.add('setting');
      document.body.classList.add('setting');
      hint.textContent = HINT_SET;
    } else if (mode === 'set') {
      let from = frozen - Date.now();        // rewind the shortest way (<= 6 h)
      const T = 12 * 3600e3;
      from = ((from % T) + T) % T;
      if (from > T / 2) from -= T;
      animFrom = from;
      animDur  = Math.min(2200, 900 + Math.abs(from) / 21600e3 * 1300);
      animStart = performance.now();
      mode = 'returning';
      crown.classList.remove('pulled');
      watch.classList.remove('setting');
      document.body.classList.remove('setting');
      hint.textContent = HINT_IDLE;
    }
  });

  /* ---------- drag around the dial to set (while crown is pulled) ---------- */
  let dragging = false, prevA = 0;
  const angleOf = e => {
    const r = caseEl.getBoundingClientRect();
    return Math.atan2(e.clientY - (r.top + r.height / 2),
                     e.clientX - (r.left + r.width / 2)) * 180 / Math.PI;
  };
  caseEl.addEventListener('pointerdown', e => {
    if (mode !== 'set') return;
    dragging = true;
    caseEl.setPointerCapture(e.pointerId);
    prevA = angleOf(e);
    watch.classList.add('dragging');
  });
  caseEl.addEventListener('pointermove', e => {
    if (!dragging || mode !== 'set') return;
    const a = angleOf(e);
    let d = a - prevA;
    if (d > 180) d -= 360; else if (d < -180) d += 360;
    frozen += d * 10000;                     // 1° of drag = 10 s of time (minute hand follows finger)
    prevA = a;
  });
  const endDrag = () => { dragging = false; watch.classList.remove('dragging'); };
  caseEl.addEventListener('pointerup', endDrag);
  caseEl.addEventListener('pointercancel', endDrag);

  /* ---------- light & tilt: the piece answers the cursor ---------- */
  let rX = 0, rY = 0, sh = 0, gx = 32, gy = 26;             // current
  let tX = 0, tY = 0, tSh = 0, tGx = 32, tGy = 26;          // targets
  if (!reduced) {
    addEventListener('pointermove', e => {
      const nx = e.clientX / innerWidth, ny = e.clientY / innerHeight;
      tY  = (nx - .5) * 13;                 // rotateY
      tX  = (.5 - ny) * 9;                  // rotateX
      tSh = (nx - .5) * 36;                 // bezel reflections rotate
      tGx = 14 + nx * 72;                   // crystal glare travels
      tGy = 10 + ny * 56;
    });
    document.addEventListener('pointerleave', () => { tX = tY = tSh = 0; tGx = 32; tGy = 26; });
  }

  function frame(t) {
    /* time source per mode */
    let disp;
    if (mode === 'running') {
      disp = Date.now();
    } else if (mode === 'set') {
      disp = frozen;
    } else {
      const p = Math.min(1, (t - animStart) / animDur);
      const e = p < .5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2;
      disp = Date.now() + animFrom * (1 - e);
      if (p >= 1) { mode = 'running'; disp = Date.now(); }
    }
    render(disp);

    /* smoothed tilt + traveling highlights */
    if (!reduced) {
      rX += (tX - rX) * .07; rY += (tY - rY) * .07;
      sh += (tSh - sh) * .07; gx += (tGx - gx) * .07; gy += (tGy - gy) * .07;
      tilt.style.transform = 'perspective(1200px) rotateY(' + rY.toFixed(3) + 'deg) rotateX(' + rX.toFixed(3) + 'deg)';
      watch.style.setProperty('--shine', sh.toFixed(2) + 'deg');
      watch.style.setProperty('--gx', gx.toFixed(2) + '%');
      watch.style.setProperty('--gy', gy.toFixed(2) + '%');
    }
    requestAnimationFrame(frame);
  }
  requestAnimationFrame(frame);
})();
</script>
</body>
</html>

Compare

Other runs