Skip to content

Commit 32298c0

Browse files
author
theunreal
committed
Update Hotspot as optional
1 parent dce725c commit 32298c0

File tree

3 files changed

+75
-32
lines changed

3 files changed

+75
-32
lines changed

README.MD

+72-29
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,115 @@
1+
![Demo Image](https://media.giphy.com/media/3o7btM6O1wZCPiTxTy/giphy.gif)
2+
13
# angular-vrviewer
4+
Embed VR media in your Angular application. Used as a wrapper for [Google VR view for the Web](https://developers.google.com/vr/concepts/vrview).
5+
Currently supports only media type of 360 degree images.
6+
7+
## Live Demo
8+
Visit https://theunreal.github.io/angular-vrview-example/
29

310
## Installation
411

5-
To install this library, run:
12+
To install angular-vrviewer, simply run:
613

714
```bash
815
$ npm install angular-vrviewer --save
916
```
1017

11-
## Consuming your library
12-
13-
Once you have published your library to npm, you can import your library in any Angular application by running:
14-
15-
```bash
16-
$ npm install angular-vrviewer
18+
Include in your `index.html`:
19+
```xml
20+
<script src="//storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
1721
```
1822

19-
and then from your Angular `AppModule`:
23+
## Usage
24+
25+
Include the `VRViewModule` in your app:
2026

2127
```typescript
2228
import { BrowserModule } from '@angular/platform-browser';
2329
import { NgModule } from '@angular/core';
2430

2531
import { AppComponent } from './app.component';
2632

27-
// Import your library
28-
import { SampleModule } from 'angular-vrviewer';
33+
// Add this line
34+
import { VRViewModule } from 'angular-vrviewer';
2935

3036
@NgModule({
3137
declarations: [
3238
AppComponent
3339
],
3440
imports: [
3541
BrowserModule,
36-
37-
// Specify your library as an import
38-
LibraryModule
42+
VRViewModule //<-- import this module
3943
],
4044
providers: [],
4145
bootstrap: [AppComponent]
4246
})
4347
export class AppModule { }
4448
```
49+
Now you can use the `<vrview>` selector to show 360 media in your angular application.
4550

46-
Once your library is imported, you can use its components, directives and pipes in your Angular application:
47-
51+
#### Example:
4852
```xml
49-
<!-- You can now use your library component in app.component.html -->
50-
<h1>
51-
{{title}}
52-
</h1>
53-
<sampleComponent></sampleComponent>
53+
<vrview
54+
[scenes]="scenes"
55+
width="100%"
56+
[height]="400">
57+
</vrview>
5458
```
5559

56-
## Development
57-
58-
To generate all `*.js`, `*.d.ts` and `*.metadata.json` files:
60+
## Scenes and Hotspots
61+
### Scene Interface:
62+
```typescript
63+
export interface Scene {
64+
[key: string]: {
65+
image: string;
66+
hotspots: Hotspot
67+
}
68+
}
69+
```
5970

60-
```bash
61-
$ npm run build
71+
### Hotspot interface:
72+
```typescript
73+
export interface Hotspot {
74+
[key: string]: {
75+
pitch: number;
76+
yaw: number;
77+
radius: number,
78+
distance: number
79+
}
80+
}
6281
```
6382

64-
To lint all `*.ts` files:
83+
### Scenes with Hotspot example:
6584

66-
```bash
67-
$ npm run lint
85+
```typescript
86+
scenes: Scene = {
87+
world: {
88+
image: 'assets/1.jpg',
89+
hotspots: {
90+
green_area: {
91+
pitch: 10,
92+
yaw: -15,
93+
radius: 0.05,
94+
distance: 1
95+
},
96+
}
97+
},
98+
green_area: {
99+
image: 'assets/2.jpg',
100+
hotspots: {
101+
world: {
102+
pitch: 20,
103+
yaw: 0,
104+
radius: 0.05,
105+
distance: 1
106+
},
107+
}
108+
}
109+
};
68110
```
69111

112+
70113
## License
71114

72-
MIT © [Eliran Elnasi](mailto:[email protected])
115+
MIT © Eliran Elnasi and contributors

src/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-vrviewer",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/theunreal/angular-vrviewer"

src/scene.interface.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export interface Scene {
22
[key: string]: {
33
image: string;
4-
hotspots: Hotspot
4+
hotspots?: Hotspot
55
}
66
}
77

@@ -12,4 +12,4 @@ export interface Hotspot {
1212
radius: number,
1313
distance: number
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)