building your world in webvr

34
A-FRAME Build theVirtual RealityWeb

Upload: vanthuy

Post on 14-Feb-2017

238 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Building your world in WebVR

A-FRAMEBuild theVirtual RealityWeb

Page 2: Building your world in WebVR
Page 3: Building your world in WebVR
Page 4: Building your world in WebVR

MozillaVRTeam@cvanw @dmarcos @fernandojsg @kearwoodgilbert

@ngokevin_ @whoyee

Page 5: Building your world in WebVR

.••

Page 6: Building your world in WebVR

It’s too hard to create WebVR experiences.

Page 7: Building your world in WebVR

Josh Carpenter

I ndex.htrnl - rainbowrneJT1brane UNREGISTERED

FOLDERS

T e , rainbowmembrane

... CJ audio

... CJ examples

... CJ img

... CJ l ib

... D models

... CJ shaderChunks

... CJ shaders

.index.html.swn

Gl:) create.js

Gl:) GEM.js

Gl:) GUl.js

Gl:) initTones.js

Gl:) Opening.js

Gl:) RayMaker.js

Gl:) RepelerMesh.js

Gl:) Tone.js

Page 8: Building your world in WebVR

<a-box>

<a-sphere>

<a-obj-model>

Page 9: Building your world in WebVR

<a-box depth=“5” height=“0.5” width=“2”>

<a-sphere color=“crimson” radius=“1.5”>

<a-obj-model src=“fox.obj”>

Page 10: Building your world in WebVR

A-FRAMEAn open source framework for creating virtual reality web

experiences without having to knowWebGL

Page 11: Building your world in WebVR
Page 12: Building your world in WebVR

OUT-OF-THE-BOX ELEMENTS

<a-video>

<a-cylinder>

<a-sky>

<a-videosphere><a-image>

<a-box> <a-obj-model>

<a-collada-model>

<a-curvedimage>

<a-light><a-sphere>

Page 13: Building your world in WebVR

WITHVANILLA JAVASCRIPT

.querySelector(‘a-image’)

.getAttribute(‘opacity’)

.setAttribute(‘material’, ‘color’,

.addEventListener(‘collide’)

’blanchedalmond’)

.createElement(‘a-entity’)

Page 14: Building your world in WebVR

WITH LIBRARIES

$(‘a-box’).attr(‘width’, 5)

d3.select(‘a-scene’).selectAll(‘a-

box.bar’).data(data)

<Entity geometry={{ primitive: ‘ring’,

material={{ color: ‘red’, shader:

radiusInner: 1.5 }}

. ‘flat’ }}

light={...lightProperties}

onClick={this.changeColor}/>.

Page 15: Building your world in WebVR

ANIMATION SYSTEM

<a-box>

<a-animation attribute=“rotation”

repeat=“indefinite”

to=“0 360 0”></a-animation>

</a-box>

Page 16: Building your world in WebVR

ASSET MANAGEMENT SYSTEM

<a-scene>

<a-assets>

<a-asset-item id=“monster” src=“monster.obj”></a-asset-item>

</a-assets>

<a-entity

</a-scene>

obj-model=“src: #monster”></a-entity>

Page 17: Building your world in WebVR

Let’s build a scene

Page 18: Building your world in WebVR

ENTITY-COMPONENT-SYSTEMComposability over inheritance

Page 19: Building your world in WebVR

ENTITY-COMPONENT-SYSTEM

• Entities - placeholder objects

• Components - modify appearance,behavior,functionality of entities

Page 20: Building your world in WebVR

REVEALINGTHEABSTRACTION LAYER

<a-box width=“5”

color=“#2E3837”>

<a-entity geometry=“primitive: box; width: 5”

material=“color: #2E3837”>

Page 21: Building your world in WebVR

COMPOSINGAN ENTITY

<a-entity>

Page 22: Building your world in WebVR

COMPOSING AN ENTITY

<a-entity geometry=“primitive: sphere; radius: 1.5”

material=“color: tomato; metalness: 0.7”>

Page 23: Building your world in WebVR

COMPOSING AN ENTITY

<a-entity geometry=“primitive: sphere; radius: 1.5”

material=“color: tomato; metalness: 0.7”

light=“type: point;

sound=“src:

color: tomato”

#rickroll; volume: 0.9”>

Page 24: Building your world in WebVR

COMPOSING AN ENTITY

<a-entity geometry=“primitive: sphere; radius: 1.5”

material=“color: tomato; metalness: 0.7”

light=“type: point;

sound=“src: #rickroll;

color: tomato”

volume: 0.9”

physics=“boundingRadius: 1.5; mass: 1”

aggro=“100” explode follow-player vibrate>

Page 25: Building your world in WebVR

ANATOMYAND PHYSIOLOGY

});

AFRAME.registerComponent(‘position’, {

Page 26: Building your world in WebVR

ANATOMY AND PHYSIOLOGY

});

AFRAME.registerComponent(‘position’,

{ schema: { type: ‘vec3’ },

Page 27: Building your world in WebVR

ANATOMY AND PHYSIOLOGY

});

AFRAME.registerComponent(‘position’,

{ schema: { type: ‘vec3’ },

update: function () {

this.el.object3D.position.set

(

this.data.x,

this.data.y,

this.data.z

);

}

Page 28: Building your world in WebVR

STANDARD COMPONENTS

obj-model

collada-model

physics

rotation

scale

material

fog

geometry

position

light

look-at

look-controlssound

text

Page 29: Building your world in WebVR

COMMUNITY COMPONENTS

along-path

leap-motion-controlscollider

proxy-controls

layoutlazy-load

extrude-geometryspawner

obj-loader

gamepad-controlslathe-geometry

Page 30: Building your world in WebVR

COMPOSING MIXINS

<a-scene>

<a-assets>

<a-mixin

<a-mixin

<a-mixin

<a-mixin

id=“ball”

id=“cube”

geometry=“primitive:

geometry=“primitive:

sphere”></a-mixin>

box”></a-mixin>

id=“green” material=“color:

id=“shiny” light=“type:

#B4CD93”></a-mixin>

point”></a-mixin>

</a-assets>

</a-scene>

<a-entity mixin=“green ball”></a-entity>

<a-entity mixin=“shiny ball”></a-entity>

<a-entity mixin=“shiny green cube”></a-entity>

Page 31: Building your world in WebVR

LATER ON, STYLESHEETS

#basketball {

geometry {

primitive: sphere;

radius: 0.5;

}

material {

roughness: 0.9;

src: url(basketball.png);

}

physics {

boundingRadius:

mass: 0.8;

0.5;

}

visible: true;

}

Page 32: Building your world in WebVR

A-FRAME + WEBVR

Page 33: Building your world in WebVR

GET INVOLVED

• aframevr-slack.herokuapp.com

• aframe.io

• github.com/aframevr

• mozvr.com

Page 34: Building your world in WebVR