npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@three-ws/agent-ui

v0.2.0

Published

Drop a 3D avatar into your UI and let it react to buttons, inputs, and navigation. The three.ws agent overlay SDK.

Readme


@three-ws/agent-ui packages the avatar-overlay runtime from the three.ws demos into a small Three.js SDK. The avatar lives on a transparent, fullscreen canvas above your DOM and is anchored to real elements: it can stand on a card, fall onto a heading, walk over to focus an input, cover its eyes when you type a password, or run off-screen before a navigation. One createAgentUI() call gets you a handle with imperative methods; one agent.scan() call wires up declarative data-agent-* attributes with no per-element JS.

Install

npm install @three-ws/agent-ui three

three (>=0.150.0) is a peer dependency so your bundler de-dupes it. The package ships source ESM (@three-ws/agent-ui) plus a prebuilt bundle subpath (@three-ws/agent-ui/bundle).

Quick start

<canvas></canvas>
<div id="hero">three.ws</div>

<script type="module">
  import { createAgentUI } from '@three-ws/agent-ui';

  const agent = await createAgentUI({
    avatar: '/avatars/cz.glb',
    clipsBase: '/animations/clips/',
    clips: ['idle', 'walk', 'falling'],
  });

  const hero = document.getElementById('hero');
  agent.fallOnto(hero, {
    onLand: () => {
      agent.fx.dust(hero);
      agent.fx.impactPulse(hero);
    },
  });

  agent.scan(); // wires any data-agent-action attributes in the page
</script>

createAgentUI(options) resolves once the GLB and clip JSONs load and the avatar is in scene. The resolved handle exposes the Three.js objects (renderer, scene, camera, canvas, avatar), animation control, movement/posing behaviors, FX helpers, and lifecycle (whenReady, destroy).

Imperative API

// Animation — clips are loaded from `clipsBase`
agent.play('idle', { loop: true });
agent.play('covereyes', { loop: false, hold: true });
agent.clip('walk');        // → clip duration in seconds (0 if not loaded)
agent.currentClip;         // → name of the clip currently playing

// Movement & posing
agent.standOn(formCard, { anchor: 'top-center' }); // park without traversal
agent.walkTo(emailInput);                          // walk-cycle over to an element
agent.fallOnto(heading, { duration: 1.4 });        // drop in from above
agent.runOff('right');                             // walk off-screen
agent.interceptNavigation(homeLink, { direction: 'right', delay: 1100 });
agent.lookAt(450);   // turn yaw toward a screen-X (pixels)
agent.faceFront();

// FX
const stopShadow = agent.fx.proximityShadow(heading); // returns a disposer
agent.fx.dust(buttonEl);
agent.fx.impactPulse(buttonEl);

// Utilities
agent.worldOfElement(el, { anchor: 'center' }); // DOM rect → world-space target
const pick = agent.pickFrom(['nod', 'shrug', 'wave']); // non-repeating picker
agent.whenReady((a) => { /* runs now or on ready */ });
agent.destroy(); // cancels RAF, unlocks root motion, tears down the renderer

Anchors accepted by standOn / walkTo / worldOfElement: top-left, top-right, top-center (default), center, bottom-center, left-of, right-of.

The same behavior functions are exported standalone for advanced compositions: createRenderer, loadAvatar, createAnimator, lockRootMotion, worldOfElement, moveTo, lookAtScreenX, faceFront, walkTo, standOn, fallOnto, runOff, interceptNavigation, createRandomPicker, caretScreenX, startCaretTracking, dust, impactPulse, proximityShadow, scan.

Declarative attributes

Mark up the page, call agent.scan() once. It returns a cleanup function that removes every listener it added.

<div class="card" data-agent-action="stand-on"></div>

<input data-agent-action="track-typing" />
<input data-agent-action="privacy-mode" type="password" />

<a href="/" data-agent-action="navigate-on-click" data-agent-direction="right">Home</a>
<button data-agent-action="react-on-click" data-agent-clip="celebrate">Subscribe</button>

| data-agent-action | Behavior | |---|---| | stand-on | Park the avatar above this element on ready. | | track-typing | On focus, walk to the input, play lookdown, then follow the caret with yaw. | | privacy-mode | On focus, walk to the input, play covereyes once and hold; play idle on blur. | | navigate-on-click | Intercept the click, run off-screen, then follow href. | | react-on-click | Play data-agent-clip once on click. |

Optional modifiers: data-agent-direction (left/right), data-agent-clip, data-agent-anchor, data-agent-delay (ms), data-agent-loop (true/false), data-agent-hold (true/false).

Options

createAgentUI({
  avatar: '/avatars/cz.glb',        // GLB URL (you host it)
  clipsBase: '/animations/clips/',  // base path for clip JSONs
  clips: ['idle', 'walk', 'lookdown', 'covereyes', 'falling', 'celebrate'],
  subclips: {
    // Trim a long Mixamo clip down to just the settle frames
    covereyes: { start: 0, end: 48, fps: 30 },
  },
  container: undefined, // defaults to document.body
  canvas: undefined,    // explicit canvas; otherwise one is created
  pixelsPerUnit: 120,
  zIndex: 999,
  parallax: true,
  crossfade: 0.3,
  lights: true,
});

Notes

  • Assets are yours. The SDK does not bundle the avatar GLB or animation JSONs — point it at whatever you host. Every URL is configurable; the three.ws CDN paths are only the defaults.
  • Three.js is a peer dep so your bundler de-dupes it. Works with Three r150+.
  • No animation-library dependency. All tweens use built-in requestAnimationFrame easings.
  • Root motion is locked automatically so walk-cycle hip translation doesn't drift the avatar off-screen.

Requirements

  • Node >=18.
  • Peer dependency: three >=0.150.0.
  • A GLB avatar and clip JSONs you host (no bundled assets).

Related packages

Links

  • Homepage: https://three.ws
  • Changelog: https://three.ws/changelog
  • Issues: https://github.com/nirholas/three.ws/issues
  • License: Apache-2.0 — see LICENSE