Git Product home page Git Product logo

angular-vrviewer's Introduction

Demo Image

angular-vrviewer

Embed VR media in your Angular application. Used as a wrapper for Google VR view for the Web. Currently supports only media type of 360 degree images.

Live Demo

Visit https://theunreal.github.io/angular-vrview-example/

Installation

To install angular-vrviewer, simply run:

$ npm install angular-vrviewer --save

Include in your index.html:

<script src="//storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>

Usage

Include the VRViewModule in your app:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

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

// Add this line
import { VRViewModule } from 'angular-vrviewer';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    VRViewModule //<-- import this module
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Now you can use the <vrview> selector to show 360 media in your angular application.

Example:

<vrview
[scenes]="scenes"
width="100%"
[height]="400">
</vrview>

Scenes and Hotspots

Scene Interface:

export interface Scene {
	[key: string]: {
	image: string;
	hotspots: Hotspot
	}
}

Hotspot interface:

export interface Hotspot {
	[key: string]: {
		pitch: number;
		yaw: number;
		radius: number,
		distance: number
	}
}

Scenes with Hotspot example:

scenes: Scene = {
    world: {
      image: 'assets/1.jpg',
      hotspots: {
        green_area: {
          pitch: 10,
          yaw: -15,
          radius: 0.05,
          distance: 1
        },
      }
    },
    green_area: {
      image: 'assets/2.jpg',
      hotspots: {
        world: {
          pitch: 20,
          yaw: 0,
          radius: 0.05,
          distance: 1
        },
      }
    }
};

License

MIT © Eliran Elnasi and contributors

angular-vrviewer's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.