Closed witfyl-ravped closed 1 year ago
Update: Got the results I was looking for by passing in custom width and height and having hydra-synth.js create my canvas for me like so:
var hydra = new Hydra({
width: 1280,
height: 1280,
detectAudio: false
})
Hey there. I want to make a simple HTML viewer page but am having trouble getting the canvas to dynamically resize to the width/height of the browser.
I ran into the issue of low image quality when using CSS to dynamically size the canvas. In React it's easy enough to use {window.innerHeight} etc. so I figured I would embed a JS script to listen and edit the canvas tag (see full code below).
However I encounter the following error whenever I use JS to either create or modify the canvas tag:
hydra-synth:3103 Uncaught TypeError: Cannot read properties of null (reading 'clear') at HydraRenderer._initRegl (hydra-synth:3103:15) at new HydraRenderer (hydra-synth:2934:10) at index.html:41:19
I checked the lines given in the error but I can't figure out why they get thrown when the canvas element is modified by JS.
I'd appreciate any thoughts on this issue, full code modified from
Hydra inside a webpage
below. Thanks!