I have multiple images (say North, East, South, West) and I want them to be shown as one combined panorama/360 view using aframe in java script, instead of each image to be shown as individual 360 view as a-sky does.
Here is a codepen for reference.
<script>
AFRAME.registerComponent('set-sky', {
schema: {default:''},
init() {
const sky = document.querySelector('a-sky');
this.el.addEventListener('click', () => {
sky.setAttribute('src', this.data);
});
}
});
</script>
<a-scene>
<a-camera position="0 2 4">
<a-cursor color="#4CC3D9" fuse="true" timeout="10"></a-cursor>
</a-camera>
<a-sphere color="#F44336" radius="1" position="-4 2 0" set-
sky="https://c3.staticflickr.com/2/1475/26239222850_cabde81c39_k.jpg"></a-
sphere>
<a-sphere color="#FFEB3B" radius="1" position="4 2 0" set-
sky="https://c2.staticflickr.com/2/1688/25044226823_53c979f8a1_k.jpg"></a-
sphere>
<a-sky></a-sky>
</a-scene>
Relevant Blog:
https://blog.neondaylight.com/build-a-simple-web-vr-ui-with-a-frame-a17a2d5b484
As said in ngokevin's comment, You could either:
create an entity made of planes with Your images, and place the camera inside:
But you need to fill it with some ground and top, so you could try to:
create a cubemap out of six images:
A demo consisting of both options is here. Just navigate Yourself with wasd-controls inside the cubemap, or planes.
Check out the source code here.