Files
junisaber/src/index.html

267 lines
13 KiB
HTML
Raw Normal View History

2018-07-18 20:48:45 +02:00
<!DOCTYPE html>
<html>
<head>
2018-10-08 16:05:25 -07:00
<title>Super Saber</title>
2018-10-17 03:02:28 -07:00
<meta name="description" content="Beat Saber on the VR Web with searchable and playable community songs from Beat Saver.">
2018-10-12 04:18:01 -07:00
<link rel="shortcut icon" href="assets/img/favicon.png" type="image/x-icon">
{% if DEBUG_AFRAME %}
<script src="http://{{ HOST }}:9000/dist/aframe-master.js"></script>
{% elif IS_PRODUCTION %}
<script src="vendor/aframe-master.min.js"></script>
{% else %}
<script src="vendor/aframe-master.js"></script>
{% endif %}
2018-07-18 20:48:45 +02:00
<script src="build/build.js"></script>
</head>
<body>
<audio id="introSong" src="assets/sounds/introSong.ogg" loop></audio>
2018-09-12 11:35:20 -07:00
<a-scene
2018-12-06 22:17:21 +01:00
mixin="gameoverAnimation bgColorAnimation tunnelColorAnimation leftLaserColorAnimation rightLaserColorAnimation textGlowColorAnimation floorColorAnimation"
bind__beat-loader="challengeId: challenge.id; difficulty: menuSelectedChallenge.difficulty; isPlaying: isPlaying; menuSelectedChallengeId: menuSelectedChallenge.id"
2018-10-09 17:17:41 -07:00
bind__gameover="isGameOver: isGameOver"
2018-10-16 21:19:48 -07:00
bind__intro-song="isPlaying: menuActive && !menuSelectedChallenge.id; isSearching: isSearching"
2018-11-18 02:01:47 -08:00
bind__leaderboard="isVictory: isVictory; menuSelectedChallengeId: menuSelectedChallenge.id; challengeId: challenge.id"
2018-10-25 06:37:17 -07:00
bind__song="challengeId: challenge.id; isPlaying: isPlaying; isBeatsPreloaded: challenge.isBeatsPreloaded; isGameOver: isGameOver; isVictory: isVictory"
2018-10-16 21:19:48 -07:00
bind__song-preview-system="challengeId: challenge.id; isSearching: isSearching; isSongLoading: isSongLoading; selectedChallengeId: menuSelectedChallenge.id"
2018-10-10 02:24:22 -07:00
animation__gameover="property: object3D.background; type: color; to: #750000; startEvents: gameover"
2018-09-12 11:35:20 -07:00
console-shortcuts
debug-beat-loader
debug-controller
debug-song-time
debug-state
2018-10-13 11:53:38 -07:00
gpu-preloader
2018-11-18 02:01:47 -08:00
leaderboard="apiKey: AIzaSyBCnpzND3eN37CBSu1bSYfaKQoe6yD3SnY; authDomain: supersaberrr.firebaseapp.com; databaseURL: https://supersaberrr.firebaseio.com; projectId: supersaberrr; storageBucket: supersaberrr.appspot.com; messagingSenderId: 172125624222"
loading-screen="backgroundColor: #000;"
2018-11-12 16:59:11 +08:00
pool__beat-arrow-blue="mixin: arrowBlueBeat; size: 10; container: #beatContainer"
2018-10-10 02:24:22 -07:00
pool__beat-arrow-red="mixin: arrowRedBeat; size: 10; container: #beatContainer"
pool__beat-dot-blue="mixin: dotBlueBeat; size: 10; container: #beatContainer"
pool__beat-dot-red="mixin: dotRedBeat; size: 10; container: #beatContainer"
pool__beat-mine="mixin: mine; size: 12; container: #beatContainer"
pool__beatscoreok="mixin: beatScoreOk; size: 2; container: #beatContainer"
pool__beatscoregood="mixin: beatScoreGood; size: 2; container: #beatContainer"
2018-12-06 22:17:21 +01:00
pool__beatscoreexcellent="mixin: beatScoreExcellent; size: 2; container: #beatContainer"
pool__beatscoresuper="mixin: beatScoreSuper; size: 2; container: #beatContainer"
2018-11-17 17:49:05 -08:00
pool__wall="mixin: wall; size: 10; container: #beatContainer"
2018-10-15 16:34:47 -07:00
proxy-event__cleargame1="event: gamemenuexit; as: cleargame; to: a-scene"
proxy-event__cleargame2="event: gamemenurestart; as: cleargame; to: a-scene"
2018-12-05 17:21:48 -08:00
play-sound__beatwrong="sound: #beatMissSound; event: beatwrong; volume: 0.4"
2018-12-05 21:01:39 +01:00
proxy-event__pausegame="event: pausegame; as: textglowoff; to: a-scene"
proxy-event__resumegame="event: gamemenuresume; as: textglownormal; to: a-scene"
play-sound__victory="sound: #victorySong; event: victory"
2018-11-17 07:22:15 -08:00
play-sound__crescendo="sound: #crescendo; event: victory; volume: 0.75"
2018-09-12 14:08:11 -07:00
search
stage-colors="color: blue"
2018-11-15 23:06:07 +01:00
vr-mode-ui="enterVRButton: #vrButton"
2018-11-16 16:57:29 +01:00
tutorial-2d>
2018-12-02 00:51:02 +01:00
<!-- fog="color: #a00; density: 0.035; type: exponential" -->
2018-10-12 02:21:08 -07:00
2018-10-17 03:02:28 -07:00
<a-assets timeout="10000">
{% include './assets.html' %}
2018-07-18 20:48:45 +02:00
</a-assets>
<a-entity id="beatObjTemplate" obj-model="obj: #beatObj" visible="false"></a-entity>
2018-12-03 17:54:04 +01:00
<a-entity id="arrowRedObjTemplate" obj-model="obj: #arrowredObj" visible="false"></a-entity>
<a-entity id="arrowBlueObjTemplate" obj-model="obj: #arrowblueObj" visible="false"></a-entity>
<a-entity id="dotRedObjTemplate" obj-model="obj: #dotredObj" visible="false"></a-entity>
<a-entity id="dotBlueObjTemplate" obj-model="obj: #dotblueObj" visible="false"></a-entity>
2018-10-10 23:06:35 -10:00
<a-entity id="mineObjTemplate" obj-model="obj: #mineObj" visible="false"></a-entity>
2018-09-25 05:40:08 -07:00
<a-entity id="cursorLaser" obj-model="obj: #laserObj" visible="false"></a-entity>
2018-12-05 00:30:59 +01:00
{% include './templates/stage.html' %}
<a-entity
id="beatContainer"
bind__pause="isPaused: !isPlaying"
beat-hit-sound></a-entity>
{% include './templates/loading.html' %}
{% include './templates/score.html' %}
{% include './templates/menu.html' %}
{% include './templates/tutorial.html' %}
{% include './templates/gameMenu.html' %}
{% include './templates/victory.html' %}
2018-11-18 02:01:47 -08:00
{% include './templates/leaderboard.html' %}
2018-07-18 20:48:45 +02:00
2018-12-02 00:51:02 +01:00
<!--
<a-entity id="testwall" geometry="width: 0.3; height: 1; depth: 1.5;" position="-1 1.6 -1" material="shader: wallShader; env: #envmapWallTexture; fog: false; transparent: true; side: double"></a-entity>
<a-entity id="testwallglow" visible = "false" obj-model="obj: #wallglowObj" position="-1 1.6 -1" scale="0.3 1.0 1.5" material="shader: flat; blending: additive; depthTest: false; src: #atlasImg; fog: false; transparent: true;"></a-entity>
-->
<!-- super cut fx rings -->
{% for i in range(1, 5) %}
2018-11-21 11:57:56 +01:00
<a-entity class="superCutFx" mixin="superCut"></a-entity>
{% endfor %}
<!-- Wrong + miss beat visual indicators. -->
<a-entity id="badContainer" bind__visible="isPlaying">
<a-entity id="wrongLeft" mixin='beatWrong'></a-entity>
<a-entity id="wrongRight" mixin='beatWrong'></a-entity>
<a-entity id="missLeft" mixin='beatMiss'></a-entity>
<a-entity id="missRight" mixin='beatMiss'></a-entity>
</a-entity>
2018-10-17 03:02:28 -07:00
<a-entity
id="saberParticles"
2018-12-06 00:05:46 +01:00
particleplayer="src: #saberParticlesJSON; pscale: 0.55; loop: false; on: explode; img: #sparkImg; count: 20%; animateScale: true; initialScale: 4 1 1; finalScale: 0.2 0.2 1"></a-entity>
<a-entity
id="mineParticles"
2018-10-23 23:43:31 +02:00
particleplayer="src: #mineParticlesJSON; pscale: 0.5; scale: 1.4; loop: false; on: explode; img: #sparkImg; count: 20%; animateScale: true; initialScale: 3 1 1; finalScale: 0.2 0.2 1"></a-entity>
<a-entity
id="sparkParticles"
2018-12-06 22:17:21 +01:00
particleplayer="src: #sparksJSON; color: #fcc; pscale: 0.7; on: explode; scale: 0.3; loop: false; img: #spark2Img; dur: 700; count: 50%; animateScale: true; initialScale: 3 0.5 1; finalScale: 0.1 0.5 1"></a-entity>
2018-09-25 05:40:08 -07:00
<a-mixin
id="cursorMesh"
material="shader: flat; transparent: true; src: #cursorMeshImg; depthTest: false"
sub-object="from: #cursorLaser; name: glow"></a-mixin>
<!-- Player. -->
<a-entity id="cameraRig" bind__recenter="enabled: !isPlaying">
2018-10-13 09:41:37 -07:00
<a-entity id="camera" position="0 1.6 0.5" camera look-controls wasd-controls>
<a-entity
id="cameraCollider"
bind__aabb-collider="enabled: isPlaying"
2018-10-22 03:29:17 -07:00
aabb-collider="objects: [data-collidable-head]; interval: 50; collideNonVisible: false"
geometry="primitive: box; width: 0.10; height: 0.10; depth: 0.10"
2018-10-13 09:41:37 -07:00
proxy-event__wallhitstart="event: hitstart; to: a-scene; as: wallhitstart"
proxy-event__wallhitend="event: hitend; to: a-scene; as: wallhitend"
visible="false"></a-entity>
</a-entity>
</a-entity>
<!--
We want the recenter transforms to apply to the controllers.
Overlay component reparents entity to different scene.
Thus need to add overlay to root-level container.
But cannot add overlay component to camera else camera would get reparented to wrong.
Thus we have a separate controller rig that matches the same transforms as cameraRig.
-->
<a-entity
id="controllerRig"
class="overlay"
bind__recenter="enabled: !isPlaying"
proxy-event="event: recentered; to: #cameraRig; captureBubbles: true; as: recenter">
2018-09-21 04:58:04 -07:00
{% macro saber (hand, otherHand, bladeColor, beamColor) %}
<a-entity id="{{ hand }}Hand"
2018-10-23 06:26:42 -07:00
class="saber"
2018-12-06 22:17:21 +01:00
mixin="raycaster"
2018-09-20 18:05:32 -07:00
bind__hand-swapper="enabled: {{ otherHand }}RaycasterActive"
2018-10-02 17:42:12 -07:00
bind__menu-controls="page: search.page; selectedChallengeId: menuSelectedChallenge.id"
2018-10-03 18:58:26 -07:00
bind__pauser="enabled: isPlaying"
2018-09-25 05:40:08 -07:00
bind__raycaster="enabled: {{ hand }}RaycasterActive"
bind__raycaster-game="enabled: isPlaying"
bind__saber-controls="bladeEnabled: isPlaying; isPaused: isPaused"
2018-10-03 18:58:26 -07:00
bind__trail="enabled: isPlaying"
2018-09-20 17:43:12 -07:00
haptics="events: mouseenter; dur: 35; force: 0.075"
2018-12-06 22:17:21 +01:00
haptics__beat="eventsFrom: #beatContainer; events: beatcollide{{ hand }}; dur: 80; force: 0.2"
2018-10-19 17:02:39 -07:00
haptics__draw="events: drawblade; dur: 750; force: 0.025"
haptics-saber
haptics-wall
raycaster="objects: [raycastable]; far: 5"
raycaster__game="objects: [raycastable-game]:not(.blade{{ hand }}); far: 1; interval: 50"
2018-10-01 11:22:40 -07:00
saber-controls="hand: {{ hand }}"
2018-10-02 17:42:12 -07:00
thumb-controls
thumb-controls-debug="enabled: false; hand: {{ hand }}; controllerType: vive-controls"
2018-10-23 06:26:42 -07:00
trail="color: {{ bladeColor }}; hand: {{ hand }}">
2018-09-25 05:40:08 -07:00
<a-entity
2018-12-06 22:17:21 +01:00
id="{{ hand }}Laser"
2018-12-06 00:01:12 +01:00
bind__cursor-laser="enabled: menuActive && activeHand === '{{ hand }}'"
geometry="primitive: cylinder; height: 1; radius: 0.005"
material="color: {{ beamColor }}; shader: flat"
rotation="-90 0 0"></a-entity>
2018-12-06 22:17:21 +01:00
<a-entity class="saberContainer" rotation="90 0 0">
<a-entity
class="bladeContainer"
bind__visible="isPlaying"
animation="property: scale; from: 0 0 0; to: 1 1 1; dur: 750; easing: linear; startEvents: drawblade"
scale="0.001 0.001 0.001">
2018-09-21 04:58:04 -07:00
<a-entity
2018-12-06 22:17:21 +01:00
class="blade blade{{ hand }}"
geometry="primitive: box; height: 0.9; depth: 0.02; width: 0.02"
material="shader: flat; color: #fff"
raycastable-game
position="0 -0.55 0"></a-entity>
2018-12-06 01:46:17 +01:00
<a-entity
2018-12-06 22:17:21 +01:00
class="saberglow"
obj-model="obj: #saberGlowObj"
material="shader: flat; color: {{ bladeColor }}; blending: additive; opacity: 0.08"
position="0 -0.55 0"></a-entity>
2018-09-21 04:58:04 -07:00
</a-entity>
<a-entity
2018-12-06 22:17:21 +01:00
class="saberHandle"
geometry="primitive: box; height: 0.2; depth: 0.025; width: 0.025"
material="shader: flat; color: #151515">
<a-entity
class="highlightTop"
geometry="primitive: box; height: 0.18; depth: 0.005; width: 0.005"
material="shader: flat; color: {{ bladeColor }}"
position="0 0 0.0125"></a-entity>
<a-entity
class="highlightBottom"
geometry="primitive: box; height: 0.18; depth: 0.005; width: 0.005"
material="shader: flat; color: {{ bladeColor }}"
position="0 0 -0.0125"></a-entity>
</a-entity>
2018-09-20 05:48:29 -07:00
</a-entity>
2018-12-06 22:17:21 +01:00
<a-entity
class="fakeGlow"
fake-glow="color: {{ beamColor }}"
position="0 0.01 0"
rotation="90 0 0"
bind__visible="!isPlaying">
</a-entity>
</a-entity>
2018-09-25 05:40:08 -07:00
<a-entity
id="{{ hand }}CursorMesh"
class="overlay"
2018-09-25 05:40:08 -07:00
mixin="cursorMesh"
bind__cursor-mesh="active: {{ hand }}RaycasterActive && !isPLaying"
cursor-mesh="cursorEl: #{{ hand }}Hand"
2018-09-25 05:40:08 -07:00
material="color: {{ beamColor }}"
scale="1.3 1.3 1.3"></a-entity>
{% endmacro %}
2018-12-06 22:17:21 +01:00
{{ saber('left', 'right', '#850e3e', 'pink') }}
{{ saber('right', 'left', '#256c43', 'cyan') }}
2018-07-18 20:48:45 +02:00
</a-entity>
2018-10-17 03:02:28 -07:00
<a-entity
id="stepback"
2018-10-25 07:17:08 -07:00
class="overlay"
obj-model="obj: #stepbackObj"
2018-10-17 03:02:28 -07:00
position="0 1.6 -1.55"
material="shader: flat; src: #atlasImg; transparent: true; opacity: 0"></a-entity>
2018-10-16 02:55:47 +02:00
{% if not IS_PRODUCTION %}
<a-entity
id="mouseCursor"
bind__raycaster="enabled: !inVR"
2018-12-06 22:17:21 +01:00
mixin="raycaster"
cursor="rayOrigin: mouse"
raycaster="objects: [raycastable]"></a-entity>
<a-entity
id="mouseCursorMesh"
class="overlay"
mixin="cursorMesh"
cursor-mesh="cursorEl: #mouseCursor"
bind__cursor-mesh="active: menuActive"></a-entity>
{% endif %}
</a-scene>
2018-10-17 03:02:28 -07:00
2018-11-17 05:26:23 -08:00
<img id="tutorial2d" data-src="assets/img/tutorial2d.png">
<script>
// Defer image so loading image loads first.
const tutorial2d = document.getElementById('tutorial2d');
tutorial2d.src = tutorial2d.dataset.src;
</script>
2018-10-10 22:12:17 -10:00
<a id="vrButton" href="#" title="Enter VR / Fullscreen"></a>
2018-11-19 08:07:50 -08:00
{% include './templates/ga.html' %}
2018-07-18 20:48:45 +02:00
</body>
</html>