Skip to content

Commit 12bc589

Browse files
committed
Moved to webpack
1 parent 84e953c commit 12bc589

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+404
-1105
lines changed

.gitignore

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
env.json
2-
.vscode
3-
.idea/
4-
/node_modules
5-
/bower_components
6-
/build
7-
/report
8-
/typings
9-
/src/tmp
10-
.DS_Store
11-
/src/assets/styles/*.css
12-
/src/fonts/
1+
# Created by .ignore support plugin (hsz.mobi)
2+
node_modules
3+
dist
4+
aot

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
1-
# Videogular 2
2-
## Angular Connect 2016 demo
1+
# Videogular 2 Starter
2+
3+
## Introduction
4+
Welcome to Videogular 2 Starter!
5+
6+
## Prerequisites
7+
You need to have [Node.js and npm](https://nodejs.org/en/)
8+
- Support Node v4 - latest
9+
- Support npm v3 - latest
10+
11+
## Installation
12+
13+
Install:
14+
```bash
15+
npm install
16+
```
17+
18+
## NPM commands
19+
Start development server:
20+
```bash
21+
npm start
22+
```
23+
Build app for development:
24+
```bash
25+
npm run build
26+
```
27+
Start production server:
28+
```bash
29+
npm run start:prod
30+
```
31+
Build app for production:
32+
```bash
33+
npm run build:prod
34+
```
35+
36+
## License
37+
MIT

src/app/vr-player.html renamed to app/app.component.html

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<a-scene vr-mode-ui="enabled: true" (renderstart)="onAframeRenderStart()">
1111
<a-assets>
12-
<video [src]="currentVideo.url" vg-media id="video" preload="auto" crossorigin="anonymous" loop>
12+
<video [src]="currentVideo.url" vg-media id="video" preload="auto" crossorigin="anonymous" loop autoplay muted>
1313
<track [src]="currentVideo.track" kind="metadata" label="Cue Points" default
1414
#metadataTrack
1515
vgCuePoints
@@ -29,34 +29,34 @@
2929
(mouseenter)="onMouseEnterPlane(txtPlane)"
3030
opacity="0">
3131
</a-plane>
32-
32+
3333
<a-text
34-
*ngFor="let txt of currentVideo.texts; let i=index"
35-
color="#FFF"
36-
[id]="txt.id"
37-
[attr.depth]="10 + i"
38-
[attr.position]="txt.position"
39-
[attr.rotation]="txt.rotation"
40-
[attr.scale]="txt.scale"
41-
[attr.text]="txt.text"
42-
[attr.animation__visibility]="txt.opaAnim"
43-
[attr.animation__position]="txt.posAnim"
44-
opacity="0">
34+
*ngFor="let txt of currentVideo.texts; let i=index"
35+
color="#FFF"
36+
[id]="txt.id"
37+
[attr.depth]="10 + i"
38+
[attr.position]="txt.position"
39+
[attr.rotation]="txt.rotation"
40+
[attr.scale]="txt.scale"
41+
[attr.text]="txt.text"
42+
[attr.animation__visibility]="txt.opaAnim"
43+
[attr.animation__position]="txt.posAnim"
44+
opacity="0">
4545
</a-text>
4646

4747
<a-image
48-
*ngFor="let door of currentVideo.doors; let i=index"
49-
[id]="door.id"
50-
[attr.depth]="100 + i"
51-
[attr.position]="door.position"
52-
[attr.rotation]="door.rotation"
53-
src="#ringImg"
54-
scale="0 0 0"
55-
(mouseenter)="onMouseEnter($event, door)"
56-
(mouseleave)="onMouseLeave($event)"
57-
animation__fadein="startEvents: vgStartFadeInAnimation; property: scale; dur: 2000; to: 1 1 1"
58-
animation__scale="startEvents: vgStartAnimation; pauseEvents: vgPauseAnimation; property: scale; dur: 2000; from: 1 1 1; to: 2 2 2"
59-
animation__visibility="startEvents: vgStartAnimation; pauseEvents: vgPauseAnimation; property: material.opacity; dur: 2000; from: 1; to: 0">
48+
*ngFor="let door of currentVideo.doors; let i=index"
49+
[id]="door.id"
50+
[attr.depth]="100 + i"
51+
[attr.position]="door.position"
52+
[attr.rotation]="door.rotation"
53+
src="#ringImg"
54+
scale="0 0 0"
55+
(mouseenter)="onMouseEnter($event, door)"
56+
(mouseleave)="onMouseLeave($event)"
57+
animation__fadein="startEvents: vgStartFadeInAnimation; property: scale; dur: 2000; to: 1 1 1"
58+
animation__scale="startEvents: vgStartAnimation; pauseEvents: vgPauseAnimation; property: scale; dur: 2000; from: 1 1 1; to: 2 2 2"
59+
animation__visibility="startEvents: vgStartAnimation; pauseEvents: vgPauseAnimation; property: material.opacity; dur: 2000; from: 1; to: 0">
6060
</a-image>
6161

6262
<a-videosphere src="#video"></a-videosphere>

app/app.component.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.title {
2+
position: absolute;
3+
color: white;
4+
z-index: 500;
5+
font-size: 60px;
6+
background: black;
7+
padding: 10px;
8+
margin: 10px;
9+
opacity: 0.5;
10+
font-family: Helvetica, Arial, sans-serif;
11+
transition: all 0.5s ease;
12+
13+
&.hide {
14+
opacity: 0;
15+
}
16+
}

src/app/vr-player.ts renamed to app/app.component.ts

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit, ElementRef } from '@angular/core';
2-
import { VgFullscreenAPI, VgAPI } from 'videogular2/core';
2+
import { VgAPI } from 'videogular2/core';
33

44

55
interface IAframeEntity {
@@ -24,7 +24,7 @@ interface IVrTextPlane extends IAframeEntity {
2424
height: number;
2525
isShown: boolean;
2626
}
27-
interface Video {
27+
interface IVideo {
2828
id: string;
2929
url: string;
3030
track: string;
@@ -35,34 +35,18 @@ interface Video {
3535

3636
@Component({
3737
selector: 'vr-player',
38-
templateUrl: './app/vr-player.html',
39-
styles: [`
40-
.title {
41-
position: absolute;
42-
color: white;
43-
z-index: 500;
44-
font-size: 60px;
45-
background: black;
46-
padding: 10px;
47-
margin: 10px;
48-
opacity: 0.5;
49-
font-family: Helvetica, Arial, sans-serif;
50-
transition: all 0.5s ease;
51-
}
52-
.title.hide {
53-
opacity: 0;
54-
}
55-
`]
38+
templateUrl: 'app.component.html',
39+
styleUrls: ['app.component.scss']
5640
})
5741
export class VRPlayer implements OnInit {
5842
elem: any;
5943
aframe: any;
6044
cuePointData: any = {};
6145
hideTitle: boolean = true;
62-
currentVideo: Video;
63-
timeout: number;
46+
currentVideo: IVideo;
47+
timeout: any;
6448
vgApi:VgAPI;
65-
videos: Array<Video> = [
49+
videos: Array<IVideo> = [
6650
{
6751
id: 'v0',
6852
url: 'http://static.videogular.com/assets/videos/vr-route-0.mp4',
@@ -84,7 +68,7 @@ export class VRPlayer implements OnInit {
8468
texts: [
8569
{
8670
id: 't1',
87-
text: 'St. Maurici lake (1910 m)',
71+
text: 'St. Maurici lake',
8872
position: '6 0 -4',
8973
rotation: '0 -30 0',
9074
scale: '2 2 2',
@@ -129,7 +113,7 @@ export class VRPlayer implements OnInit {
129113
texts: [
130114
{
131115
id: 't1',
132-
text: 'Ratera lake (2370 m)',
116+
text: 'Ratera lake',
133117
position: '9 0 -7',
134118
rotation: '0 -90 0',
135119
scale: '2 2 2',
@@ -150,7 +134,6 @@ export class VRPlayer implements OnInit {
150134

151135
ngOnInit() {
152136
this.aframe = this.elem.querySelector('a-scene');
153-
//VgFullscreenAPI.onChangeFullscreen.subscribe(this.onChangeFullscreen.bind(this));
154137
}
155138

156139
onAframeRenderStart() {
@@ -174,15 +157,6 @@ export class VRPlayer implements OnInit {
174157
.forEach(item => item.dispatchEvent(new CustomEvent('vgStartFadeInAnimation')));
175158
}
176159

177-
onChangeFullscreen(fsState) {
178-
if (fsState) {
179-
this.aframe.addFullScreenStyles();
180-
}
181-
else {
182-
this.aframe.removeFullScreenStyles();
183-
}
184-
}
185-
186160
onMouseEnterPlane(plane:IVrTextPlane) {
187161
if (!plane.isShown) {
188162
let target = document.querySelector('#' + plane.target);
@@ -191,15 +165,15 @@ export class VRPlayer implements OnInit {
191165
}
192166
}
193167

194-
onMouseEnter($event, door:IVrDoor) {
168+
onMouseEnter($event:any, door:IVrDoor) {
195169
$event.target.dispatchEvent(new CustomEvent('vgStartAnimation'));
196170

197171
this.timeout = setTimeout( () => {
198172
this.currentVideo = this.videos.filter( v => v.id === door.goto )[0];
199173
}, 2000 );
200174
}
201175

202-
onMouseLeave($event) {
176+
onMouseLeave($event:any) {
203177
$event.target.dispatchEvent(new CustomEvent('vgPauseAnimation'));
204178

205179
// Send start and pause again to reset the scale and opacity
@@ -209,18 +183,17 @@ export class VRPlayer implements OnInit {
209183
clearTimeout(this.timeout);
210184
}
211185

212-
onEnterCuePoint($event) {
186+
onEnterCuePoint($event:any) {
213187
this.hideTitle = false;
214188
this.cuePointData = JSON.parse($event.text);
215189
}
216190

217-
onExitCuePoint($event) {
191+
onExitCuePoint($event:any) {
218192
this.hideTitle = true;
219193

220194
// wait transition
221195
setTimeout( () => {
222196
this.cuePointData = {};
223197
}, 500 );
224-
225198
}
226199
}

app/app.module.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {NgModule, CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
2+
import {BrowserModule} from '@angular/platform-browser';
3+
4+
import {VRPlayer} from './app.component';
5+
6+
import {VgCore} from 'videogular2/core';
7+
import {VgControlsModule} from 'videogular2/controls';
8+
9+
@NgModule({
10+
imports: [BrowserModule, VgCore, VgControlsModule],
11+
declarations: [VRPlayer],
12+
bootstrap: [VRPlayer],
13+
schemas: [CUSTOM_ELEMENTS_SCHEMA]
14+
})
15+
export class AppModule {
16+
}

app/bootstrap-prod.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {platformBrowser} from '@angular/platform-browser';
2+
3+
import {AppModuleNgFactory} from '../aot/app/app.module.ngfactory';
4+
5+
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);

app/bootstrap.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
2+
3+
import {AppModule} from './app.module';
4+
5+
platformBrowserDynamic().bootstrapModule(AppModule);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

assets/styles/main.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
html {
2+
width: 100%;
3+
height: 100%; }
4+
5+
body {
6+
width: 100%;
7+
height: 100%;
8+
margin: 0;
9+
padding: 0; }
File renamed without changes.

config/env/env.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)