Socket
Socket
Sign inDemoInstall

@asset-manager/three

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asset-manager/three

A singleton for loading and retrieving assets used in your application.


Version published
Maintainers
2
Created
Source

@asset-manager/three

NPM version PR Welcome

This package provides loaders for preloading three.js type assets.

Introduction

Loading and retrieving assets.

import AssetManager from "@asset-manager/core";
import { GLTFLoader, TextureLoader } from "@asset-manager/three";

// Get an instance to the manager and set the loaders
const manager = AssetManager.getInstance();
manager.setLoaders({
  gltf: GLTFLoader,
  texture: TextureLoader,
});

// Set the assets to load
manager.setAssets([
  {
    id: "modelName",
    type: "gltf",
    url: "modelName.gltf",
    preload: true,
    params: {
      dracoCompressed: false,
    },
  },
  {
    id: "textureName",
    type: "texture",
    url: "texureName.png",
    preload: true,
    params: {},
  },
]);

// Elsewhere in your app you can grab assets from the manager
const gltf = AssetManager.getInstance().get<GLTFLoader>("modelName").gltf;
const texture =
  AssetManager.getInstance().get<TextureLoader>("textureName").texture;

Installation

Install this package with npm.

npm i @asset-manager/three

This package does not include the core loader. You will need to install that separately

npm i @asset-manager/core

Keywords

FAQs

Package last updated on 18 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc