Skip to content
animorio
IT
Back to the library

Search to results

Transitions, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.0 KBGSAP 28 KBFreeDownload the zip

The home page of Glyphary, a made-up typeface archive, with search as the hero: type «humanist sans», press Enter and the very same field flies into the header of the results page on a spring, while the title leaves, the filter pills slide in, the count rolls up to 128 and the typeface cards arrive in a cascade. Esc or the cross plays it all backwards.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Search to results" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Search to results</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/archivo@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- The home page of Glyphary, a made-up archive of typefaces. The big search field in the middle is the hero:
       type a search and press Enter, and the same field flies up into the header of the results page on a spring
       (it is one element, moved between two places), while the title fades, the filter pills slide in, the count
       rolls to 128 and the result cards arrive in a cascade. Esc or the cross in the bar plays it all backwards. -->
  <main class="stage" data-stage>
    <header class="top">
      <p class="brand" data-brand>
        <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M4 16 L10 4 L16 16 M6.6 11.2 H13.4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
        <span>Glyphary</span>
      </p>
      <div class="slot slot--bar" data-slot-bar aria-hidden="true"></div>
      <p class="top__meta" data-meta>2,140 families</p>
    </header>

    <section class="hero" data-hero>
      <p class="eyebrow" data-fade-home>Glyphary type archive</p>
      <h1 class="title" data-fade-home>Find the typeface<br><em>you were picturing.</em></h1>
      <div class="slot slot--home" data-slot-home aria-hidden="true"></div>
      <p class="hint" data-fade-home>Try <span>humanist sans</span>, <span>warm serif</span> or <span>mono</span></p>
    </section>

    <form class="field" data-field role="search" autocomplete="off">
      <svg class="field__lens" viewBox="0 0 20 20" aria-hidden="true"><circle cx="8.6" cy="8.6" r="5.4" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M12.6 12.6 L16.4 16.4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
      <label class="sr" for="q">Search typefaces</label>
      <input id="q" class="field__input" data-input type="text" placeholder="Search 2,140 typefaces" spellcheck="false">
      <span class="field__key" data-key aria-hidden="true">
        <svg viewBox="0 0 16 16"><path d="M12.5 3.5 V8.5 H4 M6.8 5.8 L4 8.5 L6.8 11.2" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>
      </span>
      <button class="field__close" data-close type="button" aria-label="Back to the home page">
        <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
      </button>
      <span class="field__run" data-run aria-hidden="true"></span>
    </form>

    <section class="results" data-results aria-live="polite">
      <div class="filters" data-filters>
        <button type="button" class="pill is-on">All</button>
        <button type="button" class="pill">Sans</button>
        <button type="button" class="pill">Serif</button>
        <button type="button" class="pill">Mono</button>
        <button type="button" class="pill">Variable</button>
        <p class="count" data-count><span class="count__num" data-num></span> results</p>
      </div>
      <div class="grid" data-grid>
        <article class="card" tabindex="0" style="--f: 'Mona Sans Variable'; --v: 'wdth' 100, 'wght' 480; --vh: 'wdth' 125, 'wght' 760">
          <p class="card__spec">Aa</p>
          <p class="card__name">Halden Sans</p><p class="card__meta">Humanist sans · 12 styles</p>
        </article>
        <article class="card" tabindex="0" style="--f: 'Fraunces Variable'; --v: 'opsz' 72, 'wght' 420, 'SOFT' 0; --vh: 'opsz' 144, 'wght' 640, 'SOFT' 100">
          <p class="card__spec">Aa</p>
          <p class="card__name">Marrow Serif</p><p class="card__meta">Warm serif · 18 styles</p>
        </article>
        <article class="card" tabindex="0" style="--f: 'Archivo Variable'; --v: 'wdth' 100, 'wght' 500; --vh: 'wdth' 62, 'wght' 800">
          <p class="card__spec">Aa</p>
          <p class="card__name">Tessel Grotesk</p><p class="card__meta">Grotesque · 9 widths</p>
        </article>
        <article class="card" tabindex="0" style="--f: 'Newsreader Variable'; --v: 'opsz' 16, 'wght' 400; --vh: 'opsz' 72, 'wght' 620">
          <p class="card__spec">Aa</p>
          <p class="card__name">Quillon Text</p><p class="card__meta">Book serif · 8 styles</p>
        </article>
        <article class="card" tabindex="0" style="--f: 'JetBrains Mono Variable'; --v: 'wght' 400; --vh: 'wght' 760">
          <p class="card__spec">Aa</p>
          <p class="card__name">Ledger Mono</p><p class="card__meta">Monospace · 8 weights</p>
        </article>
        <article class="card" tabindex="0" style="--f: 'Mona Sans Variable'; --v: 'wdth' 75, 'wght' 380; --vh: 'wdth' 112, 'wght' 300">
          <p class="card__spec">Aa</p>
          <p class="card__name">Fennel Light</p><p class="card__meta">Humanist sans · Variable</p>
        </article>
      </div>
    </section>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

51 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Search to results” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On warm paper, the Glyphary home page: the brand and «2,140 families» on top, the Fraunces title in the middle, «Find the typeface you were picturing.», and below it the big white search field with its magnifier. The field types by itself, the Enter key appears, a green line runs along the bottom of the field while it searches; the title rises and fades, and the field itself flies on a spring into the header, between the brand and the edge, with a cross instead of the key. Below, the header rule draws in, the filter pills slide in, the count rolls digit by digit up to «128 results» and six typeface cards arrive in a cascade, each with an «Aa» in its own variable font. On hover a card lights up and its «Aa» changes weight or width. Esc or the cross sends it all home.

How it works

One field, two places

The field is a single element, absolutely positioned over the page. The home and the header each hold an empty slot of the right size: the script measures them with getBoundingClientRect and moves the field from one to the other by animating left, top, width, height and the text size, so the type inside is never stretched. On resize the field snaps back to its current slot.

The order of the gestures

First the Enter key presses, the line runs through the field and the title leaves upwards; only then does the field take off, so it never crosses the title. Once it lands, the filters, the count and the cards come in, a few hundredths apart.

The rolling count

Each digit is a column from 0 to 9 inside a one-line window: the column scrolls to its digit, the first ones for longer than the last, like an odometer.

Running by itself

When nobody touches it, the demo types the search with a fake caret, searches, rests on the results with one card lit and goes back. As soon as the person touches the field or the page, the loop stops and starts again after six quiet seconds.

Values to change

NameFileDefaultWhat it changes
QUERYscript.js"humanist sans"What the demo types by itself.
TYPE_SPEEDscript.js0.07Seconds per typed letter.
FLYscript.js0.72How long the field takes to fly between home and header, in seconds.
SPRINGscript.js1.5How far the field overshoots when it lands (0 none).
CASCADEscript.js0.07The delay between one result card and the next, in seconds.
HOLDscript.js3.2How long the results stay before the demo goes back by itself, in seconds.
RESULTSscript.js128The result count shown for the demo search.

Try them in the Playground

When to use it

On sites where search is the first gesture: an archive, a catalogue, a property, recipe or font site, a product’s docs. The transition makes clear that the results page is the same search, just further along.

On phones

On phones the grid drops to two columns and four cards, three filters remain, the field narrows to the width and the title is sized on the height too. The field is tapped and typed into; the cross goes back.

With reduced motion

No flight and no cascade: the field fades out of the home and fades back in already in the header, the cards and filters fade in and the count is already at its number.

Pitfalls

  • Scaling the field would stretch its type: the real sizes are animated instead (left, top, width, height and font-size), which costs little on a single element.
  • The title must leave before the field takes off, otherwise the field crosses it for a moment.
  • Cards hidden on phones (nth-child) must not be animated: the script only takes the visible ones, via offsetParent.
  • The caret of the self-running loop is fake (a line measured with a canvas): focusing the real field would steal the keyboard from the page.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0, Newsreader (font variabile) 5.3.0, Archivo (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.0 KB; the libraries: GSAP 28 KB.

Testing

Tested on 29 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations