Skip to content

Commit 749d8ee

Browse files
committed
Fixed problem with heavy animated textures
1 parent c69540e commit 749d8ee

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

js/ModelViewer.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ function ModelViewer(container) {
287287

288288
}
289289

290-
// arrows
290+
// arrow
291291

292292
gridGeometry.vertices.push(new THREE.Vector3(-1, -8, 9))
293293
gridGeometry.vertices.push(new THREE.Vector3(1, -8, 9))
@@ -540,8 +540,13 @@ function JsonModel(name, rawModel, texturesReference) {
540540

541541
var frame = animation.frames[animation.currentFrame]
542542

543-
material.map.image.src = images[frame.index]
544-
animation.currentFrame = animation.currentFrame < animation.frames.length - 1 ? animation.currentFrame + 1 : 0
543+
// Prevent crashing with big animated textures
544+
try {
545+
material.map.image.src = images[frame.index]
546+
animation.currentFrame = animation.currentFrame < animation.frames.length - 1 ? animation.currentFrame + 1 : 0
547+
} catch (e) {
548+
console.log(e.message)
549+
}
545550

546551
window.setTimeout(function() {
547552
window.requestAnimationFrame(animateTexture)

0 commit comments

Comments
 (0)