0

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>

2 Answers 2

1

renderer is an attribute of the scene element, so you would use setAttribute. Specifically, refer to the documentation on updating multi-property component data.

e.g.

const scene = document.querySelector('a-scene');
scene.setAttribute('renderer', 'maxCanvasWidth', 800);
Sign up to request clarification or add additional context in comments.

Comments

0

Actually, I was able to figure it out:

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.