Reputation: 13
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>
Upvotes: 0
Views: 162
Reputation: 13
Actually, I was able to figure it out:
sceneEl = document.querySelector('a-scene');
sceneEl.maxCanvasSize = {height: , width: };
Upvotes: 0
Reputation: 589
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);
Upvotes: 1