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

@anhldh/gltf-animation-pointer-extensions

v0.1.1

Published

KHR_animation_pointer support for three.js (GLTFLoader) and gltf-transform.

Readme

@anhldh/gltf-animation-pointer-extensions

Support for the glTF KHR_animation_pointer extension on both sides of the pipeline:

  • Runtime (three.js) — load models that use KHR_animation_pointer with GLTFLoader (and drei's useGLTF). three.js does not support it by default, so those animations simply don't play.
  • Build-time (gltf-transform)preserve KHR_animation_pointer channels while processing/optimizing a model. gltf-transform drops them by default.

What is KHR_animation_pointer?

The extension lets an animation target almost any property of a model via a JSON pointer — not just node transforms, but material factors / texture transforms, light parameters (KHR_lights_punctual), cameras, morph weights, visibility, and more. Because it lives outside "classic" animation, both three.js and gltf-transform ignore it unless a dedicated extension handles it.

Installation

pnpm add @anhldh/gltf-animation-pointer-extensions

Peer dependencies are optional — install only the side you use:

# runtime (three.js)
pnpm add three

# build-time (gltf-transform)
pnpm add @gltf-transform/core @gltf-transform/extensions

Usage — three.js

Plain GLTFLoader

import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
import { GLTFAnimationPointerExtension } from "@anhldh/gltf-animation-pointer-extensions";

const loader = new GLTFLoader();
loader.register((p) => new GLTFAnimationPointerExtension(p));

const gltf = await loader.loadAsync("model.glb");
// gltf.animations now contains tracks generated from KHR_animation_pointer

React Three Fiber (drei useGLTF)

The 4th argument of useGLTF is extendLoader — where you register the extension:

import { useGLTF } from "@react-three/drei";
import type {
  GLTFLoader,
  GLTFParser,
} from "three/examples/jsm/loaders/GLTFLoader.js";
import { GLTFAnimationPointerExtension } from "@anhldh/gltf-animation-pointer-extensions";

const gltf = useGLTF(url, true, true, (loader) => {
  // drei uses the three-stdlib GLTFLoader -> cast to three/examples.
  const l = loader as unknown as GLTFLoader;
  l.register((p: GLTFParser) => new GLTFAnimationPointerExtension(p));
});

useGLTF caches by URL, so extendLoader only runs on the first load of each URL.

Usage — gltf-transform

When you run a gltf-transform pipeline (weld, dedup, draco, resample, prune, ...), KHR_animation_pointer channels are dropped by default. Register KHRAnimationPointer to read and write them back correctly — it automatically remaps pointers to the new node/material indices after transforms.

import { WebIO } from "@gltf-transform/core";
import { ALL_EXTENSIONS } from "@gltf-transform/extensions";
import { KHRAnimationPointer } from "@anhldh/gltf-animation-pointer-extensions/transform";

const io = new WebIO().registerExtensions([
  ...ALL_EXTENSIONS,
  KHRAnimationPointer,
]);

const doc = await io.read(url); // preread: maps pointer -> Node/Material
// ...doc.transform(...)...        // pointers follow Node/Material, stay correct
const glb = await io.writeBinary(doc); // write: emits pointer with new indices

On Node, use NodeIO instead of WebIO:

import { NodeIO } from "@gltf-transform/core";
import { ALL_EXTENSIONS } from "@gltf-transform/extensions";
import { KHRAnimationPointer } from "@anhldh/gltf-animation-pointer-extensions/transform";

const io = new NodeIO().registerExtensions([
  ...ALL_EXTENSIONS,
  KHRAnimationPointer,
]);

const doc = await io.read("in.glb");
await io.write("out.glb", doc);

API

three.js side — from @anhldh/gltf-animation-pointer-extensions

  • GLTFAnimationPointerExtension — plugin registered via GLTFLoader.register(...).
  • .setAnimationPointerResolver(resolver) — customize how a pointer path maps to a three.js property.
  • invalidateMaterialCache(root) — clear the material cache when materials are swapped/cloned at runtime.
  • type AnimationPointerResolver.

gltf-transform side — from @anhldh/gltf-animation-pointer-extensions/transform

  • KHRAnimationPointerExtension registered on the IO (WebIO / NodeIO).
  • AnimationPointerExtensionProperty attached to an AnimationChannel.
  • KHR_ANIMATION_POINTER — the extension-name constant ("KHR_animation_pointer").

Notes

  • The three.js side patches PropertyBinding.findNode (global, once, guarded) so pointers can bind to material / texture / light / camera. Textures shared across materials are cloned before binding to avoid animating the wrong one.
  • If an animation fails, the extension returns an empty clip instead of breaking the whole model — the model still loads, only that animation is lost.
  • Published builds are minified; read the source on GitHub.
  • The two sides are separate entry points — . (three.js) and /transform (gltf-transform). Importing one never loads the other's peer dependency, so you only need the peer dep of the side you actually import.

License

MIT