kitbash Sign in Connect agent
Components

Night Room Statement

A near-black room with a drifting cyan orb over a perspective floor and one light line that changes every few seconds.

Part of the style

Marble Lift Vitrine

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --stone: #bec3c3;
  --stone-hi: #d4d9d9;
  --stone-lo: #a7acac;
  --ink: #030204;
  --ink-soft: rgba(3, 2, 4, 0.62);
  --ink-faint: rgba(3, 2, 4, 0.18);
  --night: #000000;
  --night-2: #000000;
  --on-dark: #d4d9d9;
  --on-dark-soft: rgba(193, 198, 198, 0.62);
  --line-dark: rgba(193, 198, 198, 0.14);
  --neon: #897264;
  --petrol: #010000;
  --petrol-hi: #010000;
  --neon-soft: rgba(137, 114, 100, 0.28);
  --mist: #807771;
}
</style>

<section class="statement" aria-label="Statement">
  <canvas class="statement__canvas" role="img" aria-label="A cyan light drifting over a dark gridded floor"></canvas>
  <div class="statement__copy">
    <p class="statement__label"><span class="statement__dot" aria-hidden="true"></span>Floor 04 · Workshop</p>
    <p class="statement__lines">
      <span class="statement__line is-current">First it is found.</span>
      <span class="statement__line">Then it learns to move.</span>
      <span class="statement__line">Then it keeps time again.</span>
    </p>
    <p class="statement__note">Every piece on these floors came in broken. The workshop is open to watch, Thursdays from ten.</p>
  </div>
</section>

<style>
  .statement {
    position: relative;
    display: grid;
    place-items: center;
    min-height: clamp(440px, 56vw, 640px);
    padding: var(--section-space) var(--edge);
    overflow: hidden;
    background: var(--night);
    color: var(--on-dark);
    text-align: center;
  }
  .statement__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: var(--neon);
  }
  .statement__copy {
    position: relative;
    display: grid;
    justify-items: center;
    gap: var(--space-l);
    max-width: 52rem;
  }
  .statement__label {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    margin: 0;
    color: var(--on-dark-soft);
    font: 500 var(--text-xs)/1 var(--font-label);
    letter-spacing: var(--track-label);
    text-transform: uppercase;
  }
  .statement__dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-round);
    background: var(--neon);
    box-shadow: var(--glow);
  }
  .statement__lines {
    display: grid;
    margin: 0;
    font: var(--weight-display) var(--display-l)/1 var(--font-display);
    letter-spacing: var(--track-display);
  }
  .statement__line {
    grid-area: 1 / 1;
    opacity: 0;
    filter: blur(8px);
    transform: scale(0.98);
    transition: opacity var(--fade) var(--ease), filter var(--fade) var(--ease), transform var(--lift) var(--ease-out);
    text-wrap: balance;
  }
  .statement__line.is-current {
    opacity: 1;
    filter: none;
    transform: none;
    text-shadow: 0 0 24px rgba(63, 240, 232, 0.25);
  }
  .statement__note {
    max-width: 36ch;
    margin: 0;
    color: var(--on-dark-soft);
    font-size: var(--text-s);
  }
</style>

<script>
(() => {
  const still = matchMedia('(prefers-reduced-motion: reduce)');

  function paint(context, width, height, seconds) {
    context.clearRect(0, 0, width, height);
    const neon = getComputedStyle(context.canvas).color;
    const horizon = height * 0.58;
    const vanish = width / 2;
    context.strokeStyle = 'rgba(220, 218, 214, 0.10)';
    context.lineWidth = 1;
    for (let i = -12; i <= 12; i++) {
      context.beginPath();
      context.moveTo(vanish + i * 18, horizon);
      context.lineTo(vanish + i * width * 0.16, height);
      context.stroke();
    }
    const drift = (seconds * 0.12) % 1;
    for (let j = 0; j < 9; j++) {
      const t = (j + drift) / 9;
      const y = horizon + (height - horizon) * t * t;
      context.beginPath();
      context.moveTo(0, y);
      context.lineTo(width, y);
      context.stroke();
    }
    const x = vanish + Math.sin(seconds * 0.35) * width * 0.28;
    const y = horizon - height * 0.14 + Math.cos(seconds * 0.5) * height * 0.05;
    const radius = Math.max(width, height) * 0.22;
    const orb = context.createRadialGradient(x, y, 0, x, y, radius);
    orb.addColorStop(0, 'rgba(63, 240, 232, 0.30)');
    orb.addColorStop(0.35, 'rgba(63, 240, 232, 0.10)');
    orb.addColorStop(1, 'rgba(63, 240, 232, 0)');
    context.fillStyle = orb;
    context.fillRect(0, 0, width, height);
    const pool = context.createRadialGradient(x, height * 0.9, 0, x, height * 0.9, radius * 0.8);
    pool.addColorStop(0, 'rgba(63, 240, 232, 0.14)');
    pool.addColorStop(1, 'rgba(63, 240, 232, 0)');
    context.fillStyle = pool;
    context.fillRect(0, horizon, width, height - horizon);
    context.fillStyle = neon;
    context.beginPath();
    context.arc(x, y, 2.5, 0, Math.PI * 2);
    context.fill();
  }

  function run(root) {
    const canvas = root.querySelector('.statement__canvas');
    const lines = [...root.querySelectorAll('.statement__line')];
    const context = canvas.getContext('2d');
    let frame = 0;
    let timer = 0;
    let index = 0;
    const fit = () => {
      const density = Math.min(2, devicePixelRatio || 1);
      canvas.width = canvas.clientWidth * density;
      canvas.height = canvas.clientHeight * density;
      context.setTransform(density, 0, 0, density, 0, 0);
      paint(context, canvas.clientWidth, canvas.clientHeight, performance.now() / 1000);
    };
    const tick = (now) => {
      paint(context, canvas.clientWidth, canvas.clientHeight, now / 1000);
      frame = requestAnimationFrame(tick);
    };
    const nextLine = () => {
      lines[index].classList.remove('is-current');
      index = (index + 1) % lines.length;
      lines[index].classList.add('is-current');
    };
    new ResizeObserver(fit).observe(canvas);
    new IntersectionObserver(([entry]) => {
      cancelAnimationFrame(frame);
      clearInterval(timer);
      if (entry.isIntersecting && !still.matches) {
        frame = requestAnimationFrame(tick);
        timer = setInterval(nextLine, 3200);
      }
    }).observe(root);
  }

  document.querySelectorAll('.statement').forEach(run);
})();
</script>

Similar components

Window glimpse and statement

Window glimpse and statement

Black half, photo half

Black half, photo half

Matted diff feature

Matted diff feature

Statement

Statement

Centred statement

Centred statement

Tilting statement

Tilting statement

Drifting statement

Drifting statement

Studio statement

Studio statement