The following code snippet:
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
<script>
AFRAME.registerComponent("foo", {
init: function() {
document.querySelector('a-scene').components.screenshot.capture('perspective')
}
})
</script>
<a-scene screenshot="width: 640; height: 320" foo>
<a-entity id="box" geometry="primitive: box; width: 1; depth: 1; height: 1" position="-1 0.5 -3" rotation="0 45 0" material="color: #4CC3D9"></a-entity>
<a-entity id="sphere" geometry="primitive: sphere; radius: 1.25" material="color: #EF2D5E" position="0 1.25 -5"></a-entity>
<a-entity id="cylinder" geometry="primitive: cylinder; radius: 0.5; height: 1.5" position="1 0.75 -3" material="color: #FFC65D"></a-entity>
<a-entity id="plane" position="0 0 -4" rotation="-90 0 0" geometry="primitive: plane; width: 4; height: 4" material="color: #7BC8A4"></a-entity>
<a-entity id="sky" geometry="primitive: sphere; radius: 100" material="color: #ECECEC; shader: flat; side: back"></a-entity>
</a-scene>
This particular code acts as a shortcut for taking a screenshot, eliminating the need for manual clicks or pop-ups.
However, there have been issues reported where the captured screenshot turns out completely white or appears distorted like this: screenshot
We appreciate any assistance in resolving these problems. Thank you.