An API to use 360 view in VR with Angular framework
npm install ngx-view360
npm i webxr-polyfill --save
npm i gl-matrix --save
``
Then append these lines on polyfills.ts:
`typescript
import WebXRPolyfill from 'webxr-polyfill';
let polyfill = new WebXRPolyfill();
`
Now, you can add the library:
``
npm i ngx-view360 --save
``
$3
Import NgxView360Module on AppModule.
`typescript
import { NgxView360Module } from 'ngx-view360';
@NgModule({...
imports: [...,
NgxView360Module
...],
})
`
Then, you can use the component in template:
`html
`
API
The NgxView360Component has some attributes to display the view.
Attributes | description
------------ | -------------
imageSrc | source of the image to display, need to be a equirectangular image (jpg or png accepted)
displayMode(optional) | Mode to display image ('mono', 'stereoTopBottom','stereoLeftRight'). 'mono' is the default mode.
customButtonStyle(optional) | object to customize vr button
customCanvasStyle(optional) | object to customize canvas dimensions
showVRButton(optional) | boolean to show VR button (default value: true)
The property 'customButtonStyle' has this structure:
`typescript
interface ButtonOptionStyle {
color?: string;
height?: number;
corners?: any;
backColor?: string;
}
`
Attributes | description
------------ | -------------
color(optional) | color of texts and logos and borders
height(optional) | height of the button (px).
corners(optional) | 'square' or 'round' or any number representing border-radius (px)
backColor(optional) | background color of vr button
The property 'customCanvasStyle' has this structure:
`typescript
interface CanvasOptionStyle {
height?: string;
width?: string;
}
``