Search code examples
javascriptthree.jsaframe

Accessing and changing the renderer component properties in <a-scene>


Below is a code snippet in A-Frame that I am using. I wish to access and manipulate the maxCanvasWidth and maxCanvasHeight properties of the renderer component using conditional statements in Javascript. I can't figure out how to do it.

<a-scene renderer ="antialias: true;

                   colorManagement: true;`

                   sortObjects: true;

                   physicallyCorrectLights: true;

                   maxCanvasWidth: 1920;

                   maxCanvasHeight: 1920;"></a-scene>

Example pseudo code of what I wish to implement:
<script>
var update = document.queryselector('a-scene');
if(fps < 60){
update.maxCanvasWidth = 800;
update.maxCanvasHeight = 800; }
</script>

Solution

  • Actually, I was able to figure it out:

    sceneEl = document.querySelector('a-scene');
    sceneEl.maxCanvasSize = {height: , width: };