From e94ab73212b49796087743915d61d7bc4832801c Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Sat, 13 Oct 2018 17:19:36 -0700 Subject: [PATCH] lint --- package.json | 2 + src/components/active-color.js | 4 +- src/components/audio-columns.js | 2 +- src/components/beat-hit-sound.js | 16 ++++---- src/components/beat-loader.js | 4 +- src/components/beat.js | 20 +++++----- src/components/debug-controller.js | 42 ++++++++++----------- src/components/debug-cursor.js | 6 +-- src/components/gpu-preloader.js | 2 +- src/components/hand-swapper.js | 2 +- src/components/keyboard-raycastable.js | 2 +- src/components/logoflicker.js | 2 +- src/components/menu-controls.js | 2 +- src/components/particleplayer.js | 51 +++++++++++++------------- src/components/raycaster-target.js | 2 +- src/components/saber-controls.js | 18 ++++----- src/components/search.js | 4 +- src/components/song.js | 2 +- src/components/stage-colors.js | 10 ++--- src/components/toggle-pause-play.js | 6 +-- src/components/trail.js | 12 +++--- src/components/twister.js | 10 ++--- src/components/wall.js | 2 +- src/state/index.js | 2 +- webpack.config.js | 24 ++++++------ 25 files changed, 125 insertions(+), 124 deletions(-) diff --git a/package.json b/package.json index 12009b8..a0a1dcb 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "version": "1.0.0", "scripts": { "build": "cross-env NODE_ENV=production webpack", + "lint": "semistandard -v | snazzy", + "lint:fix": "semistandard --fix", "start": "webpack-dev-server --host 0.0.0.0 --progress --colors --hot --inline --port 3000" }, "dependencies": { diff --git a/src/components/active-color.js b/src/components/active-color.js index 17aa98b..7981463 100644 --- a/src/components/active-color.js +++ b/src/components/active-color.js @@ -26,7 +26,7 @@ AFRAME.registerComponent('active-color', { setTimeout(() => { el.emit('mouseleave', null, false); }); } } - }, + } }); AFRAME.registerComponent('active-text-color', { @@ -48,5 +48,5 @@ AFRAME.registerComponent('active-text-color', { } else { el.setAttribute('text', 'color', this.defaultColor); } - }, + } }); diff --git a/src/components/audio-columns.js b/src/components/audio-columns.js index 8a3534c..4358e55 100644 --- a/src/components/audio-columns.js +++ b/src/components/audio-columns.js @@ -37,7 +37,7 @@ AFRAME.registerComponent('audio-columns', { } } - this.geometry = THREE.BufferGeometryUtils.mergeBufferGeometries(geometries) + this.geometry = THREE.BufferGeometryUtils.mergeBufferGeometries(geometries); const mesh = new THREE.Mesh(this.geometry, this.el.sceneEl.systems.materials.black); this.el.setObject3D('mesh', mesh); }, diff --git a/src/components/beat-hit-sound.js b/src/components/beat-hit-sound.js index 0f87456..6ca70ca 100644 --- a/src/components/beat-hit-sound.js +++ b/src/components/beat-hit-sound.js @@ -2,13 +2,13 @@ var audioContext = new window.AudioContext(); // Allows for modifying detune. PR has been sent to three.js. THREE.Audio.prototype.play = function () { - if ( this.isPlaying === true ) { - console.warn( 'THREE.Audio: Audio is already playing.' ); + if (this.isPlaying === true) { + console.warn('THREE.Audio: Audio is already playing.'); return; } - if ( this.hasPlaybackControl === false ) { - console.warn( 'THREE.Audio: this Audio has no playback control.' ); + if (this.hasPlaybackControl === false) { + console.warn('THREE.Audio: this Audio has no playback control.'); return; } @@ -16,10 +16,10 @@ THREE.Audio.prototype.play = function () { source.buffer = this.buffer; source.detune.value = this.detune; source.loop = this.loop; - source.onended = this.onEnded.bind( this ); - source.playbackRate.setValueAtTime( this.playbackRate, this.startTime ); + source.onended = this.onEnded.bind(this); + source.playbackRate.setValueAtTime(this.playbackRate, this.startTime); this.startTime = this.context.currentTime; - source.start( this.startTime, this.offset ); + source.start(this.startTime, this.offset); this.isPlaying = true; @@ -46,7 +46,7 @@ AFRAME.registerComponent('beat-hit-sound', { processSound: function (audio) { // Randomize a bit. audio.detune = (Math.random() * 2000); - audio.playbackRate = 1 - (Math.random() * .20); + audio.playbackRate = 1 - (Math.random() * 0.20); this.currentBeatEl.object3D.getWorldPosition(audio.position); } }); diff --git a/src/components/beat-loader.js b/src/components/beat-loader.js index b7c5a59..8fc709b 100644 --- a/src/components/beat-loader.js +++ b/src/components/beat-loader.js @@ -133,7 +133,7 @@ AFRAME.registerComponent('beat-loader', { } } - for (i=0; i < obstacles.length; ++i) { + for (i = 0; i < obstacles.length; ++i) { noteTime = obstacles[i]._time * msPerBeat; if (noteTime > beatsTime && noteTime <= beatsTime + delta) { this.generateWall(obstacles[i]); @@ -236,4 +236,4 @@ AFRAME.registerComponent('beat-loader', { function lessThan (a, b) { return a._time - b._time; -}; +} diff --git a/src/components/beat.js b/src/components/beat.js index a054427..da22a93 100644 --- a/src/components/beat.js +++ b/src/components/beat.js @@ -130,7 +130,7 @@ AFRAME.registerComponent('beat', { var data = this.data; var i; var size; - var hitColliderConfiguration = { + var hitColliderConfiguration = { position: {x: 0, y: data.size / 2, z: 0}, size: {width: data.size, height: data.size / 5.0, depth: data.size} }; @@ -239,8 +239,8 @@ AFRAME.registerComponent('beat', { destroyBeat: (function () { var parallelPlaneMaterial = new THREE.MeshBasicMaterial({ - color: '#00008b', - side: THREE.DoubleSide + color: '#00008b', + side: THREE.DoubleSide }); var planeMaterial = new THREE.MeshBasicMaterial({color: 'grey', side: THREE.DoubleSide}); var point1 = new THREE.Vector3(); @@ -271,7 +271,7 @@ AFRAME.registerComponent('beat', { direction.copy(point1).sub(point3); this.partLeftEl.object3D.position.set(0, 0, 0); - this.partLeftEl.object3D.rotation.set(0, 0, 0) + this.partLeftEl.object3D.rotation.set(0, 0, 0); this.partLeftEl.object3D.updateMatrixWorld(); this.partRightEl.object3D.position.set(0, 0, 0); @@ -320,9 +320,9 @@ AFRAME.registerComponent('beat', { const cutRightMaterial = this.cutRightEl.getObject3D('mesh').material; cutRightMaterial.clippingPlanes = cutRightMaterial.clippingPlanes || []; - cutRightMaterial.clippingPlanes.length = 0 - cutRightMaterial.clippingPlanes.push(rightBorderOuterPlane) - cutRightMaterial.clippingPlanes.push(rightBorderInnerPlane) + cutRightMaterial.clippingPlanes.length = 0; + cutRightMaterial.clippingPlanes.push(rightBorderOuterPlane); + cutRightMaterial.clippingPlanes.push(rightBorderInnerPlane); const partLeftMaterial = this.partLeftEl.getObject3D('mesh').material; partLeftMaterial.clippingPlanes = partLeftMaterial.clippingPlanes || []; @@ -332,8 +332,8 @@ AFRAME.registerComponent('beat', { const cutLeftMaterial = this.cutLeftEl.getObject3D('mesh').material; cutLeftMaterial.clippingPlanes = cutLeftMaterial.clippingPlanes || []; cutLeftMaterial.clippingPlanes.length = 0; - cutLeftMaterial.clippingPlanes.push(leftBorderInnerPlane) - cutLeftMaterial.clippingPlanes.push(leftBorderOuterPlane) + cutLeftMaterial.clippingPlanes.push(leftBorderInnerPlane); + cutLeftMaterial.clippingPlanes.push(leftBorderOuterPlane); this.partLeftEl.object3D.visible = true; this.partRightEl.object3D.visible = true; @@ -352,7 +352,7 @@ AFRAME.registerComponent('beat', { position: this.el.object3D.position, rotation: auxObj3D.rotation }); - } + }; })(), pause: function () { diff --git a/src/components/debug-controller.js b/src/components/debug-controller.js index fd390d4..a8287c1 100644 --- a/src/components/debug-controller.js +++ b/src/components/debug-controller.js @@ -103,38 +103,38 @@ AFRAME.registerComponent('debug-controller', { // Position bindings. if (evt.ctrlKey) { secondaryPosition = secondaryHand.getAttribute('position'); - if (evt.keyCode === 72) { secondaryPosition.x -= 0.01 } // h. - if (evt.keyCode === 74) { secondaryPosition.y -= 0.01 } // j. - if (evt.keyCode === 75) { secondaryPosition.y += 0.01 } // k. - if (evt.keyCode === 76) { secondaryPosition.x += 0.01 } // l. - if (evt.keyCode === 59 || evt.keyCode === 186) { secondaryPosition.z -= 0.01 } // ;. - if (evt.keyCode === 222) { secondaryPosition.z += 0.01 } // ;. + if (evt.keyCode === 72) { secondaryPosition.x -= 0.01; } // h. + if (evt.keyCode === 74) { secondaryPosition.y -= 0.01; } // j. + if (evt.keyCode === 75) { secondaryPosition.y += 0.01; } // k. + if (evt.keyCode === 76) { secondaryPosition.x += 0.01; } // l. + if (evt.keyCode === 59 || evt.keyCode === 186) { secondaryPosition.z -= 0.01; } // ;. + if (evt.keyCode === 222) { secondaryPosition.z += 0.01; } // ;. secondaryHand.setAttribute('position', AFRAME.utils.clone(secondaryPosition)); } else { primaryPosition = primaryHand.getAttribute('position'); - if (evt.keyCode === 72) { primaryPosition.x -= 0.01 } // h. - if (evt.keyCode === 74) { primaryPosition.y -= 0.01 } // j. - if (evt.keyCode === 75) { primaryPosition.y += 0.01 } // k. - if (evt.keyCode === 76) { primaryPosition.x += 0.01 } // l. - if (evt.keyCode === 59 || evt.keyCode === 186) { primaryPosition.z -= 0.01 } // ;. - if (evt.keyCode === 222) { primaryPosition.z += 0.01 } // ;. + if (evt.keyCode === 72) { primaryPosition.x -= 0.01; } // h. + if (evt.keyCode === 74) { primaryPosition.y -= 0.01; } // j. + if (evt.keyCode === 75) { primaryPosition.y += 0.01; } // k. + if (evt.keyCode === 76) { primaryPosition.x += 0.01; } // l. + if (evt.keyCode === 59 || evt.keyCode === 186) { primaryPosition.z -= 0.01; } // ;. + if (evt.keyCode === 222) { primaryPosition.z += 0.01; } // ;. primaryHand.setAttribute('position', AFRAME.utils.clone(primaryPosition)); } // Rotation bindings. if (evt.ctrlKey) { secondaryRotation = secondaryHand.getAttribute('rotation'); - if (evt.keyCode === 89) { secondaryRotation.x -= 10 } // y. - if (evt.keyCode === 79) { secondaryRotation.x += 10 } // o. - if (evt.keyCode === 85) { secondaryRotation.y -= 10 } // u. - if (evt.keyCode === 73) { secondaryRotation.y += 10 } // i. + if (evt.keyCode === 89) { secondaryRotation.x -= 10; } // y. + if (evt.keyCode === 79) { secondaryRotation.x += 10; } // o. + if (evt.keyCode === 85) { secondaryRotation.y -= 10; } // u. + if (evt.keyCode === 73) { secondaryRotation.y += 10; } // i. secondaryHand.setAttribute('rotation', AFRAME.utils.clone(secondaryRotation)); } else { primaryRotation = primaryHand.getAttribute('rotation'); - if (evt.keyCode === 89) { primaryRotation.x -= 10 } // y. - if (evt.keyCode === 79) { primaryRotation.x += 10 } // o. - if (evt.keyCode === 85) { primaryRotation.y -= 10 } // u. - if (evt.keyCode === 73) { primaryRotation.y += 10 } // i. + if (evt.keyCode === 89) { primaryRotation.x -= 10; } // y. + if (evt.keyCode === 79) { primaryRotation.x += 10; } // o. + if (evt.keyCode === 85) { primaryRotation.y -= 10; } // u. + if (evt.keyCode === 73) { primaryRotation.y += 10; } // i. primaryHand.setAttribute('rotation', AFRAME.utils.clone(primaryRotation)); } }); @@ -165,7 +165,7 @@ AFRAME.registerComponent('debug-controller', { const bounds = this.bounds; const camera = this.el.sceneEl.camera; const left = evt.clientX - bounds.left; - const top = evt.clientY - bounds.top + const top = evt.clientY - bounds.top; mouse.x = (left / bounds.width) * 2 - 1; mouse.y = (-top / bounds.height) * 2 - 1; diff --git a/src/components/debug-cursor.js b/src/components/debug-cursor.js index 0a08a43..6cf94b4 100644 --- a/src/components/debug-cursor.js +++ b/src/components/debug-cursor.js @@ -2,7 +2,7 @@ * Log cursor events. */ AFRAME.registerComponent('debug-cursor', { - init: function() { + init: function () { if (process.env.NODE_ENV === 'production') { return; } @@ -20,12 +20,12 @@ AFRAME.registerComponent('debug-cursor', { }); }, - log: function(event, intersectedEl, color) { + log: function (event, intersectedEl, color) { if (intersectedEl.id) { console.log(`%c[${event}] ${intersectedEl.id}`, `color: ${color}`); } else { console.log(`%c[${event}]`, `color: ${color}`); console.log(intersectedEl); } - }, + } }); diff --git a/src/components/gpu-preloader.js b/src/components/gpu-preloader.js index 621f187..6983b99 100644 --- a/src/components/gpu-preloader.js +++ b/src/components/gpu-preloader.js @@ -67,5 +67,5 @@ AFRAME.registerComponent('gpu-preloader', { return; } this.el.renderer.setTexture2D(texture, i++ % 8); - }, + } }); diff --git a/src/components/hand-swapper.js b/src/components/hand-swapper.js index a26b673..df06db2 100644 --- a/src/components/hand-swapper.js +++ b/src/components/hand-swapper.js @@ -18,7 +18,7 @@ AFRAME.registerComponent('hand-swapper', { init: function () { this.swapHand = this.swapHand.bind(this); - events.forEach(event => { + events.forEach(event => { this.el.addEventListener(event, this.swapHand); }); }, diff --git a/src/components/keyboard-raycastable.js b/src/components/keyboard-raycastable.js index ca7bfb8..eda5f88 100644 --- a/src/components/keyboard-raycastable.js +++ b/src/components/keyboard-raycastable.js @@ -4,5 +4,5 @@ AFRAME.registerComponent('keyboard-raycastable', { play: function () { this.el.components['super-keyboard'].kbImg.setAttribute('bind-toggle__raycastable', 'keyboardActive'); - }, + } }); diff --git a/src/components/logoflicker.js b/src/components/logoflicker.js index f2a1f4a..d32806d 100644 --- a/src/components/logoflicker.js +++ b/src/components/logoflicker.js @@ -20,7 +20,7 @@ AFRAME.registerComponent('logoflicker', { }, update: function (oldData) { - if (this.data.active !== oldData.active){ + if (this.data.active !== oldData.active) { if (this.data.active) { this.setOn(); } else { diff --git a/src/components/menu-controls.js b/src/components/menu-controls.js index 33dc811..f13fe8e 100644 --- a/src/components/menu-controls.js +++ b/src/components/menu-controls.js @@ -1,4 +1,4 @@ -var hoveredIndex = undefined; +var hoveredIndex; var keyEventsRegistered = false; var results = null; diff --git a/src/components/particleplayer.js b/src/components/particleplayer.js index 065b8d1..1e38583 100644 --- a/src/components/particleplayer.js +++ b/src/components/particleplayer.js @@ -49,7 +49,7 @@ AFRAME.registerComponent('particleplayer', { multiple: true, - init: function() { + init: function () { this.frame = 0; this.framedata = null; this.indexPool = null; @@ -70,7 +70,7 @@ AFRAME.registerComponent('particleplayer', { this.scaleAnim = new THREE.Vector3(); }, - update: function(oldData) { + update: function (oldData) { const data = this.data; if (!data.src) { @@ -129,7 +129,7 @@ AFRAME.registerComponent('particleplayer', { } }, - loadParticlesJSON: function(json, scale) { + loadParticlesJSON: function (json, scale) { var alive; this.restPositions.length = 0; @@ -165,10 +165,10 @@ AFRAME.registerComponent('particleplayer', { let p = (this.framedata[frameIndex][particleIndex] = { position: alive ? { - x: (rawP[0] / precision) * scale, - y: (rawP[1] / precision) * scale, - z: (rawP[2] / precision) * scale - } + x: (rawP[0] / precision) * scale, + y: (rawP[1] / precision) * scale, + z: (rawP[2] / precision) * scale + } : null, alive: alive }); @@ -176,10 +176,10 @@ AFRAME.registerComponent('particleplayer', { if (jsonData.rotation) { p.rotation = alive ? { - x: rawP[3] / precision, - y: rawP[4] / precision, - z: rawP[5] / precision - } + x: rawP[3] / precision, + y: rawP[4] / precision, + z: rawP[5] / precision + } : null; } @@ -195,10 +195,10 @@ AFRAME.registerComponent('particleplayer', { } }, - createParticles: (function() { + createParticles: (function () { const tempGeometries = []; - return function(numParticleSystems) { + return function (numParticleSystems) { const data = this.data; var loop = parseInt(this.data.loop); @@ -266,14 +266,14 @@ AFRAME.registerComponent('particleplayer', { for (let i = 0; i < particleSystem.activeParticleIndices.length; i++) { particleSystem.activeParticleIndices[i] = i; - }; + } this.particleSystems.push(particleSystem); } }; })(), - start: function(evt) { + start: function (evt) { if (this.data.delay > 0) { setTimeout(() => this.startAfterDelay(evt), this.data.delay); } else { @@ -281,7 +281,7 @@ AFRAME.registerComponent('particleplayer', { } }, - startAfterDelay: function(evt) { + startAfterDelay: function (evt) { // position, rotation var found = -1; var particleSystem; @@ -324,7 +324,7 @@ AFRAME.registerComponent('particleplayer', { this.resetParticles(particleSystem); }, - doLoop: function(particleSystem) { + doLoop: function (particleSystem) { particleSystem.loopCount++; particleSystem.frame = -1; particleSystem.time = 0; @@ -334,7 +334,7 @@ AFRAME.registerComponent('particleplayer', { this.resetParticles(particleSystem); }, - resetParticle: function(particleSystem, particleIndex) { + resetParticle: function (particleSystem, particleIndex) { const geometry = particleSystem.mesh.geometry; if (this.restPositions[particleIndex]) { @@ -368,7 +368,7 @@ AFRAME.registerComponent('particleplayer', { * to their initial position and, if user asked for replaying less than 100% * of particles, randomly choose them. */ - resetParticles: function(particleSystem) { + resetParticles: function (particleSystem) { var i; var rand; @@ -408,10 +408,10 @@ AFRAME.registerComponent('particleplayer', { } }, - tick: (function() { + tick: (function () { const helperPositionVec3 = new THREE.Vector3(); - return function(time, delta) { + return function (time, delta) { var frame; // current particle system frame var fdata; // all particles data in current frame var fdataNext; // next frame (for interpolation) @@ -445,7 +445,7 @@ AFRAME.registerComponent('particleplayer', { : null; } - if (this.data.animateScale){ + if (this.data.animateScale) { particleSystem.pscale.lerp(this.data.finalScale, relTime); } @@ -454,7 +454,6 @@ AFRAME.registerComponent('particleplayer', { activeParticleIndex < particleSystem.activeParticleIndices.length; activeParticleIndex++ ) { - let particleIndex = particleSystem.activeParticleIndices[activeParticleIndex]; let rotation = useRotation && fdata[particleIndex].rotation; @@ -519,7 +518,7 @@ AFRAME.registerComponent('particleplayer', { }); // Use triangle geometry as a helper for rotating. -const tri = (function() { +const tri = (function () { const tri = new THREE.Geometry(); tri.vertices.push(new THREE.Vector3()); tri.vertices.push(new THREE.Vector3()); @@ -532,7 +531,7 @@ const tri = (function() { * Faces of a plane are v0, v2, v1 and v2, v3, v1. * Positions are 12 numbers: [v0, v1, v2, v3]. */ -function transformPlane( +function transformPlane ( particleIndex, geometry, originalArray, @@ -615,7 +614,7 @@ function transformPlane( } module.exports.transformPlane = transformPlane; -function copyArray(dest, src) { +function copyArray (dest, src) { dest.length = 0; for (let i = 0; i < src.length; i++) { dest[i] = src[i]; diff --git a/src/components/raycaster-target.js b/src/components/raycaster-target.js index 78d05b2..1d1afb1 100644 --- a/src/components/raycaster-target.js +++ b/src/components/raycaster-target.js @@ -7,7 +7,7 @@ AFRAME.registerComponent('raycaster-target', { bindToggle: {default: ''}, depth: {type: 'number'}, height: {type: 'number'}, - position: {type: 'vec3', default: {x: 0, y: 0, z: 0}}, + position: {type: 'vec3', default: {x: 0, y: 0, z: 0}}, rotation: {type: 'vec3', default: {x: 0, y: 0, z: 0}}, useBoxTarget: {default: false}, width: {type: 'number'} diff --git a/src/components/saber-controls.js b/src/components/saber-controls.js index cd401f7..11ce84e 100644 --- a/src/components/saber-controls.js +++ b/src/components/saber-controls.js @@ -23,7 +23,7 @@ AFRAME.registerComponent('saber-controls', { }, update: function (oldData) { - if (!oldData.bladeEnabled && this.data.bladeEnabled) { + if (!oldData.bladeEnabled && this.data.bladeEnabled) { this.bladeEl.emit('drawblade'); } }, @@ -47,7 +47,7 @@ AFRAME.registerComponent('saber-controls', { 'abuttondown', 'bbuttondown', 'xbuttondown', - 'ybuttondown', + 'ybuttondown' ], upEvents: [ 'triggerup', @@ -55,23 +55,23 @@ AFRAME.registerComponent('saber-controls', { 'abuttonup', 'bbuttonup', 'xbuttonup', - 'ybuttonup', - ], - }, + 'ybuttonup' + ] + } }, 'vive-controls': { cursor: { downEvents: ['trackpaddown', 'triggerdown', 'gripdown'], - upEvents: ['trackpadup', 'triggerup', 'gripup'], - }, + upEvents: ['trackpadup', 'triggerup', 'gripup'] + } }, 'windows-motion-controls': { cursor: { downEvents: ['trackpaddown', 'triggerdown', 'gripdown'], - upEvents: ['trackpadup', 'triggerup', 'gripup'], - }, + upEvents: ['trackpadup', 'triggerup', 'gripup'] + } } } }); diff --git a/src/components/search.js b/src/components/search.js index 7a262a7..4b44c8a 100644 --- a/src/components/search.js +++ b/src/components/search.js @@ -9,7 +9,7 @@ var algolia = client.initIndex('supersaber'); * Attached to super-keyboard. */ AFRAME.registerComponent('search', { - init: function() { + init: function () { this.eventDetail = {results: []}; this.popularHits = null; this.queryObject = {hitsPerPage: 100, query: ''}; @@ -66,7 +66,7 @@ AFRAME.registerComponent('search-result-list', { this.el.sceneEl.emit('menuchallengeselect', evt.target.closest('.searchResult').dataset.id, false); - }), + }) }); AFRAME.registerComponent('search-song-name-selected', { diff --git a/src/components/song.js b/src/components/song.js index dcb4fe1..88e16e0 100644 --- a/src/components/song.js +++ b/src/components/song.js @@ -32,7 +32,7 @@ AFRAME.registerComponent('song', { }, update: function (oldData) { - var audio = this.audio; + var audio = this.audio; var el = this.el; var data = this.data; diff --git a/src/components/stage-colors.js b/src/components/stage-colors.js index b5cc975..baa91f1 100644 --- a/src/components/stage-colors.js +++ b/src/components/stage-colors.js @@ -6,12 +6,12 @@ AFRAME.registerComponent('stage-colors', { }, init: function () { - this.neonRed = new THREE.Color(0xff9999); + this.neonRed = new THREE.Color(0xff9999); this.neonBlue = new THREE.Color(0x9999ff); - this.defaultRed = new THREE.Color(0xff0000); + this.defaultRed = new THREE.Color(0xff0000); this.defaultBlue = new THREE.Color(0x0000ff); this.mineEnvMap = { - red: new THREE.TextureLoader().load('assets/img/mineenviro-red.jpg'), + red: new THREE.TextureLoader().load('assets/img/mineenviro-red.jpg'), blue: new THREE.TextureLoader().load('assets/img/mineenviro-blue.jpg') }; this.mineColor = {red: new THREE.Color(0x070304), blue: new THREE.Color(0x030407)}; @@ -36,7 +36,7 @@ AFRAME.registerComponent('stage-colors', { // Init or reset. this.backglow.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc'); this.sky.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc'); - this.el.sceneEl.object3D.background.set(red ? '#770100': '#15252d'); + this.el.sceneEl.object3D.background.set(red ? '#770100' : '#15252d'); this.el.sceneEl.object3D.fog.color.set(red ? '#a00' : '#007cb9'); this.el.sceneEl.systems.materials.neon.color = red ? this.neonRed : this.neonBlue; @@ -46,5 +46,5 @@ AFRAME.registerComponent('stage-colors', { this.mineMaterial.emissive = this.mineEmission[red ? 'red' : 'blue']; this.mineMaterial.envMap = this.mineEnvMap[red ? 'red' : 'blue']; this.mineMaterial.needsUpdate = true; - }, + } }); diff --git a/src/components/toggle-pause-play.js b/src/components/toggle-pause-play.js index 244ca75..cb918a9 100644 --- a/src/components/toggle-pause-play.js +++ b/src/components/toggle-pause-play.js @@ -1,10 +1,10 @@ AFRAME.registerComponent('toggle-pause-play', { schema: { - isPlaying: { default: false }, + isPlaying: { default: false } }, - update: function() { + update: function () { const action = this.data.isPlaying ? 'pause' : 'play'; parent.postMessage(JSON.stringify({ verify: 'game-action', action }), '*'); - }, + } }); diff --git a/src/components/trail.js b/src/components/trail.js index 395aa0d..8842864 100644 --- a/src/components/trail.js +++ b/src/components/trail.js @@ -39,15 +39,15 @@ AFRAME.registerComponent('trail', { 'varying vec4 vColor;', 'attribute vec4 vertexColor;', 'void main() {', - 'vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);', - 'vColor = vertexColor;', - 'gl_Position = projectionMatrix * modelViewPosition;', + 'vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);', + 'vColor = vertexColor;', + 'gl_Position = projectionMatrix * modelViewPosition;', '}' ].join(''), fragmentShader: [ 'varying vec4 vColor;', 'void main() {', - 'gl_FragColor = vColor;', + 'gl_FragColor = vColor;', '}' ].join('') }); @@ -178,7 +178,7 @@ AFRAME.registerComponent('trail', { alpha = 1.0 - ((saberTrajectory.length - i) / saberTrajectory.length); currentPoint = saberTrajectory[i]; - previousPoint = saberTrajectory[i-1]; + previousPoint = saberTrajectory[i - 1]; vertices[36 * i] = previousPoint.center.x; vertices[36 * i + 1] = previousPoint.center.y; @@ -286,7 +286,7 @@ AFRAME.registerComponent('trail', { // Color colors[48 * i + 40] = color.red; - colors[48 * i + 41] = color.green; + colors[48 * i + 41] = color.green; colors[48 * i + 42] = color.blue; colors[48 * i + 43] = 0.0; diff --git a/src/components/twister.js b/src/components/twister.js index f7df07e..c883263 100644 --- a/src/components/twister.js +++ b/src/components/twister.js @@ -25,7 +25,7 @@ AFRAME.registerComponent('twister', { var segment; var lastSegment; - if (Math.abs(this.data.twist - this.currentTwist) > 0.001){ + if (Math.abs(this.data.twist - this.currentTwist) > 0.001) { this.animate = true; return; } @@ -45,11 +45,11 @@ AFRAME.registerComponent('twister', { createSegment: function (radius) { const R = this.data.thickness; var points = [ - new THREE.Vector2(radius - R, R), + new THREE.Vector2(radius - R, R), new THREE.Vector2(radius - R, -R), new THREE.Vector2(radius + R, -R), - new THREE.Vector2(radius + R, R), - new THREE.Vector2(radius - R, R) + new THREE.Vector2(radius + R, R), + new THREE.Vector2(radius - R, R) ]; var material = this.el.sceneEl.systems.materials.black; var geometry = new THREE.LatheBufferGeometry(points, this.data.vertices); @@ -63,7 +63,7 @@ AFRAME.registerComponent('twister', { tick: function (time, delta) { if (!this.animate) { return; } - if (Math.abs(this.data.twist - this.currentTwist) < 0.001){ + if (Math.abs(this.data.twist - this.currentTwist) < 0.001) { this.animate = false; } diff --git a/src/components/wall.js b/src/components/wall.js index 1fd58db..2eee555 100644 --- a/src/components/wall.js +++ b/src/components/wall.js @@ -27,5 +27,5 @@ AFRAME.registerComponent('wall', { this.el.object3D.position.z = 9999; this.el.pause(); this.el.removeAttribute('collidable'); - }, + } }); diff --git a/src/state/index.js b/src/state/index.js index 72176d4..47f575e 100644 --- a/src/state/index.js +++ b/src/state/index.js @@ -221,7 +221,7 @@ AFRAME.registerState({ result.songSubName = result.songSubName || 'Unknown Artist'; result.shortSongName = truncate(result.songName, SONG_NAME_TRUNCATE).toUpperCase(); result.shortSongSubName = truncate(result.songSubName, SONG_SUB_NAME_TRUNCATE); - challengeDataStore[result.id] = result + challengeDataStore[result.id] = result; } computeSearchPagination(state); computeMenuSelectedChallengeIndex(state); diff --git a/webpack.config.js b/webpack.config.js index 89d3f1b..4f8e50d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,7 +8,7 @@ var webpack = require('webpack'); // Set up templating. var nunjucks = Nunjucks.configure(path.resolve(__dirname, 'src'), { - noCache: true, + noCache: true }); nunjucks.addGlobal('DEBUG_KEYBOARD', !!process.env.DEBUG_KEYBOARD); nunjucks.addGlobal('HOST', ip.address()); @@ -59,10 +59,10 @@ if (process.env.NODE_ENV === 'production') { undefinedToVoid: true, keepFnName: true, keepClassName: true, - tdz: true, + tdz: true }, { - sourceMap: 'source-map', + sourceMap: 'source-map' } ) ); @@ -71,12 +71,12 @@ if (process.env.NODE_ENV === 'production') { module.exports = { devtool: '#inline-source-map', devServer: { - disableHostCheck: true, + disableHostCheck: true }, entry: './src/index.js', output: { path: __dirname, - filename: 'build/build.js', + filename: 'build/build.js' }, plugins: PLUGINS, module: { @@ -85,25 +85,25 @@ module.exports = { test: /\.js/, exclude: path => path.indexOf('node_modules') !== -1 || path.indexOf('panel') !== -1, - loader: 'babel-loader', + loader: 'babel-loader' }, { test: /\.glsl/, exclude: /(node_modules)/, - loader: 'webpack-glsl-loader', + loader: 'webpack-glsl-loader' }, { test: /\.css$/, exclude: /(node_modules)/, - use: ['style-loader', 'css-loader'], + use: ['style-loader', 'css-loader'] }, { test: /\.(png|jpg)/, - loader: 'url-loader', + loader: 'url-loader' } - ], + ] }, resolve: { - modules: [path.join(__dirname, 'node_modules')], - }, + modules: [path.join(__dirname, 'node_modules')] + } };