Back to Drift City
SOURCE / PINNED RELEASE

Made of little things.

Drift City

Release
098731aa0f0f…
Author-recorded commit
2822ea0a4f5b…
License
LICENSE
Author’s source reference
nostr://npub12lm3rxsva8kfempyjkxupt09e02n3fezurkyadyqfejdc5e0r2kscqty6r/wss%3A%2F%2Fgit.napplet.soy%2F/n-a4c0039c855

Archive hash verified: b3323e408235502b…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
    <title>Drift City</title>
  </head>
  <body>
    <main id="app" class="app">
      <canvas id="view" aria-label="Drift City: a car on the streets of a low-poly town"></canvas>

      <div id="hud" class="hud" hidden>
        <section id="drift" class="drift slab" aria-label="Drift score">
          <div class="drift-row">
            <span id="pts" class="pts">0</span>
            <span id="mult" class="mult">×1</span>
            <span id="angle" class="angle"></span>
          </div>
          <div class="meter" aria-hidden="true"><i id="multBar"></i></div>
          <div class="totals">
            <span>Total <b id="total">0</b></span>
            <span>Best <b id="best">0</b></span>
          </div>
        </section>

        <section class="speedo slab" aria-label="Speed">
          <b id="speed">0</b><span id="unit">km/h</span>
          <div class="speed-bar" aria-hidden="true"><i id="speedBar"></i></div>
        </section>

        <canvas id="minimap" class="minimap" aria-label="Minimap"></canvas>

        <div class="tools">
          <button id="camBtn" type="button" title="Camera view (C) · first person (V)" aria-label="Camera view">
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7h12v10H3zM15 11l6-3v8l-6-3" /></svg>
          </button>
          <button id="resetBtn" type="button" title="Back on the road (R)" aria-label="Back on the road">
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12a7 7 0 1 0 2-5M5 4v4h4" /></svg>
          </button>
          <button id="pauseBtn" type="button" title="Pause (Esc)" aria-label="Pause">
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 5v14M16 5v14" /></svg>
          </button>
        </div>

        <section id="raceHud" class="race-hud slab" aria-label="Race" hidden>
          <div class="race-pos"><b id="racePos">1</b><span id="raceOf">/4</span></div>
          <div class="race-meta">
            <span id="raceLap">Lap 1/1</span>
            <span id="raceTime">0:00.00</span>
          </div>
        </section>
        <div id="countdown" class="countdown" aria-live="assertive" hidden></div>
        <div id="raceNote" class="race-note" hidden>Off the route: get back on it (R)</div>

        <div id="popups" class="popups" aria-live="polite"></div>

        <div class="touch" aria-label="Touch controls">
          <div class="steer">
            <button class="pedal" type="button" data-k="left" aria-label="Steer left">◀</button>
            <button class="pedal" type="button" data-k="right" aria-label="Steer right">▶</button>
          </div>
          <div class="pedals">
            <button class="pedal brake" type="button" data-k="brake">Brake</button>
            <button class="pedal handbrake" type="button" data-k="drift">Drift</button>
            <button class="pedal gas" type="button" data-k="gas">Gas</button>
          </div>
        </div>
      </div>

      <div id="menu" class="overlay">
        <div class="card slab" data-step="mode">
          <div class="account">
            <span id="accAvatar" class="avatar" aria-hidden="true">G</span>
            <span class="acc-text">
              <b id="accName">Guest</b>
              <small id="accNote">Playing as a guest</small>
            </span>
            <button id="accEdit" class="link" type="button">Change name</button>
          </div>
          <div id="accForm" class="acc-form" hidden>
            <input id="accInput" maxlength="24" autocomplete="off" aria-label="Your name" placeholder="Your name" />
            <button id="accOk" class="ghost" type="button">OK</button>
          </div>
          <p class="tagline">Golden hour. <em>Go sideways.</em></p>
          <div class="modes" role="radiogroup" aria-label="Mode">
            <button type="button" role="radio" data-mode="free" aria-checked="true">
              <span class="map-name">Free drive</span>
              <span class="map-blurb">Roam the town and the countryside, drift for points and smash things.</span>
            </button>
            <button type="button" role="radio" data-mode="race" aria-checked="false">
              <span class="map-name">Race</span>
              <span class="map-blurb">Draw a route on the map, then race three rivals along it.</span>
            </button>
          </div>
          <label class="check traffic-check"><input id="trafficBox" type="checkbox" checked /> Traffic</label>
          <div class="volumes" data-volumes aria-label="Volume"></div>
          <dl class="keys keys-desktop">
            <div><dt>W A S D / arrows</dt><dd>drive</dd></div>
            <div><dt>Space / Shift</dt><dd>handbrake: drift</dd></div>
            <div><dt>R</dt><dd>back on the road</dd></div>
            <div><dt>C / V</dt><dd>camera view / first person</dd></div>
            <div><dt>Q E F / drag</dt><dd>look around</dd></div>
          </dl>
          <p class="keys keys-touch">Steer on the left, pedals on the right. Tap <b>Drift</b> into a corner, then hold the slide with <b>Gas</b> and steering.</p>
          <p class="hint">Flick the handbrake into a corner, then hold the angle on the throttle; counter-steer or lift off to straighten up. Long slides stack the multiplier; hit something and the points are gone.</p>
          <div class="paints" role="radiogroup" aria-label="Paint"></div>
          <p id="liveryNote" class="livery-note" hidden></p>
          <div class="row menu-extras">
            <button id="shopBtn" class="ghost" type="button">Paint shop</button>
            <button id="boardsBtn" class="ghost" type="button">Leaderboards</button>
          </div>
          <button id="modeNext" class="go" type="button">Continue</button>
        </div>
        <div class="card slab" data-step="map" hidden>
          <p class="tagline">Choose a map</p>
          <div class="maps" role="radiogroup" aria-label="Map"></div>
          <div class="row">
            <button id="mapBack" class="ghost" type="button">Back</button>
            <button id="driveBtn" class="go" type="button">Drive</button>
          </div>
        </div>
      </div>

      <div id="planner" class="planner" hidden>
        <canvas id="routeMap" class="route-map" aria-label="Race route: drag the flags or the line; drag the map to move it, scroll or pinch to zoom"></canvas>
        <div class="planner-top slab">
          <p class="tagline">Plan the race</p>
          <p class="hint">Drag the <b>S</b> and <b>F</b> flags, or grab the line to pull out a waypoint. Points snap to the nearest road when you let go. Drag the map to move it; scroll or pinch to zoom. Double-click a waypoint to remove it.</p>
        </div>
        <div class="planner-zoom">
          <button id="zoomIn" type="button" aria-label="Zoom in">+</button>
          <button id="zoomOut" type="button" aria-label="Zoom out">−</button>
          <button id="zoomFit" type="button" aria-label="Show the whole route" title="Show the whole route">⤢</button>
        </div>
        <div class="planner-bar slab">
          <label class="distance" title="Make a route this long from the start flag (no road used twice)">
            <span>Shorter</span>
            <input id="distSlider" type="range" min="0.5" max="8" step="0.1" value="2" aria-label="Route distance" />
            <span>Longer</span>
            <b id="distValue">2.0 km</b>
          </label>
          <div class="planner-opts">
            <label class="check"><input id="loopBox" type="checkbox" /> Circuit</label>
            <label id="lapsLabel" class="laps" hidden>Laps
              <select id="lapsSel"><option>1</option><option selected>2</option><option>3</option><option>5</option></select>
            </label>
            <span id="routeLen" class="route-len">0.0 km</span>
          </div>
          <div class="row">
            <button id="plannerBack" class="ghost" type="button">Back</button>
            <button id="plannerReset" class="ghost" type="button">Reset</button>
            <button id="raceBtn" class="go" type="button">Race</button>
          </div>
        </div>
      </div>

      <div id="results" class="overlay" hidden>
        <div class="card slab">
          <p class="tagline" id="resultTitle">Finished</p>
          <p id="resultTime" class="result-time"></p>
          <ol id="standings" class="standings"></ol>
          <div class="row">
            <button id="againBtn" class="go" type="button">Race again</button>
            <button id="editRouteBtn" class="ghost" type="button">Change route</button>
            <button id="resultsMenuBtn" class="ghost" type="button">Menu</button>
          </div>
        </div>
      </div>

      <div id="boards" class="overlay" hidden>
        <div class="card slab boards-card" role="dialog" aria-labelledby="boardsTitle">
          <p class="tagline" id="boardsTitle">Leaderboards</p>
          <div class="modes board-tabs" role="radiogroup" aria-label="Board">
            <button type="button" role="radio" data-board="longest-drift-v1" aria-checked="true"><span class="map-name">Longest drift</span></button>
            <button type="button" role="radio" data-board="races-won-v1" aria-checked="false"><span class="map-name">Races won</span></button>
          </div>
          <ol id="boardRows" class="standings board-rows"></ol>
          <p id="boardNote" class="hint"></p>
          <p id="boardMine" class="board-mine"></p>
          <button id="boardsClose" class="go" type="button">Close</button>
        </div>
      </div>

      <div id="shop" class="shop" hidden>
        <div class="shop-top slab">
          <button id="shopDone" class="ghost" type="button">Done</button>
          <input id="shopName" class="shop-name" maxlength="32" autocomplete="off" aria-label="Design name" />
          <span id="shopDirty" class="shop-dirty" title="Unsaved changes" hidden>●</span>
          <button id="shopUndo" class="icon" type="button" aria-label="Undo" title="Undo (Ctrl+Z)"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 14 4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3" /></svg></button>
          <button id="shopRedo" class="icon" type="button" aria-label="Redo" title="Redo (Ctrl+Y)"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15 14 5-5-5-5M20 9H10a6 6 0 0 0 0 12h3" /></svg></button>
          <button id="shopSave" class="ghost" type="button" title="Save (Ctrl+S)">Save</button>
          <button id="shopUse" class="go small" type="button">Use on car</button>
        </div>
        <div class="shop-tools slab" role="toolbar" aria-label="Tools">
          <button type="button" data-tool="brush" aria-pressed="true" title="Brush (B)"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M14 4l6 6-8 8H6v-6zM4 20c2 0 3-1 3-3" /></svg><span>Brush</span></button>
          <button type="button" data-tool="eraser" aria-pressed="false" title="Eraser (E)"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M8 20h12M5 15l9-9 5 5-9 9H8z" /></svg><span>Eraser</span></button>
          <button type="button" data-tool="shape" aria-pressed="false" title="Shapes (S)"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h7v7H4zM17.5 4a3.5 3.5 0 1 1 0 7 3.5 3.5 0 0 1 0-7M4 20l3.5-6 3.5 6zM14 14h7v7h-7z" /></svg><span>Shapes</span></button>
          <button type="button" data-tool="pick" aria-pressed="false" title="Pick a colour off the car (I)"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M14.5 5.5l4 4M17 3l4 4-3 3-4-4zM14 8l-9 9v3h3l9-9" /></svg><span>Picker</span></button>
          <button type="button" data-tool="orbit" aria-pressed="false" title="Turn the car (or right-drag)"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5a7 7 0 1 1-7 7M5 5v4h4" /></svg><span>Turn</span></button>
          <button id="shopMirror" type="button" aria-pressed="false" title="Mirror: paint both sides at once (M)"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v18M9 6 3 18h6zM15 6l6 12h-6z" /></svg><span>Mirror</span></button>
        </div>
        <div class="shop-panel slab">
          <div class="shop-tabs" role="tablist" aria-label="Paint shop">
            <button id="tabPaint" type="button" role="tab" aria-selected="true" aria-controls="shopPaintTab">Paint</button>
            <button id="tabDesigns" type="button" role="tab" aria-selected="false" aria-controls="shopDesignsTab">Saved designs <span id="shopCount" class="shop-count"></span></button>
          </div>
          <div id="shopPaintTab" class="shop-tab" role="tabpanel" aria-labelledby="tabPaint">
          <div id="shopColorRow" class="shop-colors">
            <div class="shop-swatches"></div>
            <label class="shop-picker" title="Any colour"><input id="shopColor" type="color" aria-label="Colour" /></label>
          </div>
          <div id="shopBrushSet" class="shop-sliders">
            <label for="shopSize">Size</label><input id="shopSize" type="range" min="0" max="100" /><output id="shopSizeOut"></output>
            <label for="shopOpacity">Opacity</label><input id="shopOpacity" type="range" min="2" max="100" /><output id="shopOpacityOut"></output>
            <label for="shopHard">Hardness</label><input id="shopHard" type="range" min="0" max="100" /><output id="shopHardOut"></output>
          </div>
          <div id="shopShapeSet" hidden>
            <div id="shopShapes" class="shop-shapes" role="group" aria-label="Shape"></div>
            <div class="shop-sliders">
              <label for="shopW">Width</label><input id="shopW" type="range" min="2" max="300" /><output id="shopWOut"></output>
              <label for="shopL">Length</label><input id="shopL" type="range" min="2" max="460" /><output id="shopLOut"></output>
              <label for="shopRot">Turn</label><input id="shopRot" type="range" min="-180" max="180" /><output id="shopRotOut"></output>
              <label for="shopShapeOpacity">Opacity</label><input id="shopShapeOpacity" type="range" min="2" max="100" /><output id="shopShapeOpacityOut"></output>
            </div>
            <p id="shopShapeHint" class="hint"></p>
            <button id="shopDeleteShape" class="ghost" type="button">Delete shape</button>
          </div>
          <div class="shop-base">
            <label>Base colour <input id="shopBase" type="color" /></label>
            <button id="shopClear" class="ghost" type="button">Clear all</button>
          </div>
          <div class="shop-views" role="group" aria-label="View">
            <button type="button" data-view="left">Left</button>
            <button type="button" data-view="right">Right</button>
            <button type="button" data-view="front">Front</button>
            <button type="button" data-view="back">Back</button>
            <button type="button" data-view="top">Top</button>
          </div>
          </div>
          <div id="shopDesignsTab" class="shop-tab" role="tabpanel" aria-labelledby="tabDesigns" hidden>
            <div class="row shop-design-actions">
              <button id="shopNew" class="ghost" type="button">New design</button>
              <button id="shopPlain" class="ghost" type="button" title="Take the design off the car: plain paint">Plain paint</button>
            </div>
            <ul id="shopList" class="shop-list"></ul>
            <div id="shopMeter" class="shop-meter" aria-hidden="true"><i></i></div>
            <p id="shopMeterText" class="hint"></p>
          </div>
        </div>
        <p id="shopStatus" class="shop-status slab" aria-live="polite" hidden></p>
        <div id="shopAsk" class="shop-ask" hidden>
          <div class="card slab" role="alertdialog" aria-labelledby="shopAskText">
            <p id="shopAskText"></p>
            <div id="shopAskButtons" class="row"></div>
          </div>
        </div>
        <p class="shop-small slab">Make the frame bigger to paint your car.</p>
      </div>

      <div id="pause" class="overlay" hidden>
        <div class="card slab">
          <p class="tagline">Paused</p>
          <div class="paints" role="radiogroup" aria-label="Paint"></div>
          <div class="volumes" data-volumes aria-label="Volume"></div>
          <div class="row">
            <button id="resumeBtn" class="go" type="button">Resume</button>
            <button id="pauseResetBtn" class="ghost" type="button">Back on the road</button>
            <button id="pauseRestartBtn" class="ghost" type="button" hidden>Restart race</button>
            <button id="pauseMapBtn" class="ghost" type="button">Menu</button>
          </div>
        </div>
      </div>
    </main>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>