Skip to content

Commit

Permalink
fix: resize CanvasTexture on VFX.update() (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
fand authored Jul 10, 2024
1 parent 70e1837 commit 578b9a4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vfx-js/src/vfx-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,12 @@ export class VFXPlayer {
updateCanvasElement(element: HTMLCanvasElement): void {
const e = this.#elements.find((e) => e.element === element);
if (e) {
e.uniforms["src"].value.needsUpdate = true;
const oldTexture = e.uniforms["src"].value;
const texture = new THREE.CanvasTexture(element);
texture.wrapS = oldTexture.wrapS;
texture.wrapT = oldTexture.wrapT;
e.uniforms["src"].value = texture;
oldTexture.dispose();
}
}

Expand Down

0 comments on commit 578b9a4

Please sign in to comment.