├── .eslintrc ├── .gitignore ├── 360-video ├── README.md ├── index.html ├── js │ └── demo.js ├── models │ ├── LICENSE.txt │ ├── rubber-duck.json │ ├── rubber-duck.mtl │ └── rubber-duck.obj ├── screenshot.jpg └── videos │ ├── paris-by-diego.mp4 │ ├── paris-by-diego.ogg │ └── paris-by-diego.webm ├── Gemfile ├── Gemfile.lock ├── LICENSE.md ├── README.md ├── _config.yml ├── _layouts ├── a-frame.html └── store.html ├── a-frame-assets ├── 360-photos │ ├── SAM_100_0042_SMALL.jpg │ ├── SAM_100_0046_SMALL.jpg │ └── SAM_100_0063_SMALL.jpg ├── Feisar_Ship_OBJ │ ├── Feisar_Ship.mtl │ ├── Feisar_Ship.obj │ └── maps │ │ ├── diffuse.bmp │ │ ├── diffuse.jpg │ │ ├── diffuse_green.jpg │ │ ├── diffuse_red.jpg │ │ ├── normal.jpg │ │ ├── specular.bmp │ │ └── specular.jpg ├── components │ ├── clone.js │ ├── curve.js │ └── ship-controller.js ├── hand │ ├── hand-fist.obj │ └── hand-relaxed.obj ├── kitchen │ ├── CakeBake.png │ ├── CounterBake.png │ ├── FridgeBake.png │ ├── RoomBake.png │ ├── SwirlBake.png │ ├── backwall.png │ ├── envmap │ │ ├── 0001.png │ │ ├── 0002.png │ │ ├── 0003.png │ │ ├── 0004.png │ │ ├── 0005.png │ │ └── 0006.png │ ├── images │ │ ├── backwall.png │ │ ├── environment.jpg │ │ └── normalmap_tile_even.png │ ├── lickthewhisk.blend │ ├── lickthewhisk.json │ └── normalmap_tile_even.png ├── ninja │ ├── NinjaLo_bin.bin │ ├── NinjaLo_bin.js │ ├── ao.jpg │ ├── displacement.jpg │ ├── displacement.txt │ └── normal.jpg ├── race-track │ ├── race-track.mtl │ └── race-track.obj └── sky │ └── CGSkies_0347_free.jpg ├── aframe-v0.4.0.min.js ├── aframe-v0.4.0.min.js.map ├── aframe.min.js ├── aframe.min.js.map ├── audio-play ├── README.md ├── audio │ └── duck-quack.mp3 ├── index.html ├── js │ └── demo.js ├── models │ ├── LICENSE.txt │ ├── rubber-duck.json │ ├── rubber-duck.mtl │ └── rubber-duck.obj └── screenshot.jpg ├── flickr-carousel ├── README.md ├── components │ ├── aframe-layout-component.min.js │ ├── aframe-look-at-component.min.js │ ├── flickr-search.js │ └── rotate-on-click.js ├── entities │ └── flickr-carousel.js ├── images │ └── sky_by_gawthrop.jpg ├── index.html └── js │ └── main.js ├── images ├── icon-master.xcf ├── icon192.png └── icon512.png ├── index.html ├── index.scss ├── kitchen ├── index.html └── scene-materials.js ├── link-to-copresence.html ├── manifest.json ├── racer ├── curve.js ├── icon192.png ├── icon512.png ├── index.html ├── manifest.json └── sw.js ├── scripts ├── init-service-worker.js ├── sw-toolbox.js └── sw-toolbox.map.json ├── speech ├── README.md ├── index.html └── js │ ├── aframe-bmfont-text-component.min.js │ ├── demo.js │ ├── svrbutton.js │ ├── svrbutton_helper.js │ └── svrtextarea.js └── super-standard.html /.eslintrc: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _site/ 2 | -------------------------------------------------------------------------------- /360-video/README.md: -------------------------------------------------------------------------------- 1 | # 360 Video Demo 2 | 3 | This demonstrates a 360 video playing in the background, with 3D models placed in the scene. You should see some 3D 4 | blocks on the pavement and a rubber duck bobbing up and down on the river! 5 | 6 | ![Screenshot](screenshot.jpg?raw=true) 7 | 8 | Thanks to [Diego Gonzalez](https://github.com/diekus) for the video, recorded in Paris with a Samsung Gear 360. 9 | 10 | Please note there is a current restriction on Chromium browsers on Android, that video [requires a user interaction before it can play](https://github.com/aframevr/aframe/issues/316). 11 | That's solved in this demo by having a prompt at the beginning. 12 | -------------------------------------------------------------------------------- /360-video/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: a-frame 3 | title: 360 Video 4 | description: Background 360 video demo 5 | author: Peter O'Shaughnessy 6 | scripts: [ 7 | '/a-frame-demos/aframe-v0.4.0.min.js' 8 | ] 9 | --- 10 | 39 | 40 | 41 | 42 | 43 | 47 | 48 | 49 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
63 |

360° video demo

64 |

Watch out for the duck!

65 | 66 |
67 | 68 | 69 | -------------------------------------------------------------------------------- /360-video/js/demo.js: -------------------------------------------------------------------------------- 1 | var sceneEl = document.getElementById('scene'); 2 | var videoEl = document.getElementById('video'); 3 | var introPrompt = document.getElementById('intro'); 4 | var startButton = document.getElementById('btn-start'); 5 | var sceneLoaded = false; 6 | 7 | scene.addEventListener('loaded', function() { 8 | startButton.innerText = 'Click to begin'; 9 | sceneLoaded = true; 10 | }); 11 | 12 | /** 13 | * NB. This gets around the Chromium Android restriction that video requires a user interaction to play. 14 | */ 15 | startButton.addEventListener('click', function() { 16 | if (sceneLoaded) { 17 | videoEl.play(); 18 | introPrompt.style.display = 'none'; 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /360-video/models/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Rubber duck model by Peter O'Shaughnessy (made using Clara.io). 2 | 3 | License: CC BY 4.0. 4 | https://creativecommons.org/licenses/by/4.0/ 5 | -------------------------------------------------------------------------------- /360-video/models/rubber-duck.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 3 3 | 4 | newmtl 0 5 | Ns 96.078431 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.000000 0.000000 0.000000 8 | Ks 0.001176 0.001176 0.001176 9 | Ni 1.000000 10 | d 1.000000 11 | illum 2 12 | 13 | newmtl e5740c 14 | Ns 96.078431 15 | Ka 0.000000 0.000000 0.000000 16 | Kd 0.898039 0.454902 0.047059 17 | Ks 0.001176 0.001176 0.001176 18 | Ni 1.000000 19 | d 1.000000 20 | illum 2 21 | 22 | newmtl e5ca3a 23 | Ns 96.078431 24 | Ka 0.000000 0.000000 0.000000 25 | Kd 0.898039 0.792157 0.227451 26 | Ks 0.001176 0.001176 0.001176 27 | Ni 1.000000 28 | d 1.000000 29 | illum 2 30 | -------------------------------------------------------------------------------- /360-video/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/360-video/screenshot.jpg -------------------------------------------------------------------------------- /360-video/videos/paris-by-diego.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/360-video/videos/paris-by-diego.mp4 -------------------------------------------------------------------------------- /360-video/videos/paris-by-diego.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/360-video/videos/paris-by-diego.ogg -------------------------------------------------------------------------------- /360-video/videos/paris-by-diego.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/360-video/videos/paris-by-diego.webm -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'github-pages', group: :jekyll_plugins 3 | gem 'jekyll-redirect-from' -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | RedCloth (4.2.9) 5 | activesupport (4.2.6) 6 | i18n (~> 0.7) 7 | json (~> 1.7, >= 1.7.7) 8 | minitest (~> 5.1) 9 | thread_safe (~> 0.3, >= 0.3.4) 10 | tzinfo (~> 1.1) 11 | addressable (2.4.0) 12 | coffee-script (2.4.1) 13 | coffee-script-source 14 | execjs 15 | coffee-script-source (1.10.0) 16 | colorator (0.1) 17 | ethon (0.8.1) 18 | ffi (>= 1.3.0) 19 | execjs (2.6.0) 20 | faraday (0.9.2) 21 | multipart-post (>= 1.2, < 3) 22 | ffi (1.9.10) 23 | gemoji (2.1.0) 24 | github-pages (68) 25 | RedCloth (= 4.2.9) 26 | github-pages-health-check (= 1.1.0) 27 | jekyll (= 3.0.3) 28 | jekyll-coffeescript (= 1.0.1) 29 | jekyll-feed (= 0.4.0) 30 | jekyll-gist (= 1.4.0) 31 | jekyll-github-metadata (= 1.10.0) 32 | jekyll-mentions (= 1.1.2) 33 | jekyll-paginate (= 1.1.0) 34 | jekyll-redirect-from (= 0.10.0) 35 | jekyll-sass-converter (= 1.3.0) 36 | jekyll-seo-tag (= 1.3.3) 37 | jekyll-sitemap (= 0.10.0) 38 | jekyll-textile-converter (= 0.1.0) 39 | jemoji (= 0.6.2) 40 | kramdown (= 1.10.0) 41 | liquid (= 3.0.6) 42 | mercenary (~> 0.3) 43 | rdiscount (= 2.1.8) 44 | redcarpet (= 3.3.3) 45 | rouge (= 1.10.1) 46 | terminal-table (~> 1.4) 47 | github-pages-health-check (1.1.0) 48 | addressable (~> 2.3) 49 | net-dns (~> 0.8) 50 | octokit (~> 4.0) 51 | public_suffix (~> 1.4) 52 | typhoeus (~> 0.7) 53 | html-pipeline (2.3.0) 54 | activesupport (>= 2, < 5) 55 | nokogiri (~> 1.8.1) 56 | i18n (0.7.0) 57 | jekyll (3.0.3) 58 | colorator (~> 0.1) 59 | jekyll-sass-converter (~> 1.0) 60 | jekyll-watch (~> 1.1) 61 | kramdown (~> 1.3) 62 | liquid (~> 3.0) 63 | mercenary (~> 0.3.3) 64 | rouge (~> 1.7) 65 | safe_yaml (~> 1.0) 66 | jekyll-coffeescript (1.0.1) 67 | coffee-script (~> 2.2) 68 | jekyll-feed (0.4.0) 69 | jekyll-gist (1.4.0) 70 | octokit (~> 4.2) 71 | jekyll-github-metadata (1.10.0) 72 | octokit (~> 4.0) 73 | jekyll-mentions (1.1.2) 74 | html-pipeline (~> 2.3) 75 | jekyll (~> 3.0) 76 | jekyll-paginate (1.1.0) 77 | jekyll-redirect-from (0.10.0) 78 | jekyll (>= 2.0) 79 | jekyll-sass-converter (1.3.0) 80 | sass (~> 3.2) 81 | jekyll-seo-tag (1.3.3) 82 | jekyll (~> 3.0) 83 | jekyll-sitemap (0.10.0) 84 | jekyll-textile-converter (0.1.0) 85 | RedCloth (~> 4.0) 86 | jekyll-watch (1.3.1) 87 | listen (~> 3.0) 88 | jemoji (0.6.2) 89 | gemoji (~> 2.0) 90 | html-pipeline (~> 2.2) 91 | jekyll (>= 3.0) 92 | json (1.8.3) 93 | kramdown (1.10.0) 94 | liquid (3.0.6) 95 | listen (3.0.6) 96 | rb-fsevent (>= 0.9.3) 97 | rb-inotify (>= 0.9.7) 98 | mercenary (0.3.5) 99 | mini_portile2 (2.0.0) 100 | minitest (5.8.4) 101 | multipart-post (2.0.0) 102 | net-dns (0.8.0) 103 | nokogiri (~> 1.8.1) 104 | mini_portile2 (~> 2.0.0.rc2) 105 | octokit (4.3.0) 106 | sawyer (~> 0.7.0, >= 0.5.3) 107 | public_suffix (1.5.3) 108 | rb-fsevent (0.9.7) 109 | rb-inotify (0.9.7) 110 | ffi (>= 0.5.0) 111 | rdiscount (2.1.8) 112 | redcarpet (3.3.3) 113 | rouge (1.10.1) 114 | safe_yaml (1.0.4) 115 | sass (3.4.22) 116 | sawyer (0.7.0) 117 | addressable (>= 2.3.5, < 2.5) 118 | faraday (~> 0.8, < 0.10) 119 | terminal-table (1.5.2) 120 | thread_safe (0.3.5) 121 | typhoeus (0.8.0) 122 | ethon (>= 0.8.0) 123 | tzinfo (1.2.2) 124 | thread_safe (~> 0.1) 125 | 126 | PLATFORMS 127 | ruby 128 | 129 | DEPENDENCIES 130 | github-pages 131 | jekyll-redirect-from 132 | 133 | BUNDLED WITH 134 | 1.12.5 135 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Copyright 2017 Samsung Electronics Co., Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Samsung Internet A-Frame Demos 2 | 3 | ## Set up 4 | 5 | The demos are collected together as a Jekyll site. To get it up and running... 6 | 7 | ### Linux 8 | 9 | ```bash 10 | sudo apt-get install bundler zlib1g-dev libxml2-dev nodejs 11 | bundle install 12 | bundle exec jekyll serve 13 | ``` 14 | 15 | ### Mac 16 | 17 | ```bash 18 | gem install bundler 19 | bundle install 20 | jekyll serve 21 | ``` 22 | 23 | If you get an error "Failed to build gem native extension", you may need to set the bundler 24 | to install under a different path and use this instead. See: [github.com/bundler/bundler/issues/4065](https://github.com/bundler/bundler/issues/4065) 25 | 26 | 27 | ### Windows 28 | 29 | *Instructions coming soon* 30 | 31 | Then you can view the site at the URL shown in the console (http://127.0.0.1:4000/a-frame-demos/). 32 | 33 | ## Net Magazine tutorial 34 | 35 | If you are here for our Net Magazine Flickr carousel tutorial, you can find the code under 36 | [flickr-carousel](flickr-carousel), or for a standalone version outside of the Jekyll site, see: 37 | [github.com/poshaughnessy/aframe-flickr-carousel/](https://github.com/poshaughnessy/aframe-flickr-carousel/). 38 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | gems: 2 | - jekyll-redirect-from 3 | 4 | siteurl: https://samsunginternet.github.io 5 | baseurl: /a-frame-demos -------------------------------------------------------------------------------- /_layouts/a-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {% if page.meta %} 9 | 10 | 11 | 12 | {% endif %} 13 | 14 | {{ page.title }} 15 | {% if page.image %} 16 | 17 | 18 | {% else %} 19 | 20 | {% endif %} 21 | 22 | 23 | {% if page.title %} 24 | 25 | {% else %} 26 | 27 | {% endif %} 28 | {% if page.description %} 29 | 30 | {% else %} 31 | 32 | {% endif %} 33 | 34 | {% if page.script %} 35 | 36 | {% endif %} 37 | {% if page.scripts %} 38 | {% for item in page.scripts %} 39 | 40 | {% endfor %} 41 | {% endif %} 42 | 43 | 44 | {{ content }} 45 | 46 | 47 | -------------------------------------------------------------------------------- /_layouts/store.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{ page.title }} 13 | {% if page.image %} 14 | 15 | 16 | {% else %} 17 | 18 | {% endif %} 19 | 20 | 21 | {% if page.title %} 22 | 23 | {% else %} 24 | 25 | {% endif %} 26 | {% if page.description %} 27 | 28 | {% else %} 29 | 30 | {% endif %} 31 | 32 | {% if page.script %} 33 | 34 | {% endif %} 35 | {% if page.scripts %} 36 | {% for item in page.scripts %} 37 | 38 | {% endfor %} 39 | {% endif %} 40 | 41 | 42 | {{ content }} 43 | 44 | 45 | -------------------------------------------------------------------------------- /a-frame-assets/360-photos/SAM_100_0042_SMALL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/360-photos/SAM_100_0042_SMALL.jpg -------------------------------------------------------------------------------- /a-frame-assets/360-photos/SAM_100_0046_SMALL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/360-photos/SAM_100_0046_SMALL.jpg -------------------------------------------------------------------------------- /a-frame-assets/360-photos/SAM_100_0063_SMALL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/360-photos/SAM_100_0063_SMALL.jpg -------------------------------------------------------------------------------- /a-frame-assets/Feisar_Ship_OBJ/Feisar_Ship.mtl: -------------------------------------------------------------------------------- 1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware 2 | # File Created: 14.03.2011 16:38:47 3 | 4 | newmtl orig_default 5 | Ns 10.0000 6 | Ni 1.5000 7 | d 1.0000 8 | Tr 1.0000 9 | Tf 1.0000 1.0000 1.0000 10 | illum 2 11 | Ka 0.0000 0.0000 0.0000 12 | Kd 0.5880 0.5880 0.5880 13 | Ks 0.0000 0.0000 0.0000 14 | Ke 0.0000 0.0000 0.0000 15 | map_Ka maps\diffuse.jpg 16 | map_Kd maps\diffuse.jpg 17 | map_Ks maps\specular.jpg 18 | -------------------------------------------------------------------------------- /a-frame-assets/Feisar_Ship_OBJ/maps/diffuse.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/Feisar_Ship_OBJ/maps/diffuse.bmp -------------------------------------------------------------------------------- /a-frame-assets/Feisar_Ship_OBJ/maps/diffuse.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/Feisar_Ship_OBJ/maps/diffuse.jpg -------------------------------------------------------------------------------- /a-frame-assets/Feisar_Ship_OBJ/maps/diffuse_green.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/Feisar_Ship_OBJ/maps/diffuse_green.jpg -------------------------------------------------------------------------------- /a-frame-assets/Feisar_Ship_OBJ/maps/diffuse_red.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/Feisar_Ship_OBJ/maps/diffuse_red.jpg -------------------------------------------------------------------------------- /a-frame-assets/Feisar_Ship_OBJ/maps/normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/Feisar_Ship_OBJ/maps/normal.jpg -------------------------------------------------------------------------------- /a-frame-assets/Feisar_Ship_OBJ/maps/specular.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/Feisar_Ship_OBJ/maps/specular.bmp -------------------------------------------------------------------------------- /a-frame-assets/Feisar_Ship_OBJ/maps/specular.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/Feisar_Ship_OBJ/maps/specular.jpg -------------------------------------------------------------------------------- /a-frame-assets/components/clone.js: -------------------------------------------------------------------------------- 1 | AFRAME.registerComponent('clone', { 2 | schema: { 3 | type: 'selector' 4 | }, 5 | 6 | init: function () { 7 | var cloneGeom = this.data.object3D.clone(true); 8 | cloneGeom.visible = true; 9 | this.el.setObject3D('clone', cloneGeom); 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /a-frame-assets/components/curve.js: -------------------------------------------------------------------------------- 1 | 2 | /* Follows an object around (don't need to be in same space) */ 3 | 4 | var __tempVector1 = new THREE.Vector3(); 5 | var __tempVector2 = new THREE.Vector3(); 6 | var up = new THREE.Vector3(0, 1, 0); 7 | var zAxis = new THREE.Vector3(0, 0, 1); 8 | var degToRad = THREE.Math.degToRad; 9 | 10 | AFRAME.registerComponent('curve-point', { 11 | 12 | dependencies: ['position'], 13 | 14 | schema: { 15 | position: {type: 'vec3', default: '0 0 0'} 16 | }, 17 | 18 | init: function () { 19 | var el = this.el; 20 | while (el && !el.components.curve) el = el.parentNode; 21 | this.parentCurve = el; 22 | }, 23 | 24 | update: function () { 25 | this.el.object3D.position.copy(this.data.position); 26 | this.parentCurve.updateComponent('curve'); 27 | }, 28 | 29 | remove: function () { 30 | this.update(); 31 | } 32 | 33 | }); 34 | 35 | AFRAME.registerComponent('curve', { 36 | 37 | schema: { 38 | 39 | // CatmullRom 40 | // Spline 41 | // CubicBezier 42 | // QuadraticBezier 43 | // Line 44 | default: 'CatmullRom' 45 | }, 46 | 47 | update: function () { 48 | this.needsUpdate = true; 49 | }, 50 | 51 | tick: function () { 52 | if (!this.needsUpdate) return; 53 | this.needsUpdate = false; 54 | this.threeConstructor = THREE[this.data + 'Curve3']; 55 | 56 | var points = Array.from(this.el.querySelectorAll('a-curve-point')).filter(function (a) { return a.tagName === 'A-CURVE-POINT' }); 57 | 58 | if (points.length <= 1) return; 59 | 60 | this.points = points.map(function (a) { 61 | if (a.x !== undefined && a.y !== undefined && a.z !== undefined) { 62 | return a; 63 | } 64 | return a.object3D.getWorldPosition() 65 | }); 66 | 67 | // apply the points as ags to the Beziers 68 | if (this.data.match(/QuadraticBezier|CubicBezier|Line/)) { 69 | this.curve = (Function.prototype.bind.apply(this.threeConstructor, this.points)); 70 | } else { 71 | if (!this.threeConstructor) { 72 | this.pause(); 73 | throw ('No Three constructor of type (case sensitive): ' + this.data + 'Curve3'); 74 | } 75 | this.curve = new this.threeConstructor(this.points); 76 | } 77 | 78 | this.el.emit('curve-updated'); 79 | 80 | this.el.setObject3D('curve', this.curve); 81 | this.ready = true; 82 | }, 83 | 84 | remove: function () { 85 | this.curve = null; 86 | this.points = null; 87 | this.ready = false; 88 | this.el.removeObject3D('curve'); 89 | }, 90 | 91 | closestPointInLocalSpace: function closestPoint(point, resolution, testPoint, currentRes) { 92 | if (!this.ready) throw Error('Curve not instantiated yet.'); 93 | resolution = resolution || 0.1 / this.curve.getLength(); 94 | currentRes = currentRes || 0.5; 95 | testPoint = testPoint || 0.5; 96 | currentRes /= 2; 97 | var aTest = testPoint + currentRes; 98 | var bTest = testPoint - currentRes; 99 | var a = this.curve.getPointAt(aTest); 100 | var b = this.curve.getPointAt(bTest); 101 | var aDistance = a.distanceTo(point); 102 | var bDistance = b.distanceTo(point); 103 | var aSmaller = aDistance < bDistance; 104 | if (currentRes < resolution) { 105 | 106 | var tangent = this.curve.getTangentAt(aSmaller ? aTest : bTest); 107 | if (currentRes < resolution) return { 108 | result: aSmaller ? aTest : bTest, 109 | location: aSmaller ? a : b, 110 | distance: aSmaller ? aDistance : bDistance, 111 | normal: normalFromTangent(tangent), 112 | tangent: tangent 113 | }; 114 | } 115 | if (aDistance < bDistance) { 116 | return this.closestPointInLocalSpace(point, resolution, aTest, currentRes); 117 | } else { 118 | return this.closestPointInLocalSpace(point, resolution, bTest, currentRes); 119 | } 120 | } 121 | }); 122 | 123 | 124 | var tempQuaternion = new THREE.Quaternion(); 125 | function normalFromTangent(tangent) { 126 | var lineEnd = new THREE.Vector3(0, 1, 0); 127 | tempQuaternion.setFromUnitVectors(zAxis, tangent); 128 | lineEnd.applyQuaternion(tempQuaternion); 129 | return lineEnd; 130 | } 131 | 132 | AFRAME.registerShader('line', { 133 | schema: {}, 134 | 135 | init: function (data) { 136 | this.material = new THREE.LineBasicMaterial(data); 137 | } 138 | }); 139 | 140 | AFRAME.registerComponent('draw-curve', { 141 | 142 | dependencies: ['curve', 'material '], 143 | 144 | schema: { 145 | curve: { type: 'selector' }, 146 | spacing: { default: 1 }, 147 | tangent: { default: false }, 148 | normal: { default: true } 149 | }, 150 | 151 | init: function () { 152 | this.data.curve.addEventListener('curve-updated', this.update.bind(this)); 153 | }, 154 | 155 | update: function () { 156 | if (this.data.curve) { 157 | this.curve = this.data.curve.components.curve; 158 | } else if (this.components.curve.curve) { 159 | this.curve = this.components.curve; 160 | } 161 | 162 | if (this.curve.curve) { 163 | 164 | var length = this.curve.curve.getLength(); 165 | var start = 0; 166 | var end = length; 167 | 168 | var counter = start 169 | var tangent; 170 | var line; 171 | var lineEnd; 172 | var tangentGeometry; 173 | var normalGeometry; 174 | var mesh = this.el.getOrCreateObject3D('mesh', THREE.Line); 175 | var geometry = mesh.geometry = new THREE.Geometry(); 176 | 177 | while (counter < end) { 178 | var p = this.curve.curve.getPointAt(counter / length); 179 | geometry.vertices.push(p); 180 | 181 | if (this.data.tangent) { 182 | tangentGeometry = new THREE.Geometry(); 183 | 184 | lineEnd = new THREE.Vector3(); 185 | lineEnd.copy(p); 186 | lineEnd.add(this.curve.curve.getTangentAt(counter / length).normalize().multiplyScalar(5)); 187 | 188 | tangentGeometry.vertices.push(new THREE.Vector3().copy(p)); 189 | tangentGeometry.vertices.push(lineEnd); 190 | 191 | line = new THREE.Line( 192 | tangentGeometry, 193 | new THREE.LineBasicMaterial({ 194 | color: 'green' 195 | }) 196 | ); 197 | 198 | mesh.add(line); 199 | } 200 | 201 | if (this.data.normal) { 202 | normalGeometry = new THREE.Geometry(); 203 | lineEnd = normalFromTangent(this.curve.curve.getTangentAt(counter / length).normalize()); 204 | lineEnd.add(p); 205 | 206 | normalGeometry.vertices.push(new THREE.Vector3().copy(p)); 207 | normalGeometry.vertices.push(lineEnd); 208 | 209 | line = new THREE.Line( 210 | normalGeometry, 211 | new THREE.LineBasicMaterial({ 212 | color: 'white' 213 | }) 214 | ); 215 | 216 | mesh.add(line); 217 | } 218 | 219 | counter += this.data.spacing; 220 | } 221 | } 222 | }, 223 | 224 | remove: function () { 225 | 226 | this.el.getObject3D('mesh').geometry = new THREE.Geometry(); 227 | } 228 | 229 | }); 230 | 231 | AFRAME.registerComponent('clone-along-curve', { 232 | 233 | dependencies: ['curve'], 234 | 235 | schema: { 236 | curve: { type: 'selector' }, 237 | spacing: { default: 1 }, 238 | rotation: { 239 | type: 'vec3', 240 | default: '0 0 0' 241 | }, 242 | scale: { 243 | type: 'vec3', 244 | default: '1 1 1' 245 | } 246 | }, 247 | 248 | init: function () { 249 | this.el.addEventListener('model-loaded', this.update.bind(this)); 250 | this.data.curve.addEventListener('curve-updated', this.update.bind(this)); 251 | }, 252 | 253 | update: function () { 254 | this.remove(); 255 | if (this.data.curve) { 256 | this.curve = this.data.curve.components.curve; 257 | } else if (this.components.curve.curve) { 258 | this.curve = this.components.curve; 259 | } 260 | }, 261 | 262 | tick: function () { 263 | if (!this.el.getObject3D('clones') && this.curve) { 264 | 265 | var mesh = this.el.getObject3D('mesh'); 266 | 267 | 268 | var length = this.curve.curve.getLength(); 269 | var start = 0; 270 | var end = length; 271 | var counter = start; 272 | 273 | var cloneMesh = this.el.getOrCreateObject3D('clones', THREE.Group); 274 | 275 | var parent = new THREE.Object3D(); 276 | mesh.scale.set(this.data.scale.x, this.data.scale.y, this.data.scale.z); 277 | mesh.rotation.set(degToRad(this.data.rotation.x), degToRad(this.data.rotation.y), degToRad(this.data.rotation.z)); 278 | mesh.rotation.order = 'YXZ'; 279 | 280 | parent.add(mesh); 281 | 282 | while (counter < end) { 283 | 284 | var child = parent.clone(true); 285 | 286 | child.position.copy( this.curve.curve.getPointAt(counter/length) ); 287 | 288 | tangent = this.curve.curve.getTangentAt(counter/length).normalize(); 289 | 290 | child.quaternion.setFromUnitVectors(zAxis, tangent); 291 | 292 | cloneMesh.add(child); 293 | 294 | counter += this.data.spacing; 295 | } 296 | } 297 | }, 298 | 299 | remove: function () { 300 | this.curve = null; 301 | this.el.removeObject3D('clones'); 302 | } 303 | 304 | }); 305 | 306 | AFRAME.registerPrimitive('a-draw-curve', { 307 | defaultComponents: { 308 | 'draw-curve': {}, 309 | 'material': {} 310 | }, 311 | mappings: { 312 | curve: 'draw-curve.curve', 313 | material: 'material' 314 | } 315 | }); 316 | 317 | AFRAME.registerPrimitive('a-curve-point', { 318 | defaultComponents: { 319 | 'curve-point': { 320 | position: '0 0 0' 321 | } 322 | }, 323 | mappings: { 324 | position: 'curve-point.position' 325 | } 326 | }); 327 | 328 | 329 | AFRAME.registerPrimitive('a-curve', { 330 | 331 | defaultComponents: { 332 | 'curve': {} 333 | }, 334 | 335 | mappings: { 336 | curve: 'curve', 337 | } 338 | 339 | }); 340 | -------------------------------------------------------------------------------- /a-frame-assets/components/ship-controller.js: -------------------------------------------------------------------------------- 1 | // Based on https://github.com/aframevr/aframe/blob/master/src/components/wasd-controls.js 2 | // it controls the ship with wasd, head tilting and mouse clicks 3 | 4 | var shouldCaptureKeyEvent = AFRAME.utils.shouldCaptureKeyEvent; 5 | 6 | var MAX_DELTA = 0.2; 7 | 8 | /** 9 | * WASD component to control entities using WASD keys. 10 | */ 11 | AFRAME.registerComponent('ship-controller', { 12 | schema: { 13 | easing: { default: 10 }, 14 | rollEasing: { default: 1 }, 15 | acceleration: { default: 250 }, 16 | rollAcceleration: { default: 50 }, 17 | rollTarget: { type: 'selector' }, 18 | turnTarget: { type: 'selector' }, 19 | }, 20 | 21 | init: function () { 22 | this.velocity = new THREE.Vector3(); 23 | // To keep track of the pressed keys 24 | this.keys = {}; 25 | this.onBlur = this.onBlur.bind(this); 26 | this.onFocus = this.onFocus.bind(this); 27 | this.onVisibilityChange = this.onVisibilityChange.bind(this); 28 | this.onKeyDown = this.onKeyDown.bind(this); 29 | this.onKeyUp = this.onKeyUp.bind(this); 30 | this.attachVisibilityEventListeners(); 31 | this.roll = 0; 32 | }, 33 | 34 | update: function (previousData) { 35 | 36 | var data = this.data; 37 | var acceleration = data.acceleration; 38 | var easing = data.easing; 39 | var velocity = this.velocity; 40 | var prevTime = this.prevTime = this.prevTime || Date.now(); 41 | var time = window.performance.now(); 42 | var delta = (time - prevTime) / 1000; 43 | this.prevTime = time; 44 | var keys = this.keys; 45 | var movementVector; 46 | var el = this.el; 47 | 48 | // If data changed or FPS too low, reset velocity. 49 | if (previousData || delta > MAX_DELTA) { 50 | velocity.x = 0; 51 | velocity.z = 0; 52 | return; 53 | } 54 | 55 | var position = el.getAttribute('position'); 56 | var rotation = (this.data.turnTarget || el).getAttribute('rotation'); 57 | 58 | this.roll -= this.el.sceneEl.camera.el.getAttribute('rotation').z * (Math.PI/180) * delta * this.data.rollAcceleration; 59 | rotation.y += this.roll * this.data.rollEasing * delta * -velocity.z * 0.1; 60 | this.roll -= this.roll * this.data.rollEasing * delta; 61 | velocity.x -= velocity.x * easing * delta; 62 | velocity.z -= velocity.z * easing * delta; 63 | 64 | if (this.data.rollTarget) { 65 | var rollTargetRotation = this.data.rollTarget.getAttribute('rotation'); 66 | rollTargetRotation.z = this.roll; 67 | this.data.rollTarget.setAttribute('rotation', rollTargetRotation); 68 | } else { 69 | rotation.z = this.roll; 70 | } 71 | 72 | if (keys[65] || keys[37]) { this.roll -= this.data.rollAcceleration * delta; } // Left 73 | if (keys[68] || keys[39]) { this.roll += this.data.rollAcceleration * delta; } // Right 74 | if (keys[87] || keys[38] || keys['touch']) { velocity.z += acceleration * delta; } // Up 75 | if (keys[83] || keys[40]) { velocity.z -= acceleration * delta; } // Down 76 | 77 | movementVector = this.getMovementVector(delta); 78 | el.object3D.translateX(movementVector.x); 79 | el.object3D.translateY(movementVector.y); 80 | el.object3D.translateZ(movementVector.z); 81 | 82 | el.setAttribute('position', { 83 | x: position.x + movementVector.x, 84 | y: position.y + movementVector.y, 85 | z: position.z + movementVector.z 86 | }); 87 | 88 | (this.data.turnTarget || el).setAttribute('rotation', rotation); 89 | }, 90 | 91 | play: function () { 92 | this.attachKeyEventListeners(); 93 | }, 94 | 95 | pause: function () { 96 | this.keys = {}; 97 | this.removeKeyEventListeners(); 98 | }, 99 | 100 | tick: function (t) { 101 | this.update(); 102 | }, 103 | 104 | remove: function () { 105 | this.pause(); 106 | this.removeVisibilityEventListeners(); 107 | }, 108 | 109 | attachVisibilityEventListeners: function () { 110 | window.addEventListener('blur', this.onBlur); 111 | window.addEventListener('focus', this.onFocus); 112 | document.addEventListener('visibilitychange', this.onVisibilityChange); 113 | }, 114 | 115 | removeVisibilityEventListeners: function () { 116 | window.removeEventListener('blur', this.onBlur); 117 | window.removeEventListener('focus', this.onFocus); 118 | document.removeEventListener('visibilitychange', this.onVisibilityChange); 119 | }, 120 | 121 | attachKeyEventListeners: function () { 122 | window.addEventListener('keydown', this.onKeyDown); 123 | window.addEventListener('keyup', this.onKeyUp); 124 | 125 | this.el.sceneEl.addEventListener("touchstart", this.handleTouchStart.bind(this), false); 126 | this.el.sceneEl.addEventListener("touchend", this.handleTouchEnd.bind(this), false); 127 | this.el.sceneEl.addEventListener("touchcancel", this.handleTouchCancel.bind(this), false); 128 | 129 | this.el.sceneEl.addEventListener("mousedown", this.handleTouchStart.bind(this), false); 130 | this.el.sceneEl.addEventListener("mouseup", this.handleTouchEnd.bind(this), false); 131 | this.el.sceneEl.addEventListener("mouseleave", this.handleTouchCancel.bind(this), false); 132 | }, 133 | 134 | removeKeyEventListeners: function () { 135 | window.removeEventListener('keydown', this.onKeyDown); 136 | window.removeEventListener('keyup', this.onKeyUp); 137 | 138 | this.el.sceneEl.addEventListener("touchstart", this.handleTouchStart.bind(this), false); 139 | this.el.sceneEl.addEventListener("touchend", this.handleTouchEnd.bind(this), false); 140 | this.el.sceneEl.addEventListener("touchcancel", this.handleTouchCancel.bind(this), false); 141 | 142 | this.el.sceneEl.addEventListener("mousedown", this.handleTouchStart.bind(this), false); 143 | this.el.sceneEl.addEventListener("mouseup", this.handleTouchEnd.bind(this), false); 144 | this.el.sceneEl.addEventListener("mouseleave", this.handleTouchCancel.bind(this), false); 145 | }, 146 | 147 | onBlur: function () { 148 | this.pause(); 149 | }, 150 | 151 | onFocus: function () { 152 | this.play(); 153 | }, 154 | 155 | onVisibilityChange: function () { 156 | if (document.hidden) { 157 | this.onBlur(); 158 | } else { 159 | this.onFocus(); 160 | } 161 | }, 162 | 163 | onKeyDown: function (event) { 164 | if (!shouldCaptureKeyEvent(event)) { return; } 165 | this.keys[event.keyCode] = true; 166 | }, 167 | 168 | onKeyUp: function (event) { 169 | if (!shouldCaptureKeyEvent(event)) { return; } 170 | this.keys[event.keyCode] = false; 171 | }, 172 | 173 | handleTouchStart: function (e) { 174 | if (e.target.tagName !== "BUTTON") { 175 | e.preventDefault(); 176 | this.keys['touch'] = true; 177 | } 178 | }, 179 | 180 | handleTouchCancel: function (e) { 181 | if (e.target.tagName !== "BUTTON") { 182 | e.preventDefault(); 183 | this.keys['touch'] = false; 184 | } 185 | }, 186 | 187 | handleTouchEnd: function (e) { 188 | if (e.target.tagName !== "BUTTON") { 189 | e.preventDefault(); 190 | this.keys['touch'] = false; 191 | } 192 | }, 193 | 194 | getMovementVector: (function (delta) { 195 | var direction = new THREE.Vector3(0, 0, 0); 196 | var rotation = new THREE.Euler(0, 0, 0, 'YXZ'); 197 | return function (delta) { 198 | var velocity = this.velocity; 199 | var elRotation = (this.data.turnTarget || el).getAttribute('rotation'); 200 | direction.copy(velocity); 201 | direction.multiplyScalar(delta); 202 | if (!elRotation) { return direction; } 203 | if (!this.data.fly) { elRotation.x = 0; } 204 | rotation.set(THREE.Math.degToRad(elRotation.x), THREE.Math.degToRad(elRotation.y), 0); 205 | direction.applyEuler(rotation); 206 | return direction; 207 | }; 208 | })() 209 | }); 210 | -------------------------------------------------------------------------------- /a-frame-assets/hand/hand-fist.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.74 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib hand.mtl 4 | o Box2 5 | v -0.462384 -0.193406 0.496106 6 | v -0.500000 -0.193406 0.000000 7 | v -0.500032 -0.219335 -0.444314 8 | v -0.462384 0.140650 0.496106 9 | v -0.500000 0.193406 0.000000 10 | v -0.499995 0.119962 -0.500802 11 | v 0.499968 -0.219366 -0.444251 12 | v 0.380472 -0.237947 0.102896 13 | v 0.380472 -0.237947 0.605270 14 | v 0.499993 0.014055 -0.500472 15 | v 0.697704 -0.101512 0.073157 16 | v 0.692185 -0.137057 0.605270 17 | v 0.249968 -0.219358 -0.444267 18 | v -0.000032 -0.219351 -0.444283 19 | v -0.250032 -0.219343 -0.444298 20 | v 0.250000 -0.193406 0.000000 21 | v -0.000000 -0.193406 0.000000 22 | v -0.250000 -0.193406 0.000000 23 | v 0.250000 -0.193406 0.605270 24 | v -0.000000 -0.193406 0.605270 25 | v -0.250000 -0.193406 0.605270 26 | v 0.250000 0.255930 0.605270 27 | v 0.000000 0.255930 0.605270 28 | v -0.250000 0.255930 0.605270 29 | v 0.250000 0.193406 0.000000 30 | v -0.048640 0.193406 0.000000 31 | v -0.250000 0.193406 0.000000 32 | v 0.250005 0.119939 -0.500756 33 | v 0.000005 0.119947 -0.500771 34 | v -0.249995 0.119954 -0.500787 35 | v 0.873701 -0.378212 -0.096301 36 | v 0.641381 -0.520833 -0.096301 37 | v 0.830105 -0.290021 0.290179 38 | v 0.518391 -0.390910 0.290179 39 | v -0.488441 -0.277005 -0.681003 40 | v -0.488474 -0.296526 -0.457269 41 | v -0.261500 -0.276864 -0.681086 42 | v -0.261534 -0.296386 -0.457352 43 | v -0.217529 -0.296387 -0.457350 44 | v -0.217493 -0.257525 -0.693909 45 | v 0.008625 -0.257532 -0.693894 46 | v 0.008589 -0.296394 -0.457336 47 | v 0.031173 -0.296395 -0.457334 48 | v 0.031209 -0.257533 -0.693893 49 | v 0.281209 -0.257541 -0.693877 50 | v 0.281173 -0.296403 -0.457318 51 | v 0.310894 -0.296404 -0.457317 52 | v 0.310930 -0.257542 -0.693875 53 | v 0.560930 -0.257549 -0.693860 54 | v 0.560894 -0.296411 -0.457301 55 | v 0.760609 -0.332053 -0.266260 56 | v 0.554157 -0.424392 -0.323857 57 | v 0.898154 -0.492129 -0.398803 58 | v 0.728432 -0.606093 -0.398803 59 | v -0.462285 -0.458577 -0.329791 60 | v -0.462262 -0.557434 -0.439543 61 | v -0.271321 -0.557440 -0.439531 62 | v -0.271343 -0.458583 -0.329779 63 | v -0.191751 -0.498870 -0.398654 64 | v -0.191729 -0.597727 -0.508406 65 | v -0.000787 -0.597733 -0.508394 66 | v -0.000810 -0.498876 -0.398642 67 | v 0.055814 -0.516013 -0.427938 68 | v 0.055837 -0.614870 -0.537689 69 | v 0.268859 -0.614877 -0.537676 70 | v 0.268836 -0.516020 -0.427924 71 | v 0.360190 -0.486374 -0.377224 72 | v 0.360213 -0.585231 -0.486976 73 | v 0.545499 -0.585237 -0.486964 74 | v 0.545476 -0.486380 -0.377212 75 | v 0.515328 -0.445719 -0.611389 76 | v 0.709177 -0.353619 -0.611389 77 | v 0.840373 -0.485598 -0.693974 78 | v 0.627559 -0.612972 -0.627100 79 | v 0.213673 0.193406 0.802813 80 | v 0.213673 -0.193406 0.802813 81 | v -0.036327 0.193406 0.802813 82 | v -0.036327 -0.193406 0.802813 83 | v -0.286327 0.193406 0.802813 84 | v -0.286327 -0.193406 0.802813 85 | v -0.433631 0.140650 0.794558 86 | v -0.433631 -0.193406 0.794558 87 | vt 0.000000 1.000000 88 | vt 0.000000 0.000000 89 | vt 0.500000 0.000000 90 | vt 0.500000 1.000000 91 | vt 1.000000 0.000000 92 | vt 1.000000 1.000000 93 | vt 0.000000 0.500000 94 | vt 0.250000 0.500000 95 | vt 0.250000 1.000000 96 | vt 0.500000 0.500000 97 | vt 0.750000 0.500000 98 | vt 0.750000 1.000000 99 | vt 1.000000 0.500000 100 | vt 0.250000 0.000000 101 | vt 0.750000 0.000000 102 | vn -0.997100 0.000000 0.075600 103 | vn -0.999300 0.000100 0.037300 104 | vn -0.999300 0.000000 0.038500 105 | vn -0.999900 -0.005500 -0.016200 106 | vn -0.999900 -0.010000 -0.009300 107 | vn 0.993200 -0.097300 0.064700 108 | vn 0.991500 -0.071600 0.108900 109 | vn 0.958400 -0.280400 -0.052800 110 | vn 0.959500 -0.281000 0.018900 111 | vn 0.875700 -0.342500 0.340200 112 | vn 0.849600 -0.303100 0.431700 113 | vn 0.772500 -0.302000 0.558600 114 | vn 0.745400 -0.282500 0.603800 115 | vn 0.228300 -0.967000 -0.113400 116 | vn 0.167600 -0.967600 -0.188700 117 | vn 0.086300 -0.996100 -0.016200 118 | vn 0.214800 -0.962800 -0.163700 119 | vn 0.141800 -0.986700 -0.079400 120 | vn -0.000000 -0.999600 -0.028200 121 | vn 0.159900 -0.969800 -0.184300 122 | vn 0.048100 -0.993500 -0.102900 123 | vn 0.164600 -0.968600 -0.186400 124 | vn -0.065600 -0.989000 -0.132700 125 | vn -0.000000 -0.999600 -0.029000 126 | vn 0.067700 -0.985900 -0.152800 127 | vn 0.334200 -0.935200 -0.117500 128 | vn 0.097600 -0.995200 0.000000 129 | vn 0.000000 -1.000000 0.000000 130 | vn -0.345200 0.938500 -0.008800 131 | vn -0.354800 0.915000 -0.192000 132 | vn -0.138900 0.990100 -0.019400 133 | vn -0.068300 0.996100 -0.055800 134 | vn 0.000100 1.000000 0.002100 135 | vn -0.000000 0.997800 -0.066900 136 | vn 0.002300 1.000000 0.001600 137 | vn -0.015300 0.999400 -0.030300 138 | vn -0.023600 0.999400 -0.024600 139 | vn -0.024300 0.992100 0.122800 140 | vn -0.298400 0.945400 -0.131000 141 | vn -0.157300 0.983600 -0.088400 142 | vn -0.000000 0.998000 -0.062500 143 | vn 0.001600 0.997400 -0.072300 144 | vn -0.000100 0.999500 -0.032600 145 | vn 0.000000 0.000000 1.000000 146 | vn -0.233300 0.047500 0.971300 147 | vn -0.235200 -0.000000 0.972000 148 | vn -0.455000 0.041400 0.889500 149 | vn -0.457100 0.000000 0.889400 150 | vn 0.000100 0.315600 -0.948900 151 | vn 0.000000 0.315600 -0.948900 152 | vn -0.431900 0.048000 -0.900600 153 | vn -0.432500 0.113600 -0.894400 154 | vn -0.441200 0.093100 -0.892500 155 | vn -0.418100 0.046200 -0.907200 156 | vn -0.289200 0.939300 0.184700 157 | vn -0.382300 0.924000 0.001800 158 | vn 0.764600 -0.292700 0.574300 159 | vn 0.814500 -0.343400 0.467600 160 | vn 0.153600 -0.938300 -0.309900 161 | vn 0.325500 -0.930900 -0.165500 162 | vn -0.998700 -0.025700 -0.045100 163 | vn -0.998300 -0.035100 -0.047100 164 | vn 0.015000 0.999100 0.039900 165 | vn -0.016300 0.998800 0.045700 166 | vn 0.999600 -0.016100 -0.022800 167 | vn 0.999600 -0.014600 -0.023300 168 | vn 0.999600 -0.017000 -0.024400 169 | vn 0.999600 -0.016100 -0.022500 170 | vn 0.062000 -0.996200 0.061300 171 | vn -0.022600 -0.997200 0.070600 172 | vn -0.997200 -0.039600 -0.063700 173 | vn -0.996900 -0.045900 -0.064300 174 | vn -0.997600 -0.043900 -0.052800 175 | vn -0.996700 -0.043300 -0.069100 176 | vn -0.010300 0.997900 0.063300 177 | vn -0.002800 0.999800 0.020700 178 | vn -0.011100 0.999000 0.043700 179 | vn -0.041300 0.997400 0.059100 180 | vn 0.999800 0.014400 0.015100 181 | vn 0.999800 0.012400 0.016900 182 | vn 1.000000 -0.002600 -0.003200 183 | vn 1.000000 -0.001200 -0.005000 184 | vn 0.063500 -0.996400 -0.055800 185 | vn -0.021400 -0.999500 -0.023600 186 | vn -0.997400 -0.038100 -0.061300 187 | vn -0.997100 -0.044100 -0.061700 188 | vn -0.997900 -0.041100 -0.049500 189 | vn -0.996900 -0.040400 -0.066800 190 | vn -0.009900 0.997900 0.063300 191 | vn -0.009900 0.999700 0.020700 192 | vn -0.038600 0.998200 0.045000 193 | vn -0.038400 0.997200 0.063500 194 | vn 0.997200 0.051200 0.053700 195 | vn 0.996900 0.046600 0.062600 196 | vn 0.999800 0.011500 0.018300 197 | vn 0.999900 0.009800 0.009500 198 | vn 0.057200 -0.993200 -0.101600 199 | vn -0.025500 -0.997000 -0.073300 200 | vn -0.990700 -0.070800 -0.116000 201 | vn -0.989000 -0.085000 -0.120600 202 | vn -0.991500 -0.082300 -0.100900 203 | vn -0.988300 -0.082800 -0.127800 204 | vn -0.194100 0.978500 0.070100 205 | vn -0.233700 0.971600 0.036100 206 | vn -0.095200 0.994800 0.034900 207 | vn -0.069000 0.994300 0.081400 208 | vn 0.998600 0.028100 0.045300 209 | vn 0.998800 0.034700 0.033500 210 | vn 0.125600 -0.990800 -0.049800 211 | vn -0.031300 -0.998500 0.045700 212 | vn -0.801300 0.233900 -0.550700 213 | vn -0.854900 0.305100 -0.419500 214 | vn -0.843300 0.278600 -0.459500 215 | vn -0.795300 0.239500 -0.556800 216 | vn -0.484600 0.872200 -0.066400 217 | vn -0.449600 0.893100 0.016400 218 | vn 0.975100 -0.220000 -0.029200 219 | vn 0.958000 -0.265000 -0.109400 220 | vn 0.924900 -0.314100 -0.214100 221 | vn 0.915000 -0.288700 -0.281700 222 | vn 0.051300 -0.948500 -0.312600 223 | vn 0.046300 -0.941800 -0.332900 224 | vn -0.994500 -0.068800 -0.079200 225 | vn -0.995700 -0.057200 -0.073100 226 | vn 0.008500 0.948800 -0.315700 227 | vn -0.025000 0.948600 -0.315600 228 | vn 0.999400 -0.021500 -0.027600 229 | vn 0.999200 -0.026000 -0.029400 230 | vn 0.015500 -0.986900 0.160500 231 | vn -0.004800 -0.987000 0.160500 232 | vn -0.995700 -0.055100 -0.074900 233 | vn -0.997000 -0.040100 -0.066000 234 | vn 0.010400 0.936400 -0.350800 235 | vn -0.028100 0.936100 -0.350600 236 | vn 0.999600 -0.014600 -0.024300 237 | vn 0.999400 -0.020300 -0.027100 238 | vn 0.018700 -0.999700 0.012600 239 | vn -0.006800 -0.999900 0.012600 240 | vn -0.996400 -0.048000 -0.070200 241 | vn -0.997600 -0.032800 -0.060800 242 | vn 0.014200 0.948100 -0.317700 243 | vn -0.028000 0.947800 -0.317600 244 | vn 0.999400 -0.016300 -0.030600 245 | vn 0.999100 -0.024200 -0.035000 246 | vn 0.017800 -0.998200 -0.057600 247 | vn -0.008900 -0.998300 -0.057600 248 | vn -0.983400 -0.109100 -0.145300 249 | vn -0.988300 -0.084200 -0.127300 250 | vn 0.016400 0.927800 -0.372700 251 | vn -0.050200 0.926800 -0.372100 252 | vn 0.998800 -0.026900 -0.040800 253 | vn 0.998400 -0.035300 -0.045300 254 | vn 0.034200 -0.997400 0.063900 255 | vn -0.010900 -0.997900 0.064100 256 | vn -0.932800 0.285100 0.220500 257 | vn -0.933700 0.280800 0.222300 258 | vn -0.925100 0.288500 0.247100 259 | vn -0.931400 0.281600 0.230500 260 | vn -0.440700 0.892700 0.093700 261 | vn -0.444800 0.892400 0.075700 262 | vn 0.810200 -0.306000 -0.500000 263 | vn 0.809000 -0.315400 -0.495900 264 | vn 0.124300 -0.987200 -0.100200 265 | vn 0.116700 -0.981700 -0.150300 266 | vn 0.987700 0.000000 0.156300 267 | vn 0.987700 -0.001800 0.156400 268 | vn 0.987600 -0.004500 0.156700 269 | vn -0.000000 0.969500 -0.245000 270 | vn 0.008800 0.969500 -0.244900 271 | vn 0.009400 0.969500 -0.244900 272 | vn -0.123200 0.983700 -0.131100 273 | vn -0.087200 0.991500 -0.096600 274 | vn -0.118000 0.986000 -0.117500 275 | vn -0.142100 0.972400 -0.185000 276 | vn -0.987700 -0.000000 -0.156300 277 | usemtl b0b0b0 278 | s 1 279 | f 1/1/1 4/2/1 5/3/2 2/4/3 280 | f 2/4/3 5/3/2 6/5/4 3/6/5 281 | f 7/1/6 10/2/7 11/3/8 8/4/9 282 | f 32/4/10 31/3/11 33/5/12 34/6/13 283 | f 7/1/14 8/7/15 16/8/16 13/9/17 284 | f 13/9/18 16/8/16 17/10/19 14/4/20 285 | f 14/4/21 17/10/19 18/11/19 15/12/22 286 | f 15/12/23 18/11/19 2/13/24 3/6/25 287 | f 8/7/15 9/2/26 19/14/27 16/8/16 288 | f 16/8/16 19/14/27 20/3/28 17/10/19 289 | f 17/10/19 20/3/28 21/15/28 18/11/19 290 | f 18/11/19 21/15/28 1/5/28 2/13/24 291 | f 12/1/29 11/7/30 25/8/31 22/9/32 292 | f 22/9/32 25/8/31 26/10/33 23/4/34 293 | f 23/4/34 26/10/33 27/11/35 24/12/36 294 | f 24/12/36 27/11/35 5/13/37 4/6/38 295 | f 11/7/30 10/2/39 28/14/40 25/8/31 296 | f 25/8/31 28/14/40 29/3/41 26/10/33 297 | f 26/10/33 29/3/41 30/15/42 27/11/35 298 | f 27/11/35 30/15/42 6/5/43 5/13/37 299 | f 9/1/44 12/2/44 22/14/44 19/9/44 300 | f 76/9/44 75/14/44 77/3/44 78/4/44 301 | f 78/4/44 77/3/44 79/15/45 80/12/46 302 | f 80/12/46 79/15/45 81/5/47 82/6/48 303 | f 55/1/49 56/2/50 57/14/49 58/9/50 304 | f 59/9/49 60/14/50 61/3/49 62/4/50 305 | f 63/4/49 64/3/50 65/15/49 66/12/50 306 | f 67/12/49 68/15/50 69/5/50 70/6/50 307 | f 71/2/51 72/2/52 73/2/53 74/2/54 308 | f 11/2/30 12/2/29 33/2/55 31/2/56 309 | f 12/2/57 9/2/58 34/2/13 33/2/12 310 | f 9/2/26 8/2/15 32/2/59 34/2/60 311 | f 3/2/5 6/2/4 35/2/61 36/2/62 312 | f 6/2/43 30/2/42 37/2/63 35/2/64 313 | f 30/2/65 15/2/66 38/2/67 37/2/68 314 | f 15/2/23 3/2/25 36/2/69 38/2/70 315 | f 15/2/71 30/2/72 40/2/73 39/2/74 316 | f 30/2/75 29/2/76 41/2/77 40/2/78 317 | f 29/2/79 14/2/80 42/2/81 41/2/82 318 | f 14/2/21 15/2/22 39/2/83 42/2/84 319 | f 14/2/85 29/2/86 44/2/87 43/2/88 320 | f 29/2/89 28/2/90 45/2/91 44/2/92 321 | f 28/2/93 13/2/94 46/2/95 45/2/96 322 | f 13/2/18 14/2/20 43/2/97 46/2/98 323 | f 13/2/99 28/2/100 48/2/101 47/2/102 324 | f 28/2/103 10/2/104 49/2/105 48/2/106 325 | f 10/2/7 7/2/6 50/2/107 49/2/108 326 | f 7/2/14 13/2/17 47/2/109 50/2/110 327 | f 8/2/111 11/2/112 51/2/113 52/2/114 328 | f 11/2/30 31/2/56 53/2/115 51/2/116 329 | f 31/2/117 32/2/118 54/2/119 53/2/120 330 | f 32/2/59 8/2/15 52/2/121 54/2/122 331 | f 36/2/62 35/2/61 56/2/123 55/2/124 332 | f 35/2/64 37/2/63 57/2/125 56/2/126 333 | f 37/2/68 38/2/67 58/2/127 57/2/128 334 | f 38/2/70 36/2/69 55/2/129 58/2/130 335 | f 39/2/74 40/2/73 60/2/131 59/2/132 336 | f 40/2/78 41/2/77 61/2/133 60/2/134 337 | f 41/2/82 42/2/81 62/2/135 61/2/136 338 | f 42/2/84 39/2/83 59/2/137 62/2/138 339 | f 43/2/88 44/2/87 64/2/139 63/2/140 340 | f 44/2/92 45/2/91 65/2/141 64/2/142 341 | f 45/2/96 46/2/95 66/2/143 65/2/144 342 | f 46/2/98 43/2/97 63/2/145 66/2/146 343 | f 47/2/102 48/2/101 68/2/147 67/2/148 344 | f 48/2/106 49/2/105 69/2/149 68/2/150 345 | f 49/2/108 50/2/107 70/2/151 69/2/152 346 | f 50/2/110 47/2/109 67/2/153 70/2/154 347 | f 52/2/155 51/2/156 72/2/157 71/2/158 348 | f 51/2/116 53/2/115 73/2/159 72/2/160 349 | f 53/2/120 54/2/119 74/2/161 73/2/162 350 | f 54/2/122 52/2/121 71/2/163 74/2/164 351 | f 19/2/165 22/2/166 75/2/167 76/2/165 352 | f 22/2/32 23/2/34 77/2/168 75/2/169 353 | f 20/2/28 19/2/27 76/2/28 78/2/28 354 | f 23/2/34 24/2/36 79/2/170 77/2/168 355 | f 21/2/28 20/2/28 78/2/28 80/2/28 356 | f 24/2/171 4/2/172 81/2/173 79/2/174 357 | f 4/2/175 1/2/175 82/2/175 81/2/175 358 | f 1/2/28 21/2/28 80/2/28 82/2/28 359 | -------------------------------------------------------------------------------- /a-frame-assets/hand/hand-relaxed.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.74 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib hand.mtl 4 | o Box1 5 | v -0.462384 -0.193406 0.496106 6 | v -0.500000 -0.193406 0.000000 7 | v -0.500000 -0.193406 -0.500000 8 | v -0.462384 0.140650 0.496106 9 | v -0.500000 0.193406 0.000000 10 | v -0.500000 0.119618 -0.500000 11 | v 0.500000 -0.193406 -0.500000 12 | v 0.380472 -0.237947 0.102896 13 | v 0.380472 -0.237947 0.605270 14 | v 0.500000 0.013741 -0.500000 15 | v 0.697704 -0.101512 0.073157 16 | v 0.692185 -0.137057 0.605270 17 | v 0.250000 -0.193406 -0.500000 18 | v -0.000000 -0.193406 -0.500000 19 | v -0.250000 -0.193406 -0.500000 20 | v 0.250000 -0.193406 0.000000 21 | v -0.000000 -0.193406 0.000000 22 | v -0.250000 -0.193406 0.000000 23 | v 0.250000 -0.193406 0.605270 24 | v -0.000000 -0.193406 0.605270 25 | v -0.250000 -0.193406 0.605270 26 | v 0.250000 0.255930 0.605270 27 | v 0.000000 0.255930 0.605270 28 | v -0.250000 0.255930 0.605270 29 | v 0.250000 0.193406 0.000000 30 | v -0.048640 0.193406 0.000000 31 | v -0.250000 0.193406 0.000000 32 | v 0.250000 0.119618 -0.500000 33 | v 0.000000 0.119618 -0.500000 34 | v -0.250000 0.119618 -0.500000 35 | v 0.946053 -0.383125 -0.275629 36 | v 0.641381 -0.489303 -0.275629 37 | v 0.830105 -0.290021 0.290179 38 | v 0.518391 -0.390910 0.290179 39 | v -0.488470 -0.003034 -1.116164 40 | v -0.488470 -0.196940 -0.956942 41 | v -0.261530 -0.002887 -1.116261 42 | v -0.261530 -0.196793 -0.957039 43 | v -0.217525 -0.196793 -0.957039 44 | v -0.217525 0.016462 -1.129037 45 | v 0.008593 0.016462 -1.129037 46 | v 0.008593 -0.196793 -0.957039 47 | v 0.031177 -0.196793 -0.957039 48 | v 0.031177 0.016462 -1.129037 49 | v 0.281177 0.016462 -1.129037 50 | v 0.281177 -0.196793 -0.957039 51 | v 0.310898 -0.196793 -0.957039 52 | v 0.310898 0.016462 -1.129037 53 | v 0.560898 0.016462 -1.129037 54 | v 0.560898 -0.196793 -0.957039 55 | v 0.751261 -0.222161 -0.266260 56 | v 0.523590 -0.300363 -0.323857 57 | v 0.919789 -0.394561 -0.398803 58 | v 0.651425 -0.491902 -0.398803 59 | v -0.462269 -0.375749 -1.112266 60 | v -0.462269 -0.283343 -1.297011 61 | v -0.271328 -0.283343 -1.297011 62 | v -0.271328 -0.375749 -1.112266 63 | v -0.191735 -0.415988 -1.181248 64 | v -0.191735 -0.323582 -1.365993 65 | v -0.000794 -0.323582 -1.365993 66 | v -0.000794 -0.415988 -1.181248 67 | v 0.055830 -0.433104 -1.210590 68 | v 0.055830 -0.340698 -1.395336 69 | v 0.268852 -0.340698 -1.395336 70 | v 0.268852 -0.433104 -1.210590 71 | v 0.360206 -0.403489 -1.159821 72 | v 0.360206 -0.311083 -1.344566 73 | v 0.545492 -0.311083 -1.344566 74 | v 0.545492 -0.403489 -1.159821 75 | v 0.479789 -0.269483 -0.611389 76 | v 0.694899 -0.190702 -0.611389 77 | v 0.792326 -0.330126 -0.693974 78 | v 0.549662 -0.442667 -0.627100 79 | v 0.213673 0.193406 0.802813 80 | v 0.213673 -0.193406 0.802813 81 | v -0.036327 0.193406 0.802813 82 | v -0.036327 -0.193406 0.802813 83 | v -0.286327 0.193406 0.802813 84 | v -0.286327 -0.193406 0.802813 85 | v -0.433631 0.140650 0.794558 86 | v -0.433631 -0.193406 0.794558 87 | vt 0.000000 1.000000 88 | vt 0.000000 0.000000 89 | vt 0.500000 0.000000 90 | vt 0.500000 1.000000 91 | vt 1.000000 0.000000 92 | vt 1.000000 1.000000 93 | vt 0.000000 0.500000 94 | vt 0.250000 0.500000 95 | vt 0.250000 1.000000 96 | vt 0.500000 0.500000 97 | vt 0.750000 0.500000 98 | vt 0.750000 1.000000 99 | vt 1.000000 0.500000 100 | vt 0.250000 0.000000 101 | vt 0.750000 0.000000 102 | vn -0.997100 0.000000 0.075600 103 | vn -0.999300 0.000100 0.037300 104 | vn -0.999300 0.000000 0.037800 105 | vn -0.999900 -0.001100 -0.012300 106 | vn -0.999900 -0.001600 -0.011500 107 | vn 0.988100 -0.132300 0.078000 108 | vn 0.988700 -0.144200 0.041100 109 | vn 0.957300 -0.284200 -0.052300 110 | vn 0.958300 -0.285000 0.019900 111 | vn 0.869600 -0.292900 0.397600 112 | vn 0.845800 -0.283900 0.451700 113 | vn 0.763900 -0.308500 0.566800 114 | vn 0.751900 -0.282700 0.595500 115 | vn 0.045100 -0.998000 -0.044100 116 | vn 0.195200 -0.976500 -0.091600 117 | vn 0.080700 -0.996600 0.017400 118 | vn 0.048700 -0.998000 -0.039500 119 | vn 0.000000 -0.999000 -0.044400 120 | vn 0.000000 -1.000000 0.000000 121 | vn 0.000000 -0.997900 -0.064500 122 | vn -0.000000 -0.999000 -0.044300 123 | vn 0.000100 -0.999000 -0.044200 124 | vn 0.000200 -0.997900 -0.064500 125 | vn 0.336100 -0.934800 -0.115100 126 | vn 0.097600 -0.995200 0.000000 127 | vn -0.343300 0.939200 -0.011600 128 | vn -0.350100 0.913100 -0.209000 129 | vn -0.138900 0.990100 -0.019200 130 | vn -0.068300 0.996100 -0.055800 131 | vn 0.000100 1.000000 0.002400 132 | vn -0.000000 0.997800 -0.066900 133 | vn 0.002300 1.000000 0.002000 134 | vn -0.015300 0.999400 -0.030300 135 | vn -0.023600 0.999400 -0.024200 136 | vn -0.024300 0.992100 0.122800 137 | vn -0.298400 0.945500 -0.130700 138 | vn -0.157400 0.983600 -0.087800 139 | vn 0.000000 0.998100 -0.061800 140 | vn -0.000100 0.997100 -0.075500 141 | vn -0.000200 0.999200 -0.040200 142 | vn 0.000000 0.000000 1.000000 143 | vn -0.233300 0.047500 0.971300 144 | vn -0.235200 -0.000000 0.972000 145 | vn -0.455000 0.041400 0.889500 146 | vn -0.457100 0.000000 0.889400 147 | vn 0.000000 -0.305400 -0.952200 148 | vn -0.431500 0.074800 -0.899000 149 | vn -0.436900 0.140800 -0.888400 150 | vn -0.447400 0.134200 -0.884200 151 | vn -0.421400 0.086600 -0.902700 152 | vn -0.312600 0.936700 0.157700 153 | vn -0.426500 0.899900 -0.091100 154 | vn 0.764600 -0.292700 0.574300 155 | vn 0.814500 -0.343400 0.467600 156 | vn 0.142300 -0.969500 -0.199800 157 | vn 0.335100 -0.935300 -0.113800 158 | vn -0.998400 -0.024700 -0.051600 159 | vn -0.999100 -0.012800 -0.039500 160 | vn -0.000100 0.990300 0.138800 161 | vn -0.001000 0.989900 0.141600 162 | vn 0.999700 -0.003000 -0.022600 163 | vn 0.999700 -0.003200 -0.023000 164 | vn 0.999700 -0.006000 -0.023200 165 | vn 0.999700 -0.010200 -0.023400 166 | vn 0.026800 -0.945500 -0.324500 167 | vn -0.009500 -0.946000 -0.323900 168 | vn -0.997900 -0.009200 -0.064800 169 | vn -0.997900 -0.008600 -0.063700 170 | vn -0.998000 -0.020400 -0.060700 171 | vn -0.997800 -0.012200 -0.064500 172 | vn -0.000100 1.000000 -0.005800 173 | vn -0.000000 0.998800 -0.048500 174 | vn -0.000000 0.993400 0.114600 175 | vn -0.000600 0.993300 0.115500 176 | vn 0.999900 0.002400 0.017100 177 | vn 0.999800 0.002500 0.017100 178 | vn 1.000000 -0.001000 0.000400 179 | vn 0.999900 -0.005100 -0.010400 180 | vn 0.016600 -0.944600 -0.327900 181 | vn -0.006500 -0.942300 -0.334700 182 | vn -0.998000 -0.008800 -0.062200 183 | vn -0.998100 -0.008200 -0.061100 184 | vn -0.998200 -0.017600 -0.057300 185 | vn -0.998000 -0.010600 -0.062200 186 | vn -0.000100 0.998800 -0.048500 187 | vn -0.000100 0.992900 0.119300 188 | vn -0.000500 0.992900 0.118900 189 | vn 0.998000 0.008700 0.062100 190 | vn 0.998000 0.008900 0.062200 191 | vn 0.999700 0.002600 0.023600 192 | vn 1.000000 -0.003500 -0.002000 193 | vn 0.013800 -0.944100 -0.329400 194 | vn -0.007400 -0.940500 -0.339600 195 | vn -0.992500 -0.017100 -0.120900 196 | vn -0.992800 -0.016000 -0.118800 197 | vn -0.992400 -0.041600 -0.116000 198 | vn -0.992400 -0.025000 -0.120700 199 | vn -0.163000 0.982500 -0.089900 200 | vn -0.202900 0.972000 -0.119000 201 | vn -0.128100 0.990500 0.049800 202 | vn -0.122200 0.988000 0.094800 203 | vn 0.998400 0.009700 0.055600 204 | vn 0.999900 -0.005300 0.009500 205 | vn 0.033100 -0.946200 -0.321800 206 | vn -0.012300 -0.939900 -0.341400 207 | vn -0.809700 0.248200 -0.531800 208 | vn -0.823000 0.276200 -0.496300 209 | vn -0.827700 0.247600 -0.503700 210 | vn -0.797600 0.276400 -0.536100 211 | vn -0.488900 0.842700 -0.225600 212 | vn -0.499400 0.857800 -0.121500 213 | vn 0.963500 -0.262900 -0.051000 214 | vn 0.963800 -0.256300 -0.073400 215 | vn 0.893800 -0.307100 -0.326700 216 | vn 0.900000 -0.308800 -0.307500 217 | vn 0.039400 -0.981300 -0.188500 218 | vn 0.025400 -0.989400 -0.142600 219 | vn -0.997500 -0.033100 -0.063200 220 | vn -0.996800 -0.035200 -0.071500 221 | vn 0.010800 0.973900 0.226700 222 | vn -0.030900 0.973500 0.226500 223 | vn 0.999600 -0.013200 -0.026800 224 | vn 0.999600 -0.012400 -0.023700 225 | vn 0.014200 -0.913200 -0.407400 226 | vn -0.004400 -0.913200 -0.407400 227 | vn -0.997600 -0.023600 -0.064800 228 | vn -0.996700 -0.032800 -0.074600 229 | vn 0.008200 0.990900 0.134400 230 | vn -0.022300 0.990700 0.134300 231 | vn 0.999600 -0.012000 -0.027300 232 | vn 0.999700 -0.008600 -0.023600 233 | vn 0.009100 -0.906000 -0.423100 234 | vn -0.003400 -0.906100 -0.423200 235 | vn -0.997800 -0.020300 -0.062500 236 | vn -0.996900 -0.031900 -0.071600 237 | vn 0.009700 0.989500 0.144500 238 | vn -0.019200 0.989300 0.144400 239 | vn 0.999200 -0.016000 -0.035900 240 | vn 0.999500 -0.010200 -0.031300 241 | vn 0.007600 -0.904300 -0.426700 242 | vn -0.003800 -0.904400 -0.426800 243 | vn -0.991300 -0.048600 -0.122100 244 | vn -0.988200 -0.061700 -0.140100 245 | vn 0.014600 0.992000 0.125600 246 | vn -0.044800 0.991100 0.125000 247 | vn 0.998800 -0.019500 -0.044300 248 | vn 0.999100 -0.015400 -0.038500 249 | vn 0.019300 -0.907600 -0.419400 250 | vn -0.006000 -0.907700 -0.419600 251 | vn -0.931400 0.276600 0.236700 252 | vn -0.941300 0.285000 0.180900 253 | vn -0.938800 0.279500 0.201500 254 | vn -0.926900 0.279600 0.250400 255 | vn -0.427800 0.896600 0.114500 256 | vn -0.451200 0.892400 0.000300 257 | vn 0.852900 -0.310100 -0.419900 258 | vn 0.816200 -0.294800 -0.496900 259 | vn 0.053000 -0.994800 -0.086600 260 | vn 0.104100 -0.994500 -0.006200 261 | vn 0.987700 0.000000 0.156300 262 | vn 0.987700 -0.001800 0.156400 263 | vn 0.987600 -0.004500 0.156700 264 | vn -0.000000 0.969500 -0.245000 265 | vn 0.008800 0.969500 -0.244900 266 | vn 0.009400 0.969500 -0.244900 267 | vn -0.123200 0.983700 -0.131100 268 | vn -0.087200 0.991500 -0.096600 269 | vn -0.118000 0.986000 -0.117500 270 | vn -0.142100 0.972400 -0.185000 271 | vn -0.987700 -0.000000 -0.156300 272 | usemtl b0b0b0 273 | s 1 274 | f 1/1/1 4/2/1 5/3/2 2/4/3 275 | f 2/4/3 5/3/2 6/5/4 3/6/5 276 | f 7/1/6 10/2/7 11/3/8 8/4/9 277 | f 32/4/10 31/3/11 33/5/12 34/6/13 278 | f 7/1/14 8/7/15 16/8/16 13/9/17 279 | f 13/9/18 16/8/16 17/10/19 14/4/20 280 | f 14/4/21 17/10/19 18/11/19 15/12/20 281 | f 15/12/22 18/11/19 2/13/19 3/6/23 282 | f 8/7/15 9/2/24 19/14/25 16/8/16 283 | f 16/8/16 19/14/25 20/3/19 17/10/19 284 | f 17/10/19 20/3/19 21/15/19 18/11/19 285 | f 18/11/19 21/15/19 1/5/19 2/13/19 286 | f 12/1/26 11/7/27 25/8/28 22/9/29 287 | f 22/9/29 25/8/28 26/10/30 23/4/31 288 | f 23/4/31 26/10/30 27/11/32 24/12/33 289 | f 24/12/33 27/11/32 5/13/34 4/6/35 290 | f 11/7/27 10/2/36 28/14/37 25/8/28 291 | f 25/8/28 28/14/37 29/3/38 26/10/30 292 | f 26/10/30 29/3/38 30/15/39 27/11/32 293 | f 27/11/32 30/15/39 6/5/40 5/13/34 294 | f 9/1/41 12/2/41 22/14/41 19/9/41 295 | f 76/9/41 75/14/41 77/3/41 78/4/41 296 | f 78/4/41 77/3/41 79/15/42 80/12/43 297 | f 80/12/43 79/15/42 81/5/44 82/6/45 298 | f 55/1/46 56/2/46 57/14/46 58/9/46 299 | f 59/9/46 60/14/46 61/3/46 62/4/46 300 | f 63/4/46 64/3/46 65/15/46 66/12/46 301 | f 67/12/46 68/15/46 69/5/46 70/6/46 302 | f 71/2/47 72/2/48 73/2/49 74/2/50 303 | f 11/2/27 12/2/26 33/2/51 31/2/52 304 | f 12/2/53 9/2/54 34/2/13 33/2/12 305 | f 9/2/24 8/2/15 32/2/55 34/2/56 306 | f 3/2/5 6/2/4 35/2/57 36/2/58 307 | f 6/2/40 30/2/39 37/2/59 35/2/60 308 | f 30/2/61 15/2/62 38/2/63 37/2/64 309 | f 15/2/22 3/2/23 36/2/65 38/2/66 310 | f 15/2/67 30/2/68 40/2/69 39/2/70 311 | f 30/2/71 29/2/72 41/2/73 40/2/74 312 | f 29/2/75 14/2/76 42/2/77 41/2/78 313 | f 14/2/21 15/2/20 39/2/79 42/2/80 314 | f 14/2/81 29/2/82 44/2/83 43/2/84 315 | f 29/2/71 28/2/85 45/2/86 44/2/87 316 | f 28/2/88 13/2/89 46/2/90 45/2/91 317 | f 13/2/18 14/2/20 43/2/92 46/2/93 318 | f 13/2/94 28/2/95 48/2/96 47/2/97 319 | f 28/2/98 10/2/99 49/2/100 48/2/101 320 | f 10/2/7 7/2/6 50/2/102 49/2/103 321 | f 7/2/14 13/2/17 47/2/104 50/2/105 322 | f 8/2/106 11/2/107 51/2/108 52/2/109 323 | f 11/2/27 31/2/52 53/2/110 51/2/111 324 | f 31/2/112 32/2/113 54/2/114 53/2/115 325 | f 32/2/55 8/2/15 52/2/116 54/2/117 326 | f 36/2/58 35/2/57 56/2/118 55/2/119 327 | f 35/2/60 37/2/59 57/2/120 56/2/121 328 | f 37/2/64 38/2/63 58/2/122 57/2/123 329 | f 38/2/66 36/2/65 55/2/124 58/2/125 330 | f 39/2/70 40/2/69 60/2/126 59/2/127 331 | f 40/2/74 41/2/73 61/2/128 60/2/129 332 | f 41/2/78 42/2/77 62/2/130 61/2/131 333 | f 42/2/80 39/2/79 59/2/132 62/2/133 334 | f 43/2/84 44/2/83 64/2/134 63/2/135 335 | f 44/2/87 45/2/86 65/2/136 64/2/137 336 | f 45/2/91 46/2/90 66/2/138 65/2/139 337 | f 46/2/93 43/2/92 63/2/140 66/2/141 338 | f 47/2/97 48/2/96 68/2/142 67/2/143 339 | f 48/2/101 49/2/100 69/2/144 68/2/145 340 | f 49/2/103 50/2/102 70/2/146 69/2/147 341 | f 50/2/105 47/2/104 67/2/148 70/2/149 342 | f 52/2/150 51/2/151 72/2/152 71/2/153 343 | f 51/2/111 53/2/110 73/2/154 72/2/155 344 | f 53/2/115 54/2/114 74/2/156 73/2/157 345 | f 54/2/117 52/2/116 71/2/158 74/2/159 346 | f 19/2/160 22/2/161 75/2/162 76/2/160 347 | f 22/2/29 23/2/31 77/2/163 75/2/164 348 | f 20/2/19 19/2/25 76/2/19 78/2/19 349 | f 23/2/31 24/2/33 79/2/165 77/2/163 350 | f 21/2/19 20/2/19 78/2/19 80/2/19 351 | f 24/2/166 4/2/167 81/2/168 79/2/169 352 | f 4/2/170 1/2/170 82/2/170 81/2/170 353 | f 1/2/19 21/2/19 80/2/19 82/2/19 354 | -------------------------------------------------------------------------------- /a-frame-assets/kitchen/CakeBake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/CakeBake.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/CounterBake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/CounterBake.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/FridgeBake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/FridgeBake.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/RoomBake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/RoomBake.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/SwirlBake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/SwirlBake.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/backwall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/backwall.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/envmap/0001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/envmap/0001.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/envmap/0002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/envmap/0002.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/envmap/0003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/envmap/0003.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/envmap/0004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/envmap/0004.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/envmap/0005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/envmap/0005.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/envmap/0006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/envmap/0006.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/images/backwall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/images/backwall.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/images/environment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/images/environment.jpg -------------------------------------------------------------------------------- /a-frame-assets/kitchen/images/normalmap_tile_even.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/images/normalmap_tile_even.png -------------------------------------------------------------------------------- /a-frame-assets/kitchen/lickthewhisk.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/lickthewhisk.blend -------------------------------------------------------------------------------- /a-frame-assets/kitchen/normalmap_tile_even.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/kitchen/normalmap_tile_even.png -------------------------------------------------------------------------------- /a-frame-assets/ninja/NinjaLo_bin.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/ninja/NinjaLo_bin.bin -------------------------------------------------------------------------------- /a-frame-assets/ninja/NinjaLo_bin.js: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "metadata" : 4 | { 5 | "formatVersion" : 3.1, 6 | "sourceFile" : "ninjaHead_Low.obj", 7 | "generatedBy" : "OBJConverter", 8 | "vertices" : 4485, 9 | "faces" : 4810, 10 | "normals" : 4485, 11 | "uvs" : 4543, 12 | "materials" : 0 13 | }, 14 | 15 | "materials": [ { 16 | "DbgColor" : 15658734, 17 | "DbgIndex" : 0, 18 | "DbgName" : "default" 19 | }], 20 | 21 | "buffers": "NinjaLo_bin.bin" 22 | 23 | } 24 | -------------------------------------------------------------------------------- /a-frame-assets/ninja/ao.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/ninja/ao.jpg -------------------------------------------------------------------------------- /a-frame-assets/ninja/displacement.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/ninja/displacement.jpg -------------------------------------------------------------------------------- /a-frame-assets/ninja/displacement.txt: -------------------------------------------------------------------------------- 1 | DisplacementMap Scale: 2.436143 2 | DisplacementMap Bias : -0.428408 3 | -------------------------------------------------------------------------------- /a-frame-assets/ninja/normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/ninja/normal.jpg -------------------------------------------------------------------------------- /a-frame-assets/race-track/race-track.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl Standard 5 | Ns 96.078431 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.666667 0.666667 0.666667 8 | Ks 0.012549 0.012549 0.012549 9 | Ni 1.000000 10 | d 1.000000 11 | illum 2 12 | -------------------------------------------------------------------------------- /a-frame-assets/race-track/race-track.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.74 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | mtllib race-track.mtl 4 | o Box 5 | v -2.491088 0.002800 -0.619400 6 | v -2.649757 -0.343405 -0.619400 7 | v -2.491087 0.002800 1.445027 8 | v -2.649756 -0.343405 1.445027 9 | v -2.759117 -0.343404 -0.619400 10 | v -3.345866 -0.161921 -0.619400 11 | v -2.759116 -0.343404 1.445027 12 | v -3.345865 -0.161921 1.445027 13 | v -2.649757 0.773589 -0.619400 14 | v -2.649756 0.773589 1.445027 15 | v -3.772897 0.770047 -0.619399 16 | v -3.772897 0.770047 1.445027 17 | v -3.261540 0.772803 1.205251 18 | v -3.261540 0.772803 0.647760 19 | v -3.567982 0.770833 0.647760 20 | v -3.567982 0.770833 1.205251 21 | v -3.165935 1.392689 1.205251 22 | v -3.165935 1.392689 0.647760 23 | v -3.456398 1.448214 0.647760 24 | v -3.456398 1.448214 1.205251 25 | v -2.649752 -0.276310 -0.619400 26 | v -2.806787 -0.123923 -0.619400 27 | v -2.672926 -0.281568 -0.619400 28 | v -3.147869 -0.131535 -0.619400 29 | v -3.602619 0.726976 -0.619400 30 | v -2.805966 0.725899 -0.619400 31 | v -2.649752 -0.276310 -1.907169 32 | v -2.806788 -0.123923 -1.907169 33 | v -2.672926 -0.281568 -1.907169 34 | v -3.147870 -0.131535 -1.907169 35 | v -3.602620 0.726976 -1.907169 36 | v -2.805966 0.725899 -1.907169 37 | v -3.506202 0.973531 0.647760 38 | v -3.258552 0.969198 0.647760 39 | v -3.461423 1.229879 0.647760 40 | v -3.225951 1.218687 0.647760 41 | v -3.258553 0.969198 -2.102797 42 | v -3.506202 0.973531 -2.102797 43 | v -3.461423 1.229879 -2.102797 44 | v -3.225951 1.218687 -2.102797 45 | v -0.000000 -0.295615 -1.907169 46 | v -0.000000 -0.123923 -1.907169 47 | v 0.000000 -0.343405 1.445027 48 | v 0.000000 0.002800 1.445027 49 | v -0.000000 0.002800 -0.619400 50 | v -0.000000 -0.343405 -0.619400 51 | v -0.000000 -0.295615 -0.619400 52 | v -0.000000 -0.123923 -0.619400 53 | v 2.491088 0.002800 -0.619400 54 | v 2.649757 -0.343405 -0.619400 55 | v 2.491088 0.002800 1.445027 56 | v 2.649757 -0.343405 1.445027 57 | v 2.759117 -0.343404 -0.619400 58 | v 3.345866 -0.161921 -0.619401 59 | v 2.759117 -0.343404 1.445027 60 | v 3.345866 -0.161921 1.445026 61 | v 2.649757 0.773589 -0.619400 62 | v 2.649757 0.773589 1.445027 63 | v 3.772897 0.770047 -0.619401 64 | v 3.772897 0.770047 1.445026 65 | v 3.261541 0.772803 1.205251 66 | v 3.261540 0.772803 0.647759 67 | v 3.567982 0.770833 0.647759 68 | v 3.567982 0.770833 1.205251 69 | v 3.165936 1.392689 1.205251 70 | v 3.165935 1.392689 0.647759 71 | v 3.456398 1.448214 0.647759 72 | v 3.456398 1.448214 1.205251 73 | v 2.649752 -0.276310 -0.619400 74 | v 2.806787 -0.123923 -0.619400 75 | v 2.672926 -0.281568 -0.619400 76 | v 3.147869 -0.131535 -0.619400 77 | v 3.602619 0.726976 -0.619401 78 | v 2.805966 0.725899 -0.619400 79 | v 2.649752 -0.276310 -1.907169 80 | v 2.806787 -0.123923 -1.907169 81 | v 2.672926 -0.281568 -1.907169 82 | v 3.147869 -0.131535 -1.907170 83 | v 3.602619 0.726976 -1.907170 84 | v 2.805966 0.725899 -1.907169 85 | v 3.506202 0.973531 0.647759 86 | v 3.258552 0.969198 0.647759 87 | v 3.461423 1.229879 0.647759 88 | v 3.225951 1.218687 0.647759 89 | v 3.258552 0.969198 -2.102798 90 | v 3.506202 0.973531 -2.102798 91 | v 3.461423 1.229879 -2.102798 92 | v 3.225950 1.218687 -2.102798 93 | v -0.000000 -0.295615 -1.907169 94 | v -0.000000 -0.123923 -1.907169 95 | v 0.000000 -0.343405 1.445027 96 | v 0.000000 0.002800 1.445027 97 | v -0.000000 0.002800 -0.619400 98 | v -0.000000 -0.343405 -0.619400 99 | v -0.000000 -0.295615 -0.619400 100 | v -0.000000 -0.123923 -0.619400 101 | vt 1.008860 -0.206692 102 | vt 1.008860 -0.251704 103 | vt 1.008860 0.500000 104 | vt 0.367908 0.500000 105 | vt 0.367908 -0.206692 106 | vt 0.367908 -0.449182 107 | vt 0.367908 -0.282728 108 | vt 1.008860 -0.282728 109 | vt 1.008860 -0.449182 110 | vt -0.031911 -0.296252 111 | vt -0.031911 -0.251703 112 | vt -0.031911 -0.258277 113 | vt -0.031911 -0.393013 114 | vt 0.367908 -0.251704 115 | vt 0.934415 -0.398138 116 | vt 0.761329 -0.398138 117 | vt 0.761329 -0.480538 118 | vt 0.934415 -0.480538 119 | vt 0.197903 0.002776 120 | vt 0.197903 0.619988 121 | vt 0.341014 0.619988 122 | vt 0.341014 0.002776 123 | vt -0.031911 -0.522020 124 | vt -0.031911 -0.296019 125 | vt 1.008860 -0.570325 126 | vt 0.367908 -0.570325 127 | vt 0.761329 -0.425260 128 | vt 0.934415 -0.425260 129 | vt 0.761329 -0.512193 130 | vt 0.934415 -0.512193 131 | vt 0.326577 0.074463 132 | vt 0.326577 0.241139 133 | vt 0.388503 0.241139 134 | vt 0.388503 0.074463 135 | vt -0.092648 -0.424412 136 | vt -0.092648 -0.494667 137 | vt -0.092648 -0.481964 138 | vt -0.092648 -0.415163 139 | vt 0.367908 -0.296252 140 | vt 0.367908 -0.258277 141 | vt 0.367908 -0.393013 142 | vt 0.367908 -0.522020 143 | vt 0.367908 -0.296019 144 | vt -0.031911 0.500000 145 | vt 0.330214 0.619988 146 | vt 0.182596 0.619988 147 | vt 0.182596 1.004999 148 | vt 0.330214 1.004999 149 | vt 0.761329 -0.494667 150 | vt 0.761329 -0.424412 151 | vt 0.761329 -0.481964 152 | vt 0.761329 -0.415163 153 | vt 0.373823 0.241139 154 | vt 0.349530 0.241139 155 | vt 0.349530 1.063487 156 | vt 0.373823 1.063487 157 | vt 1.008860 1.251704 158 | vt 1.008860 1.206692 159 | vt 0.367908 1.206692 160 | vt 1.008860 1.449182 161 | vt 1.008860 1.282728 162 | vt 0.367908 1.282728 163 | vt 0.367908 1.449182 164 | vt -0.031911 1.393013 165 | vt -0.031911 1.258277 166 | vt -0.031911 1.251703 167 | vt -0.031911 1.296252 168 | vt 0.367908 1.251704 169 | vt 0.934415 1.480538 170 | vt 0.761329 1.480538 171 | vt 0.761329 1.398138 172 | vt 0.934415 1.398138 173 | vt 0.658986 0.002776 174 | vt 0.658986 0.619988 175 | vt 0.802097 0.619988 176 | vt 0.802097 0.002776 177 | vt -0.031911 1.296019 178 | vt -0.031911 1.522020 179 | vt 0.367908 1.570325 180 | vt 1.008860 1.570325 181 | vt 0.934415 1.425260 182 | vt 0.761329 1.425260 183 | vt 0.761329 1.512193 184 | vt 0.934415 1.512193 185 | vt 0.611497 0.074463 186 | vt 0.611497 0.241139 187 | vt 0.673423 0.241139 188 | vt 0.673423 0.074463 189 | vt -0.092648 1.415163 190 | vt -0.092648 1.481964 191 | vt -0.092648 1.494667 192 | vt -0.092648 1.424412 193 | vt 0.367908 1.296252 194 | vt 0.367908 1.258277 195 | vt 0.367908 1.393013 196 | vt 0.367908 1.522020 197 | vt 0.367908 1.296019 198 | vt 0.669786 1.004999 199 | vt 0.817404 1.004999 200 | vt 0.817404 0.619988 201 | vt 0.669786 0.619988 202 | vt 0.761329 1.424412 203 | vt 0.761329 1.494667 204 | vt 0.761329 1.481964 205 | vt 0.761329 1.415163 206 | vt 0.626177 1.063487 207 | vt 0.650470 1.063487 208 | vt 0.650470 0.241139 209 | vt 0.626177 0.241139 210 | vn 0.000000 -0.000000 1.000000 211 | vn 0.000000 1.000000 0.000000 212 | vn -0.929700 -0.368300 0.000000 213 | vn -0.878900 -0.476900 0.000000 214 | vn -0.000000 -0.000000 -1.000000 215 | vn -0.000000 -1.000000 0.000000 216 | vn -0.366500 0.930400 -0.000000 217 | vn 0.990100 0.140400 -0.000000 218 | vn -0.957600 -0.287900 -0.000000 219 | vn -0.003500 1.000000 -0.001200 220 | vn -0.001800 1.000000 0.000200 221 | vn -0.005400 1.000000 -0.000000 222 | vn -0.004800 1.000000 0.000100 223 | vn -0.001600 1.000000 0.000100 224 | vn -0.001600 1.000000 0.000000 225 | vn -0.001600 1.000000 -0.001300 226 | vn 0.996400 -0.085100 -0.000000 227 | vn -0.995700 0.092100 0.000000 228 | vn 0.221300 -0.975200 -0.000000 229 | vn -0.301200 -0.953600 0.000000 230 | vn -0.866000 -0.500000 -0.000000 231 | vn 0.001400 1.000000 0.000000 232 | vn 1.000000 -0.001000 -0.000000 233 | vn -0.017500 -0.999800 0.000000 234 | vn -0.985100 0.172100 0.000000 235 | vn 0.047500 0.998900 0.000000 236 | vn 0.991600 -0.129600 -0.000000 237 | vn -0.007300 -1.000000 0.000000 238 | vn 0.929700 -0.368300 -0.000000 239 | vn 0.878900 -0.476900 -0.000000 240 | vn 0.366500 0.930400 -0.000000 241 | vn -0.990100 0.140400 0.000000 242 | vn 0.957600 -0.287900 0.000000 243 | vn 0.004800 1.000000 0.000100 244 | vn 0.005400 1.000000 -0.000000 245 | vn 0.001800 1.000000 0.000200 246 | vn 0.003500 1.000000 -0.001200 247 | vn 0.001600 1.000000 0.000000 248 | vn 0.001600 1.000000 0.000100 249 | vn 0.001600 1.000000 -0.001300 250 | vn -0.996400 -0.085100 -0.000000 251 | vn 0.995700 0.092100 -0.000000 252 | vn -0.221300 -0.975200 0.000000 253 | vn 0.301200 -0.953600 -0.000000 254 | vn 0.866000 -0.500000 0.000000 255 | vn -0.001400 1.000000 0.000000 256 | vn -1.000000 -0.001000 0.000000 257 | vn 0.017500 -0.999800 0.000000 258 | vn 0.985100 0.172100 -0.000000 259 | vn -0.047500 0.998900 0.000000 260 | vn -0.991600 -0.129600 0.000000 261 | vn 0.007300 -1.000000 0.000000 262 | usemtl Standard 263 | s 1 264 | f 3/1/1 4/2/1 43/3/1 44/3/1 265 | f 3/1/2 44/3/2 45/4/2 1/5/2 266 | f 6/6/3 5/7/4 7/8/4 8/9/3 267 | f 28/10/5 27/11/5 29/12/5 30/13/5 268 | f 2/14/6 4/2/6 7/8/6 5/7/6 269 | f 4/2/1 3/1/1 8/9/1 7/8/1 270 | f 17/15/7 18/16/7 19/17/7 20/18/7 271 | f 3/19/8 1/20/8 9/21/8 10/22/8 272 | f 28/10/5 30/13/5 31/23/5 32/24/5 273 | f 6/6/3 8/9/3 12/25/9 11/26/9 274 | f 8/9/1 3/1/1 10/2/1 12/25/1 275 | f 10/2/10 9/14/11 14/27/12 13/28/13 276 | f 9/14/11 11/26/14 15/29/15 14/27/12 277 | f 11/26/14 12/25/16 16/30/14 15/29/15 278 | f 12/25/16 10/2/10 13/28/13 16/30/14 279 | f 13/31/17 14/32/17 18/33/17 17/34/17 280 | f 37/35/5 38/36/5 39/37/5 40/38/5 281 | f 15/29/18 16/30/18 20/18/18 19/17/18 282 | f 16/30/1 13/28/1 17/15/1 20/18/1 283 | f 1/5/5 45/4/5 48/4/5 22/39/5 284 | f 2/14/5 5/7/5 23/40/5 21/14/5 285 | f 5/7/5 6/6/5 24/41/5 23/40/5 286 | f 6/6/5 11/26/5 25/42/5 24/41/5 287 | f 11/26/5 9/14/5 26/43/5 25/42/5 288 | f 9/14/5 1/5/5 22/39/5 26/43/5 289 | f 22/39/2 48/4/2 42/44/2 28/10/2 290 | f 21/14/19 23/40/19 29/12/19 27/11/19 291 | f 23/40/20 24/41/20 30/13/20 29/12/20 292 | f 24/41/21 25/42/21 31/23/21 30/13/21 293 | f 25/42/22 26/43/22 32/24/22 31/23/22 294 | f 26/45/23 22/46/23 28/47/23 32/48/23 295 | f 14/27/5 15/29/5 33/49/5 34/50/5 296 | f 15/29/5 19/17/5 35/51/5 33/49/5 297 | f 19/17/5 18/16/5 36/52/5 35/51/5 298 | f 18/16/5 14/27/5 34/50/5 36/52/5 299 | f 34/50/24 33/49/24 38/36/24 37/35/24 300 | f 33/49/25 35/51/25 39/37/25 38/36/25 301 | f 35/51/26 36/52/26 40/38/26 39/37/26 302 | f 36/53/27 34/54/27 37/55/27 40/56/27 303 | f 41/44/5 27/11/5 28/10/5 42/44/5 304 | f 43/3/6 4/2/6 2/14/6 46/4/6 305 | f 46/4/5 2/14/5 21/14/5 47/4/5 306 | f 47/4/28 21/14/28 27/11/28 41/44/28 307 | f 92/3/1 91/3/1 52/57/1 51/58/1 308 | f 49/59/2 93/4/2 92/3/2 51/58/2 309 | f 56/60/29 55/61/30 53/62/30 54/63/29 310 | f 78/64/5 77/65/5 75/66/5 76/67/5 311 | f 53/62/6 55/61/6 52/57/6 50/68/6 312 | f 55/61/1 56/60/1 51/58/1 52/57/1 313 | f 68/69/31 67/70/31 66/71/31 65/72/31 314 | f 58/73/32 57/74/32 49/75/32 51/76/32 315 | f 80/77/5 79/78/5 78/64/5 76/67/5 316 | f 59/79/33 60/80/33 56/60/29 54/63/29 317 | f 60/80/1 58/57/1 51/58/1 56/60/1 318 | f 61/81/34 62/82/35 57/68/36 58/57/37 319 | f 62/82/35 63/83/38 59/79/39 57/68/36 320 | f 63/83/38 64/84/39 60/80/40 59/79/39 321 | f 64/84/39 61/81/34 58/57/37 60/80/40 322 | f 65/85/41 66/86/41 62/87/41 61/88/41 323 | f 88/89/5 87/90/5 86/91/5 85/92/5 324 | f 67/70/42 68/69/42 64/84/42 63/83/42 325 | f 68/69/1 65/72/1 61/81/1 64/84/1 326 | f 70/93/5 96/4/5 93/4/5 49/59/5 327 | f 69/68/5 71/94/5 53/62/5 50/68/5 328 | f 71/94/5 72/95/5 54/63/5 53/62/5 329 | f 72/95/5 73/96/5 59/79/5 54/63/5 330 | f 73/96/5 74/97/5 57/68/5 59/79/5 331 | f 74/97/5 70/93/5 49/59/5 57/68/5 332 | f 76/67/2 90/44/2 96/4/2 70/93/2 333 | f 75/66/43 77/65/43 71/94/43 69/68/43 334 | f 77/65/44 78/64/44 72/95/44 71/94/44 335 | f 78/64/45 79/78/45 73/96/45 72/95/45 336 | f 79/78/46 80/77/46 74/97/46 73/96/46 337 | f 80/98/47 76/99/47 70/100/47 74/101/47 338 | f 82/102/5 81/103/5 63/83/5 62/82/5 339 | f 81/103/5 83/104/5 67/70/5 63/83/5 340 | f 83/104/5 84/105/5 66/71/5 67/70/5 341 | f 84/105/5 82/102/5 62/82/5 66/71/5 342 | f 85/92/48 86/91/48 81/103/48 82/102/48 343 | f 86/91/49 87/90/49 83/104/49 81/103/49 344 | f 87/90/50 88/89/50 84/105/50 83/104/50 345 | f 88/106/51 85/107/51 82/108/51 84/109/51 346 | f 90/44/5 76/67/5 75/66/5 89/44/5 347 | f 94/4/6 50/68/6 52/57/6 91/3/6 348 | f 95/4/5 69/68/5 50/68/5 94/4/5 349 | f 89/44/52 75/66/52 69/68/52 95/4/52 350 | -------------------------------------------------------------------------------- /a-frame-assets/sky/CGSkies_0347_free.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/a-frame-assets/sky/CGSkies_0347_free.jpg -------------------------------------------------------------------------------- /audio-play/README.md: -------------------------------------------------------------------------------- 1 | # Audio Playback Demo 2 | 3 | This demonstrates a simple audio playback on user input. 4 | 5 | ## Instructions 6 | 7 | * Look at the duck! 8 | -------------------------------------------------------------------------------- /audio-play/audio/duck-quack.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/audio-play/audio/duck-quack.mp3 -------------------------------------------------------------------------------- /audio-play/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: a-frame 3 | title: Audio Play 4 | description: Simple audio playback demo 5 | author: Peter O'Shaughnessy 6 | scripts: [ 7 | '/a-frame-demos/aframe-v0.4.0.min.js' 8 | ] 9 | --- 10 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /audio-play/js/demo.js: -------------------------------------------------------------------------------- 1 | var sceneEl = document.getElementById('scene'); 2 | var videoEl = document.getElementById('video'); 3 | var introPrompt = document.getElementById('intro'); 4 | var startButton = document.getElementById('btn-start'); 5 | var sceneLoaded = false; 6 | 7 | scene.addEventListener('loaded', function() { 8 | startButton.innerText = 'Click to begin'; 9 | sceneLoaded = true; 10 | }); 11 | 12 | /** 13 | * NB. This gets around the Chromium Android restriction that video requires a user interaction to play. 14 | */ 15 | startButton.addEventListener('click', function() { 16 | if (sceneLoaded) { 17 | videoEl.play(); 18 | introPrompt.style.display = 'none'; 19 | } 20 | }); 21 | -------------------------------------------------------------------------------- /audio-play/models/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Rubber duck model by Peter O'Shaughnessy (made using Clara.io). 2 | 3 | License: CC BY 4.0. 4 | https://creativecommons.org/licenses/by/4.0/ 5 | -------------------------------------------------------------------------------- /audio-play/models/rubber-duck.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 3 3 | 4 | newmtl 0 5 | Ns 96.078431 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.000000 0.000000 0.000000 8 | Ks 0.001176 0.001176 0.001176 9 | Ni 1.000000 10 | d 1.000000 11 | illum 2 12 | 13 | newmtl e5740c 14 | Ns 96.078431 15 | Ka 0.000000 0.000000 0.000000 16 | Kd 0.898039 0.454902 0.047059 17 | Ks 0.001176 0.001176 0.001176 18 | Ni 1.000000 19 | d 1.000000 20 | illum 2 21 | 22 | newmtl e5ca3a 23 | Ns 96.078431 24 | Ka 0.000000 0.000000 0.000000 25 | Kd 0.898039 0.792157 0.227451 26 | Ks 0.001176 0.001176 0.001176 27 | Ni 1.000000 28 | d 1.000000 29 | illum 2 30 | -------------------------------------------------------------------------------- /audio-play/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/audio-play/screenshot.jpg -------------------------------------------------------------------------------- /flickr-carousel/README.md: -------------------------------------------------------------------------------- 1 | # A-Frame Flickr Carousel 2 | 3 | A virtual reality web app demonstration, using [A-Frame](https://aframe.io/). 4 | 5 | It pulls a set of photos from Flickr dynamically and displays them in a circular carousel. 6 | (Llama photos are optional, but recommended). 7 | 8 | Click to spin the carousel to the next photo, or just look around with a WebVR-compatible headset on. 9 | 10 | ## Local development 11 | 12 | Please note that the `index.html` file in this folder is intended to be transformed by Jekyll, 13 | to fit in well with the rest of this collection of demos. See the [README at the root of this 14 | repository](https://github.com/SamsungInternet/a-frame-demos) for instructions. 15 | 16 | If you would prefer to view the version with raw HTML, without requiring Jekyll, it is available at: 17 | [github.com/poshaughnessy/aframe-flickr-carousel](https://github.com/poshaughnessy/aframe-flickr-carousel). 18 | 19 | ## If the carousel does not load... 20 | 21 | Please update the Flickr API key in index.html. 22 | 23 | To generate a new one, visit: https://www.flickr.com/services/api/explore/flickr.photos.search. 24 | 25 | ## Credits 26 | 27 | * [360 degree sky image by Peter Gawthrop (CC BY-NC-SA 2.0)](https://www.flickr.com/photos/gawthrop/3559516146). 28 | -------------------------------------------------------------------------------- /flickr-carousel/components/aframe-layout-component.min.js: -------------------------------------------------------------------------------- 1 | !function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e){function i(t,e,i){for(var n=[],r=Math.ceil(e/t.columns),o=0;r>o;o++)for(var a=0;ar;r++){var o=r*(2*Math.PI)/e;n.push([i.x+t.radius*Math.cos(o),i.y,i.z+t.radius*Math.sin(o)])}return n}function r(t,e,n){return t.columns=e,i(t,e,n)}function o(t,e,i){return u([[1,0,0],[0,1,0],[0,0,1],[-1,0,0],[0,-1,0],[0,0,-1]],i,t.radius/2)}function a(t,e,i){var n=(1+Math.sqrt(5))/2,r=1/n,o=2-n,a=-1*r,s=-1*o;return u([[-1,o,0],[-1,s,0],[0,-1,o],[0,-1,s],[0,1,o],[0,1,s],[1,o,0],[1,s,0],[r,r,r],[r,r,a],[r,a,r],[r,a,a],[o,0,1],[o,0,-1],[a,r,r],[a,r,a],[a,a,r],[a,a,a],[s,0,1],[s,0,-1]],i,t.radius/2)}function s(t,e,i){var n=Math.sqrt(3),r=-1/Math.sqrt(3),o=2*Math.sqrt(2/3);return u([[0,0,n+r],[-1,0,r],[1,0,r],[0,o,0]],i,t.radius/2)}function u(t,e,i){return e=[e.x,e.y,e.z],t.map(function(t){return t.map(function(t,n){return t*i+e[n]})})}function c(t,e){t.forEach(function(t,i){var n=e[i];t.setAttribute("position",{x:n[0],y:n[1],z:n[2]})})}AFRAME.registerComponent("layout",{schema:{columns:{"default":1,min:0,"if":{type:["box"]}},margin:{"default":1,min:0,"if":{type:["box","line"]}},radius:{"default":1,min:0,"if":{type:["circle","cube","dodecahedron","pyramid"]}},type:{"default":"line",oneOf:["box","circle","cube","dodecahedron","line","pyramid"]}},init:function(){var t=this,e=this.el;this.children=e.getChildEntities(),this.initialPositions=[],this.children.forEach(function(e){function i(){var i=e.getComputedAttribute("position");t.initialPositions.push([i.x,i.y,i.z])}return e.hasLoaded?i():void e.addEventListener("loaded",i)}),e.addEventListener("child-attached",function(i){i.detail.el.parentNode===e&&(t.children.push(i.detail.el),t.update())})},update:function(t){var e,u,d=this.children,h=this.data,l=this.el,f=d.length,p=l.getComputedAttribute("position");switch(h.type){case"box":e=i;break;case"circle":e=n;break;case"cube":e=o;break;case"dodecahedron":e=a;break;case"pyramid":e=s;break;default:e=r}u=e(h,f,p),c(d,u)},remove:function(){this.el.removeEventListener("child-attached",this.childAttachedCallback),c(this.children,this.initialPositions)}}),t.exports.getBoxPositions=i,t.exports.getCirclePositions=n,t.exports.getLinePositions=r,t.exports.getCubePositions=o,t.exports.getDodecahedronPositions=a,t.exports.getPyramidPositions=s}]); -------------------------------------------------------------------------------- /flickr-carousel/components/aframe-look-at-component.min.js: -------------------------------------------------------------------------------- 1 | !function(t){function e(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var o={};return e.m=t,e.c=o,e.p="",e(0)}([function(t,e){var o=AFRAME.utils.debug,n=AFRAME.utils.coordinates,r=o("components:look-at:warn"),i=n.isCoordinate;delete AFRAME.components["look-at"],AFRAME.registerComponent("look-at",{schema:{"default":"",parse:function(t){return i(t)||"object"==typeof t?n.parse(t):t},stringify:function(t){return"object"==typeof t?n.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3},update:function(){var t,e=this,o=e.data,n=e.el.object3D;return!o||"object"==typeof o&&!Object.keys(o).length?e.remove():"object"==typeof o?n.lookAt(new THREE.Vector3(o.x,o.y,o.z)):(t=e.el.sceneEl.querySelector(o),t?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",function(){e.beginTracking(t)}):void r('"'+o+'" does not point to a valid entity to look-at'))},tick:function(t){var e=this.target3D;return e?this.el.object3D.lookAt(this.vector.setFromMatrixPosition(e.matrixWorld)):void 0},beginTracking:function(t){this.target3D=t.object3D}})}]); -------------------------------------------------------------------------------- /flickr-carousel/components/flickr-search.js: -------------------------------------------------------------------------------- 1 | var API_URL = 'https://api.flickr.com/services/rest/?method=flickr.photos.search&safe_search=&format=json&nojsoncallback=1'; 2 | 3 | /** 4 | * For URL format details, see: https://www.flickr.com/services/api/misc.urls.html 5 | */ 6 | function processImageUrls(photos) { 7 | 8 | var imageSources = []; 9 | 10 | for (var i=0; i < photos.length; i++) { 11 | var photo = photos[i]; 12 | // This would be neater as a template literal, but that needs support/transpilation/polyfilling 13 | var domain = 'https://farm'+photo.farm+'.staticflickr.com'; 14 | var path = '/'+photo.server+'/'; 15 | var filename = photo.id+'_'+photo.secret+'_z.jpg'; 16 | imageSources.push(domain + path + filename); 17 | } 18 | 19 | return imageSources; 20 | 21 | } 22 | 23 | function generateImage(src) { 24 | 25 | var imageEl = document.createElement('a-image'); 26 | imageEl.setAttribute('src', src); 27 | imageEl.setAttribute('width', 1.25); 28 | imageEl.setAttribute('height', 1); 29 | 30 | // Rotate the image to face the centre 31 | imageEl.setAttribute('look-at', '0 0.75 0'); 32 | 33 | return imageEl; 34 | 35 | } 36 | 37 | 38 | AFRAME.registerComponent('flickr-search', { 39 | schema: { 40 | search: {default: ''}, 41 | numResults: {default: 10}, 42 | apiKey: {default: ''} 43 | }, 44 | 45 | init: function() { 46 | this.images = []; 47 | }, 48 | 49 | update: function() { 50 | 51 | var self = this; 52 | var el = this.el; 53 | 54 | if (!this.data.apiKey) { 55 | // No api key yet - it may take a couple of updates to come through 56 | return; 57 | } 58 | 59 | fetch(API_URL+'&text='+this.data.search+'&per_page='+this.data.numResults+'&api_key='+this.data.apiKey) 60 | .then(function(response) { 61 | return response.json(); 62 | }) 63 | .then(function(json) { 64 | 65 | if (!json || !json.photos || !json.photos.photo) { 66 | console.log('Invalid JSON', json); 67 | throw 'Invalid JSON response'; 68 | } 69 | 70 | var imageSources = processImageUrls(json.photos.photo); 71 | 72 | for (var i = 0; i < imageSources.length; i++) { 73 | var aImage = generateImage(imageSources[i]); 74 | self.images.push(aImage); 75 | el.appendChild(aImage); 76 | } 77 | 78 | }) 79 | .catch(function (err) { 80 | console.error('Unable to fetch photos', err); 81 | }); 82 | 83 | }, 84 | 85 | remove: function() { 86 | this.images.forEach(function(imageEl) { 87 | this.el.remove(imageEl); 88 | }); 89 | } 90 | }); 91 | -------------------------------------------------------------------------------- /flickr-carousel/components/rotate-on-click.js: -------------------------------------------------------------------------------- 1 | var DEGS_TO_RADIANS = Math.PI / 180; 2 | 3 | AFRAME.registerComponent('rotate-on-click', { 4 | schema: { 5 | degrees: {default: 90}, 6 | duration: {default: 500} 7 | }, 8 | init: function() { 9 | 10 | var self = this; 11 | 12 | this.el.addEventListener('click', function() { 13 | 14 | var targetRotation = self.el.object3D.rotation.y + self.data.degrees * DEGS_TO_RADIANS; 15 | 16 | new AFRAME.TWEEN.Tween(self.el.object3D.rotation) 17 | .to({y: targetRotation}, self.data.duration) 18 | .start(); 19 | }); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /flickr-carousel/entities/flickr-carousel.js: -------------------------------------------------------------------------------- 1 | AFRAME.registerPrimitive('a-flickr-carousel', { 2 | defaultComponents: { 3 | 'flickr-search': { 4 | search: '', 5 | apiKey: '', 6 | numResults: 15 7 | }, 8 | 'rotate-on-click': { 9 | degrees: 24 10 | }, 11 | 'layout': { 12 | type: 'circle' 13 | } 14 | }, 15 | mappings: { 16 | search: 'flickr-search.search', 17 | 'num-results': 'flickr-search.numResults', 18 | 'api-key': 'flickr-search.apiKey', 19 | degrees: 'rotate-on-click.degrees', 20 | duration: 'rotate-on-click.duration', 21 | radius: 'layout.radius' 22 | } 23 | }); 24 | -------------------------------------------------------------------------------- /flickr-carousel/images/sky_by_gawthrop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/flickr-carousel/images/sky_by_gawthrop.jpg -------------------------------------------------------------------------------- /flickr-carousel/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: a-frame 3 | title: Flickr Carousel 4 | description: For viewing images from Flickr in a 3D carousel 5 | author: Peter O'Shaughnessy 6 | scripts: [ 7 | '/a-frame-demos/aframe.min.js', # A-Frame 0.3 8 | 'components/aframe-layout-component.min.js', 9 | 'components/aframe-look-at-component.min.js', 10 | 'components/flickr-search.js', 11 | 'components/rotate-on-click.js', 12 | 'entities/flickr-carousel.js' 13 | ] 14 | --- 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /flickr-carousel/js/main.js: -------------------------------------------------------------------------------- 1 | // To generate an API URL, visit: https://www.flickr.com/services/api/explore/flickr.photos.search 2 | var API_URL = 'https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=e0a100af1e50282bf685a422d5aa22c4&text=llama+farm&safe_search=&per_page=15&format=json&nojsoncallback=1'; 3 | 4 | var NUM_PHOTOS = 15; 5 | var DEGS_TO_RADIANS = Math.PI / 180; 6 | var CAROUSEL_ROTATE_RADIANS = 360 * DEGS_TO_RADIANS / NUM_PHOTOS; 7 | 8 | var scene = document.getElementById('scene'); 9 | var assets = document.querySelector('a-assets'); 10 | var imageContainer = document.getElementById('imageContainer'); 11 | 12 | var currentRotationY = 18 * DEGS_TO_RADIANS; 13 | var imageSrcArray = []; 14 | 15 | var carouselTween; 16 | 17 | function generateImage(id, src) { 18 | 19 | var imgEl = document.createElement('img'); 20 | imgEl.id = 'img' + id; 21 | imgEl.crossOrigin = "anonymous"; 22 | imgEl.setAttribute('src', src); 23 | 24 | assets.appendChild(imgEl); 25 | 26 | var aframeImageEl = document.createElement('a-image'); 27 | aframeImageEl.setAttribute('src', '#img' + id); 28 | aframeImageEl.setAttribute('width', 1.25); 29 | aframeImageEl.setAttribute('height', 1); 30 | 31 | // Rotate the image to face the centre 32 | aframeImageEl.setAttribute('look-at', '0 0.75 0'); 33 | 34 | imageContainer.appendChild(aframeImageEl); 35 | 36 | } 37 | 38 | function generateImages() { 39 | 40 | for (var i=0; i < imageSrcArray.length; i++) { 41 | generateImage(i, imageSrcArray[i]); 42 | } 43 | 44 | console.log('Generated images'); 45 | 46 | } 47 | 48 | /** 49 | * For URL format details, see: https://www.flickr.com/services/api/misc.urls.html 50 | */ 51 | function processImageUrls(photos) { 52 | 53 | imageSrcArray = []; 54 | 55 | for (var i=0; i < photos.length; i++) { 56 | var photo = photos[i]; 57 | // This would be neater as a template literal, but that needs support/transpilation/polyfilling 58 | var domain = 'https://farm'+photo.farm+'.staticflickr.com'; 59 | var path = '/'+photo.server+'/'; 60 | var filename = photo.id+'_'+photo.secret+'_z.jpg'; 61 | imageSrcArray.push(domain + path + filename); 62 | } 63 | 64 | console.log('Processed URLs'); 65 | 66 | } 67 | 68 | function animate(time) { 69 | if (carouselTween) { 70 | carouselTween.update(time); 71 | } 72 | requestAnimationFrame(animate); 73 | } 74 | 75 | function setupTween() { 76 | 77 | var targetRotation = currentRotationY + CAROUSEL_ROTATE_RADIANS; 78 | 79 | carouselTween = new AFRAME.TWEEN.Tween(imageContainer.object3D.rotation) 80 | .to({y: targetRotation}, 500) 81 | .onComplete(function() { 82 | currentRotationY = targetRotation; 83 | }); 84 | } 85 | 86 | function setupAnimation() { 87 | 88 | scene.addEventListener('click', function () { 89 | setupTween(); 90 | carouselTween.start(); 91 | }); 92 | 93 | requestAnimationFrame(animate); 94 | 95 | } 96 | 97 | function fetchImages() { 98 | 99 | fetch(API_URL) 100 | .then(function(response) { 101 | return response.json(); 102 | }) 103 | .then(function(json) { 104 | processImageUrls(json.photos.photo); 105 | generateImages(); 106 | }) 107 | .catch(function (err) { 108 | console.error('Unable to fetch photos', err); 109 | }); 110 | 111 | } 112 | 113 | function init() { 114 | setupAnimation(); 115 | fetchImages(); 116 | } 117 | 118 | init(); 119 | -------------------------------------------------------------------------------- /images/icon-master.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/images/icon-master.xcf -------------------------------------------------------------------------------- /images/icon192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/images/icon192.png -------------------------------------------------------------------------------- /images/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/images/icon512.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: store 3 | title: Samsung A-Frame Demos 4 | --- 5 | 6 |

Samsung A-Frame Demos

7 | 8 |

9 | This site contains links to demos prodcuced to test or build with a-frame. 10 |

11 | 12 | 16 | 17 |

Web Apps

18 | 19 | {% for page in site.pages %} 20 | {% if page.meta %} 21 |
22 |
23 | 24 | {{ page.title }}
25 | {{ page.description }} 26 |
27 | {% endif %} 28 | {% endfor %} 29 | 30 |

Demos

31 | 32 | 33 | {% for page in site.pages %} 34 | {% if page.meta == null %} 35 | {% if page.layout == 'a-frame' %} 36 |
37 | {{ page.title }} -  {{ page.description }} 38 |
39 | {% endif %} 40 | {% endif %} 41 | {% endfor %} -------------------------------------------------------------------------------- /index.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | html, body { 5 | font-family: sans; 6 | } 7 | 8 | .store-item { 9 | display: block; 10 | display: flex; 11 | 12 | .store-icon { 13 | width: 5em; 14 | display: inline-block; 15 | text-align: center; 16 | 17 | img { 18 | width: 100%; 19 | } 20 | 21 | } 22 | 23 | .description { 24 | padding: 1em; 25 | float: right; 26 | } 27 | 28 | :after { 29 | content: ""; 30 | display: block; 31 | clear: both; 32 | } 33 | } -------------------------------------------------------------------------------- /kitchen/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: a-frame 3 | title: Lick the Whisk 4 | description: Scene for viewing recipes 5 | image: https://cdn-images-1.medium.com/max/1600/1*5C86U-OZFf4eYedrsIEjqw.png 6 | scripts: [ 7 | 8 | # A-Frame 9 | '/a-frame-demos/aframe.min.js', # A-Frame 0.3 10 | 11 | # Required to load the demo model 12 | 'https://cdn.rawgit.com/mrdoob/three.js/r79/examples/js/loaders/BinaryLoader.js', 13 | 14 | # JSON loader 15 | 'https://cdn.rawgit.com/donmccurdy/aframe-extras/v2.3.0/dist/aframe-extras.loaders.min.js' 16 | ] 17 | --- 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /kitchen/scene-materials.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Update textures to Baked ones and add envmap 3 | */ 4 | 5 | var textureLoader = new THREE.TextureLoader(); 6 | var cubeTextureLoader = new THREE.CubeTextureLoader(); 7 | var sceneEl = document.getElementsByTagName('a-scene')[0]; 8 | var scene = sceneEl.object3D; 9 | var jsonEl = document.querySelector('[three-model]'); 10 | 11 | /** 12 | * Helper for picking objects from a scene 13 | * @param {Object3d} root root Object3d e.g. a scene or a mesh 14 | * @param {[String]} namesIn list of namesd to find e.g. 'Camera' or 'Floor' 15 | * @return {Object map} map of names to objects {'Camera': (THREE.Camera with name Camera), 'Floor': (THREE.Mesh with name Floor)} 16 | */ 17 | function pickObjectsHelper(root, namesIn) { 18 | 19 | var collection = {}; 20 | var names = new Set(namesIn); 21 | 22 | (function pickObjects(root) { 23 | if (root.children) { 24 | root.children.forEach(function (node) { 25 | if (names.has(node.name)) { 26 | collection[node.name] = node; 27 | names.delete(node.name); 28 | } 29 | if (names.size) { 30 | pickObjects(node); 31 | } 32 | }); 33 | } 34 | })(root); 35 | 36 | if (names.size) { 37 | console.warn('Not all objects found: ' + names.values().next().value + ' missing'); 38 | } 39 | 40 | return collection; 41 | } 42 | 43 | jsonEl.addEventListener('model-loaded', function () { 44 | // Select objects from the scene for later processing. 45 | var toTexture = pickObjectsHelper(scene, ['Room', 'Counter', 'Cake', 'Swirl.000', 'Swirl.001', 'Swirl.002', 'Swirl.003', 'Swirl.004', 'Swirl.005', 'Swirl.006', 'Swirl.007', 'Swirl.008', 'Swirl.009']); 46 | var toShiny = pickObjectsHelper(scene, ['LickTheWhisk', 'Whisk', 'SaucePan', 'SaucePan.001', 'SaucePan.002', 'SaucePan.003', 'Fridge']); 47 | Object.keys(toTexture).forEach(function (name) { 48 | textureLoader.load('/a-frame-demos/a-frame-assets/kitchen/' + name.split('.')[0] + 'Bake.png', function (map) { 49 | toTexture[name].material = new THREE.MeshBasicMaterial({map: map}) 50 | }); 51 | }); 52 | 53 | var path = "/a-frame-demos/a-frame-assets/kitchen/envmap/"; 54 | var format = '.png'; 55 | var urls = [ 56 | path + '0004' + format, // +x 57 | path + '0002' + format, // -x 58 | path + '0006' + format, // +y 59 | path + '0005' + format, // -y 60 | path + '0001' + format, // +z 61 | path + '0003' + format // -z 62 | ]; 63 | cubeTextureLoader.load(urls, function (envMap) { 64 | var copper = new THREE.MeshPhongMaterial( { color: 0xff9999, specular: 0x772222, envMap: envMap, combine: THREE.MixOperation, reflectivity: 0.3, metal: true} ); 65 | var aluminium = new THREE.MeshPhongMaterial( { color: 0x888888, specular: 0x999999, envMap: envMap, combine: THREE.MixOperation, reflectivity: 0.3, metal: true} ); 66 | var chocolate = new THREE.MeshPhongMaterial( { color: toShiny.LickTheWhisk.material.color, specular: 0x999999, envMap: envMap, combine: THREE.MixOperation, reflectivity: 0.3, metal: true} ); 67 | 68 | toShiny['SaucePan'].material = copper; 69 | toShiny['SaucePan.001'].material = copper; 70 | toShiny['SaucePan.002'].material = copper; 71 | toShiny['SaucePan.003'].material = copper; 72 | toShiny.Whisk.material = aluminium; 73 | toShiny.LickTheWhisk.material = chocolate; 74 | 75 | textureLoader.load('/a-frame-demos/a-frame-assets/kitchen/FridgeBake.png', function (map) { 76 | toShiny.Fridge.material = new THREE.MeshPhongMaterial({map:map, envMap:envMap, combine: THREE.MixOperation, specular: 0x999999, reflectivity: 0.3, metal: true, side: THREE.DoubleSide }); 77 | }); 78 | 79 | }); 80 | 81 | }); -------------------------------------------------------------------------------- /link-to-copresence.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: a-frame 3 | redirect_to: https://copresence.herokuapp.com/ 4 | title: Copresence 5 | description: An experiment in using webrtc to perform copresence 6 | --- -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | { 4 | "name": "A-Frame Demos", 5 | "shortname": "Demos", 6 | "icons": [ 7 | { 8 | "src": "{{ site.baseurl }}/images/icon512.png", 9 | "sizes": "192x192", 10 | "type": "image/png" 11 | }, 12 | { 13 | "src": "{{ site.baseurl }}/images/icon192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | } 17 | ], 18 | "start_url": "{{ site.baseurl }}/", 19 | "display": "standalone", 20 | "orientation": "portrait", 21 | "background_color": "white", 22 | "theme_color": "#8953D8" 23 | } 24 | -------------------------------------------------------------------------------- /racer/curve.js: -------------------------------------------------------------------------------- 1 | 2 | /* For dealing with spline curves */ 3 | 4 | var __tempVector1 = new THREE.Vector3(); 5 | var __tempVector2 = new THREE.Vector3(); 6 | var up = new THREE.Vector3(0, 1, 0); 7 | var zAxis = new THREE.Vector3(0, 0, 1); 8 | var degToRad = THREE.Math.degToRad; 9 | 10 | AFRAME.registerComponent('curve-point', { 11 | 12 | dependencies: ['position'], 13 | 14 | schema: { 15 | position: {type: 'vec3', default: '0 0 0'} 16 | }, 17 | 18 | init: function () { 19 | var el = this.el; 20 | while (el && !el.matches('[curve]')) el = el.parentNode; 21 | this.parentCurve = el; 22 | }, 23 | 24 | update: function () { 25 | this.el.object3D.position.copy(this.data.position); 26 | this.parentCurve.updateComponent('curve'); 27 | }, 28 | 29 | remove: function () { 30 | this.update(); 31 | } 32 | 33 | }); 34 | 35 | AFRAME.registerComponent('curve', { 36 | 37 | schema: { 38 | 39 | // CatmullRom 40 | // Spline 41 | // CubicBezier 42 | // QuadraticBezier 43 | // Line 44 | type: { 45 | default: 'CatmullRom' 46 | } 47 | }, 48 | 49 | update: function () { 50 | this.needsUpdate = true; 51 | }, 52 | 53 | tick: function () { 54 | if (!this.needsUpdate) return; 55 | this.needsUpdate = false; 56 | this.threeConstructor = THREE[this.data.type + 'Curve3']; 57 | 58 | var points = Array.from(this.el.querySelectorAll('a-curve-point')).filter(function (a) { return a.tagName === 'A-CURVE-POINT' }); 59 | 60 | if (points.length <= 1) return; 61 | 62 | this.points = points.map(function (a) { 63 | if (a.x !== undefined && a.y !== undefined && a.z !== undefined) { 64 | return a; 65 | } 66 | 67 | // flush position information to object 3D 68 | 69 | a.updateComponent('position'); 70 | return a.object3D.getWorldPosition() 71 | }); 72 | 73 | // apply the points as ags to the Beziers 74 | if (this.data.type.match(/QuadraticBezier|CubicBezier|Line/)) { 75 | this.curve = (Function.prototype.bind.apply(this.threeConstructor, this.points)); 76 | } else { 77 | if (!this.threeConstructor) { 78 | this.pause(); 79 | throw ('No Three constructor of type (case sensitive): ' + this.data.type + 'Curve3'); 80 | } 81 | this.curve = new this.threeConstructor(this.points); 82 | } 83 | 84 | this.el.emit('curve-updated'); 85 | 86 | this.ready = true; 87 | }, 88 | 89 | remove: function () { 90 | this.curve = null; 91 | this.points = null; 92 | this.ready = false; 93 | }, 94 | 95 | closestPointInLocalSpace: function closestPoint(point, resolution, testPoint, currentRes) { 96 | if (!this.ready) throw Error('Curve not instantiated yet.'); 97 | resolution = resolution || 0.1 / this.curve.getLength(); 98 | currentRes = currentRes || 0.5; 99 | testPoint = testPoint || 0.5; 100 | currentRes /= 2; 101 | var aTest = testPoint + currentRes; 102 | var bTest = testPoint - currentRes; 103 | var a = this.curve.getPointAt(aTest); 104 | var b = this.curve.getPointAt(bTest); 105 | var aDistance = a.distanceTo(point); 106 | var bDistance = b.distanceTo(point); 107 | var aSmaller = aDistance < bDistance; 108 | if (currentRes < resolution) { 109 | 110 | var tangent = this.curve.getTangentAt(aSmaller ? aTest : bTest); 111 | if (currentRes < resolution) return { 112 | result: aSmaller ? aTest : bTest, 113 | location: aSmaller ? a : b, 114 | distance: aSmaller ? aDistance : bDistance, 115 | normal: normalFromTangent(tangent), 116 | tangent: tangent 117 | }; 118 | } 119 | if (aDistance < bDistance) { 120 | return this.closestPointInLocalSpace(point, resolution, aTest, currentRes); 121 | } else { 122 | return this.closestPointInLocalSpace(point, resolution, bTest, currentRes); 123 | } 124 | } 125 | }); 126 | 127 | 128 | var tempQuaternion = new THREE.Quaternion(); 129 | function normalFromTangent(tangent) { 130 | var lineEnd = new THREE.Vector3(0, 1, 0); 131 | tempQuaternion.setFromUnitVectors(zAxis, tangent); 132 | lineEnd.applyQuaternion(tempQuaternion); 133 | return lineEnd; 134 | } 135 | 136 | AFRAME.registerShader('line', { 137 | schema: {}, 138 | 139 | init: function (data) { 140 | this.material = new THREE.LineBasicMaterial(data); 141 | } 142 | }); 143 | 144 | AFRAME.registerComponent('draw-curve', { 145 | 146 | dependencies: ['curve', 'material '], 147 | 148 | schema: { 149 | curve: { type: 'selector' }, 150 | spacing: { default: 1 }, 151 | tangent: { default: false }, 152 | normal: { default: true } 153 | }, 154 | 155 | init: function () { 156 | this.data.curve.addEventListener('curve-updated', this.update.bind(this)); 157 | }, 158 | 159 | update: function () { 160 | if (this.data.curve) { 161 | this.curve = this.data.curve.components.curve; 162 | } else if (this.components.curve.curve) { 163 | this.curve = this.components.curve; 164 | } 165 | 166 | if (this.curve.curve) { 167 | 168 | var length = this.curve.curve.getLength(); 169 | var start = 0; 170 | var end = length; 171 | 172 | var counter = start 173 | var tangent; 174 | var line; 175 | var lineEnd; 176 | var tangentGeometry; 177 | var normalGeometry; 178 | var mesh = this.el.getOrCreateObject3D('mesh', THREE.Line); 179 | var geometry = mesh.geometry = new THREE.Geometry(); 180 | 181 | while (counter < end) { 182 | var p = this.curve.curve.getPointAt(counter / length); 183 | geometry.vertices.push(p); 184 | 185 | if (this.data.tangent) { 186 | tangentGeometry = new THREE.Geometry(); 187 | 188 | lineEnd = new THREE.Vector3(); 189 | lineEnd.copy(p); 190 | lineEnd.add(this.curve.curve.getTangentAt(counter / length).normalize().multiplyScalar(5)); 191 | 192 | tangentGeometry.vertices.push(new THREE.Vector3().copy(p)); 193 | tangentGeometry.vertices.push(lineEnd); 194 | 195 | line = new THREE.Line( 196 | tangentGeometry, 197 | new THREE.LineBasicMaterial({ 198 | color: 'green' 199 | }) 200 | ); 201 | 202 | mesh.add(line); 203 | } 204 | 205 | if (this.data.normal) { 206 | normalGeometry = new THREE.Geometry(); 207 | lineEnd = normalFromTangent(this.curve.curve.getTangentAt(counter / length).normalize()); 208 | lineEnd.add(p); 209 | 210 | normalGeometry.vertices.push(new THREE.Vector3().copy(p)); 211 | normalGeometry.vertices.push(lineEnd); 212 | 213 | line = new THREE.Line( 214 | normalGeometry, 215 | new THREE.LineBasicMaterial({ 216 | color: 'white' 217 | }) 218 | ); 219 | 220 | mesh.add(line); 221 | } 222 | 223 | counter += this.data.spacing; 224 | } 225 | } 226 | }, 227 | 228 | remove: function () { 229 | 230 | this.el.getObject3D('mesh').geometry = new THREE.Geometry(); 231 | } 232 | 233 | }); 234 | 235 | AFRAME.registerComponent('clone-along-curve', { 236 | 237 | dependencies: ['curve'], 238 | 239 | schema: { 240 | curve: { type: 'selector' }, 241 | spacing: { default: 1 }, 242 | rotation: { 243 | type: 'vec3', 244 | default: '0 0 0' 245 | }, 246 | scale: { 247 | type: 'vec3', 248 | default: '1 1 1' 249 | } 250 | }, 251 | 252 | init: function () { 253 | this.el.addEventListener('model-loaded', this.update.bind(this)); 254 | this.data.curve.addEventListener('curve-updated', this.update.bind(this)); 255 | }, 256 | 257 | update: function () { 258 | this.remove(); 259 | if (this.data.curve) { 260 | this.curve = this.data.curve.components.curve; 261 | } else if (this.components.curve.curve) { 262 | this.curve = this.components.curve; 263 | } 264 | }, 265 | 266 | tick: function () { 267 | if (!this.el.getObject3D('clones') && this.curve) { 268 | 269 | var mesh = this.el.getObject3D('mesh'); 270 | 271 | 272 | var length = this.curve.curve.getLength(); 273 | var start = 0; 274 | var end = length; 275 | var counter = start; 276 | 277 | var cloneMesh = this.el.getOrCreateObject3D('clones', THREE.Group); 278 | 279 | var parent = new THREE.Object3D(); 280 | mesh.scale.set(this.data.scale.x, this.data.scale.y, this.data.scale.z); 281 | mesh.rotation.set(degToRad(this.data.rotation.x), degToRad(this.data.rotation.y), degToRad(this.data.rotation.z)); 282 | mesh.rotation.order = 'YXZ'; 283 | 284 | parent.add(mesh); 285 | 286 | while (counter < end) { 287 | 288 | var child = parent.clone(true); 289 | 290 | child.position.copy( this.curve.curve.getPointAt(counter/length) ); 291 | 292 | tangent = this.curve.curve.getTangentAt(counter/length).normalize(); 293 | 294 | child.quaternion.setFromUnitVectors(zAxis, tangent); 295 | 296 | cloneMesh.add(child); 297 | 298 | counter += this.data.spacing; 299 | } 300 | } 301 | }, 302 | 303 | remove: function () { 304 | this.curve = null; 305 | this.el.removeObject3D('clones'); 306 | } 307 | 308 | }); 309 | 310 | AFRAME.registerPrimitive('a-draw-curve', { 311 | defaultComponents: { 312 | 'draw-curve': {}, 313 | 'material': {} 314 | }, 315 | mappings: { 316 | curve: 'draw-curve.curve', 317 | material: 'material' 318 | } 319 | }); 320 | 321 | AFRAME.registerPrimitive('a-curve-point', { 322 | defaultComponents: { 323 | 'curve-point': { 324 | position: '0 0 0' 325 | } 326 | }, 327 | mappings: { 328 | position: 'curve-point.position' 329 | } 330 | }); 331 | 332 | 333 | AFRAME.registerPrimitive('a-curve', { 334 | 335 | defaultComponents: { 336 | 'curve': {} 337 | }, 338 | 339 | mappings: { 340 | curve: 'curve', 341 | } 342 | 343 | }); 344 | -------------------------------------------------------------------------------- /racer/icon192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/racer/icon192.png -------------------------------------------------------------------------------- /racer/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SamsungInternet/a-frame-demos/9611b694d96058092e7bba9a6ec74db5995547e9/racer/icon512.png -------------------------------------------------------------------------------- /racer/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: a-frame 3 | title: A-Frame Racer 4 | description: Speed through ruined tracks in the ocean. 5 | image: https://cdn-images-1.medium.com/max/1600/1*4SZ_eI61m8c03Kdvyr8RCw.png 6 | meta: racer 7 | redirect_from: "/racer.html" 8 | scripts: [ 9 | '/a-frame-demos/scripts/init-service-worker.js', 10 | 'https://aframe.io/releases/0.4.0/aframe.min.js', # Latest A-Frame Master 11 | 'https://cdn.rawgit.com/ngokevin/aframe-look-at-component/master/dist/aframe-look-at-component.min.js', # look at component 12 | 'https://cdn.rawgit.com/SamsungInternet/a-frame-components/v0.0.1/dist/follow.js', 13 | 'curve.js', 14 | 'https://samsunginter.net/a-frame-components/dist/ocean-plane.js', 15 | '/a-frame-demos/a-frame-assets/components/ship-controller.js', 16 | ] 17 | --- 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 225 | -------------------------------------------------------------------------------- /racer/manifest.json: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | { 4 | "name": "A-Frame Racer", 5 | "shortname": "Racer", 6 | "icons": [ 7 | { 8 | "src": "{{ site.baseurl }}/racer/icon512.png", 9 | "sizes": "192x192", 10 | "type": "image/png" 11 | }, 12 | { 13 | "src": "{{ site.baseurl }}/racer/icon192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | } 17 | ], 18 | "start_url": "{{ site.baseurl }}/racer/", 19 | "display": "standalone", 20 | "orientation": "landscape", 21 | "background_color": "white", 22 | "theme_color": "#8953D8" 23 | } 24 | -------------------------------------------------------------------------------- /racer/sw.js: -------------------------------------------------------------------------------- 1 | /* global toolbox, importScripts, self */ 2 | /* jshint browser:true */ 3 | 'use strict'; 4 | 5 | importScripts('/a-frame-demos/scripts/sw-toolbox.js'); 6 | 7 | toolbox.options.networkTimeoutSeconds = 3; 8 | toolbox.router.default = (location.protocol === 'http:' || location.hostname === 'localhost') ? toolbox.networkFirst : toolbox.fastest; 9 | -------------------------------------------------------------------------------- /scripts/init-service-worker.js: -------------------------------------------------------------------------------- 1 | if ('serviceWorker' in navigator) { 2 | navigator.serviceWorker.register('sw.js') 3 | .then(function(reg) { 4 | console.log('sw registered', reg); 5 | }).catch(function(error) { 6 | console.log('sw registration failed with ' + error); 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /scripts/sw-toolbox.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.toolbox = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;or.value[TIMESTAMP_PROPERTY]){var t=r.value[URL_PROPERTY];u.push(t),s["delete"](t),r["continue"]()}},c.oncomplete=function(){t(u)},c.onabort=o}):Promise.resolve([])}function expireExtraEntries(e,r){return r?new Promise(function(n,t){var o=[],i=e.transaction(STORE_NAME,"readwrite"),u=i.objectStore(STORE_NAME),c=u.index(TIMESTAMP_PROPERTY),s=c.count();c.count().onsuccess=function(){var e=s.result;e>r&&(c.openCursor().onsuccess=function(n){var t=n.target.result;if(t){var i=t.value[URL_PROPERTY];o.push(i),u["delete"](i),e-o.length>r&&t["continue"]()}})},i.oncomplete=function(){n(o)},i.onabort=t}):Promise.resolve([])}function expireEntries(e,r,n,t){return expireOldEntries(e,n,t).then(function(n){return expireExtraEntries(e,r).then(function(e){return n.concat(e)})})}var DB_PREFIX="sw-toolbox-",DB_VERSION=1,STORE_NAME="store",URL_PROPERTY="url",TIMESTAMP_PROPERTY="timestamp",cacheNameToDbPromise={};module.exports={getDb:getDb,setTimestampForUrl:setTimestampForUrl,expireEntries:expireEntries}; 21 | },{}],3:[function(require,module,exports){ 22 | "use strict";var scope;scope=self.registration?self.registration.scope:self.scope||new URL("./",self.location).href,module.exports={cache:{name:"$$$toolbox-cache$$$"+scope+"$$$",maxAgeSeconds:null,maxEntries:null},debug:!1,networkTimeoutSeconds:null,preCacheItems:[],successResponses:/^0|([123]\d\d)|(40[14567])|410$/}; 23 | },{}],4:[function(require,module,exports){ 24 | "use strict";var url=new URL("./",self.location),basePath=url.pathname,pathRegexp=require("path-to-regexp"),Route=function(e,t,i,s){t instanceof RegExp?this.fullUrlRegExp=t:(0!==t.indexOf("/")&&(t=basePath+t),this.keys=[],this.regexp=pathRegexp(t,this.keys)),this.method=e,this.options=s,this.handler=i};Route.prototype.makeHandler=function(e){var t;if(this.regexp){var i=this.regexp.exec(e);t={},this.keys.forEach(function(e,s){t[e.name]=i[s+1]})}return function(e){return this.handler(e,t,this.options)}.bind(this)},module.exports=Route; 25 | },{"path-to-regexp":14}],5:[function(require,module,exports){ 26 | "use strict";function regexEscape(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var Route=require("./route"),keyMatch=function(e,t){for(var r=e.entries(),o=r.next(),n=[];!o.done;){var u=new RegExp(o.value[0]);u.test(t)&&n.push(o.value[1]),o=r.next()}return n},Router=function(){this.routes=new Map,this.routes.set(RegExp,new Map),this["default"]=null};["get","post","put","delete","head","any"].forEach(function(e){Router.prototype[e]=function(t,r,o){return this.add(e,t,r,o)}}),Router.prototype.add=function(e,t,r,o){o=o||{};var n;t instanceof RegExp?n=RegExp:(n=o.origin||self.location.origin,n=n instanceof RegExp?n.source:regexEscape(n)),e=e.toLowerCase();var u=new Route(e,t,r,o);this.routes.has(n)||this.routes.set(n,new Map);var a=this.routes.get(n);a.has(e)||a.set(e,new Map);var s=a.get(e),i=u.regexp||u.fullUrlRegExp;s.set(i.source,u)},Router.prototype.matchMethod=function(e,t){var r=new URL(t),o=r.origin,n=r.pathname;return this._match(e,keyMatch(this.routes,o),n)||this._match(e,[this.routes.get(RegExp)],t)},Router.prototype._match=function(e,t,r){if(0===t.length)return null;for(var o=0;o0)return a[0].makeHandler(r)}}return null},Router.prototype.match=function(e){return this.matchMethod(e.method,e.url)||this.matchMethod("any",e.url)},module.exports=new Router; 27 | },{"./route":4}],6:[function(require,module,exports){ 28 | "use strict";function cacheFirst(e,r,t){return helpers.debug("Strategy: cache first ["+e.url+"]",t),helpers.openCache(t).then(function(r){return r.match(e).then(function(r){return r?r:helpers.fetchAndCache(e,t)})})}var helpers=require("../helpers");module.exports=cacheFirst; 29 | },{"../helpers":1}],7:[function(require,module,exports){ 30 | "use strict";function cacheOnly(e,r,c){return helpers.debug("Strategy: cache only ["+e.url+"]",c),helpers.openCache(c).then(function(r){return r.match(e)})}var helpers=require("../helpers");module.exports=cacheOnly; 31 | },{"../helpers":1}],8:[function(require,module,exports){ 32 | "use strict";function fastest(e,n,t){return helpers.debug("Strategy: fastest ["+e.url+"]",t),new Promise(function(r,s){var c=!1,o=[],a=function(e){o.push(e.toString()),c?s(new Error('Both cache and network failed: "'+o.join('", "')+'"')):c=!0},h=function(e){e instanceof Response?r(e):a("No result returned")};helpers.fetchAndCache(e.clone(),t).then(h,a),cacheOnly(e,n,t).then(h,a)})}var helpers=require("../helpers"),cacheOnly=require("./cacheOnly");module.exports=fastest; 33 | },{"../helpers":1,"./cacheOnly":7}],9:[function(require,module,exports){ 34 | module.exports={networkOnly:require("./networkOnly"),networkFirst:require("./networkFirst"),cacheOnly:require("./cacheOnly"),cacheFirst:require("./cacheFirst"),fastest:require("./fastest")}; 35 | },{"./cacheFirst":6,"./cacheOnly":7,"./fastest":8,"./networkFirst":10,"./networkOnly":11}],10:[function(require,module,exports){ 36 | "use strict";function networkFirst(e,r,t){t=t||{};var s=t.successResponses||globalOptions.successResponses,n=t.networkTimeoutSeconds||globalOptions.networkTimeoutSeconds;return helpers.debug("Strategy: network first ["+e.url+"]",t),helpers.openCache(t).then(function(r){var o,u,i=[];if(n){var c=new Promise(function(t){o=setTimeout(function(){r.match(e).then(function(e){e&&t(e)})},1e3*n)});i.push(c)}var a=helpers.fetchAndCache(e,t).then(function(e){if(o&&clearTimeout(o),s.test(e.status))return e;throw helpers.debug("Response was an HTTP error: "+e.statusText,t),u=e,new Error("Bad response")})["catch"](function(s){return helpers.debug("Network or response error, fallback to cache ["+e.url+"]",t),r.match(e).then(function(e){if(e)return e;if(u)return u;throw s})});return i.push(a),Promise.race(i)})}var globalOptions=require("../options"),helpers=require("../helpers");module.exports=networkFirst; 37 | },{"../helpers":1,"../options":3}],11:[function(require,module,exports){ 38 | "use strict";function networkOnly(e,r,t){return helpers.debug("Strategy: network only ["+e.url+"]",t),fetch(e)}var helpers=require("../helpers");module.exports=networkOnly; 39 | },{"../helpers":1}],12:[function(require,module,exports){ 40 | "use strict";function cache(e,t){return helpers.openCache(t).then(function(t){return t.add(e)})}function uncache(e,t){return helpers.openCache(t).then(function(t){return t["delete"](e)})}function precache(e){e instanceof Promise||validatePrecacheInput(e),options.preCacheItems=options.preCacheItems.concat(e)}require("serviceworker-cache-polyfill");var options=require("./options"),router=require("./router"),helpers=require("./helpers"),strategies=require("./strategies");helpers.debug("Service Worker Toolbox is loading");var flatten=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},validatePrecacheInput=function(e){var t=Array.isArray(e);if(t&&e.forEach(function(e){"string"==typeof e||e instanceof Request||(t=!1)}),!t)throw new TypeError("The precache method expects either an array of strings and/or Requests or a Promise that resolves to an array of strings and/or Requests.");return e};self.addEventListener("install",function(e){var t=options.cache.name+"$$$inactive$$$";helpers.debug("install event fired"),helpers.debug("creating cache ["+t+"]"),e.waitUntil(helpers.openCache({cache:{name:t}}).then(function(e){return Promise.all(options.preCacheItems).then(flatten).then(validatePrecacheInput).then(function(t){return helpers.debug("preCache list: "+(t.join(", ")||"(none)")),e.addAll(t)})}))}),self.addEventListener("activate",function(e){helpers.debug("activate event fired");var t=options.cache.name+"$$$inactive$$$";e.waitUntil(helpers.renameCache(t,options.cache.name))}),self.addEventListener("fetch",function(e){var t=router.match(e.request);t?e.respondWith(t(e.request)):router["default"]&&"GET"===e.request.method&&e.respondWith(router["default"](e.request))}),module.exports={networkOnly:strategies.networkOnly,networkFirst:strategies.networkFirst,cacheOnly:strategies.cacheOnly,cacheFirst:strategies.cacheFirst,fastest:strategies.fastest,router:router,options:options,cache:cache,uncache:uncache,precache:precache}; 41 | },{"./helpers":1,"./options":3,"./router":5,"./strategies":9,"serviceworker-cache-polyfill":15}],13:[function(require,module,exports){ 42 | module.exports=Array.isArray||function(r){return"[object Array]"==Object.prototype.toString.call(r)}; 43 | },{}],14:[function(require,module,exports){ 44 | function parse(e){for(var t,r=[],n=0,o=0,a="";null!=(t=PATH_REGEXP.exec(e));){var p=t[0],i=t[1],s=t.index;if(a+=e.slice(o,s),o=s+p.length,i)a+=i[1];else{var c=e[o],u=t[2],l=t[3],f=t[4],g=t[5],x=t[6],h=t[7];a&&(r.push(a),a="");var d=null!=u&&null!=c&&c!==u,y="+"===x||"*"===x,m="?"===x||"*"===x,R=t[2]||"/",T=f||g||(h?".*":"[^"+R+"]+?");r.push({name:l||n++,prefix:u||"",delimiter:R,optional:m,repeat:y,partial:d,asterisk:!!h,pattern:escapeGroup(T)})}}return o=46||"Chrome"===r&&n>=50)||(Cache.prototype.addAll=function(t){function e(t){this.name="NetworkError",this.code=19,this.message=t}var r=this;return e.prototype=Object.create(Error.prototype),Promise.resolve().then(function(){if(arguments.length<1)throw new TypeError;return t=t.map(function(t){return t instanceof Request?t:String(t)}),Promise.all(t.map(function(t){"string"==typeof t&&(t=new Request(t));var r=new URL(t.url).protocol;if("http:"!==r&&"https:"!==r)throw new e("Invalid scheme");return fetch(t.clone())}))}).then(function(n){if(n.some(function(t){return!t.ok}))throw new e("Incorrect response status");return Promise.all(n.map(function(e,n){return r.put(t[n],e)}))}).then(function(){})},Cache.prototype.add=function(t){return this.addAll([t])})}(); 47 | },{}]},{},[12])(12) 48 | }); 49 | 50 | 51 | //# sourceMappingURL=./build/sw-toolbox.map.json -------------------------------------------------------------------------------- /speech/README.md: -------------------------------------------------------------------------------- 1 | # Web Speech API Demo 2 | 3 | **In progress...** 4 | 5 | This demonstrates using the Web Speech API to dictate a tweet using voice input. 6 | -------------------------------------------------------------------------------- /speech/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: a-frame 3 | title: Speech 4 | description: Web Speech API tweet demo 5 | author: Peter O'Shaughnessy 6 | scripts: [ 7 | '/a-frame-demos/aframe-v0.4.0.min.js', 8 | 'js/aframe-bmfont-text-component.min.js', 9 | 'js/svrbutton_helper.js', 10 | 'js/svrbutton.js', 11 | 'js/svrtextarea.js', 12 | 'js/demo.js' 13 | ] 14 | --- 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /speech/js/aframe-bmfont-text-component.min.js: -------------------------------------------------------------------------------- 1 | !function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){function n(t,e){o(t.font,function(r,n){if(r)throw r;var i=new THREE.TextureLoader;i.load(t.image,function(t){e(n,t)})})}if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");var i=r(29),o=r(21),a=r(7);r(6),AFRAME.registerComponent("bmfont-text",{schema:{text:{type:"string"},width:{type:"number","default":1e3},align:{type:"string","default":"left"},letterSpacing:{type:"number","default":0},lineHeight:{type:"number","default":38},fnt:{type:"string","default":"https://cdn.rawgit.com/bryik/aframe-bmfont-text-component/aa0655cf90f646e12c40ab4708ea90b4686cfb45/assets/DejaVu-sdf.fnt"},fntImage:{type:"string","default":"https://cdn.rawgit.com/bryik/aframe-bmfont-text-component/aa0655cf90f646e12c40ab4708ea90b4686cfb45/assets/DejaVu-sdf.png"},mode:{type:"string","default":"normal"},color:{type:"color","default":"#000"},opacity:{type:"number","default":"1.0"}},update:function(t){function e(t,e){e.needsUpdate=!0,e.anisotropy=16;var n={font:t,text:o.text,width:o.width,align:o.align,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,mode:o.mode},u=i(n),s=new THREE.RawShaderMaterial(a({map:e,side:THREE.DoubleSide,transparent:!0,color:o.color,opacity:o.opacity})),f=new THREE.Mesh(u,s);f.rotation.y=Math.PI,f.scale.multiplyScalar(-.005),r.setObject3D("bmfont-text",f)}var r=this.el,o=this.data;n({font:o.fnt,image:o.fntImage},e)},remove:function(){this.el.removeObject3D("bmfont-text")}})},function(t,e,r){(function(t,n){/*! 2 | * The buffer module from node.js, for the browser. 3 | * 4 | * @author Feross Aboukhadijeh 5 | * @license MIT 6 | */ 7 | "use strict";function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function o(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,r){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function y(e){return+e!=e&&(e=0),t.alloc(+e)}function v(e,r){if(t.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(i)return G(e).length;r=(""+r).toLowerCase(),i=!0}}function w(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return U(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(e,r,n,i,o){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=t.from(r,i)),t.isBuffer(r))return 0===r.length?-1:E(e,r,n,i,o);if("number"==typeof r)return r=255&r,t.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):E(e,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,i){function o(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,u=t.length,s=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,u/=2,s/=2,r/=2}var f;if(i){var h=-1;for(f=r;fu&&(r=u-s),f=r;f>=0;f--){for(var c=!0,p=0;pi&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+u<=r){var s,f,h,c;switch(u){case 1:o<128&&(a=o);break;case 2:s=t[i+1],128===(192&s)&&(c=(31&o)<<6|63&s,c>127&&(a=c));break;case 3:s=t[i+1],f=t[i+2],128===(192&s)&&128===(192&f)&&(c=(15&o)<<12|(63&s)<<6|63&f,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:s=t[i+1],f=t[i+2],h=t[i+3],128===(192&s)&&128===(192&f)&&128===(192&h)&&(c=(15&o)<<18|(63&s)<<12|(63&f)<<6|63&h,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,u=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=u}return I(n)}function I(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function k(e,r,n,i,o,a){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||re.length)throw new RangeError("Index out of range")}function j(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function H(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function Y(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return i||Y(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return i||Y(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,r,n,52,8),r+8}function F(t){if(t=X(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function X(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function z(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function J(t){return Z.toByteArray(F(t))}function W(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function $(t){return t!==t}var Z=r(10),K=r(16),Q=r(12);e.Buffer=t,e.SlowBuffer=y,e.INSPECT_MAX_BYTES=50,t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:i(),e.kMaxLength=o(),t.poolSize=8192,t._augment=function(e){return e.__proto__=t.prototype,e},t.from=function(t,e,r){return u(null,t,e,r)},t.TYPED_ARRAY_SUPPORT&&(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0})),t.alloc=function(t,e,r){return f(null,t,e,r)},t.allocUnsafe=function(t){return h(null,t)},t.allocUnsafeSlow=function(t){return h(null,t)},t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,a=Math.min(n,i);o0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},t.prototype.compare=function(e,r,n,i,o){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var a=o-i,u=n-r,s=Math.min(a,u),f=this.slice(i,o),h=e.slice(r,n),c=0;ci)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return x(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return R(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r0&&(i*=256);)n+=this[t+--e]*i;return n},t.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),K.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),K.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),K.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),K.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e=0|e,r=0|r,!n){var i=Math.pow(2,8*r)-1;k(this,t,e,r,i,0)}var o=1,a=0;for(this[e]=255&t;++a=0&&(a*=256);)this[e+o]=t/a&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):j(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):j(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):H(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):H(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=0,a=1,u=0;for(this[e]=255&t;++o>0)-u&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=r-1,a=1,u=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):j(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):j(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):H(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r=0|r,n||k(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):H(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},t.prototype.copy=function(e,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r=0;--o)e[o+r]=this[o+n];else if(a<1e3||!t.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=r;a0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[u-2]?2:"="===t[u-1]?1:0,a=new f(3*u/4-o),n=o>0?u-4:u;var h=0;for(e=0,r=0;e>16&255,a[h++]=i>>8&255,a[h++]=255&i;return 2===o?(i=s[t.charCodeAt(e)]<<2|s[t.charCodeAt(e+1)]>>4,a[h++]=255&i):1===o&&(i=s[t.charCodeAt(e)]<<10|s[t.charCodeAt(e+1)]<<4|s[t.charCodeAt(e+2)]>>2,a[h++]=i>>8&255,a[h++]=255&i),a}function i(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function o(t,e,r){for(var n,o=[],a=e;ah?h:f+s));return 1===n?(e=t[r-1],i+=u[e>>2],i+=u[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=u[e>>10],i+=u[e>>4&63],i+=u[e<<2&63],i+="="),a.push(i),a.join("")}e.toByteArray=n,e.fromByteArray=a;var u=[],s=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array;r()},function(t,e,r){var n=r(1).Buffer;t.exports=function(t,e){if(n.isBuffer(t)&&n.isBuffer(e)){if("function"==typeof t.equals)return t.equals(e);if(t.length!==e.length)return!1;for(var r=0;r>1,h=-7,c=r?i-1:0,p=r?-1:1,l=t[e+c];for(c+=p,o=l&(1<<-h)-1,l>>=-h,h+=u;h>0;o=256*o+t[e+c],c+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=p,h-=8);if(0===o)o=1-f;else{if(o===s)return a?NaN:(l?-1:1)*(1/0);a+=Math.pow(2,n),o-=f}return(l?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,u,s,f=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-a))<1&&(a--,s*=2),e+=a+c>=1?p/s:p*Math.pow(2,1-c),e*s>=2&&(a++,s/=2),a+c>=h?(u=0,a=h):a+c>=1?(u=(e*s-1)*Math.pow(2,i),a+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+l]=255&u,l+=d,u/=256,i-=8);for(a=a<0;t[r+l]=255&a,l+=d,a/=256,f-=8);t[r+l-d]|=128*g}},function(t,e){t.exports=function(t){if(!t||"string"!=typeof t)throw new Error("must specify property for indexof search");return new Function("array","value","start",["start = start || 0","for (var i=start; i 11 | * @license MIT 12 | */ 13 | t.exports=function(t){return null!=t&&(r(t)||n(t)||!!t._isBuffer)}},function(t,e,r){function n(t){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(t)}function i(t){Object.defineProperty(n.prototype,t,{get:o(t),configurable:!0})}function o(t){return new Function(["return function "+t+"() {"," return this._"+t,"}"].join("\n"))()}function a(t,e){if(!t.chars||0===t.chars.length)return null;var r=d(t.chars,e);return r>=0?t.chars[r]:null}function u(t){for(var e=0;e=0)return t.chars[n].height}return 0}function s(t){for(var e=0;e=0)return t.chars[n]}return 0}function f(t){for(var e=0;e=0)return t.chars[n].height}return 0}function h(t,e,r){if(!t.kernings||0===t.kernings.length)return 0;for(var n=t.kernings,i=0;i=n||g>=n)break;s=g,f=y,o=i}c++}return o&&(f+=o.xoffset),{start:e,end:e+c,width:f}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach(i)},function(t,e,r){(function(e){function n(t){var e=Object.prototype.toString;return"[object ArrayBuffer]"===e.call(t)}function i(t){if(p)return c(t,{responseType:"arraybuffer"});if("undefined"==typeof window.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new window.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),c({xhr:e},t)}var o=r(35),a=function(){},u=r(23),s=r(25),f=r(24),h=r(22),c=r(2),p=function(){return window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}();t.exports=function(t,r){r="function"==typeof r?r:a,"string"==typeof t?t={uri:t}:t||(t={});var c=t.binary;c&&(t=i(t)),o(t,function(i,o,c){if(i)return r(i);if(!/^2/.test(o.statusCode))return r(new Error("http status code: "+o.statusCode));if(!c)return r(new Error("no body result"));var p=!1;if(n(c)){var l=new Uint8Array(c);c=new e(l,"binary")}h(c)&&(p=!0,"string"==typeof c&&(c=new e(c,"binary"))),p||(e.isBuffer(c)&&(c=c.toString(t.encoding)),c=c.trim());var d;try{var g=o.headers["content-type"];d=p?f(c):/json/.test(g)||"{"===c.charAt(0)?JSON.parse(c):/xml/.test(g)||"<"===c.charAt(0)?s(c):u(c)}catch(y){r(new Error("error parsing font "+y.message)),r=a}r(null,d)})}}).call(e,r(1).Buffer)},function(t,e,r){(function(e){var n=r(11),i=new e([66,77,70,3]);t.exports=function(t){return"string"==typeof t?"BMF"===t.substring(0,3):t.length>4&&n(t.slice(0,4),i)}}).call(e,r(1).Buffer)},function(t,e){function r(t,e){if(t=t.replace(/\t+/g," ").trim(),!t)return null;var r=t.indexOf(" ");if(r===-1)throw new Error("no named row at line "+e);var i=t.substring(0,r);t=t.substring(r+1),t=t.replace(/letter=[\'\"]\S+[\'\"]/gi,""),t=t.split("="),t=t.map(function(t){return t.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)});for(var o=[],a=0;ae.length-1)return 0;var s=e.readUInt8(r++),f=e.readInt32LE(r);switch(r+=4,s){case 1:t.info=n(e,r);break;case 2:t.common=i(e,r);break;case 3:t.pages=o(e,r,f);break;case 4:t.chars=a(e,r,f);break;case 5:t.kernings=u(e,r,f)}return 5+f}function n(t,e){var r={};r.size=t.readInt16LE(e);var n=t.readUInt8(e+2);return r.smooth=n>>7&1,r.unicode=n>>6&1,r.italic=n>>5&1,r.bold=n>>4&1,n>>3&1&&(r.fixedHeight=1),r.charset=t.readUInt8(e+3)||"",r.stretchH=t.readUInt16LE(e+4),r.aa=t.readUInt8(e+6),r.padding=[t.readInt8(e+7),t.readInt8(e+8),t.readInt8(e+9),t.readInt8(e+10)],r.spacing=[t.readInt8(e+11),t.readInt8(e+12)],r.outline=t.readUInt8(e+13),r.face=f(t,e+14),r}function i(t,e){var r={};r.lineHeight=t.readUInt16LE(e),r.base=t.readUInt16LE(e+2),r.scaleW=t.readUInt16LE(e+4),r.scaleH=t.readUInt16LE(e+6),r.pages=t.readUInt16LE(e+8);t.readUInt8(e+10);return r.packed=0,r.alphaChnl=t.readUInt8(e+11),r.redChnl=t.readUInt8(e+12),r.greenChnl=t.readUInt8(e+13),r.blueChnl=t.readUInt8(e+14),r}function o(t,e,r){for(var n=[],i=s(t,e),o=i.length+1,a=r/o,u=0;u3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var o={kernings:[],chars:[]},a=0;a<5;a++)n+=r(o,t,n);return o}},function(t,e,r){function n(t){var e=i(t);return e.reduce(function(t,e){var r=o(e.nodeName);return t[r]=e.nodeValue,t},{})}function i(t){for(var e=[],r=0;r element");for(var o=i.getElementsByTagName("page"),s=0;s0});this.visibleGlyphs=h;var c=f.positions(h),p=f.uvs(h,n,o,e),l=a({clockwise:!0,type:"uint16",count:h.length});if(u.index(this,l,1,"uint16"),u.attr(this,"position",c,2),u.attr(this,"uv",p,2),!t.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(t.multipage){var d=f.pages(h);u.attr(this,"page",d,1)}},n.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var t=this.attributes.position.array,e=this.attributes.position.itemSize;return!t||!e||t.length<2?(this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0)):(h.computeSphere(t,this.boundingSphere),void(isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')))},n.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.boundingBox,e=this.attributes.position.array,r=this.attributes.position.itemSize;return!e||!r||e.length<2?void t.makeEmpty():void h.computeBox(e,t)}},function(t,e){function r(t){var e=t.length/n;i.min[0]=t[0],i.min[1]=t[1],i.max[0]=t[0],i.max[1]=t[1];for(var r=0;rn?n:i}function n(t){return f.test(t)}function i(t,e,r,n,i){for(var o=[],a=r,s=r;si&&!n(e.charAt(l));)l--;if(l===i)d>i+s.length&&d--,l=d;else for(d=l;l>i&&n(e.charAt(l-s.length));)l--}if(l>=i){var g=t(e,i,l,h);f.push(g)}i=d}return f}function a(t,e,r,n){var i=Math.min(n,r-e);return{start:e,end:e+i}}var u=/\n/,s="\n",f=/\s/;t.exports=function(e,r){var n=t.exports.lines(e,r);return n.map(function(t){return e.substring(t.start,t.end)}).join("\n")},t.exports.lines=function(t,e){if(e=e||{},0===e.width&&"nowrap"!==e.mode)return[];t=t||"";var r="number"==typeof e.width?e.width:Number.MAX_VALUE,n=Math.max(0,e.start||0),u="number"==typeof e.end?e.end:t.length,s=e.mode,f=e.measure||a;return"pre"===s?i(f,t,n,u,r):o(f,t,n,u,r,s)}},function(t,e,r){"use strict";function n(t,e){for(var r=0;r0&&(g=setTimeout(function(){d=!0,c.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",n(t)},t.timeout)),c.setRequestHeader)for(l in m)m.hasOwnProperty(l)&&c.setRequestHeader(l,m[l]);else if(t.headers&&!i(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(c.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(c),c.send(w),c}function s(t){if("document"===t.responseType)return t.responseXML;var e=204===t.status&&t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||e?null:t.responseXML}function f(){}var h=r(15),c=r(4),p=r(27),l=r(2);t.exports=a,a.XMLHttpRequest=h.XMLHttpRequest||f,a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:h.XDomainRequest,n(["get","put","post","patch","head","delete"],function(t){a["delete"===t?"del":t]=function(e,r,n){return r=o(e,r,n),r.method=t.toUpperCase(),u(r)}})},function(t,e){t.exports=function(){return"undefined"!=typeof window.DOMParser?function(t){var e=new window.DOMParser;return e.parseFromString(t,"application/xml")}:"undefined"!=typeof window.ActiveXObject&&new window.ActiveXObject("Microsoft.XMLDOM")?function(t){var e=new window.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}:function(t){var e=document.createElement("div");return e.innerHTML=t,e}}()}]); -------------------------------------------------------------------------------- /speech/js/demo.js: -------------------------------------------------------------------------------- 1 | var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition; 2 | var SpeechGrammarList = SpeechGrammarList || webkitSpeechGrammarList; 3 | var SpeechRecognitionEvent = SpeechRecognitionEvent || webkitSpeechRecognitionEvent; 4 | 5 | var transcript = ''; 6 | var recognising = false; 7 | var recognition = new SpeechRecognition(); 8 | 9 | recognition.continuous = true; 10 | recognition.interimResults = false; 11 | 12 | recognition.onstart = function() { 13 | recognising = true; 14 | }; 15 | 16 | recognition.onerror = function(event) { 17 | console.error('Speech recognition error', event); 18 | }; 19 | 20 | recognition.onend = function() { 21 | recognising = false; 22 | }; 23 | 24 | recognition.onresult = function(event) { 25 | console.log('On result', event.results); 26 | 27 | if (event.results.length) { 28 | transcript = event.results[0][0].transcript; 29 | } else { 30 | transcript = ''; 31 | } 32 | 33 | updateTranscriptText(); 34 | }; 35 | 36 | function updateTranscriptText() { 37 | var textElement = document.getElementById('text-tweet'); 38 | textElement.setAttribute('text', transcript); 39 | } 40 | 41 | function startListening() { 42 | 43 | var recordButton = document.getElementById('btn-record'); 44 | 45 | console.log('recordButton', recordButton.object3D); 46 | 47 | if (recognising) { 48 | recognition.stop(); 49 | recordButton.setAttribute('text', 'Record'); 50 | 51 | } else { 52 | 53 | // Reset text 54 | transcript = ''; 55 | updateTranscriptText(); 56 | 57 | recordButton.setAttribute('text', 'Recording'); 58 | recordButton.setAttribute('btntweaks', 'textposition:0.49, 0, 0.2; textscale:1 1 1') 59 | 60 | recognition.start(); 61 | } 62 | 63 | } 64 | 65 | function sendTweet() { 66 | console.log('TODO send tweet'); 67 | } 68 | -------------------------------------------------------------------------------- /speech/js/svrbutton.js: -------------------------------------------------------------------------------- 1 | //button primitive 2 | AFRAME.registerPrimitive('a-svrbutton', { 3 | defaultComponents: { 4 | geometry: { 5 | primitive:'box', 6 | height:1.5, 7 | depth:0.2, 8 | width:3.5 9 | }, 10 | material: { 11 | opacity:1.0, 12 | transparent:true, 13 | side:'Double', 14 | color:'#987FFF' 15 | }, 16 | 'bmfont-text':{ 17 | text:'button', 18 | color: 'white', 19 | align: 'left', 20 | width:500 21 | }, 22 | btntweaks: { 23 | textposition: '0 0 0.5', 24 | textscale: '4 4 1', 25 | textoffset: 0.2 26 | } 27 | }, 28 | mappings:{ 29 | height:'geometry.height', 30 | width:'geometry.width', 31 | depth:'geometry.depth', 32 | color:'material.color', 33 | opacity:'material.opacity', 34 | text: 'bmfont-text.text', 35 | textoffset: 'btnTweaks.textoffset', 36 | textposition: 'btnTweaks.textposition', 37 | textscale: 'btnTweaks.textscale' 38 | } 39 | }); -------------------------------------------------------------------------------- /speech/js/svrbutton_helper.js: -------------------------------------------------------------------------------- 1 | //svrbutton helper 2 | AFRAME.registerComponent('btntweaks', { 3 | schema: { 4 | textposition: { 5 | type: 'vec3', 6 | default:'0, 0, 0.5' 7 | }, 8 | textscale:{ 9 | type:'vec3', 10 | default: '4, 4, 1' 11 | }, 12 | textoffset:{ 13 | type:'number', 14 | default:0.2 15 | } 16 | }, 17 | tick: function () { 18 | if ( 19 | !this.text || 20 | this.text !== this.el.getObject3D('bmfont-text') 21 | ) { 22 | this.text = this.el.getObject3D('bmfont-text'); 23 | if (this.text) { 24 | 25 | this.text.position.copy(this.data.textposition); 26 | this.text.scale.multiply(this.data.textscale); 27 | 28 | this.el.object3D.children[0].geometry.computeBoundingBox(); 29 | var text_bbox = this.el.object3D.children[0].geometry.boundingBox; 30 | var distCenter = (text_bbox['max'].x - text_bbox['min'].x)/2; 31 | this.text.translateX(distCenter + this.data.textoffset); 32 | } 33 | } 34 | } 35 | }); -------------------------------------------------------------------------------- /speech/js/svrtextarea.js: -------------------------------------------------------------------------------- 1 | //text area primitive 2 | AFRAME.registerPrimitive('a-svrtextarea', { 3 | defaultComponents: { 4 | geometry: { 5 | primitive: 'plane', 6 | height: 3, 7 | width: 4 8 | }, 9 | material: { 10 | opacity: 0, 11 | transparent: true 12 | }, 13 | 'bmfont-text':{ 14 | text: '', 15 | color: 'white', 16 | align: 'left', 17 | width: 500 18 | }, 19 | btntweaks: { 20 | textposition: '0 0 0.5', 21 | textscale: '4 4 1', 22 | textoffset: 0.2 23 | } 24 | }, 25 | mappings:{ 26 | height: 'geometry.height', 27 | width: 'geometry.width', 28 | color: 'material.color', 29 | opacity: 'material.opacity', 30 | text: 'bmfont-text.text', 31 | textoffset: 'btnTweaks.textoffset', 32 | textposition: 'btnTweaks.textposition', 33 | textscale: 'btnTweaks.textscale' 34 | } 35 | }); -------------------------------------------------------------------------------- /super-standard.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: a-frame 3 | title: A-Frame Physical Shaders 4 | description: Complex physical materials in A-Frame 5 | image: 'https://cdn-images-1.medium.com/max/1600/1*5C86U-OZFf4eYedrsIEjqw.png' 6 | scripts: [ 7 | # A-Frame 8 | 'https://cdn.rawgit.com/AdaRoseEdwards/aframe/fast/dist/aframe.min.fast.js', 9 | 10 | # Required to load the demo model 11 | 'https://cdn.rawgit.com/mrdoob/three.js/r79/examples/js/loaders/BinaryLoader.js', 12 | 13 | # Ocean primitive which relies on the new materials 14 | 'https://samsunginter.net/a-frame-components/dist/ocean-plane.js' 15 | ] 16 | --- 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 44 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 96 | --------------------------------------------------------------------------------