Skip to content

Instantly share code, notes, and snippets.

@ayamflow
ayamflow / texture-atlas.js
Last active November 21, 2023 01:22
threejs Texture Atlas (TexturePacker spritesheet)
import _ from 'underscore';
export default class TextureAtlas {
constructor(json, image) {
this._textures = {};
let texture = new THREE.Texture(image);
texture.needsUpdate = true;
let frames = json.frames;
_.keys(frames).forEach(function(key, i) {