<!DOCTYPE html>
<html>
<head>
<base href="." />
<title>angular playground</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="https://aframe.io/releases/0.6.1/aframe.min.js"></script>
<script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js/dist/zone.js"></script>
<script src="https://unpkg.com/zone.js/dist/long-stack-trace-zone.js"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.3/Reflect.js"></script>
<script src="https://unpkg.com/systemjs@0.19.31/dist/system.js"></script>
<script src="config.js"></script>
<script>
System.import('app')
.catch(console.error.bind(console));
</script>
</head>
<body>
<my-app>
loading...
</my-app>
</body>
</html>
/* Styles go here */
### Angular Starter Plunker - Typescript
System.config({
//use typescript for compilation
transpiler: 'typescript',
//typescript compiler options
typescriptOptions: {
emitDecoratorMetadata: true
},
paths: {
'npm:': 'https://unpkg.com/'
},
//map tells the System loader where to look for things
map: {
'app': './src',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
'@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
'rxjs': 'npm:rxjs',
'typescript': 'npm:typescript@2.2.1/lib/typescript.js'
},
//packages defines our app package
packages: {
app: {
main: './main.ts',
defaultExtension: 'ts'
},
rxjs: {
defaultExtension: 'js'
}
}
});
//main entry point
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';
platformBrowserDynamic().bootstrapModule(AppModule)
//our root app component
import {Component, NgModule, VERSION} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { aScene } from './a-scene.comp.ts';
import { aScenePhoto } from './a-scene.photo.comp.ts';
import { mainPanel } from './mainpanel.comp.ts';
import {Routes,RouterModule} from'@angular/router';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'my-app',
templateUrl: 'src/app.html',
styleUrls:['src/styles.css']
})
export class App {
}
const routes: Routes = [
{path: 'simple',component:aScene},
{path: 'photo',component:aScenePhoto},
{path: '',component:mainPanel},
{path: 'photo/:photoAsset',component:aScenePhoto},
];
const routing = RouterModule.forRoot(routes);
@NgModule({
imports: [ BrowserModule,
FormsModule,
routing],
declarations: [ App,
aScene,
aScenePhoto,
mainPanel,
],
bootstrap: [ App ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule {}
import {Component, NgModule, VERSION} from '@angular/core'
import { Component, Input } from '@angular/core';
@Component({
selector: 'a-scene-1',
templateUrl: 'src/a-scene.comp.html',
styleUrls:['src/styles.css']
})
export class aScene {
@Input() selector: number;
@Input() light: bool;
//DECLARE VARIABLES FOR THE SELECT FORMS
simpleAsset:string;
preview:string;
photoAsset:string;
R:number;
recording:bool;
simpleLight: bool;
selectedBulb:bool;
selectedRec:bool;
HEX: string;
constructor() {
//SET INITIAL VARIABLES IN THE SELECT FORMS
this.simpleAsset=0;
this.preview=0;
this.photoAsset=0;
this.R=255;
this.simpleLight = false;
this.selectedBulb = false;
this.selectedRec = false;
this.recording = false;
}
record():void{
if(!this.selectedRec){
console.log("recordCheck");
this.startDictation();
this.selectedRec = true;
}
}
startDictation():void {
console.log("start dictaction");
if (window.hasOwnProperty('webkitSpeechRecognition')) {
console.log("start");
var recognition = new webkitSpeechRecognition();
recognition.continuous = false;
recognition.interimResults = false;
recognition.lang = "en-US";
recognition.start();
console.log("start");
recognition.onresult = (e)=>{
document.getElementById('transcript').value
= e.results[0][0].transcript;
recognition.stop();
if(e.results[0][0].transcript=="lights on"){
this.simpleLight = true;
}
if(e.results[0][0].transcript=="lights off"){
this.simpleLight = false;
}
if(e.results[0][0].transcript=="cube"){
this.simpleAsset = 1;
}
};
recognition.onaudioend=(e)=>{
this.selectedRec=false;
}
recognition.onerror = function(e) {
recognition.stop();
}
}
}
toggleSimpleLight() : void{
this.simpleLight=!this.simpleLight;
}
makeHex() : void{
this.HEX = "#" + ((1 << 24) + (200 << 16) + (255 << 8) + 0).toString(16).slice(1);
}
}
import {Component, NgModule, VERSION} from '@angular/core'
import { Component, Input } from '@angular/core';
@Component({
selector: 'a-scene-2',
templateUrl: 'src/a-scene.photo.comp.html',
styleUrls:['src/styles.css']
})
export class aScenePhoto {
@Input() selector: number;
photoAsset:string;
constructor() {
//SET INITIAL VARIABLES IN THE SELECT FORMS
this.photoAsset=0;
}
}
.wrapper {
left:0;
}
.sitecontainer{
margin:auto;
width:80%;
background: rgb(54, 25, 25); /* Fall-back for browsers that don't
support rgba */
background: rgba(255, 255, 255, .6);
height:100vh;
padding-left:10px;
border-style: solid;
border-color: black;
}
.selected {
background-color: #dddddd !important;
}
.button {
margin: 0 0 0 0;
list-style-type: none;
padding: 0;
width: 15em;
}
.button li {
cursor: pointer;
position: relative;
left: 0;
background-color: #e3e1de;
margin: 0;
padding: .3em 0;
border-radius: 4px;
}
.button li.selected:hover {
background-color: #BBD8DC !important;
}
.button li:hover {
color: #607D8B;
background-color: #DDD;
}
.button .text {
position: relative;
top: -3px;
}
.button .badge {
display: inline-block;
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color: #607D8B;
position: relative;
left: 0px;
top: -4px;
height: 2em;
margin-right: .8em;
border-radius: 4px 0 0 4px;
}
.icon{
position:relative;
display: inline-block;
float: right;
height: 1.9em;
}
.recicon{
-webkit-filter: brightness(0); /* Safari 6.0 - 9.0 */
filter: brightness(0);
}
.selectedbulb{
-webkit-filter: brighness(500%); /* Safari 6.0 - 9.0 */
filter: brightness(500%);
}
.selectedrec{
-webkit-filter: brighness(100%); /* Safari 6.0 - 9.0 */
filter: brightness(100%);
}
a-scene {
height: 50vh;
width: 100%;
margin:auto;
}
.main{
background-color:#817c75;
width:100%;
height:100vh;
}
.footerfiller{
height:200px;
}
import {Component, NgModule, VERSION} from '@angular/core'
import { Component, Input } from '@angular/core';
@Component({
selector: 'a-scene-3',
templateUrl: 'src/mainpanel.comp.html',
styleUrls:['src/styles.css']
})
export class mainPanel {
}
<p> Basic setup for interacting within the aframe canvas</p>
Select which asset should be visible:
<select [(ngModel)]="simpleAsset">
<option value="0">All
<option value="1">Cube
<option value="2">Sphere
<option value="3">Cylinder
</select>
<a-scene embedded>
<a-assets>
<a-mixin id="light" geometry="primitive: sphere; radius: 1.5"
material="color: #FFF; shader: flat"
light="color: #DDDDFF; distance: 120; intensity: 2; type: point">
</a-mixin>
</a-assets>
<!-- Lights. -->
<a-entity *ngIf="simpleLight" position="0 0 0">
<a-animation attribute="rotation" to="0 360 0"
repeat="indefinite" easing="linear" dur="4096">
</a-animation>
<a-entity mixin="light" position="30 0 0"></a-entity>
</a-entity>
<a-entity
light="type: ambient; color: #BBB;groundColor:#FFF"></a-entity>
<a-entity position="-0.5 1 1"
light="type: directional; color: #BBB;groundColor:#FFF"></a-entity>
<a-box *ngIf="simpleAsset==0||simpleAsset==1" position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
<a-sphere *ngIf="simpleAsset==0||simpleAsset==2" position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
<a-cylinder *ngIf="simpleAsset==0||simpleAsset==3" position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
<a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
<a-sky color="#ECECEC"></a-sky>
</a-scene>
<ul class="button">
<li [class.selected]="simpleLight"
(click)="makeHex();toggleSimpleLight()">
<span class="badge">
</span>Light
<span class = "icon" [class.selectedbulb]="simpleLight">
<img height = "100%" src="https://cdn2.iconfinder.com/data/icons/business-office-4/256/Idea-512.png"/>
</span>
</li>
<li (click)="record();">
<span class="badge"> </span>Voice Recognition
<span class = "icon recicon" [class.selectedrec]="selectedRec">
<img height = "100%" src="http://www.iconsdb.com/icons/preview/red/microphone-xxl.png" />
</span>
</li>
</ul>
<p>Voice Recognition Result:
<input type="text" name="q" id="transcript" placeholder="None" disabled/>
</p>
<p>Voice recognition works on Chrome, reacts on: "Lights on" and "Lights off"</p>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" >Polandball wants into vr !!</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a [routerLink]="['/']">Home</a></li>
<li><a [routerLink]="['/simple']"> Simple Preview</a></li>
<li><a [routerLink]="['/photo']">Photo Preview</a></li>
</ul>
</div>
</nav>
<div class = "main">
<div class = "footerfiler">
<div class = "sitecontainer">
<br><br><br>
<router-outlet></router-outlet>
</div>
</div>
</div>
<!--PHOTO PREVIEW-->
Select a photo on the a-sky:
<select [(ngModel)]="photoAsset">
<option value="0">Berlin360
<option value="1">Hill360
</select>
<a-scene embedded>
<a-sky *ngIf="photoAsset==0" src="https://upload.wikimedia.org/wikipedia/commons/6/65/SonyCenter_360panorama.jpg" rotation="0 -130 0"></a-sky>
<a-sky *ngIf="photoAsset==1" src="https://upload.wikimedia.org/wikipedia/commons/6/6f/Helvellyn_Striding_Edge_360_Panorama%2C_Lake_District_-_June_09.jpg" rotation="0 -130 0"></a-sky>
</a-scene>
<p> Photos aquired @wikipedia.com, may be huge and take a sec. to load </p>
<h1>Angulal.io and A-frame:</h1>
<hr>
<h2>What is a-frame ?</h2>
<p> Mostly a-frame is: </p>
<ul>
<li><a target="_blank" href="https://en.wiktionary.org/wiki/amazed">Amazing</a></li>
<li><a target="_blank" href="http://www.dictionary.com/browse/awesome">Awesome</a></li>
<li><a target="_blank" href="http://www.urbandictionary.com/define.php?term=jaw-dropper
">Jawdropping</a></li>
</ul>
<p><a href="https://aframe.io/">A-frame</a> is a great library build on <a href="https://threejs.org/">three.js</a>
designed to allow easy creating virtual reality apps and websites.</p>
<hr>
<h2>But..why ? </h2>
<p>A-frame based sites are supported by most browsers supporting html5
(only found issues with html video tags on the apple systems),
yet the virtual reality can be experienced on: </p>
<ul>
<li> STEAM's DESKTOP VR:
<ul>
<li>HTC VIVE</li>
<li>OCULUS RIFT</li>
</ul>
</li>
<li> Modern Smartphones with a cardboard or GEAR-like equipment</li>
</ul>