Skip to content

Commit

Permalink
Bump to A-Frame 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarcos committed Jan 31, 2021
1 parent 54de8b2 commit b244312
Show file tree
Hide file tree
Showing 17 changed files with 1,192 additions and 4,172 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<meta property="twitter:image" content="https://supermedium.com/moonrider/assets/img/splash.jpg">

<link rel="shortcut icon" href="assets/img/favicon.png" type="image/x-icon">
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@44212208beaa0f2d13c9721549687455886587c3/dist/aframe-master.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@37b219d2cf43c1f7cbd7ac4fc98e8ce5d914a1f7/dist/aframe-master.min.js"></script>
<script src="build/build.js?v=3"></script>
</head>
<body>
Expand Down
5,275 changes: 1,123 additions & 4,152 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"aframe-orbit-controls": "^1.2.0",
"aframe-proxy-event-component": "^2.1.0",
"aframe-render-order-component": "^1.1.0",
"aframe-ring-shader": "^1.2.0",
"aframe-slice9-component": "^1.0.0",
"aframe-state-component": "6.7.0",
"aframe-super-hot-html-loader": "^1.2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@
id="bigMenuButton"
geometry="primitive: plane; width: 1.15; height: 0.23"
material="shader: panelShader; brightness: 0.5; borderWidth: 0.05; ratio: 4; borderRadius: 0.6"
animation__mouseenter1="property: components.material.material.uniforms.active.value; from: 0; to: 1; startEvents: mouseenter; pauseEvents: mouseleave; dur: 100"
animation__mouseleave1="property: components.material.material.uniforms.active.value; from: 1; to: 0; startEvents: mouseleave; pauseEvents: mouseenter; dur: 100"
animation__mouseenter1="property: components.material.material.uniforms.activePanel.value; from: 0; to: 1; startEvents: mouseenter; pauseEvents: mouseleave; dur: 100"
animation__mouseleave1="property: components.material.material.uniforms.activePanel.value; from: 1; to: 0; startEvents: mouseleave; pauseEvents: mouseenter; dur: 100"
animation__mouseenter2="property: scale; from: 1 1 1; to: 1.04 1.04 1.04; startEvents: mouseenter; pauseEvents: mouseleave; dur: 80"
animation__mouseleave2="property: scale; to: 1 1 1; from: 1.04 1.04 1.04; startEvents: mouseleave; pauseEvents: mouseenter; dur: 80"
render-order="menubutton"></a-mixin>
Expand Down
2 changes: 1 addition & 1 deletion src/components/panel-shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import COLORS from '../constants/colors';

AFRAME.registerShader('panelShader', {
schema: {
active: {type: 'number', is: 'uniform', default: 0},
activePanel: {type: 'number', is: 'uniform', default: 0},
brightness: {type: 'number', is: 'uniform', default: 0.3},
borderWidth: {type: 'number', is: 'uniform', default: 0.004},
borderRadius: {type: 'number', is: 'uniform', default: 0.15},
Expand Down
13 changes: 13 additions & 0 deletions src/components/ring.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
AFRAME.registerShader('ring', {
schema: {
blur: {default: 0.01, is: 'uniform'},
color: {type: 'color', is: 'uniform'},
progress: {default: 0, is: 'uniform'},
radiusInner: {default: 0.6, is: 'uniform'},
radiusOuter: {default: 1, is: 'uniform'}
},

vertexShader: require('./shaders/ring.vert.glsl'),

fragmentShader: require('./shaders/ring.frag.glsl')
});
8 changes: 5 additions & 3 deletions src/components/shaders/panel.frag.glsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#extension GL_OES_standard_derivatives : enable
#if __VERSION__ == 100
#extension GL_OES_standard_derivatives : enable
#endif

uniform vec3 colorPrimary;
uniform vec3 colorSecondary;
Expand All @@ -12,7 +14,7 @@ uniform float brightness;
uniform float ratio;
uniform float midSection;
uniform float opacity;
uniform float active;
uniform float activePanel;

varying vec2 uvs;

Expand All @@ -28,7 +30,7 @@ void main()
vec2 uv2 = uv * 2.0 - 1.0; // from -1 to 1
uv2.x *= ratio;

vec3 col = mix(colorSecondary * uv.y, colorPrimary * uv.y, uv.x) * (brightness + active * 0.4);
vec3 col = mix(colorSecondary * uv.y, colorPrimary * uv.y, uv.x) * (brightness + activePanel * 0.4);
vec3 borderCol = mix(colorSecondary, colorPrimary, uv.y);

vec2 size = vec2(0.83 * ratio, 0.86) - borderRadius;
Expand Down
30 changes: 30 additions & 0 deletions src/components/shaders/ring.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#if __VERSION__ == 100
#extension GL_OES_standard_derivatives : enable
#endif
#define PI 3.14159265358979
uniform float blur;
uniform float progress;
uniform float radiusInner;
uniform float radiusOuter;
uniform vec3 color;

varying vec2 vUv;

void main () {
// make uvs go from -1 to 1
vec2 uv = vec2(vUv.x * 2.0 - 1.0, vUv.y * 2.0 - 1.0);
// calculate distance of fragment to center
float r = uv.x * uv.x + uv.y * uv.y;
// calculate antialias
float aa = fwidth(r);
// make full circle (radiusOuter - radiusInner)
float col = (1.0 - smoothstep(radiusOuter - aa, radiusOuter + blur + aa, r)) * smoothstep(radiusInner - aa, radiusInner + blur + aa, r);
// radial gradient
float a = smoothstep(-PI-aa, PI+aa, atan(uv.y, uv.x));
// progress angle
float p = 1.0 - progress - blur;
// apply progress to full circle (1 for done part, 0 for part to go)
col *= smoothstep(p, p + blur, a);
// multiply by user color
gl_FragColor = vec4(color * col, col);
}
6 changes: 6 additions & 0 deletions src/components/shaders/ring.vert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
varying vec2 vUv;

void main () {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
2 changes: 1 addition & 1 deletion src/components/stars.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AFRAME.registerComponent('stars', {
for (let i = 0; i < this.data.count; i++) {
positions.push(rand(), rand(), rand() * 4);
}
geometry.addAttribute('position', new THREE.Float32BufferAttribute(positions, 3));
geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3));
geometry.computeBoundingSphere();
const points = new THREE.Points(geometry, this.material);
this.el.setObject3D('stars', points);
Expand Down
2 changes: 1 addition & 1 deletion src/components/tail.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AFRAME.registerComponent('tail', {

const geometry = this.geometry = new THREE.PlaneBufferGeometry(
data.width, data.height, data.segments, 1);
geometry.removeAttribute('normal');
geometry.deleteAttribute('normal');
geometry.translate(data.width / 2, 0, 0);

const material = this.el.sceneEl.systems.materials.handStarTrail;
Expand Down
4 changes: 2 additions & 2 deletions src/components/trail.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ AFRAME.registerComponent('trail', {

this.newSample = null;

geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3).setDynamic(true));
geometry.addAttribute('vertexColor', new THREE.BufferAttribute(colors, 4).setDynamic(true));
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3).setUsage(THREE.DynamicDrawUsage));
geometry.setAttribute('vertexColor', new THREE.BufferAttribute(colors, 4).setUsage(THREE.DynamicDrawUsage));

const material = new THREE.ShaderMaterial({
side: THREE.DoubleSide,
Expand Down
2 changes: 1 addition & 1 deletion src/components/vertex-colors-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ AFRAME.registerComponent('vertex-colors-buffer', {
}

if (!geometry.attributes.color) {
geometry.addAttribute('color',
geometry.setAttribute('color',
new THREE.BufferAttribute(
new Float32Array(geometry.attributes.position.array.length), 3
)
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ if (process.env.DEBUG_LOG) {
require('aframe-orbit-controls');
require('aframe-proxy-event-component');
require('aframe-render-order-component');
require('aframe-ring-shader');
require('aframe-state-component');
require('aframe-slice9-component');
require('aframe-thumb-controls-component');
Expand Down
4 changes: 2 additions & 2 deletions src/state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ AFRAME.registerState({
accuracy: 100, // Out of 100.
accuracyScore: 0, // Raw number.
accuracyInt: 100, // Out of 100.
active: false,
activePanel: false,
beatsHit: 0,
beatsMissed: 0,
beatsText: '',
Expand All @@ -146,7 +146,7 @@ AFRAME.registerState({
score: 0
},
search: {
active: true,
activePanel: true,
page: 0,
hasError: false,
hasNext: false,
Expand Down
4 changes: 2 additions & 2 deletions src/templates/gameMenu.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<a-mixin
id="gameMenuButton"
mixin="bigMenuButton"
animation__mouseenter="property: components.material.material.uniforms.active.value; from: 0; to: 1; startEvents: mouseenter; pauseEvents: mouseleave; dur: 70"
animation__mouseleave="property: components.material.material.uniforms.active.value; from: 1; to: 0; startEvents: mouseleave; pauseEvents: mouseenter; dur: 70"
animation__mouseenter="property: components.material.material.uniforms.activePanel.value; from: 0; to: 1; startEvents: mouseenter; pauseEvents: mouseleave; dur: 70"
animation__mouseleave="property: components.material.material.uniforms.activePanel.value; from: 1; to: 0; startEvents: mouseleave; pauseEvents: mouseenter; dur: 70"
geometry="height: 0.28"></a-mixin>

<a-mixin
Expand Down
4 changes: 2 additions & 2 deletions src/templates/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@
proxy-event="event: click; to: a-scene; as: playbuttonclick"
material="shader: panelShader; brightness: 0.7; transparent: true; midSection: 0; ratio: 2.8; borderRadius: 0.6; borderWidth: 0.08"
render-order="menubutton"
animation__mouseenter1="property: components.material.material.uniforms.active.value; from: 0; to: 1; startEvents: mouseenter; pauseEvents: mouseleave; dur: 100"
animation__mouseleave1="property: components.material.material.uniforms.active.value; from: 1; to: 0; startEvents: mouseleave; pauseEvents: mouseenter; dur: 100"
animation__mouseenter1="property: components.material.material.uniforms.activePanel.value; from: 0; to: 1; startEvents: mouseenter; pauseEvents: mouseleave; dur: 100"
animation__mouseleave1="property: components.material.material.uniforms.activePanel.value; from: 1; to: 0; startEvents: mouseleave; pauseEvents: mouseenter; dur: 100"
animation__mouseenter2="property: scale; from: 1 1 1; to: 1.1 1.1 1.1; startEvents: mouseenter; pauseEvents: mouseleave; dur: 100"
animation__mouseleave2="property: scale; to: 1 1 1; from: 1.1 1.1 1.1; startEvents: mouseleave; pauseEvents: mouseenter; dur: 100">
<a-entity mixin="font" text="align: center; color: #FFF; wrapCount: 15; value: PLAY" position="0 -0.085 0.01"></a-entity>
Expand Down

0 comments on commit b244312

Please sign in to comment.