Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
360° Video
<div id="container"></div>
<a id="play_btn" href='javascript:;'>Click to Load</a>
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__css_css_css__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__css_css_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__css_css_css__);
/**
* Created by sanchez
*/
// import CSS
// import animate_css from 'animate.css/animate.min.css';
// import scss from '../css/sass.scss';
// require('aframe');
// require('t')
// window.Detector = require('./entities/Detector');
// require('./entities/CanvasRenderer');
// require('./entities/Projector');
// require('jquery.valiant360');
// import Js Plugins/Entities
//ES6 Module
// import Bar1 from './entities/Bar1';
// import Howler from 'howler';
// //CommonJS
// var Bar2=require('./entities/Bar2');
if (/Mobile/i.test(navigator.userAgent)) {
window.isMobile = true;
} else {
window.isMobile = false;
}
window.h5 = {
initThree360: function() {
var camera, scene, renderer;
var texture_placeholder,
isUserInteracting = false,
onMouseDownMouseX = 0,
onMouseDownMouseY = 0,
lon = 0,
onMouseDownLon = 0,
lat = 0,
onMouseDownLat = 0,
phi = 0,
theta = 0,
distance = 500,
onPointerDownPointerX = 0,
onPointerDownPointerY = 0,
onPointerDownLon = 0,
onPointerDownLat = 0;
init();
// animate();
function init() {
var container, mesh;
window.loaded = false;
container = document.getElementById('container');
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1100);
camera.target = new THREE.Vector3(0, 0, 0);
scene = new THREE.Scene();
var geometry = new THREE.SphereBufferGeometry(500, 60, 40);
// invert the geometry on the x-axis so that all of the faces point inward
geometry.scale(-1, 1, 1);
var play_btn = document.getElementById('play_btn');
var video = document.createElement('video');
video.width = 640;
video.height = 360;
video.loop = true;
video.muted = true;
video.src = 'http://flimshaw.github.io/Valiant360/videos/overpass-2k.mp4';
video.setAttribute('webkit-playsinline', 'webkit-playsinline');
video.setAttribute('playsinline', 'playsinline');
video.setAttribute('x5-video-player-fullscreen', 'false');
video.setAttribute('x5-video-player-type', 'h5');
video.setAttribute('x-webkit-airplay', 'true');
video.crossOrigin = "Anonymous";
// play_btn.innerHTML = 'Play';
var texture = new THREE.VideoTexture(video);
texture.minFilter = THREE.LinearFilter;
texture.format = THREE.RGBFormat;
var material = new THREE.MeshBasicMaterial({ map: texture });
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
container.appendChild(renderer.domElement);
animate();
play_btn.addEventListener('click', function() {
play_btn.innerHTML = 'Play';
if (!window.loaded) {
// video.pause();
window.loaded = true;
} else {
video.play();
play_btn.style.display = 'none';
}
}, true);
var eventstart, eventmove, eventstart;
document.addEventListener('touchstart', function(e) {}, false);
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, false);
container.addEventListener('touchstart', onDocumenTouchDown, false);
container.addEventListener('touchmove', onDocumentTouchMove, false);
container.addEventListener('touchend', onDocumentTouchUp, false);
container.addEventListener('mousedown', onDocumentMouseDown, false);
container.addEventListener('mousemove', onDocumentMouseMove, false);
container.addEventListener('mouseup', onDocumentMouseUp, false);
window.addEventListener('resize', onWindowResize, false);
}
function onWindowResize() {
if (/Mobile/i.test(navigator.userAgent)) {
window.isMobile = true;
} else {
window.isMobile = false;
}
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
function onDocumentMouseDown(event) {
event.preventDefault();
isUserInteracting = true;
onPointerDownPointerX = event.clientX;
onPointerDownPointerY = event.clientY;
onPointerDownLon = lon;
onPointerDownLat = lat;
}
function onDocumentMouseMove(event) {
if (isUserInteracting === true) {
lon = (onPointerDownPointerX - event.clientX) * 0.5 + onPointerDownLon;
lat = (event.clientY - onPointerDownPointerY) * 0.5 + onPointerDownLat;
}
}
function onDocumentMouseUp(event) {
isUserInteracting = false;
}
function onDocumenTouchDown(event) {
event.preventDefault();
isUserInteracting = true;
onPointerDownPointerX = event.touches[0].clientX;
onPointerDownPointerY = event.touches[0].clientY;
onPointerDownLon = lon;
onPointerDownLat = lat;
}
function onDocumentTouchMove(event) {
if (isUserInteracting === true) {
lon = (onPointerDownPointerX - event.touches[0].clientX) * 0.5 + onPointerDownLon;
lat = (event.touches[0].clientY - onPointerDownPointerY) * 0.5 + onPointerDownLat;
}
}
function onDocumentTouchUp(event) {
isUserInteracting = false;
}
function animate() {
requestAnimationFrame(animate);
update();
}
function update() {
lat = Math.max(-85, Math.min(85, lat));
phi = THREE.Math.degToRad(90 - lat);
theta = THREE.Math.degToRad(lon);
camera.position.x = distance * Math.sin(phi) * Math.cos(theta);
camera.position.y = distance * Math.cos(phi);
camera.position.z = distance * Math.sin(phi) * Math.sin(theta);
camera.lookAt(camera.target);
/*
// distortion
camera.position.copy( camera.target ).negate();
*/
renderer.render(scene, camera);
}
},
initValiant360: function() {
var play_btn = document.getElementById('play_btn');
$('.valiantContainer').Valiant360();
play_btn.addEventListener('click', function() {
// play
$('.valiantContainer').Valiant360('play');
$('.valiantContainer').Valiant360('pause');
}, false);
$('.valiantContainer').Valiant360('loadVideo', './assets/media/city.mp4');
$('.valiantContainer').Valiant360('play');
// $('.valiantContainer').Valiant360('pause');
},
rootResize2: function() {
//orientation landscape width=1334px
var wFsize;
var wWidth = (screen.width > 0) ? (window.innerWidth >= screen.width || window.innerWidth == 0) ? screen.width :
window.innerWidth : window.innerWidth;
var wHeight = (screen.height > 0) ? (window.innerHeight >= screen.height || window.innerHeight == 0) ?
screen.height : window.innerHeight : window.innerHeight;
if (wWidth > wHeight) {
wHeight = wWidth;
}
wFsize = wHeight / 13.34;
document.getElementsByTagName('html')[0].style.fontSize = wFsize + 'px';
},
rootResize1: function() {
//orientation landscape width=1334px
var that = this;
var Dpr = 1,
uAgent = window.navigator.userAgent;
var isIOS = uAgent.match(/iphone/i);
var isYIXIN = uAgent.match(/yixin/i);
var is2345 = uAgent.match(/Mb2345/i);
var ishaosou = uAgent.match(/mso_app/i);
var isSogou = uAgent.match(/sogoumobilebrowser/ig);
var isLiebao = uAgent.match(/liebaofast/i);
var isGnbr = uAgent.match(/GNBR/i);
var isWeixin = uAgent.match(/MicroMessenger/i);
var wFsize;
var wWidth = (screen.width > 0) ? (window.innerWidth >= screen.width || window.innerWidth == 0) ? screen.width :
window.innerWidth : window.innerWidth;
var wHeight = (screen.height > 0) ? (window.innerHeight >= screen.height || window.innerHeight == 0) ?
screen.height : window.innerHeight : window.innerHeight;
if (isIOS) {
wWidth = screen.width;
wHeight = screen.height;
}
if (wWidth > wHeight) {
wHeight = wWidth;
}
wFsize = wHeight / 13.34;
if (isYIXIN || is2345 || ishaosou || isSogou || isLiebao || isGnbr || isWeixin) { //YIXIN 和 2345 这里有个刚调用系统浏览器时候的bug,需要一点延迟来获取
setTimeout(function() {
wHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
wWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
if (wWidth > wHeight) {
wHeight = wWidth;
}
wFsize = wHeight / 13.34;
// wFsize = wFsize > 32 ? wFsize : 32;
document.getElementsByTagName('html')[0].style.fontSize = wFsize + 'px';
}, 500);
} else {
document.getElementsByTagName('html')[0].style.fontSize = wFsize + 'px';
}
return that;
},
eventInit: function() {
var that = this;
document.addEventListener('touchstart', function(e) {}, false);
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, false);
return that;
},
cssInit: function() {
var that = this;
/*
that.rootResize1();
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
if (window.orientation == 90 || window.orientation == -90) {
//横屏
//_.renderShuping();
that.rootResize();
} else {
//竖屏
//_.closeShuping();
}
}, false);
*/
var noChangeCountToEnd = 100,
noEndTimeout = 1000;
that.rootResize2();
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
var interval,
timeout,
end,
lastInnerWidth,
lastInnerHeight,
noChangeCount;
end = function() {
// "orientationchangeend"
clearInterval(interval);
clearTimeout(timeout);
interval = null;
timeout = null;
that.rootResize1();
};
interval = setInterval(function() {
if (window.innerWidth === lastInnerWidth && window.innerHeight === lastInnerHeight) {
noChangeCount++;
if (noChangeCount === noChangeCountToEnd) {
// The interval resolved the issue first.
end();
}
} else {
lastInnerWidth = window.innerWidth;
lastInnerHeight = window.innerHeight;
noChangeCount = 0;
}
});
timeout = setTimeout(function() {
// The timeout happened first.
end();
}, noEndTimeout);
});
return that;
}
};
window.h5.initThree360();
// window.h5.initValiant360();
// window.h5.cssInit().eventInit();
function showStats() {
var stats = new Stats();
stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
var fs = document.createElement('div');
fs.style.position = 'absolute';
fs.style.left = 0;
fs.style.top = 0;
fs.style.zIndex = 999;
fs.appendChild(stats.domElement);
document.body.appendChild(fs);
function animate() {
stats.begin();
// monitored code goes here
stats.end();
requestAnimationFrame(animate);
}
requestAnimationFrame(animate);
}
showStats();
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAgOTc1ZWZkZmYwZDgyOTc2YTMyYTkiLCJ3ZWJwYWNrOi8vLy4vc3JjL2Fzc2V0cy9qcy9tYWluLmpzIiwid2VicGFjazovLy8uL3NyYy9hc3NldHMvY3NzL2Nzcy5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOzs7QUFHQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxhQUFLO0FBQ0w7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQS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SA9IGZhbHNlO1xufVxuXG5cbndpbmRvdy5oNSA9IHtcbiAgICBpbml0VGhyZWUzNjA6IGZ1bmN0aW9uKCkge1xuICAgICAgICB2YXIgY2FtZXJhLCBzY2VuZSwgcmVuZGVyZXI7XG4gICAgICAgIHZhciB0ZXh0dXJlX3BsYWNlaG9sZGVyLFxuICAgICAgICAgICAgaXNVc2VySW50ZXJhY3RpbmcgPSBmYWxzZSxcbiAgICAgICAgICAgIG9uTW91c2VEb3duTW91c2VYID0gMCxcbiAgICAgICAgICAgIG9uTW91c2VEb3duTW91c2VZID0gMCxcbiAgICAgICAgICAgIGxvbiA9IDAsXG4gICAgICAgICAgICBvbk1vdXNlRG93bkxvbiA9IDAsXG4gICAgICAgICAgICBsYXQgPSAwLFxuICAgICAgICAgICAgb25Nb3VzZURvd25MYXQgPSAwLFxuICAgICAgICAgICAgcGhpID0gMCxcbiAgICAgICAgICAgIHRoZXRhID0gMCxcbiAgICAgICAgICAgIGRpc3RhbmNlID0gNTAwLFxuICAgICAgICAgICAgb25Qb2ludGVyRG93blBvaW50ZXJYID0gMCxcbiAgICAgICAgICAgIG9uUG9pbnRlckRvd25Qb2ludGVyWSA9IDAsXG4gICAgICAgICAgICBvblBvaW50ZXJEb3duTG9uID0gMCxcbiAgICAgICAgICAgIG9uUG9pbnRlckRvd25MYXQgPSAwO1xuICAgICAgICBpbml0KCk7XG4gICAgICAgIC8vIGFuaW1hdGUoKTtcblxuICAgICAgICBmdW5jdGlvbiBpbml0KCkge1xuICAgICAgICAgICAgdmFyIGNvbnRhaW5lciwgbWVzaDtcbiAgICAgICAgICAgIHdpbmRvdy5sb2FkZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIGNvbnRhaW5lciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdjb250YWluZXInKTtcbiAgICAgICAgICAgIGNhbWVyYSA9IG5ldyBUSFJFRS5QZXJzcGVjdGl2ZUNhbWVyYSg3NSwgd2luZG93LmlubmVyV2lkdGggL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O1xuICAgICAgICAgICAgYW5pbWF0ZSgpO1xuXG5cbiAgICAgICAgICAgIHBsYXlfYnRuLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgcGxheV9idG4uaW5uZXJIVE1MID0gJ1BsYXknO1xuICAgICAgICAgICAgICAgIGlmICghd2luZG93LmxvYWRlZCkge1xuICAgICAgICAgICAgICAgICAgICAvLyB2aWRlby5wYXVzZSgpO1xuICAgICAgICAgICAgICAgICAgICB3aW5kb3cubG9hZGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB2aWRlby5wbGF5KCk7XG4gICAgICAgICAgICAgICAgICAgIHBsYXlfYnRuLnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSwgdHJ1ZSk7XG4gICAgICAgICAgICB2YXIgZXZlbnRzdGFydCwgZXZlbnRtb3ZlLCBldmVudHN0YXJ0O1xuXG4gICAgICAgICAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCd0b3VjaHN0YXJ0JywgZnVuY3Rpb24oZSkge30sIGZhbHNlKTtcbiAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ3RvdWNobW92ZScsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICB9LCBmYWxzZSk7XG5cbiAgICAgICAgICAgIGNvbnRhaW5lci5hZGRFdmVudExpc3RlbmVyKCd0b3VjaHN0YXJ0Jywgb25Eb2N1bWVuVG91Y2hEb3duLCBmYWxzZSk7XG4gICAgICAgICAgICBjb250YWluZXIuYWRkRXZlbnRMaXN0ZW5lcigndG91Y2htb3ZlJywgb25Eb2N1bWVudFRvdWNoTW92ZSwgZmFsc2UpO1xuICAgICAgICAgICAgY29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d24oZXZlbnQpIHtcbiAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICBpc1VzZXJJbnRlcmFjdGluZyA9IHRydWU7XG4gICAgICAgICAgICBvblBvaW50ZXJEb3duUG9pbnRlclggPSBldmVudC5jbGllbnRYO1xuICAgICAgICAgICAgb25Qb2ludGVyRG93blBvaW50ZXJZID0gZXZlbnQuY2xpZW50WTtcbiAgICAgICAgICAgIG9uUG9pbnRlckRvd25Mb24gPSBsb247XG4gICAgICAgICAgICBvblBvaW50ZXJEb3duTGF0ID0gbGF0O1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gb25Eb2N1bWVudE1vdXNlTW92ZShldmVudCkge1xuXG4gICAgICAgICAgICBpZiAoaXNVc2VySW50ZXJhY3RpbmcgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICBsb24gPSAob25Qb2ludGVyRG93blBvaW50ZXJYIC0gZXZlbnQuY2xpZW50WCkgKiAwLjUgKyBvblBvaW50ZXJEb3duTG9uO1xuICAgICAgICAgICAgICAgIGxhdCA9IChldmVudC5jbGllbnRZIC0gb25Qb2ludGVyRG93blBvaW50ZXJZKSAqIDAuNSArIG9uUG9pbnRlckRvd25MYXQ7XG5cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1bmN0aW9uIG9uRG9jdW1lbnRNb3VzZVVwKGV2ZW50KSB7XG4gICAgICAgICAgICBpc1VzZXJJbnRlcmFjdGluZyA9IGZhbHNlO1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gb25Eb2N1bWVuVG91Y2hEb3duKGV2ZW50KSB7XG4gICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgaXNVc2VySW50ZXJhY3RpbmcgPSB0cnVlO1xuICAgICAgICAgICAgb25Qb2ludGVyRG93blBvaW50ZXJYID0gZXZlbnQudG91Y2hlc1swXS5jbGllbnRYO1xuICAgICAgICAgICAgb25Qb2ludGVyRG93blBvaW50ZXJZID0gZXZlbnQudG91Y2hlc1swXS5jbGllbnRZO1xuICAgICAgICAgICAgb25Qb2ludGVyRG93bkxvbiA9IGxvbjtcbiAgICAgICAgICAgIG9uUG9pbnRlckRvd25MYXQgPSBsYXQ7XG4gICAgICAgIH1cblxuICAgICAgICBmdW5jdGlvbiBvbkRvY3VtZW50VG91Y2hNb3ZlKGV2ZW50KSB7XG5cbiAgICAgICAgICAgIGlmIChpc1VzZXJJbnRlcmFjdGluZyA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIGxvbiA9IChvblBvaW50ZXJEb3duUG9pbnRlclggLSBldmVudC50b3VjaGVzWzBdLmNsaWVudFgpICogMC41ICsgb25Qb2ludGVyRG93bkxvbjtcbiAgICAgICAgICAgICAgICBsYXQgPSAoZXZlbnQudG91Y2hlc1swXS5jbGllbnRZIC0gb25Qb2ludGVyRG93blBvaW50ZXJZKSAqIDAuNSArIG9uUG9pbnRlckRvd25MYXQ7XG5cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1bmN0aW9uIG9uRG9jdW1lbnRUb3VjaFVwKGV2ZW50KSB7XG4gICAgICAgICAgICBpc1VzZXJJbnRlcmFjdGluZyA9IGZhbHNlO1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gYW5pbWF0ZSgpIHtcbiAgICAgICAgICAgIHJlcXVlc3RBbmltYXRpb25GcmFtZShhbmltYXRlKTtcbiAgICAgICAgICAgIHVwZGF0ZSgpO1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gdXBkYXRlKCkge1xuICAgICAgICAgICAgbGF0ID0gTWF0aC5tYXgoLTg1LCBNYXRoLm1pbig4NSwgbGF0KSk7XG4gICAgICAgICAgICBwaGkgPSBUSFJFRS5NYXRoLmRlZ1RvUmFkKDkwIC0gbGF0KTtcbiAgICAgICAgICAgIHRoZXRhID0gVEhSRUUuTWF0aC5kZWdUb1JhZChsb24pO1xuICAgICAgICAgICAgY2FtZXJhLnBvc2l0aW9uLnggPSBkaXN0YW5jZSAqIE1hdGguc2luKHBoaSkgKiBNYXRoLmNvcyh0aGV0YSk7XG4gICAgICAgICAgICBjYW1lcmEucG9zaXRpb24ueSA9IGRpc3RhbmNlICogTWF0aC5jb3MocGhpKTtcbiAgICAgICAgICAgIGNhbWVyYS5wb3NpdGlvbi56ID0gZGlzdGFuY2UgKiBNYXRoLnNpbihwaGkpICogTWF0aC5zaW4odGhldGEpO1xuICAgICAgICAgICAgY2FtZXJhLmxvb2tBdChjYW1lcmEudGFyZ2V0KTtcbiAgICAgICAgICAgIC8qXG4gICAgICAgICAgICAvLyBkaXN0b3J0aW9uXG4gICAgICAgICAgICBjYW1lcmEucG9zaXRpb24uY29weSggY2FtZXJhLnRhcmdldCApLm5lZ2F0ZSgpO1xuICAgICAgICAgICAgKi9cbiAgICAgICAgICAgIHJlbmRlcmVyLnJlbmRlcihzY2VuZSwgY2FtZXJhKTtcbiAgICAgICAgfVxuXG4gICAgfSxcbiAgICBpbml0VmFsaWFudDM2MDogZnVuY3Rpb24oKSB7XG4gICAgICAgIHZhciBwbGF5X2J0biA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdwbGF5X2J0bicpO1xuICAgICAgICAkKCcudmFsaWFudENvbnRhaW5lcicpLlZhbGlhbnQzNjAoKTtcbiAgICAgICAgcGxheV9idG4uYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIC8vIHBsYXlcbiAgICAgICAgICAgICQoJy52YWxpYW50Q29udGFpbmVyJykuVmFsaWFudDM2MCgncGxheScpO1xuICAgICAgICAgICAgJCgnLnZhbGlhbnRDb250YWluZXInKS5WYWxpYW50MzYwKCdwYXVzZScpO1xuICAgICAgICB9LCBmYWxzZSk7XG4gICAgICAgICQoJy52YWxpYW50Q29udGFpbmVyJykuVmFsaWFudDM2MCgnb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WdodCB8fCB3aW5kb3cuaW5uZXJIZWlnaHQgPT0gMCkgP1xuICAgICAgICAgICAgc2NyZWVuLmhlaWdodCA6IHdpbmRvdy5pbm5lckhlaWdodCA6IHdpbmRvdy5pbm5lckhlaWdodDtcbiAgICAgICAgaWYgKGlzSU9TKSB7XG4gICAgICAgICAgICB3V2lkdGggPSBzY3JlZW4ud2lkdGg7XG4gICAgICAgICAgICB3SGVpZ2h0ID0gc2NyZWVuLmhlaWdodDtcbiAgICAgICAgfVxuICAgICAgICBpZiAod1dpZHRoID4gd0hlaWdodCkge1xuICAgICAgICAgICAgd0hlaWdodCA9IHdXaWR0aDtcbiAgICAgICAgfVxuICAgICAgICB3RnNpemUgPSB3SGVpZ2h0IC8gMTMuMzQ7XG4gICAgICAgIGlmIChpc1lJWElOIHx8IGlzMjM0NSB8fCBpc2hhb3NvdSB8fCBpc1NvZ291IHx8IGlzTGllYmFvIHx8IGlzR25iciB8fCBpc1dlaXhpbikgeyAvL1lJWElOIOWSjCAyMzQ1IOi/memHjOacieS4quWImuiwg+eUqOezu+e7n+a1j+iniOWZqOaXtuWAmeeahGJ1Z++8jOmcgOimgeS4gOeCueW7tui/n+adpeiOt+WPllxuICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICB3SGVpZ2h0ID0gd2luZG93LmlubmVySGVpZ2h0IHx8IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5jbGllbnRIZWlnaHQgfHwgZG9jdW1lbnQuYm9keS5jbGllbnRIZWlnaHQ7XG4gICAgICAgICAgICAgICAgd1dpZHRoID0gd2luZG93LmlubmVyV2lkdGggfHwgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LmNsaWVudFdpZHRoIHx8IGRvY3VtZW50LmJvZHkuY2xpZW50V2lkdGg7XG4gICAgICAgICAgICAgICAgaWYgKHdXaWR0aCA+IHdIZWlnaHQpIHtcbiAgICAgICAgICAgICAgICAgICAgd0hlaWdodCA9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dlXCIgOiBcInJlc2l6ZVwiLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGlmICh3aW5kb3cub3JpZW50YXRpb24gPT0gOTAgfHwgd2luZG93Lm9yaWVudGF0aW9uID09IC05MCkge1xuICAgICAgICAgICAgICAgIC8v5qiq5bGPXG4gICAgICAgICAgICAgICAgLy9fLnJlbmRlclNodXBpbmcoKTtcbiAgICAgICAgICAgICAgICB0aGF0LnJvb3RSZXNpemUoKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy/nq5blsY9cbiAgICAgICAgICAgICAgICAvL18uY2xvc2VTaHVwaW5nKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sIGZhbHNlKTtcbiAgICAgICAgKi9cbiAgICAgICAgdmFyIG5vQ2hhbmdlQ291bnRUb0VuZCA9IDEwMCxcbiAgICAgICAgICAgIG5vRW5kVGltZW91dCA9IDEwMDA7XG4gICAgICAgIHRoYXQucm9vdFJlc2l6ZTIoKTtcbiAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoXCJvbm9yaWVudGF0aW9uY2hhbmdlXCIgaW4gd2luZG93ID8gXCJvcmllbnRhdGlvbmNoYW5nZVwiIDogXCJyZXNpemVcIiwgZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICB2YXIgaW50ZXJ2YWwsXG4gICAgICAgICAgICAgICAgdGltZW91dCxcbiAgICAgICAgICAgICAgICBlbmQsXG4gICAgICAgICAgICAgICAgbGFzdElubmVyV2lkdGgsXG4gICAgICAgICAgICAgICAgbGFzdElubmVySGVpZ2h0LFxuICAgICAgICAgICAgICAgIG5vQ2hhbmdlQ291bnQ7XG4gICAgICAgICAgICBlbmQgPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAvLyBcIm9yaWVudGF0aW9uY2hhbmdlZW5kXCJcbiAgICAgICAgICAgICAgICBjbGVhckludGVydmFsKGludGVydmFsKTtcbiAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodGltZW91dCk7XG4gICAgICAgICAgICAgICAgaW50ZXJ2YWwgPSBudWxsO1xuICAgICAgICAgICAgICAgIHRpbWVvdXQgPSBudWxsO1xuICAgICAgICAgICAgICAgIHRoYXQucm9vdFJlc2l6ZTEoKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpbnRlcnZhbCA9IHNldEludGVydmFsKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuaW5uZXJXaWR0aCA9PT0gbGFzdElubmVyV2lkdGggJiYgd2luZG93LmlubmVySGVpZ2h0ID09PSBsYXN0SW5uZXJIZWlnaHQpIHtcbiAgICAgICAgICAgICAgICAgICAgbm9DaGFuZ2VDb3VudCsrO1xuICAgICAgICAgICAgICAgICAgICBpZiAobm9DaGFuZ2VDb3VudCA9PT0gbm9DaGFuZ2VDb3VudFRvRW5kKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGUgaW50ZXJ2YWwgcmVzb2x2ZWQgdGhlIGlzc3VlIGZpcnN0LlxuICAgICAgICAgICAgICAgICAgICAgICAgZW5kKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBsYXN0SW5uZXJXaWR0aCA9IHdpbmRvdy5pbm5lcldpZHRoO1xuICAgICAgICAgICAgICAgICAgICBsYXN0SW5uZXJIZWlnaHQgPSB3aW5kb3cuaW5uZXJIZWlnaHQ7XG4gICAgICAgICAgICAgICAgICAgIG5vQ2hhbmdlQ291bnQgPSAwO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgdGltZW91dCA9IHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgLy8gVGhlIHRpbWVvdXQgaGFwcGVuZWQgZmlyc3QuXG4gICAgICAgICAgICAgICAgZW5kKCk7XG4gICAgICAgICAgIC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WQgPSAwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCIsIi8vIHJlbW92ZWQgYnkgZXh0cmFjdC10ZXh0LXdlYnBhY2stcGx1Z2luXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9zcmMvYXNzZXRzL2Nzcy9jc3MuY3NzXG4vLyBtb2R1bGUgaWQgPSAxXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0=
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/87/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/stats.js/r16/Stats.min.js"></script>
* {
margin: 0 auto;
padding: 0;
overflow: hidden;
}
body {
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
}
#play_btn {
position: absolute;
width: 8rem;
height: 3rem;
color: #000;
background-color: #fff;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
text-align: center;
line-height: 3rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.