-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
253 lines (194 loc) · 9.48 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<html>
<head>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script>
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
function getRandomText() {
// var letters = 'ϏϐϑϖϗϘϙϚϛϜϝϞϟϠϡϰϱϴϵ϶ϷϸϻϼϽϾϿἇᾯᾚᾈᾠ𐆂𐅊𐅋𐅌𐅍𐅎𐅏𐅐𐅑𐅒𐅓𐅔𐅕𐅖𐅗𐅘𐅙𐅚𐅛𐅜𐅝𐅞𐅟𐅠𐅡𐅢𐅣𐅤𐅥𐅦𐅧𐅨𐅩𐅪𐅫𐅬𐅭𐅮𐅯𐅰𐅱𐅲𐅳𐅴𐅵𐅶𐅷𐅸𐅹𐅺𐅻𐅼𐅽𐅾𐅿𐆀𐆁𐆃𐆄𐆅𐆆𐆇𐆈𐆉𐆊𐆋𐆌𐆍𐆎𐆠𝈀𝈁𝈂𝈃𝈄𝈅𝈆𝈇𝈈𝈉𝈊𝈋𝈌𝈍𝈎𝈏𝈐𝈑𝈒𝈓𝈔𝈕𝈖𝈗𝈘𝈙𝈚𝈛𝈜𝈝𝈞𝈟𝈠𝈡𝈢𝈣𝈤𝈥𝈦𝈧𝈨𝈩';
var letters = 'repoakrgeorkghoesrkrgoerger';
var text = '0x';
for (var i = 0; i < 64; i++) {
text += letters[Math.floor(Math.random() * letters.length)];
}
return text;
}
function random(max){
max = max || 40;
return Math.round(Math.random() * 100 % max)
}
function generate_text(number){
var cryptic = document.querySelector('#cryptic');
var base_element = `
<a-text class=cryptic_block value="0xooeseoeerokposoorgreegrrreggrseggrorraokrgarggeseahpoeeehrrrorkr" position="0 -10 0" side="double" width="5" text="" geometry="primitive: circle; radius: 0; segments: 24" rotation="0 2129.000000000054 90" color="#A38E64" direction="-1" speed="0.14967379999742117"></a-text>
`
var array = [];
for (let i = 0; i < number; i++) {
array.push(base_element)
}
cryptic.innerHTML = array.join('\n');
}
AFRAME.registerComponent('cursor-listener', {
init: function () {
var lastIndex = -1;
var COLORS = ['red', 'green', 'blue'];
this.el.addEventListener('click', function (evt) {
lastIndex = (lastIndex + 1) % COLORS.length;
this.setAttribute('material', 'color', COLORS[lastIndex]);
console.log('I was clicked at: ', evt.detail.intersection.point);
});
}
});
navigator.xr.addEventListener('sessiongranted', function (evt) {
// One could check for the type of session granted.
// Events notifies of session creation after navigation, UA action, or requestSession.
// The session object is provided as part of this event.
if (evt.session.mode === 'immersive-vr') {
// set up app state for immersive vr, if that's what the app wants
} else {
// notify user that this app only works in immersive vr mode, if desired
}
})
function open_link(link){
if (link == 'level1'){
var answer = prompt(`Open ${link}?`)
if (answer == 1){
window.location.href='level1-overflow.html'
}
if (answer == 2){
window.location.href='level2-xless.html'
}
}
}
function change_intro_message(){
var text = [
"Hello Seal. You are a program.\nYou have pseudo AI capabilities.",
"Probably your features have not yet\nbeen activated. But that was\nnecessary to survive antivirus checks",
"Your goal is to observe other\nprograms. When all your features\n are activated, you will have a new goal."
]
var el = document.querySelector(".welcome_text");
var index = el.attributes.array_text.nodeValue
index = (index + 1) % text.length;
el.attributes.array_text.nodeValue = index;
console.log(index)
el.attributes.value.nodeValue = text[index]
}
AFRAME.registerComponent('text_animation', {
init: function () {
generate_text(100)
this.cryptic_elements = document.querySelectorAll('.cryptic_block');
this.first = true;
for (let i = 0; i < this.cryptic_elements.length; i++) {
var el = this.cryptic_elements[i]
el.setAttribute('position', `${random()} -20 ${random()}`);
el.setAttribute('rotation', "0 0 90");
el.setAttribute('color', getRandomColor());
var new_value = getRandomText()
console.log(new_value)
el.setAttribute('value', new_value);
// el.setAttribute('font', "DejaVuSans-msdf.json");
}
//console.log("init")
},
tick: function () {
//console.log("tick")
// Don't call query selector in here, query beforehand.
for (let i = 0; i < this.cryptic_elements.length; i++) {
var el = this.cryptic_elements[i]
if (this.first) {
this.first = false;
}
/*
el.opacity = el.opacity || 1
el.setAttribute('opacity', Math.round(Math.random() * 20));
*/
function random_direction() {
return !!((Math.abs(+new Date() % 4 * -1) % 2) * -1)
}
var direction = el.getAttribute('direction')
// console.log("direction",direction)
if (!direction) {
direction = 1
if (random_direction()) direction = -1;
}
el.setAttribute('direction', direction);
var value = Math.random() * 10;
// console.log(value, !(Math.round(value * 100) % 3))
// if (/*position.y > 10 &&*/ !(Math.round(value * 1000) % 99) /*&& +new Date() % 20*/) direction *= -1;
// el.setAttribute('direction', direction);
var speed = el.getAttribute('speed')
if (!speed) speed = Math.random() / 10 + 0.1;
el.setAttribute('speed', speed);
var position = el.getAttribute('position')
if (Math.abs(position.y) > 30) {
position.y *= -1;
if (random_direction()) {
// direction = 1;
// position.y = 20;
// console.log(direction, speed, position.y, )
// el.setAttribute('direction', direction);
speed = Math.random() / 10 + 0.1;
el.setAttribute('speed', speed);
}
}
position.y += speed * direction;
el.setAttribute('position', position);
var rotation = el.getAttribute('rotation');
rotation.y += random(5);
el.setAttribute('rotation', rotation);
//el.opacity -= 0.1
}
}
});
</script>
</head>
<body>
<a-scene inspector="" keyboard-shortcuts="" screenshot="" vr-mode-ui="" device-orientation-permission-ui="">
<a-assets>
<img id="floor_grid" src="img/grid_hex.jpg">
<img id="level1Thumb" src="level1Thumb.jpg">
</a-assets>
<a-sky color="#cfe6e8"></a-sky>
<a-entity id="computer blocks" visible="">
<a-box position="34.13002 1.4 -24.76631" rotation="-0.04984732817638162 -89.40605322559905 0.19996227050065732"
opacity="0.7" color="#4CC3D9" material="color: #8cdae8" geometry="" scale="0.30015 3.344 1.90779"></a-box>
</a-entity>
<a-entity id="cryptic" visible="" position="-23.76867 0 -29.83805">
<!-- <a-text value="q" position="0 2 0" side="double" width=10></a-text> -->
</a-entity>
<a-entity id="welcome" visible="" position="-0.07 2 -2">
<!-- <a-text value="q" position="0 2 0" side="double" width=10></a-text> -->
<a-text onclick=change_intro_message() class='welcome_text' value="" array_text = 2 position="0 0 0" side="double" width="4" text="align: center; color: #ffffff" geometry="width: 3.62; depth: 0" material="opacity: 0.45; side: double; transparent: true; color: #787878;"></a-text>
<a-entity geometry="primitive: tetrahedron; radius: 0.22" rotation="-35 120 -45" position="-1.66 -0.371 0.131" material="opacity: 0.9; color: #67dc18" animation="property: rotation; from: -35 0 -45; to: -35 120 -45; dur: 3000; easing: linear; loop: true"></a-entity>
</a-entity>
<!-- <a-box position="-1 1.6 -5" animation="property: position; to: 1 8 -10; dur: 2000; easing: linear; loop: true" color="tomato"></a-box> -->
<a-entity rotation="0 0 0" animation="property: rotation; to: 0 360 0; easing: linear; loop: true; dur: 10000">
<a-sphere position="5 0 0" color="mediumseagreen"></a-sphere>
</a-entity>
<a-plane src="#floor_grid" position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"
material="color: #8eb4aa; shader: flat; repeat: 20 20" geometry="" id="" scale="20 20 1"></a-plane>
<!-- <a-entity camera="" position="27.98897 1.6 -34.22068" wasd-controls="" rotation="0.67992 140.66820000000001 0"
look-controls="" aframe-injected="" data-aframe-inspector-original-camera=""></a-entity> -->
<!--Controls -->
<a-entity id="fans" position="0 0 -80" text_animation></a-entity>
<a-entity class=links id=level01 position="2 2 -37" scale="1 1 0.02" onclick="open_link('level1')"" link="href: level1-overflow.html; title: Level 1; image: #level1Thumb; visualAspectEnabled:true; highlightedColor: #ffcf24; backgroundColor: #000000; borderColor: #3700ff; on: 'click';"></a-entity>
<!-- <a-box geometry="primitive: box" material="color: blue" position="2 2 -30"></a-entity> -->
<a-entity position="0 0 0" wasd-controls="" rotation="0 0 0"
look-controls="" aframe-injected="" data-aframe-inspector-original-camera="">
<a-entity cursor="fuse: true; fuseTimeout: 500"
position="0 2 -1"
geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03"
material="color: black; shader: flat">
</a-entity>
</a-entity>
<!-- <a-entity id="box" cursor-listener geometry="primitive: box" material="color: blue"></a-entity> -->
<div class="a-loader-title" style="display: none;"></div>
</a-scene>
</body>
</html>