kitbash Sign in Connect agent
Components

Lens-scale intro

A black loader over faint scale columns: stills blink in at the edges, a serif tagline fades, a counter runs to 100 and the wordmark parts.

Part of the style

Focus Scale Reel

7 parts that belong together, with their tokens, type and rules.

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --black: #101213;
  --night: #3b3f40;
  --cream: #e8e6ed;
  --bone: #f0eef5;
  --bone-soft: rgba(240, 238, 245, 0.7);
  --cream-dim: rgba(232, 230, 237, 0.2);
  --cream-faint: rgba(232, 230, 237, 0.12);
  --shade: rgba(16, 18, 19, 0.45);
}
</style>

<section class="intro" aria-label="Opening">
  <div class="intro__scales" aria-hidden="true">
    <div class="intro__scale" data-from="200" data-step="-10"></div>
    <div class="intro__scale" data-from="90" data-step="10"></div>
    <div class="intro__scale" data-from="440" data-step="-20"></div>
    <div class="intro__scale" data-from="100" data-step="10"></div>
  </div>

  <ul class="intro__stills" aria-hidden="true">
    <li class="intro__still intro__still--a"><img src="assets/light-trails.jpg" alt="" width="800" height="530"></li>
    <li class="intro__still intro__still--b"><img src="assets/rain-underpass.jpg" alt="" width="800" height="571"></li>
    <li class="intro__still intro__still--c"><img src="assets/grey-beach.jpg" alt="" width="800" height="533"></li>
    <li class="intro__still intro__still--d"><img src="assets/dune-dusk.jpg" alt="" width="800" height="533"></li>
    <li class="intro__still intro__still--e"><img src="assets/white-dunes.jpg" alt="" width="800" height="600"></li>
    <li class="intro__still intro__still--f"><img src="assets/fog-bridge.jpg" alt="" width="612" height="800"></li>
  </ul>

  <p class="intro__line"><i>Q</i>uiet, <i>S</i>alted<br><i>W</i>eather <i>P</i>ictures</p>
  <p class="intro__count" aria-hidden="true"><span class="intro__count-num">00</span></p>

  <h1 class="intro__mark">
    <span class="intro__half intro__half--l">out</span><span class="intro__half intro__half--r">water</span>
  </h1>

  <div class="intro__foot">
    <span>Reel 2014 — 2027</span>
    <button class="intro__replay" type="button">Replay</button>
  </div>
</section>

<style>
  .intro {
    position: relative;
    height: clamp(560px, 62vw, 760px);
    overflow: hidden;
    background: var(--black);
    color: var(--cream);
    isolation: isolate;
  }
  .intro__scales {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0 var(--edge);
    opacity: 0;
    transition: opacity var(--fade-slow) ease;
  }
  .intro.is-scale .intro__scales {
    opacity: 1;
  }
  .intro__scale {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-m) 0;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: 1;
    color: var(--cream-faint);
  }
  .intro__scale:nth-child(even) {
    align-items: flex-end;
  }
  .intro__scale:nth-child(odd) {
    align-items: flex-start;
  }
  .intro__scale span {
    writing-mode: vertical-rl;
  }
  .intro__scale i {
    display: block;
    width: var(--rule);
    height: 6px;
    background: var(--cream-faint);
  }

  .intro__stills {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .intro__still {
    position: absolute;
    width: clamp(72px, 12vw, 170px);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-s);
    opacity: 0;
  }
  .intro__still img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .intro__still--a { left: 0; top: 20%; }
  .intro__still--b { right: 0; top: 4%; }
  .intro__still--c { right: 0; top: 46%; }
  .intro__still--d { left: 0; bottom: 6%; }
  .intro__still--e { right: 0; bottom: 10%; }
  .intro__still--f { left: 26%; top: 8%; width: clamp(56px, 8vw, 110px); aspect-ratio: 3 / 4; }
  /* Stills blink: on, off, on, as frames cut in a projector. */
  .intro.is-stills .intro__still {
    animation: intro-blink var(--fade) steps(1, end) both;
    animation-delay: calc(var(--i, 0) * 120ms);
  }
  .intro__still--a { --i: 0; }
  .intro__still--b { --i: 1; }
  .intro__still--c { --i: 3; }
  .intro__still--d { --i: 2; }
  .intro__still--e { --i: 4; }
  .intro__still--f { --i: 5; }
  @keyframes intro-blink {
    0% { opacity: 1; }
    30% { opacity: 0; }
    60%, 100% { opacity: 1; }
  }

  .intro__line,
  .intro__count,
  .intro__mark {
    position: absolute;
    left: 50%;
    top: 50%;
    margin: 0;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: var(--track-display);
    text-align: center;
    white-space: nowrap;
  }
  .intro__line {
    font-size: var(--display-s);
    line-height: 1.02;
    opacity: 0;
    transition: opacity var(--fade) var(--ease-fade);
  }
  .intro.is-line .intro__line {
    opacity: 1;
  }
  .intro.is-count .intro__line,
  .intro.is-mark .intro__line {
    opacity: 0;
  }
  .intro__count {
    font-size: var(--display-m);
    line-height: 1;
    font-style: italic;
    opacity: 0;
    transition: opacity var(--fade) var(--ease-fade);
  }
  .intro.is-count .intro__count {
    opacity: 1;
  }
  .intro.is-mark .intro__count {
    opacity: 0;
  }
  .intro__mark {
    display: flex;
    justify-content: space-between;
    width: var(--mark-closed, 4em);
    max-width: calc(100% - 2 * var(--edge));
    transition: width var(--slide) var(--ease-slide);
    font-size: var(--display-xl);
    line-height: 1;
  }
  .intro__half {
    display: block;
    opacity: 0;
    transform: translateY(30%);
    transition: transform var(--slide) var(--ease-slide), opacity var(--fade) var(--ease-fade);
  }
  .intro.is-mark .intro__half {
    opacity: 1;
    transform: translateY(0);
  }
  /* The two halves part to the edges, as on a split title card. */
  .intro.is-part .intro__mark {
    width: calc(100% - 2 * var(--edge));
  }
  .intro__half--l,
  .intro__half--r {
    flex: 0 0 auto;
  }

  .intro__foot {
    position: absolute;
    left: var(--edge);
    right: var(--edge);
    bottom: var(--space-m);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: var(--text-s);
    letter-spacing: var(--track-label);
    text-transform: uppercase;
    color: var(--cream-dim);
  }
  .intro__replay {
    min-width: 44px;
    min-height: 44px;
    margin: -12px 0;
    padding: 0 var(--space-s);
    border: 0;
    background: none;
    color: var(--bone-soft);
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
    transition: color var(--quick) ease;
  }
  .intro__replay:hover,
  .intro__replay:focus-visible {
    color: var(--cream);
  }
  .intro__replay:focus-visible {
    outline: var(--rule) solid var(--cream);
  }

  @media (max-width: 600px) {
    .intro__scales {
      grid-template-columns: repeat(2, 1fr);
    }
    .intro__scale:nth-child(n + 3) {
      display: none;
    }
    .intro__still--f {
      display: none;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .intro .intro__still {
      animation: none;
      opacity: 1;
    }
  }
</style>

<script>
  (function () {
    document.querySelectorAll(".intro").forEach(function (root) {
      root.querySelectorAll(".intro__scale").forEach(function (scale) {
        var value = Number(scale.dataset.from);
        var step = Number(scale.dataset.step);
        for (var i = 0; i < 12; i++) {
          var number = document.createElement("span");
          number.textContent = String(value);
          scale.appendChild(number);
          scale.appendChild(document.createElement("i"));
          value += step;
        }
        scale.lastChild.remove();
      });

      var counter = root.querySelector(".intro__count-num");
      var timers = [];
      var frame = 0;
      var stages = ["is-scale", "is-stills", "is-line", "is-count", "is-mark", "is-part"];

      var halves = root.querySelectorAll(".intro__half");
      function measure() {
        var width = 0;
        halves.forEach(function (half) { width += half.offsetWidth; });
        root.style.setProperty("--mark-closed", Math.ceil(width) + 2 + "px");
      }
      function finish() {
        measure();
        stages.forEach(function (stage) { root.classList.add(stage); });
        counter.textContent = "100";
      }
      function clear() {
        timers.forEach(clearTimeout);
        timers = [];
        cancelAnimationFrame(frame);
      }
      function count(duration) {
        var start = performance.now();
        function tick(now) {
          var share = Math.min(1, (now - start) / duration);
          counter.textContent = String(Math.round(share * 100)).padStart(2, "0");
          if (share < 1) frame = requestAnimationFrame(tick);
        }
        frame = requestAnimationFrame(tick);
      }
      function play() {
        clear();
        stages.forEach(function (stage) { root.classList.remove(stage); });
        counter.textContent = "00";
        if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
          finish();
          return;
        }
        var plan = [[300, "is-scale"], [900, "is-stills"], [1500, "is-line"], [2500, "is-count"], [3500, "is-mark"], [4000, "is-part"]];
        plan.forEach(function (step) {
          timers.push(setTimeout(function () {
            root.classList.add(step[1]);
            if (step[1] === "is-count") count(900);
            if (step[1] === "is-mark") measure();
          }, step[0]));
        });
      }
      root.querySelector(".intro__replay").addEventListener("click", play);
      play();
    });
  })();
</script>

Similar components

Scramble loader

Scramble loader

Blur-in statement

Blur-in statement

Wordmark intro

Wordmark intro

Thumbnail ring loader

Thumbnail ring loader

Letter gathering intro

Letter gathering intro

Boot screen

Boot screen

Print burst intro

Print burst intro

Intro loader

Intro loader