Skip to content

Instantly share code, notes, and snippets.

@cwervo
Last active October 26, 2019 10:31
Show Gist options
  • Save cwervo/67fc6c2c96d1c8e01a683caa9b092fd5 to your computer and use it in GitHub Desktop.
Save cwervo/67fc6c2c96d1c8e01a683caa9b092fd5 to your computer and use it in GitHub Desktop.
testing-camernder-2019-10-26
<!DOCTYPE html>
<!-- Secondary camera projected on a screen
-->
<html>
<head>
<script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.0.1/dist/aframe-extras.min.js"></script>
<script src="https://rawcdn.githack.com/jgbarah/aframe-playground/e1a42e1bc745f340c572c7b4db43f7c97210ee76/camrender-01/camrender.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<!-- Canvas for rendering secondary camera -->
<canvas id="cam2"></canvas>
</a-assets>
<!-- Objects in the scene -->
<a-box position='0 0.5 0' material='color: red;'></a-box>
<a-box position="-1 0.5 -1" rotation="0 45 0" color="#4CC3D9" shadow></a-box>
<a-sphere position="0 1.25 -3" radius="1.25" color="#EF2D5E" shadow></a-sphere>
<a-cylinder position="1 0.75 -1" radius="0.5" height="1.5" color="#FFC65D" shadow></a-cylinder>
<a-plane position="0 0 -2" rotation="-90 0 0" width="4" height="4" color="#7BC8A4" shadow></a-plane>
<a-sky color="#ECECEC"></a-sky>
<!-- "Regular" camera, linked to movement controls, and to a cone -->
<a-entity position="0 0 5" movement-controls="fly: true; speed: 0.1">
<a-entity camera position="0 1.6 0" look-controls camera="active: true" camrender="cid: cam2">
<a-cone color="brown" radius-bottom=".2" radius-top=".05" height=".5"
position="0 -.6 -1" rotation="-80 0 0"></a-cone>
</a-entity>
</a-entity>
<!-- Screen for showing the secondary camera -->
<a-plane position="-4 2 0" rotation="0 20 0" width="4" height="3"
material="src:#cam2; opacity: .95" canvas-updater></a-plane>
</a-scene>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment