wired all scene sync events
This commit is contained in:
BIN
assets/img/neon.png
Normal file
BIN
assets/img/neon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
36
assets/models/laserneon.obj
Normal file
36
assets/models/laserneon.obj
Normal file
@@ -0,0 +1,36 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'neons.blend'
|
||||
# www.blender.org
|
||||
o laser
|
||||
v -0.056853 -150.000031 0.100000
|
||||
v -0.056853 150.000031 0.100000
|
||||
v -0.082947 -150.000015 -0.100000
|
||||
v -0.082947 150.000015 -0.100000
|
||||
v 0.056853 -150.000031 0.100000
|
||||
v 0.056853 150.000031 0.100000
|
||||
v 0.082947 -150.000015 -0.100000
|
||||
v 0.082947 150.000015 -0.100000
|
||||
v -4.780099 -165.906036 -0.242529
|
||||
v -4.780099 165.906036 -0.242529
|
||||
v 4.780099 -165.906036 -0.242529
|
||||
v 4.780099 165.906036 -0.242529
|
||||
vt 0.004204 0.528840
|
||||
vt 0.003617 0.446357
|
||||
vt 0.004204 0.446357
|
||||
vt 0.995039 1.000000
|
||||
vt 0.020153 0.000000
|
||||
vt 0.995039 0.000000
|
||||
vt 0.007355 0.528840
|
||||
vt 0.006767 0.446357
|
||||
vt 0.007355 0.446357
|
||||
vt 0.006767 0.528840
|
||||
vt 0.003617 0.528840
|
||||
vt 0.020153 1.000000
|
||||
s off
|
||||
f 2/1 3/2 1/3
|
||||
f 12/4 9/5 11/6
|
||||
f 8/7 5/8 7/9
|
||||
f 6/10 1/3 5/8
|
||||
f 2/1 4/11 3/2
|
||||
f 12/4 10/12 9/5
|
||||
f 8/7 6/10 5/8
|
||||
f 6/10 2/1 1/3
|
||||
@@ -1,132 +1,212 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'neons.blend'
|
||||
# www.blender.org
|
||||
o tunnelneon
|
||||
v 11.925084 7.848577 -13.610518
|
||||
v 7.848576 11.925085 -13.610518
|
||||
v 11.925084 7.848577 -13.710936
|
||||
v 7.848576 11.925085 -13.710936
|
||||
v 11.972422 7.895914 -13.610518
|
||||
v 7.895913 11.972423 -13.610518
|
||||
v 11.972422 7.895914 -13.710936
|
||||
v 7.895913 11.972423 -13.710936
|
||||
v -11.925084 7.848576 -13.610518
|
||||
v -7.848577 11.925083 -13.610518
|
||||
v -11.925084 7.848576 -13.710936
|
||||
v -7.848577 11.925083 -13.710936
|
||||
v -11.972423 7.895913 -13.610518
|
||||
v -7.895913 11.972422 -13.610518
|
||||
v -11.972423 7.895913 -13.710936
|
||||
v -7.895913 11.972422 -13.710936
|
||||
v 11.925084 7.848577 -22.869068
|
||||
v 7.848576 11.925085 -22.869068
|
||||
v 11.925084 7.848577 -22.969488
|
||||
v 7.848576 11.925085 -22.969488
|
||||
v 11.972422 7.895914 -22.869068
|
||||
v 7.895913 11.972423 -22.869068
|
||||
v 11.972422 7.895914 -22.969488
|
||||
v 7.895913 11.972423 -22.969488
|
||||
v -11.925084 7.848576 -22.869068
|
||||
v -7.848577 11.925083 -22.869068
|
||||
v -11.925084 7.848576 -22.969488
|
||||
v -7.848577 11.925083 -22.969488
|
||||
v -11.972423 7.895913 -22.869068
|
||||
v -7.895913 11.972422 -22.869068
|
||||
v -11.972423 7.895913 -22.969488
|
||||
v -7.895913 11.972422 -22.969488
|
||||
v 11.925084 7.848577 -32.127625
|
||||
v 7.848576 11.925085 -32.127625
|
||||
v 11.925084 7.848577 -32.228039
|
||||
v 7.848576 11.925085 -32.228039
|
||||
v 11.972422 7.895914 -32.127625
|
||||
v 7.895913 11.972423 -32.127625
|
||||
v 11.972422 7.895914 -32.228039
|
||||
v 7.895913 11.972423 -32.228039
|
||||
v -11.925084 7.848576 -32.127625
|
||||
v -7.848577 11.925083 -32.127625
|
||||
v -11.925084 7.848576 -32.228039
|
||||
v -7.848577 11.925083 -32.228039
|
||||
v -11.972423 7.895913 -32.127625
|
||||
v -7.895913 11.972422 -32.127625
|
||||
v -11.972423 7.895913 -32.228039
|
||||
v -7.895913 11.972422 -32.228039
|
||||
v 11.925084 7.848577 -41.386173
|
||||
v 7.848576 11.925085 -41.386173
|
||||
v 11.925084 7.848577 -41.486595
|
||||
v 7.848576 11.925085 -41.486595
|
||||
v 11.972422 7.895914 -41.386173
|
||||
v 7.895913 11.972423 -41.386173
|
||||
v 11.972422 7.895914 -41.486595
|
||||
v 7.895913 11.972423 -41.486595
|
||||
v -11.925084 7.848576 -41.386173
|
||||
v -7.848577 11.925083 -41.386173
|
||||
v -11.925084 7.848576 -41.486595
|
||||
v -7.848577 11.925083 -41.486595
|
||||
v -11.972423 7.895913 -41.386173
|
||||
v -7.895913 11.972422 -41.386173
|
||||
v -11.972423 7.895913 -41.486595
|
||||
v -7.895913 11.972422 -41.486595
|
||||
v 12.287716 7.337969 -13.550458
|
||||
v 7.337968 12.287718 -13.550458
|
||||
v 12.287716 7.337969 -13.770995
|
||||
v 7.337968 12.287718 -13.770995
|
||||
v 12.391678 7.441931 -13.550458
|
||||
v 7.441930 12.391680 -13.550458
|
||||
v 14.462343 0.359674 -14.639281
|
||||
v 0.359670 14.462343 -14.639280
|
||||
v 19.704720 5.602050 -14.220368
|
||||
v 5.602043 19.704716 -14.220367
|
||||
v -12.287715 7.337968 -13.550458
|
||||
v -7.337968 12.287716 -13.550458
|
||||
v -12.287715 7.337968 -13.770995
|
||||
v -7.337968 12.287716 -13.770995
|
||||
v -12.391677 7.441930 -13.550458
|
||||
v -7.441930 12.391678 -13.550458
|
||||
v -14.462344 0.359674 -14.639281
|
||||
v -0.359670 14.462341 -14.639280
|
||||
v -19.704720 5.602048 -14.220368
|
||||
v -5.602044 19.704716 -14.220367
|
||||
v 12.287716 7.337969 -22.805450
|
||||
v 7.337968 12.287718 -22.805450
|
||||
v 12.287716 7.337969 -23.025986
|
||||
v 7.337968 12.287718 -23.025986
|
||||
v 12.391678 7.441931 -22.805450
|
||||
v 7.441930 12.391680 -22.805450
|
||||
v 14.462343 0.359674 -23.894272
|
||||
v 0.359670 14.462343 -23.894272
|
||||
v 19.704720 5.602050 -23.475361
|
||||
v 5.602043 19.704716 -23.475361
|
||||
v -12.287715 7.337968 -22.805450
|
||||
v -7.337968 12.287716 -22.805450
|
||||
v -12.287715 7.337968 -23.025986
|
||||
v -7.337968 12.287716 -23.025986
|
||||
v -12.391677 7.441930 -22.805450
|
||||
v -7.441930 12.391678 -22.805450
|
||||
v -14.462344 0.359674 -23.894272
|
||||
v -0.359670 14.462341 -23.894272
|
||||
v -19.704720 5.602048 -23.475361
|
||||
v -5.602044 19.704716 -23.475361
|
||||
v 12.287716 7.337969 -32.060440
|
||||
v 7.337968 12.287718 -32.060440
|
||||
v 12.287716 7.337969 -32.280979
|
||||
v 7.337968 12.287718 -32.280979
|
||||
v 12.391678 7.441931 -32.060440
|
||||
v 7.441930 12.391680 -32.060440
|
||||
v 14.462343 0.359674 -33.149265
|
||||
v 0.359670 14.462343 -33.149265
|
||||
v 19.704720 5.602050 -32.730354
|
||||
v 5.602043 19.704716 -32.730354
|
||||
v -12.287715 7.337968 -32.060440
|
||||
v -7.337968 12.287716 -32.060440
|
||||
v -12.287715 7.337968 -32.280979
|
||||
v -7.337968 12.287716 -32.280979
|
||||
v -12.391677 7.441930 -32.060440
|
||||
v -7.441930 12.391678 -32.060440
|
||||
v -14.462344 0.359674 -33.149265
|
||||
v -0.359670 14.462341 -33.149265
|
||||
v -19.704720 5.602048 -32.730354
|
||||
v -5.602044 19.704716 -32.730354
|
||||
v 12.287716 7.337969 -41.315434
|
||||
v 7.337968 12.287718 -41.315434
|
||||
v 12.287716 7.337969 -41.535969
|
||||
v 7.337968 12.287718 -41.535969
|
||||
v 12.391678 7.441931 -41.315434
|
||||
v 7.441930 12.391680 -41.315434
|
||||
v 14.462343 0.359674 -42.404255
|
||||
v 0.359670 14.462343 -42.404255
|
||||
v 19.704720 5.602050 -41.985344
|
||||
v 5.602043 19.704716 -41.985344
|
||||
v -12.287715 7.337968 -41.315434
|
||||
v -7.337968 12.287716 -41.315434
|
||||
v -12.287715 7.337968 -41.535969
|
||||
v -7.337968 12.287716 -41.535969
|
||||
v -12.391677 7.441930 -41.315434
|
||||
v -7.441930 12.391678 -41.315434
|
||||
v -14.462344 0.359674 -42.404255
|
||||
v -0.359670 14.462341 -42.404255
|
||||
v -19.704720 5.602048 -41.985344
|
||||
v -5.602044 19.704716 -41.985344
|
||||
vt 0.002174 0.466970
|
||||
vt 0.004290 0.465414
|
||||
vt 0.004291 0.466970
|
||||
vt 0.002175 0.468527
|
||||
vt 0.004291 0.468526
|
||||
vt 0.996800 0.000086
|
||||
vt 0.027429 0.999914
|
||||
vt 0.996800 0.999914
|
||||
vt 0.004290 0.465414
|
||||
vt 0.002174 0.466970
|
||||
vt 0.004291 0.466970
|
||||
vt 0.002175 0.468527
|
||||
vt 0.004291 0.468526
|
||||
vt 0.996800 0.999914
|
||||
vt 0.027429 0.000086
|
||||
vt 0.996800 0.000086
|
||||
vt 0.002174 0.466970
|
||||
vt 0.004290 0.465414
|
||||
vt 0.004291 0.466970
|
||||
vt 0.002175 0.468527
|
||||
vt 0.004291 0.468526
|
||||
vt 0.996800 0.000086
|
||||
vt 0.027429 0.999914
|
||||
vt 0.996800 0.999914
|
||||
vt 0.004290 0.465414
|
||||
vt 0.002174 0.466970
|
||||
vt 0.004291 0.466970
|
||||
vt 0.002175 0.468527
|
||||
vt 0.004291 0.468526
|
||||
vt 0.996800 0.999914
|
||||
vt 0.027429 0.000086
|
||||
vt 0.996800 0.000086
|
||||
vt 0.002174 0.466970
|
||||
vt 0.004290 0.465414
|
||||
vt 0.004291 0.466970
|
||||
vt 0.002175 0.468527
|
||||
vt 0.004291 0.468526
|
||||
vt 0.996800 0.000086
|
||||
vt 0.027429 0.999914
|
||||
vt 0.996800 0.999914
|
||||
vt 0.004290 0.465414
|
||||
vt 0.002174 0.466970
|
||||
vt 0.004291 0.466970
|
||||
vt 0.002175 0.468527
|
||||
vt 0.004291 0.468526
|
||||
vt 0.996800 0.999914
|
||||
vt 0.027429 0.000086
|
||||
vt 0.996800 0.000086
|
||||
vt 0.002174 0.466970
|
||||
vt 0.004290 0.465414
|
||||
vt 0.004291 0.466970
|
||||
vt 0.002175 0.468527
|
||||
vt 0.004291 0.468526
|
||||
vt 0.996800 0.000086
|
||||
vt 0.027429 0.999914
|
||||
vt 0.996800 0.999914
|
||||
vt 0.004290 0.465414
|
||||
vt 0.002174 0.466970
|
||||
vt 0.004291 0.466970
|
||||
vt 0.002175 0.468527
|
||||
vt 0.004291 0.468526
|
||||
vt 0.996800 0.999914
|
||||
vt 0.027429 0.000086
|
||||
vt 0.996800 0.000086
|
||||
vt 0.002173 0.465414
|
||||
vt 0.027429 0.000086
|
||||
vt 0.002173 0.465414
|
||||
vt 0.027429 0.999914
|
||||
vt 0.002173 0.465414
|
||||
vt 0.027429 0.000086
|
||||
vt 0.002173 0.465414
|
||||
vt 0.027429 0.999914
|
||||
vt 0.002173 0.465414
|
||||
vt 0.027429 0.000086
|
||||
vt 0.002173 0.465414
|
||||
vt 0.027429 0.999914
|
||||
vt 0.002173 0.465414
|
||||
vt 0.027429 0.000086
|
||||
vt 0.002173 0.465414
|
||||
vt 0.027429 0.999914
|
||||
s off
|
||||
f 2 3 1
|
||||
f 4 7 3
|
||||
f 8 5 7
|
||||
f 6 1 5
|
||||
f 11 10 9
|
||||
f 15 12 11
|
||||
f 13 16 15
|
||||
f 9 14 13
|
||||
f 18 19 17
|
||||
f 20 23 19
|
||||
f 24 21 23
|
||||
f 22 17 21
|
||||
f 27 26 25
|
||||
f 31 28 27
|
||||
f 29 32 31
|
||||
f 25 30 29
|
||||
f 34 35 33
|
||||
f 36 39 35
|
||||
f 40 37 39
|
||||
f 38 33 37
|
||||
f 43 42 41
|
||||
f 47 44 43
|
||||
f 45 48 47
|
||||
f 41 46 45
|
||||
f 50 51 49
|
||||
f 52 55 51
|
||||
f 56 53 55
|
||||
f 54 49 53
|
||||
f 59 58 57
|
||||
f 63 60 59
|
||||
f 61 64 63
|
||||
f 57 62 61
|
||||
f 2 4 3
|
||||
f 4 8 7
|
||||
f 8 6 5
|
||||
f 6 2 1
|
||||
f 11 12 10
|
||||
f 15 16 12
|
||||
f 13 14 16
|
||||
f 9 10 14
|
||||
f 18 20 19
|
||||
f 20 24 23
|
||||
f 24 22 21
|
||||
f 22 18 17
|
||||
f 27 28 26
|
||||
f 31 32 28
|
||||
f 29 30 32
|
||||
f 25 26 30
|
||||
f 34 36 35
|
||||
f 36 40 39
|
||||
f 40 38 37
|
||||
f 38 34 33
|
||||
f 43 44 42
|
||||
f 47 48 44
|
||||
f 45 46 48
|
||||
f 41 42 46
|
||||
f 50 52 51
|
||||
f 52 56 55
|
||||
f 56 54 53
|
||||
f 54 50 49
|
||||
f 59 60 58
|
||||
f 63 64 60
|
||||
f 61 62 64
|
||||
f 57 58 62
|
||||
f 2/1 3/2 1/3
|
||||
f 6/4 1/3 5/5
|
||||
f 7/6 10/7 8/8
|
||||
f 13/9 12/10 11/11
|
||||
f 11/11 16/12 15/13
|
||||
f 18/14 19/15 17/16
|
||||
f 22/17 23/18 21/19
|
||||
f 26/20 21/19 25/21
|
||||
f 27/22 30/23 28/24
|
||||
f 33/25 32/26 31/27
|
||||
f 31/27 36/28 35/29
|
||||
f 38/30 39/31 37/32
|
||||
f 42/33 43/34 41/35
|
||||
f 46/36 41/35 45/37
|
||||
f 47/38 50/39 48/40
|
||||
f 53/41 52/42 51/43
|
||||
f 51/43 56/44 55/45
|
||||
f 58/46 59/47 57/48
|
||||
f 62/49 63/50 61/51
|
||||
f 66/52 61/51 65/53
|
||||
f 67/54 70/55 68/56
|
||||
f 73/57 72/58 71/59
|
||||
f 71/59 76/60 75/61
|
||||
f 78/62 79/63 77/64
|
||||
f 2/1 4/65 3/2
|
||||
f 6/4 2/1 1/3
|
||||
f 7/6 9/66 10/7
|
||||
f 13/9 14/67 12/10
|
||||
f 11/11 12/10 16/12
|
||||
f 18/14 20/68 19/15
|
||||
f 22/17 24/69 23/18
|
||||
f 26/20 22/17 21/19
|
||||
f 27/22 29/70 30/23
|
||||
f 33/25 34/71 32/26
|
||||
f 31/27 32/26 36/28
|
||||
f 38/30 40/72 39/31
|
||||
f 42/33 44/73 43/34
|
||||
f 46/36 42/33 41/35
|
||||
f 47/38 49/74 50/39
|
||||
f 53/41 54/75 52/42
|
||||
f 51/43 52/42 56/44
|
||||
f 58/46 60/76 59/47
|
||||
f 62/49 64/77 63/50
|
||||
f 66/52 62/49 61/51
|
||||
f 67/54 69/78 70/55
|
||||
f 73/57 74/79 72/58
|
||||
f 71/59 72/58 76/60
|
||||
f 78/62 80/80 79/63
|
||||
|
||||
@@ -4,6 +4,7 @@ var utils = require('../utils');
|
||||
* Load beat data (all the beats and such).
|
||||
*/
|
||||
AFRAME.registerComponent('beat-loader', {
|
||||
dependencies: ['stage-colors'],
|
||||
schema: {
|
||||
beatAnticipationTime: {default: 2.0},
|
||||
beatSpeed: {default: 4.0},
|
||||
@@ -27,7 +28,14 @@ AFRAME.registerComponent('beat-loader', {
|
||||
this.songCurrentTime = undefined;
|
||||
this.onKeyDown = this.onKeyDown.bind(this);
|
||||
|
||||
this.stageColors = this.el.components['stage-colors'];
|
||||
this.twister = document.getElementById('twister');
|
||||
this.leftStageLasers = document.getElementById('leftStageLasers');
|
||||
this.rightStageLasers = document.getElementById('rightStageLasers');
|
||||
|
||||
this.el.addEventListener('cleargame', this.clearBeats.bind(this));
|
||||
|
||||
//this.addDebugControls();
|
||||
},
|
||||
|
||||
update: function (oldData) {
|
||||
@@ -223,30 +231,41 @@ AFRAME.registerComponent('beat-loader', {
|
||||
},
|
||||
|
||||
generateEvent: function (event) {
|
||||
console.log(event);
|
||||
switch(event._type) {
|
||||
case 0: // lasers color
|
||||
case 1: // tunnel neon color
|
||||
document.getElementById('tunnelNeon').setAttribute('colorPreset', event._value);
|
||||
document.getElementById('tunnelNeon').emit('pulse');
|
||||
break;
|
||||
case 2: document.getElementById('leftStageLasers').setAttribute('colorPreset', event._value);
|
||||
break;
|
||||
case 3: document.getElementById('rightStageLasers').setAttribute('colorPreset', event._value);
|
||||
break;
|
||||
case 0:
|
||||
this.stageColors.setColor('fog', event._value);
|
||||
this.stageColors.setColor('sky', event._value);
|
||||
this.stageColors.setColor('backglow', event._value);
|
||||
break;
|
||||
case 1:
|
||||
this.stageColors.setColor('tunnelNeon', event._value);
|
||||
break;
|
||||
case 2:
|
||||
this.stageColors.setColor('leftStageLaser0', event._value);
|
||||
this.stageColors.setColor('leftStageLaser1', event._value);
|
||||
this.stageColors.setColor('leftStageLaser2', event._value);
|
||||
break;
|
||||
case 3:
|
||||
this.stageColors.setColor('rightStageLaser0', event._value);
|
||||
this.stageColors.setColor('rightStageLaser1', event._value);
|
||||
this.stageColors.setColor('rightStageLaser2', event._value);
|
||||
break;
|
||||
case 4:
|
||||
document.getElementById('floor').emit('pulse');
|
||||
document.getElementById('stageNeon').emit('pulse');
|
||||
break;
|
||||
this.stageColors.setColor('floor', event._value);
|
||||
this.stageColors.setColor('stageNeon', event._value);
|
||||
break;
|
||||
case 8:
|
||||
case 9: document.getElementById('twister').components.twister.pulse(event._value);
|
||||
break;
|
||||
case 12: document.getElementById('leftStageLasers').components['stage-lasers'].pulse(event._value);
|
||||
console.log('left laser', event._value);
|
||||
break;
|
||||
case 13: document.getElementById('rightStageLasers').components['stage-lasers'].pulse(event._value);
|
||||
console.log('right laser', event._value);
|
||||
break;
|
||||
this.twister.components.twister.pulse(event._value);
|
||||
break;
|
||||
case 9:
|
||||
this.twister.components.twister.zoom(event._value);
|
||||
break;
|
||||
case 12:
|
||||
this.leftStageLasers.components['stage-lasers'].pulse(event._value);
|
||||
break;
|
||||
case 13:
|
||||
this.rightStageLasers.components['stage-lasers'].pulse(event._value);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -277,6 +296,56 @@ AFRAME.registerComponent('beat-loader', {
|
||||
child.components.wall.returnToPool(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addDebugControls: function () {
|
||||
var self = this;
|
||||
var currControl = 0;
|
||||
function addControl(i, name, type){
|
||||
var div = document.createElement('div');
|
||||
div.style.position = 'absolute';
|
||||
div.id = 'stagecontrol' + i;
|
||||
div.style.width = '100px';
|
||||
div.style.height = '30px';
|
||||
div.style.top = type === 'element' ? '20px' : '70px';
|
||||
div.style.background = '#000';
|
||||
div.style.color = '#fff';
|
||||
div.style.zIndex = 999999999;
|
||||
div.style.padding = '5px';
|
||||
div.style.font = '14px sans-serif';
|
||||
div.style.textAlign = 'center';
|
||||
div.style.cursor = 'pointer';
|
||||
div.style.left = (20 + i * 120)+'px';
|
||||
div.innerHTML = name;
|
||||
if (type === 'element') {
|
||||
div.addEventListener('click', () => {
|
||||
document.getElementById('stagecontrol' + currControl).style.background = '#000';
|
||||
div.style.background = '#66f';
|
||||
currControl = i;
|
||||
} )
|
||||
} else {
|
||||
div.addEventListener('click', () => { self.generateEvent({_type: currControl, _value: i}) })
|
||||
}
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
|
||||
[ 'sky',
|
||||
'tunnelNeon',
|
||||
'leftStageLasers',
|
||||
'rightStageLasers',
|
||||
'floor'].forEach((id, i) => {addControl(i, id, 'element'); });
|
||||
|
||||
[
|
||||
'off',
|
||||
'blue',
|
||||
'blue',
|
||||
'bluefade',
|
||||
'',
|
||||
'red',
|
||||
'red',
|
||||
'redfade'
|
||||
].forEach((id, i) => {addControl(i, id, 'value'); });
|
||||
;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -25,9 +25,27 @@ AFRAME.registerComponent('stage-colors', {
|
||||
});
|
||||
this.sky = document.getElementById('sky');
|
||||
this.backglow = document.getElementById('backglow');
|
||||
this.smoke1 = document.getElementById('smoke1');
|
||||
this.smoke2 = document.getElementById('smoke2');
|
||||
this.auxColor = new THREE.Color();
|
||||
|
||||
let $ = function (id) { return document.getElementById(id); };
|
||||
|
||||
this.targets = {};
|
||||
[ 'fog',
|
||||
'sky',
|
||||
'backglow',
|
||||
'tunnelNeon',
|
||||
'leftStageLaser0',
|
||||
'leftStageLaser1',
|
||||
'leftStageLaser2',
|
||||
'rightStageLaser0',
|
||||
'rightStageLaser1',
|
||||
'rightStageLaser2',
|
||||
'floor',
|
||||
'stageNeon'].forEach((id) => {
|
||||
this.targets[id] = id == 'fog' ? this.el.sceneEl : document.getElementById(id);
|
||||
});
|
||||
|
||||
this.colorCodes = ['off', 'blue', 'blue', 'bluefade', '', 'red', 'red', 'redfade'];
|
||||
},
|
||||
|
||||
update: function (oldData) {
|
||||
@@ -46,5 +64,11 @@ AFRAME.registerComponent('stage-colors', {
|
||||
this.mineMaterial.emissive = this.mineEmission[red ? 'red' : 'blue'];
|
||||
this.mineMaterial.envMap = this.mineEnvMap[red ? 'red' : 'blue'];
|
||||
this.mineMaterial.needsUpdate = true;
|
||||
},
|
||||
|
||||
setColor: function (target, code) {
|
||||
var mesh = this.targets[target].getObject3D('mesh');
|
||||
if (mesh) mesh.material.opacity = 1;
|
||||
this.targets[target].emit('color' + this.colorCodes[code], {}, false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ AFRAME.registerComponent('stage-lasers', {
|
||||
},
|
||||
|
||||
pulse: function (speed) {
|
||||
this.speed = speed / 3;
|
||||
this.speed = speed / 5;
|
||||
},
|
||||
|
||||
tick: function (time, delta) {
|
||||
|
||||
@@ -12,16 +12,23 @@ AFRAME.registerComponent('twister', {
|
||||
init: function () {
|
||||
this.currentTwist = 0;
|
||||
this.animate = false;
|
||||
this.zoomProgress = 0;
|
||||
},
|
||||
|
||||
pulse: function (twist) {
|
||||
if (!this.data.enabled) { return; }
|
||||
if (twist == 0) { twist = 0.1 + Math.random() * 0.25; }
|
||||
else twist = Math.min(twist, 0.5);
|
||||
if (twist == 0) { twist = 0.05 + Math.random() * 0.15; }
|
||||
else twist = Math.min(twist * 0.5, 0.5);
|
||||
twist *= Math.random() < 0.5 ? -1 : 1; // random direction
|
||||
this.el.setAttribute('twister', {twist: twist});
|
||||
},
|
||||
|
||||
zoom: function () {
|
||||
if (!this.data.enabled) { return; }
|
||||
this.zoomProgress = 0.01;
|
||||
this.animate = true;
|
||||
},
|
||||
|
||||
update: function (oldData) {
|
||||
var radius = 4;
|
||||
var segment;
|
||||
@@ -65,16 +72,28 @@ AFRAME.registerComponent('twister', {
|
||||
|
||||
tick: function (time, delta) {
|
||||
if (!this.animate) { return; }
|
||||
if (Math.abs(this.data.twist - this.currentTwist) < 0.001) {
|
||||
delta *= 0.001;
|
||||
|
||||
this.currentTwist += (this.data.twist - this.currentTwist) * delta;
|
||||
|
||||
var child = this.el.object3D.children[0];
|
||||
var zoom = this.zoomProgress ? Math.sin(this.zoomProgress * Math.PI) * 0.4 : 0;
|
||||
|
||||
while (child) {
|
||||
child.rotation.y = this.currentTwist;
|
||||
child.position.y = this.data.positionIncrement + zoom;
|
||||
child = child.children[0];
|
||||
}
|
||||
|
||||
if (this.zoomProgress > 0) {
|
||||
this.zoomProgress += delta;
|
||||
if (this.zoomProgress >= 1) {
|
||||
this.zoomProgress = 0;
|
||||
}
|
||||
}
|
||||
if (Math.abs(this.data.twist - this.currentTwist) < 0.001 && this.zoomProgress == 0){
|
||||
this.animate = false;
|
||||
}
|
||||
|
||||
this.currentTwist += (this.data.twist - this.currentTwist) * delta * 0.001;
|
||||
|
||||
var child = this.el.object3D.children[0];
|
||||
while (child) {
|
||||
child.rotation.y = this.currentTwist;
|
||||
child = child.children[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<audio id="introSong" src="assets/sounds/introSong.ogg" loop></audio>
|
||||
|
||||
<a-scene
|
||||
mixin="gameoverAnimation"
|
||||
mixin="gameoverAnimation fogAnimation"
|
||||
bind__beat-loader="challengeId: challenge.id; difficulty: challenge.difficulty; isPlaying: isPlaying"
|
||||
bind__gameover="isGameOver: isGameOver"
|
||||
bind__intro-song="isPlaying: menu.active && !menuSelectedChallenge.id"
|
||||
@@ -52,6 +52,7 @@
|
||||
<a-asset-item id="logobackObj" src="assets/models/logoback.obj"></a-asset-item>
|
||||
<a-asset-item id="logofrontUObj" src="assets/models/logofront-u.obj"></a-asset-item>
|
||||
<a-asset-item id="laserObj" src="assets/models/laser/laser.obj"></a-asset-item>
|
||||
<a-asset-item id="laserNeonObj" src="assets/models/laserneon.obj"></a-asset-item>
|
||||
<a-asset-item id="logoSparks" src="assets/models/logosparks.json"></a-asset-item>
|
||||
<a-asset-item id="mineObj" src="assets/models/mine.obj"></a-asset-item>
|
||||
<a-asset-item id="sabercutParticles" src="assets/models/sabercut.json"></a-asset-item>
|
||||
@@ -76,6 +77,7 @@
|
||||
<img id="wrongImg" src="assets/img/wrong.png">
|
||||
<img id="missImg" src="assets/img/miss.png">
|
||||
<img id="noiseTexture" src="assets/img/noise.png"></img>
|
||||
<img id="neonImg" src="assets/img/neon.png">
|
||||
<img id="sparkImg" src="assets/img/spark.png">
|
||||
|
||||
<a-mixin id="slice" slice9="color: #050505; transparent: true; opacity: 0.7; src: #sliceImg; left: 50; right: 52; top: 50; bottom: 52; padding: 0.18"></a-mixin>
|
||||
|
||||
@@ -1,11 +1,49 @@
|
||||
<a-mixin id="stageLaser" geometry="height: 300; depth: 0.16; width: 0.16" materials="neon"></a-mixin>
|
||||
<a-mixin id="stageLaser" obj-model="obj:#laserNeonObj" material="depthWrite: false; transparent: true; shader: flat; fog: false; color: #00a; src: #neonImg;"></a-mixin>
|
||||
|
||||
<a-mixin id="neonAnimation"
|
||||
material="shader: flat; fog: false; color: #9999ff"
|
||||
animation__coloroff="property: components.material.material.opacity;
|
||||
to: 0.1; dur: 500; easing: linear; startEvents: coloroff"
|
||||
animation__colorblue="property: components.material.material.color;
|
||||
type: color; to: #AAAAFF; dur: 5; easing: linear; startEvents: colorblue"
|
||||
animation__colorbluefade="property: components.material.material.color;
|
||||
type: color; from: #EEF; to: #AAAAff; dur: 500; easing: linear; startEvents: colorbluefade"
|
||||
animation__colorred="property: components.material.material.color;
|
||||
type: color; to: #FFAAAA; dur: 5; easing: linear; startEvents: colorred"
|
||||
animation__colorredfade="property: components.material.material.color;
|
||||
type: color; from: #FEE; to: #ffAAAA; dur: 500; easing: linear; startEvents: colorredfade"></a-mixin>
|
||||
|
||||
<a-mixin id="bgAnimation"
|
||||
material="shader: flat; fog: false;"
|
||||
animation__coloroff="property: components.material.material.color;
|
||||
type: color; to: #111; dur: 500; easing: linear; startEvents: coloroff"
|
||||
animation__colorblue="property: components.material.material.color;
|
||||
type: color; to: #00acfc; dur: 5; easing: linear; startEvents: colorblue"
|
||||
animation__colorbluefade="property: components.material.material.color;
|
||||
type: color; from: #5FCCFF; to: #00acfc; dur: 500; easing: linear; startEvents: colorbluefade"
|
||||
animation__colorred="property: components.material.material.color;
|
||||
type: color; to: #fc0000; dur: 5; easing: linear; startEvents: colorred"
|
||||
animation__colorredfade="property: components.material.material.color;
|
||||
type: color; from: #FF4343; to: #fc0000; dur: 500; easing: linear; startEvents: colorredfade"></a-mixin>
|
||||
|
||||
<a-mixin id="fogAnimation"
|
||||
animation__coloroff="property: components.fog.el.object3D.fog.color;
|
||||
type: color; to: #010101; dur: 500; easing: linear; startEvents: coloroff"
|
||||
animation__colorblue="property: components.fog.el.object3D.fog.color;
|
||||
type: color; to: #007cb9; dur: 5; easing: linear; startEvents: colorblue"
|
||||
animation__colorbluefade="property: components.fog.el.object3D.fog.color;
|
||||
type: color; from: #3398CA; to: #007cb9; dur: 500; easing: linear; startEvents: colorbluefade"
|
||||
animation__colorred="property: components.fog.el.object3D.fog.color;
|
||||
type: color; to: #b90000; dur: 5; easing: linear; startEvents: colorred"
|
||||
animation__colorredfade="property: components.fog.el.object3D.fog.color;
|
||||
type: color; from: #ff0000; to: #b90000; dur: 500; easing: linear; startEvents: colorredfade"></a-mixin>
|
||||
|
||||
<a-sky
|
||||
id="sky"
|
||||
mixin="gameoverAnimation"
|
||||
mixin="gameoverAnimation bgAnimation"
|
||||
animation__gameover="property: components.material.material.color; type: color; to: #301000; startEvents: gameover"
|
||||
geometry="segmentsHeight: 16; segmentsWidth: 32"
|
||||
material="fog: false; src: #skyTexture"></a-sky>
|
||||
material="src: #skyTexture"></a-sky>
|
||||
|
||||
<a-entity
|
||||
id="audioAnalyser"
|
||||
@@ -15,10 +53,10 @@
|
||||
|
||||
<a-entity id="stage">
|
||||
<a-entity id="backglow"
|
||||
mixin="gameoverAnimation"
|
||||
mixin="gameoverAnimation bgAnimation"
|
||||
animation__gameover="property: components.material.material.opacity; to: 0.2; startEvents: gameover"
|
||||
obj-model="obj: #backglowObj"
|
||||
material="shader: flat; transparent: true; fog: false; color: #f00; src: #backglowTexture; opacity: 0.8"
|
||||
material="transparent: true; color: #f00; src: #backglowTexture; opacity: 0.7"
|
||||
position="0 0 -50"
|
||||
scale="20 20 20"></a-entity>
|
||||
|
||||
@@ -43,22 +81,23 @@
|
||||
</a-entity>
|
||||
|
||||
<a-entity id="tunnel" obj-model="obj:#tunnelObj" material="shader: flat; flatShading: true; color: #010101"></a-entity>
|
||||
<a-entity id="tunnelNeon" obj-model="obj:#tunnelNeonObj" material="shader: flat; fog: false; color: #9999ff" animation="property: components.material.material.color; type: color; from: #FFF to: #6666ff; dur: 200; easing: linear; startEvents: pulse"></a-entity>
|
||||
<a-entity id="tunnelNeon" obj-model="obj:#tunnelNeonObj" material="shader: flat; fog: false; transparent: true; color: #9999ff; src: #neonImg; depthWrite: false;"
|
||||
mixin="neonAnimation"></a-entity>
|
||||
|
||||
<a-entity id="stageNeon" obj-model="obj:#stageNeonObj" material="shader: flat; fog: false; color: #9999ff" animation="property: components.material.material.color; type: color; from: #FFF to: #6666ff; dur: 200; easing: linear; startEvents: pulse"></a-entity>
|
||||
<a-entity id="stageNeon" obj-model="obj:#stageNeonObj" mixin="neonAnimation"></a-entity>
|
||||
|
||||
<!-- Lasers left. -->
|
||||
<a-entity bind__stage-lasers="enabled: !menu.active" id="leftStageLasers">
|
||||
<a-entity class="stageLaser" mixin="stageLaser" position=" -6 2.3 -40"></a-entity>
|
||||
<a-entity class="stageLaser" mixin="stageLaser" position="-10 0 -38"></a-entity>
|
||||
<a-entity class="stageLaser" mixin="stageLaser" position="-14 -3 -36"></a-entity>
|
||||
<a-entity id="leftStageLaser0" mixin="stageLaser neonAnimation" position=" -6 2.3 -40"></a-entity>
|
||||
<a-entity id="leftStageLaser1" mixin="stageLaser neonAnimation" position="-10 0 -38"></a-entity>
|
||||
<a-entity id="leftStageLaser2" mixin="stageLaser neonAnimation" position="-14 -3 -36"></a-entity>
|
||||
</a-entity>
|
||||
|
||||
<!-- Lasers right. -->
|
||||
<a-entity bind__stage-lasers="enabled: !menu.active" id="rightStageLasers">
|
||||
<a-entity class="stageLaser" mixin="stageLaser" position=" 6 4 -40"></a-entity>
|
||||
<a-entity class="stageLaser" mixin="stageLaser" position="10 2 -38"></a-entity>
|
||||
<a-entity class="stageLaser" mixin="stageLaser" position="14 -1.5 -36"></a-entity>
|
||||
<a-entity id="rightStageLaser0" mixin="stageLaser neonAnimation" position=" 6 4 -40"></a-entity>
|
||||
<a-entity id="rightStageLaser1" mixin="stageLaser neonAnimation" position="10 2 -38"></a-entity>
|
||||
<a-entity id="rightStageLaser2" mixin="stageLaser neonAnimation" position="14 -1.5 -36"></a-entity>
|
||||
</a-entity>
|
||||
|
||||
<a-mixin
|
||||
@@ -109,9 +148,8 @@
|
||||
</a-entity>
|
||||
|
||||
<a-entity
|
||||
id="floor"
|
||||
animation="property: components.material.material.color; type: color; from: #FFF to: #888; dur: 200; easing: linear; startEvents: pulse"
|
||||
id="floor" mixin="neonAnimation"
|
||||
geometry="primitive: plane; width: 3; height: 3"
|
||||
material="color: #888; shader: flat; src: #floorImg"
|
||||
material="color: #AAF; shader: flat; src: #floorImg"
|
||||
rotation="-90 0 0"></a-entity>
|
||||
</a-entity>
|
||||
|
||||
Reference in New Issue
Block a user