Animated icons JS behaviour

Looping icons

Continuously working icons inside a sync console’s real controls: a dot trio and an arc spinner, counter-rotating sync arrows, a magnifier pulsing in a live search field, an upload arrow whose fill is the progress bar, and a bouncing download arrow — each in a status card with text and a time meta.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

Working icons, working controls

Useanimations-style looping icons inside the real controls of a sync console: a dot trio and an arc spinner, counter-rotating sync arrows, a magnifier that pulses while the search field filters, an upload arrow whose fill is the progress bar, and a download arrow bouncing into its tray — each in a status card with its time meta.

Processing payout

Atlas Pay · closing 3 ledger entries

queued · 2s ago

Loading dashboard

Meridian analytics · 6 modules

streaming chunks · 08:41

Syncing workspace

Frankfurt cluster · 214 files

last sync: just now

Fetching installer

Vertex Studio 2026.10 · 42 MB

mirror: Dublin · 09:12

Uploading release cut

q4-report.mp4 · 12.4 MB

the arrow fill is the progress bar

Important props

Important props
Prop Type Default What it does
loop technique '@keyframes' Every loop is pure CSS — no timers for the spins; only the upload progress and the search debounce run on Alpine, both cleaned up on destroy.
upload-fill clip-path 'inset((100 − p)% 0 0 0)' The upload arrow’s fill is the progress bar: a filled copy of its paths rises via clip-path while the Persian-digit percentage counts beside it.
sync keyframe '1.6s · reverse' Two arrowed arcs rotate against each other around the icon’s centre — the feel of two sides being reconciled.
search-debounce ms '900' The magnifier pulses until 900ms after the last keystroke; the debounce timer resets per key and is cleared on destroy.
reduced-motion media 'frozen' All loops freeze in place; the icons stay legible and static while the upload progress remains readable from the text.

Snippet

<div class="iml">
    {{-- arc spinner --}}
    <span class="iml-ico" role="img" aria-label="loading">
        <svg class="iml-arc" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9" pathLength="100"/></svg>
    </span>

    {{-- counter-rotating sync arrows --}}
    <span class="iml-ico" role="img" aria-label="syncing">
        <svg class="iml-sync" viewBox="0 0 24 24" aria-hidden="true">
            <g class="iml-cw"><path class="iml-line" d="M19.5 13.5A8 8 0 0 1 5.6 16.4"/><path class="iml-line" d="M4.5 13.5v3.8h3.8"/></g>
            <g class="iml-ccw"><path class="iml-line" d="M4.5 10.5A8 8 0 0 1 18.4 7.6"/><path class="iml-line" d="M19.5 10.5V6.7h-3.8"/></g>
        </svg>
    </span>

    {{-- upload whose arrow fill is the progress bar --}}
    <span class="iml-ico" x-data="{ p: 0 }"
          x-init="up = setInterval(() => (p = p < 100 ? p + 2 : 0), 90); $cleanup(() => clearInterval(up))">
        <svg viewBox="0 0 24 24" aria-hidden="true">
            <path class="iml-line" d="M12 15.5V4.5"/>
            <path class="iml-line" d="m6.5 9.5 5.5-5 5.5 5"/>
            <path class="iml-line" d="M5 20h14"/>
            <g :style="`clip-path: inset(${100 - p}% 0 0 0)`">
                <path class="iml-upfill" d="M12 15.5V4.5"/>
                <path class="iml-upfill" d="m6.5 9.5 5.5-5 5.5 5Z"/>
            </g>
        </svg>
    </span>

    {{-- pulsing magnifier in a live search field --}}
    <label class="iml-field" x-data="{ busy: false, t: null }" x-init="$cleanup(() => clearTimeout(t))">
        <span class="iml-magwrap" x-bind:data-busy="busy ? 'true' : 'false'">
            <svg class="iml-mag" viewBox="0 0 24 24" aria-hidden="true">
                <path class="iml-line" d="M17.5 10.5a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"/>
                <path class="iml-line" d="m16 16 4.5 4.5"/>
            </svg>
        </span>
        <input type="search" placeholder="Search the team docs…"
               x-on:input="busy = true; clearTimeout(t); t = setTimeout(() => (busy = false), 900)">
    </label>
</div>

<style>
.iml-ico { display: grid; place-items: center; inline-size: 2.6rem; block-size: 2.6rem;
           border-radius: .8rem; background: #eef2ff; color: #4f46e5; }
.iml-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iml-arc { animation: iml-spin 1.3s linear infinite; }
.iml-arc circle { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round;
                  stroke-dasharray: 30 70; transform-origin: center; }
.iml-sync g { transform-origin: 12px 12px; }
.iml-sync .iml-cw { animation: iml-spin 1.6s linear infinite; }
.iml-sync .iml-ccw { animation: iml-spin 1.6s linear infinite reverse; }
.iml-upfill { fill: currentColor; stroke: none; }
.iml-magwrap { position: relative; }
.iml-magwrap[data-busy='true'] .iml-mag { animation: iml-pulse .9s ease-in-out infinite; }
.iml-magwrap[data-busy='true']::after { content: ''; position: absolute; inset: 0; border-radius: inherit;
                                        border: 2px solid currentColor; animation: iml-halo 1.1s ease-out infinite; }
.iml-field { display: flex; align-items: center; gap: .6rem; padding: .6rem .85rem;
             border: 1px solid #e7e5e4; border-radius: .8rem; }
@keyframes iml-spin { to { rotate: 360deg; } }
@keyframes iml-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.18; } }
@keyframes iml-halo { from { opacity: .7; scale: .8; } to { opacity: 0; scale: 1.25; } }
@media (prefers-reduced-motion: reduce) {
    .iml-arc, .iml-sync .iml-cw, .iml-sync .iml-ccw,
    .iml-magwrap[data-busy='true'] .iml-mag, .iml-magwrap[data-busy='true']::after { animation: none; }
}
</style>
// app/Pages/IconMotion.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import LoopSet from '@/components/LoopSet';

export default function IconMotion() {
  return (
    <NabuXUIProvider locale="en" linkComponent={Link}>
      <main className="nx-page">
        <LoopSet />
      </main>
    </NabuXUIProvider>
  );
}
// LoopSet.jsx — looping icons inside a sync console's real controls
import { useEffect, useRef, useState } from 'react';
import '@nabuxai/ui-core/css';

export default function LoopSet() {
  const [p, setP] = useState(0);
  const [q, setQ] = useState('');
  const [busy, setBusy] = useState(false);
  const debounce = useRef(null);

  // The upload climbs 2% a tick and restarts after a pause at 100%.
  useEffect(() => {
    let resting = false;
    const id = setInterval(() => {
      setP((v) => {
        if (v < 100) return Math.min(100, v + 2);
        if (!resting) { resting = true; setTimeout(() => { setP(0); resting = false; }, 1400); }
        return v;
      });
    }, 90);
    return () => clearInterval(id);
  }, []);

  // The magnifier pulses until 900ms after the last keystroke.
  const onSearch = (value) => {
    setQ(value);
    setBusy(true);
    clearTimeout(debounce.current);
    debounce.current = setTimeout(() => setBusy(false), 900);
  };
  useEffect(() => () => clearTimeout(debounce.current), []);

  return (
    <>
      <style>{`
        .iml-ico { display: grid; place-items: center; inline-size: 2.6rem; block-size: 2.6rem;
                   border-radius: .8rem; background: #eef2ff; color: #4f46e5; }
        .iml-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
        .iml-arc { animation: iml-spin 1.3s linear infinite; }
        .iml-arc circle { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round;
                          stroke-dasharray: 30 70; transform-origin: center; }
        .iml-sync g { transform-origin: 12px 12px; }
        .iml-sync .iml-cw { animation: iml-spin 1.6s linear infinite; }
        .iml-sync .iml-ccw { animation: iml-spin 1.6s linear infinite reverse; }
        .iml-upfill { fill: currentColor; stroke: none; }
        .iml-pct { font: 600 .72rem/1 ui-monospace, monospace; color: #4f46e5; margin-inline-start: auto; }
        .iml-magwrap { position: relative; }
        .iml-magwrap[data-busy='true'] .iml-mag { animation: iml-pulse .9s ease-in-out infinite; }
        .iml-magwrap[data-busy='true']::after { content: ''; position: absolute; inset: 0; border-radius: inherit;
                                                border: 2px solid currentColor; animation: iml-halo 1.1s ease-out infinite; }
        .iml-field { display: flex; align-items: center; gap: .6rem; padding: .6rem .85rem;
                     border: 1px solid #e7e5e4; border-radius: .8rem; }
        @keyframes iml-spin { to { rotate: 360deg; } }
        @keyframes iml-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.18; } }
        @keyframes iml-halo { from { opacity: .7; scale: .8; } to { opacity: 0; scale: 1.25; } }
        @media (prefers-reduced-motion: reduce) {
          .iml-arc, .iml-sync .iml-cw, .iml-sync .iml-ccw,
          .iml-magwrap[data-busy='true'] .iml-mag, .iml-magwrap[data-busy='true']::after { animation: none; }
        }
      `}</style>
      <div className="iml-card">
        <span className="iml-ico" role="img" aria-label="syncing">
          <svg className="iml-sync" viewBox="0 0 24 24" aria-hidden="true">
            <g className="iml-cw"><path className="iml-line" d="M19.5 13.5A8 8 0 0 1 5.6 16.4" /><path className="iml-line" d="M4.5 13.5v3.8h3.8" /></g>
            <g className="iml-ccw"><path className="iml-line" d="M4.5 10.5A8 8 0 0 1 18.4 7.6" /><path className="iml-line" d="M19.5 10.5V6.7h-3.8" /></g>
          </svg>
        </span>
        <b>Syncing workspace</b>
        <span className="iml-pct">Frankfurt · 214 files</span>
      </div>
      <div className="iml-card">
        <span className="iml-ico" role="img" aria-label="uploading">
          <svg viewBox="0 0 24 24" aria-hidden="true">
            <path className="iml-line" d="M12 15.5V4.5" />
            <path className="iml-line" d="m6.5 9.5 5.5-5 5.5 5" />
            <path className="iml-line" d="M5 20h14" />
            {/* The filled copy of the arrow IS the progress bar. */}
            <g style={{ clipPath: `inset(${100 - p}% 0 0 0)` }}>
              <path className="iml-upfill" d="M12 15.5V4.5" />
              <path className="iml-upfill" d="m6.5 9.5 5.5-5 5.5 5Z" />
            </g>
          </svg>
        </span>
        <b>Uploading release cut</b>
        <span className="iml-pct" role="status">{p}%</span>
      </div>
      <label className="iml-field">
        <span className="iml-ico iml-magwrap" data-busy={busy} role="img" aria-label={busy ? 'filtering' : 'search'}>
          <svg className="iml-mag" viewBox="0 0 24 24" aria-hidden="true">
            <path className="iml-line" d="M17.5 10.5a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z" />
            <path className="iml-line" d="m16 16 4.5 4.5" />
          </svg>
        </span>
        <input type="search" value={q} placeholder="Search the team docs…"
          onChange={(e) => onSearch(e.target.value)} aria-label="Search docs" />
      </label>
    </>
  );
}
<!-- LoopSet.vue — looping icons inside a sync console's real controls -->
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref } from 'vue';
import '@nabuxai/ui-core/css';

const p = ref(0);
const q = ref('');
const busy = ref(false);
let up: number | undefined;
let debounce: number | undefined;

onMounted(() => {
  let resting = false;
  // The upload climbs 2% a tick and restarts after a pause at 100%.
  up = window.setInterval(() => {
    if (p.value < 100) p.value = Math.min(100, p.value + 2);
    else if (!resting) { resting = true; setTimeout(() => { p.value = 0; resting = false; }, 1400); }
  }, 90);
});
// The magnifier pulses until 900ms after the last keystroke.
const onSearch = () => {
  busy.value = true;
  clearTimeout(debounce);
  debounce = window.setTimeout(() => (busy.value = false), 900);
};
onBeforeUnmount(() => { clearInterval(up); clearTimeout(debounce); });
</script>

<template>
  <div class="iml-card">
    <span class="iml-ico" role="img" aria-label="syncing">
      <svg class="iml-sync" viewBox="0 0 24 24" aria-hidden="true">
        <g class="iml-cw"><path class="iml-line" d="M19.5 13.5A8 8 0 0 1 5.6 16.4" /><path class="iml-line" d="M4.5 13.5v3.8h3.8" /></g>
        <g class="iml-ccw"><path class="iml-line" d="M4.5 10.5A8 8 0 0 1 18.4 7.6" /><path class="iml-line" d="M19.5 10.5V6.7h-3.8" /></g>
      </svg>
    </span>
    <b>Syncing workspace</b>
    <span class="iml-pct">Frankfurt · 214 files</span>
  </div>
  <div class="iml-card">
    <span class="iml-ico" role="img" aria-label="uploading">
      <svg viewBox="0 0 24 24" aria-hidden="true">
        <path class="iml-line" d="M12 15.5V4.5" />
        <path class="iml-line" d="m6.5 9.5 5.5-5 5.5 5" />
        <path class="iml-line" d="M5 20h14" />
        <!-- The filled copy of the arrow IS the progress bar. -->
        <g :style="{ clipPath: `inset(${100 - p}% 0 0 0)` }">
          <path class="iml-upfill" d="M12 15.5V4.5" />
          <path class="iml-upfill" d="m6.5 9.5 5.5-5 5.5 5Z" />
        </g>
      </svg>
    </span>
    <b>Uploading release cut</b>
    <span class="iml-pct" role="status">{{ p }}%</span>
  </div>
  <label class="iml-field">
    <span class="iml-ico iml-magwrap" :data-busy="busy" role="img" :aria-label="busy ? 'filtering' : 'search'">
      <svg class="iml-mag" viewBox="0 0 24 24" aria-hidden="true">
        <path class="iml-line" d="M17.5 10.5a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z" />
        <path class="iml-line" d="m16 16 4.5 4.5" />
      </svg>
    </span>
    <input type="search" v-model="q" placeholder="Search the team docs…" aria-label="Search docs" @input="onSearch" />
  </label>
</template>

<style scoped>
.iml-ico { display: grid; place-items: center; inline-size: 2.6rem; block-size: 2.6rem;
           border-radius: .8rem; background: #eef2ff; color: #4f46e5; }
.iml-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iml-sync g { transform-origin: 12px 12px; }
.iml-sync .iml-cw { animation: iml-spin 1.6s linear infinite; }
.iml-sync .iml-ccw { animation: iml-spin 1.6s linear infinite reverse; }
.iml-upfill { fill: currentColor; stroke: none; }
.iml-pct { font: 600 .72rem/1 ui-monospace, monospace; color: #4f46e5; margin-inline-start: auto; }
.iml-magwrap { position: relative; }
.iml-magwrap[data-busy='true'] .iml-mag { animation: iml-pulse .9s ease-in-out infinite; }
.iml-magwrap[data-busy='true']::after { content: ''; position: absolute; inset: 0; border-radius: inherit;
                                        border: 2px solid currentColor; animation: iml-halo 1.1s ease-out infinite; }
.iml-field { display: flex; align-items: center; gap: .6rem; padding: .6rem .85rem;
             border: 1px solid #e7e5e4; border-radius: .8rem; }
@keyframes iml-spin { to { rotate: 360deg; } }
@keyframes iml-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.18; } }
@keyframes iml-halo { from { opacity: .7; scale: .8; } to { opacity: 0; scale: 1.25; } }
@media (prefers-reduced-motion: reduce) {
  .iml-sync .iml-cw, .iml-sync .iml-ccw,
  .iml-magwrap[data-busy='true'] .iml-mag, .iml-magwrap[data-busy='true']::after { animation: none; }
}
</style>
<!-- LoopSet.svelte — looping icons inside a sync console's real controls -->
<script lang="ts">
  import { onMount } from 'svelte';
  import '@nabuxai/ui-core/css';

  let p = $state(0);
  let q = $state('');
  let busy = $state(false);
  let up: number | undefined;
  let debounce: number | undefined;

  onMount(() => {
    let resting = false;
    // The upload climbs 2% a tick and restarts after a pause at 100%.
    up = window.setInterval(() => {
      if (p < 100) p = Math.min(100, p + 2);
      else if (!resting) { resting = true; setTimeout(() => { p = 0; resting = false; }, 1400); }
    }, 90);
    return () => { clearInterval(up); clearTimeout(debounce); };
  });

  // The magnifier pulses until 900ms after the last keystroke.
  const onSearch = () => {
    busy = true;
    clearTimeout(debounce);
    debounce = window.setTimeout(() => (busy = false), 900);
  };
</script>

<div class="iml-card">
  <span class="iml-ico" role="img" aria-label="syncing">
    <svg class="iml-sync" viewBox="0 0 24 24" aria-hidden="true">
      <g class="iml-cw"><path class="iml-line" d="M19.5 13.5A8 8 0 0 1 5.6 16.4" /><path class="iml-line" d="M4.5 13.5v3.8h3.8" /></g>
      <g class="iml-ccw"><path class="iml-line" d="M4.5 10.5A8 8 0 0 1 18.4 7.6" /><path class="iml-line" d="M19.5 10.5V6.7h-3.8" /></g>
    </svg>
  </span>
  <b>Syncing workspace</b>
  <span class="iml-pct">Frankfurt · 214 files</span>
</div>
<div class="iml-card">
  <span class="iml-ico" role="img" aria-label="uploading">
    <svg viewBox="0 0 24 24" aria-hidden="true">
      <path class="iml-line" d="M12 15.5V4.5" />
      <path class="iml-line" d="m6.5 9.5 5.5-5 5.5 5" />
      <path class="iml-line" d="M5 20h14" />
      <!-- The filled copy of the arrow IS the progress bar. -->
      <g style="clip-path: inset({100 - p}% 0 0 0)">
        <path class="iml-upfill" d="M12 15.5V4.5" />
        <path class="iml-upfill" d="m6.5 9.5 5.5-5 5.5 5Z" />
      </g>
    </svg>
  </span>
  <b>Uploading release cut</b>
  <span class="iml-pct" role="status">{p}%</span>
</div>
<label class="iml-field">
  <span class="iml-ico iml-magwrap" data-busy={busy} role="img" aria-label={busy ? 'filtering' : 'search'}>
    <svg class="iml-mag" viewBox="0 0 24 24" aria-hidden="true">
      <path class="iml-line" d="M17.5 10.5a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z" />
      <path class="iml-line" d="m16 16 4.5 4.5" />
    </svg>
  </span>
  <input type="search" bind:value={q} oninput={onSearch} placeholder="Search the team docs…" aria-label="Search docs" />
</label>

<style>
.iml-ico { display: grid; place-items: center; inline-size: 2.6rem; block-size: 2.6rem;
           border-radius: .8rem; background: #eef2ff; color: #4f46e5; }
.iml-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iml-sync g { transform-origin: 12px 12px; }
.iml-sync .iml-cw { animation: iml-spin 1.6s linear infinite; }
.iml-sync .iml-ccw { animation: iml-spin 1.6s linear infinite reverse; }
.iml-upfill { fill: currentColor; stroke: none; }
.iml-pct { font: 600 .72rem/1 ui-monospace, monospace; color: #4f46e5; margin-inline-start: auto; }
.iml-magwrap { position: relative; }
.iml-magwrap[data-busy='true'] .iml-mag { animation: iml-pulse .9s ease-in-out infinite; }
.iml-magwrap[data-busy='true']::after { content: ''; position: absolute; inset: 0; border-radius: inherit;
                                        border: 2px solid currentColor; animation: iml-halo 1.1s ease-out infinite; }
.iml-field { display: flex; align-items: center; gap: .6rem; padding: .6rem .85rem;
             border: 1px solid #e7e5e4; border-radius: .8rem; }
@keyframes iml-spin { to { rotate: 360deg; } }
@keyframes iml-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.18; } }
@keyframes iml-halo { from { opacity: .7; scale: .8; } to { opacity: 0; scale: 1.25; } }
@media (prefers-reduced-motion: reduce) {
  .iml-arc, .iml-sync .iml-cw, .iml-sync .iml-ccw,
  .iml-magwrap[data-busy='true'] .iml-mag, .iml-magwrap[data-busy='true']::after { animation: none; }
}
</style>