Skip to content

Instantly share code, notes, and snippets.

@jimib
jimib / index.js
Created March 16, 2022 15:27
ThreeJS Animation
var loader = new THREE.GLTFLoader();
var mixer;
loader.load( SRC_GLB,
( gltf ) => {
//add the scene to a container (or directly to our THREE scene)
container.add( gltf.scene )
//configure the animation
var heightPx = 512;
var widthPx = 512;
var sizePx = Math.max( widthPx, heightPx );
var targetSize = 0.5;
var scaleX = targetSize * widthPx / sizePx;
var scaleY = targetSize * heightPx / sizePx;