three-async-gltf-loader
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ThreeJS Async GLTF Loader

ThreeJS TypeScript

Install

# npm
npm install three-async-gltf-loader

# yarn
yarn add three-async-gltf-loader

# pnpm
pnpm add three-async-gltf-loader

# bun
bun add three-async-gltf-loader

Usage

import { AsyncGLTFLoader } from 'three-async-gltf-loader';

// Instantiate a loader
const loader = new AsyncGLTFLoader();

// Optional: Provide a DRACOLoader instance to decode compressed mesh data
const dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath('/examples/jsm/libs/draco/');
loader.setDRACOLoader(dracoLoader);

// Load a glTF resource
const gltf = await loader.loadAsync(
  // resource URL
  'models/gltf/duck/duck.gltf',
  // called while loading is progressing. optional
  function (xhr: XMLHttpRequest) {
    console.log(`${xhr.loaded / xhr.total * 100} % loaded`)
  },
);

Dependents (0)

Package Sidebar

Install

npm i three-async-gltf-loader

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.81 kB

Total Files

8

Last publish

Collaborators

  • juunini