├── README.md ├── package.json ├── .gitignore ├── LICENSE ├── components └── set-image.js └── index.html /README.md: -------------------------------------------------------------------------------- 1 | > Discontinued, moved to https://glitch.com/~aframe-gallery 2 | 3 | # 360-image-gallery-boilerplate 4 | 5 | > Featured in the *Building an Advanced Scene* guide. 6 | 7 | Scene for selecting between different 360-degree images. 8 | 9 | ## Dependencies 10 | 11 | - [A-Frame](https://github.com/aframevr/aframe) 12 | - [K-Frame](https://github.com/ngokevin/k-frame) 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aframe-360-image-gallery-boilerplate", 3 | "version": "0.3.0-beta6", 4 | "license": "MIT", 5 | "scripts": { 6 | "start": "budo --live --verbose --port 3000 --open", 7 | "deploy": "ghpages", 8 | "ghpages": "ghpages" 9 | }, 10 | "devDependencies": { 11 | "budo": "^7.0.0", 12 | "ghpages": "0.0.3" 13 | }, 14 | "keywords": [ 15 | "aframe", 16 | "aframe-example", 17 | "aframe-boilerplate", 18 | "aframe-scene", 19 | "vr", 20 | "webvr" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 A-Frame 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. 22 | -------------------------------------------------------------------------------- /components/set-image.js: -------------------------------------------------------------------------------- 1 | /* global AFRAME */ 2 | 3 | /** 4 | * Component that listens to an event, fades out an entity, swaps the texture, and fades it 5 | * back in. 6 | */ 7 | AFRAME.registerComponent('set-image', { 8 | schema: { 9 | on: {type: 'string'}, 10 | target: {type: 'selector'}, 11 | src: {type: 'string'}, 12 | dur: {type: 'number', default: 300} 13 | }, 14 | 15 | init: function () { 16 | var data = this.data; 17 | var el = this.el; 18 | 19 | this.setupFadeAnimation(); 20 | 21 | el.addEventListener(data.on, function () { 22 | // Fade out image. 23 | data.target.emit('set-image-fade'); 24 | // Wait for fade to complete. 25 | setTimeout(function () { 26 | // Set image. 27 | data.target.setAttribute('material', 'src', data.src); 28 | }, data.dur); 29 | }); 30 | }, 31 | 32 | /** 33 | * Setup fade-in + fade-out. 34 | */ 35 | setupFadeAnimation: function () { 36 | var data = this.data; 37 | var targetEl = this.data.target; 38 | 39 | // Only set up once. 40 | if (targetEl.dataset.setImageFadeSetup) { return; } 41 | targetEl.dataset.setImageFadeSetup = true; 42 | 43 | // Create animation. 44 | targetEl.setAttribute('animation__fade', { 45 | property: 'material.color', 46 | startEvents: 'set-image-fade', 47 | dir: 'alternate', 48 | dur: data.dur, 49 | from: '#FFF', 50 | to: '#000' 51 | }); 52 | } 53 | }); 54 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 360° Image Gallery 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 58 | 59 | 60 | 61 | 62 | --------------------------------------------------------------------------------