-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
498 lines (479 loc) · 20.3 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
<!doctype html>
<html lang="en-GB">
<head>
<meta charset="UTF-8" />
<title>Flock XR - Creative coding in 3D</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover"
/>
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="manifest" href="/flock/manifest.webmanifest" />
<link rel="apple-touch-icon" href="/images/apple-touch-icon.png" />
<link rel="icon" href="/images/favicon.ico" type="image/x-icon" />
<link rel="icon" href="/images/favicon.svg" type="image/svg+xml" />
<meta name="theme-color" content="#511d91" />
<script async src="https://www.googletagmanager.com/gtag/js?id=G-QCGT3X072N"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QCGT3X072N', {
'client_storage': 'none', // Prevents setting cookies
'anonymize_ip': true // Hides IP addresses for privacy
});
</script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<input
type="file"
id="importFile"
style="display: none"
accept=".json,.svg,.png"
/>
<div id="flockeditor">
<div id="menu">
<div id="menuleft">
<img src="images/flockxr-bird.png" alt="Flock bird logo" id="logo" />
<button class="bigbutton" id="runCodeButton" title="Run your code">
<div class="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
<path
fill="#511D91"
d="M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c-7.6 4.2-12.3 12.3-12.3 20.9l0 176c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z"
/>
</svg>
</div>
</button>
<button class="bigbutton" id="stopCodeButton" title="Stop your code">
<div class="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
<path
fill="#511D91"
d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM192 160l128 0c17.7 0 32 14.3 32 32l0 128c0 17.7-14.3 32-32 32l-128 0c-17.7 0-32-14.3-32-32l0-128c0-17.7 14.3-32 32-32z"
/>
</svg>
</div>
</button>
<button
class="bigbutton"
title="Open a project from a file on your computer"
>
<input type="file" id="fileInput" style="display: none" disabled />
<label for="fileInput"
><div class="icon" style="width: 1.25em; height: 1.25em">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
<path
fill="#511D91"
d="M64 480H448c35.3 0 64-28.7 64-64V160c0-35.3-28.7-64-64-64H288c-10.1 0-19.6-4.7-25.6-12.8L243.2 57.6C231.1 41.5 212.1 32 192 32H64C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64z"
/>
</svg></div
></label>
</button>
<input
type="text"
style="
flex-shrink: 1;
width: 100%;
min-width: 10px;
max-width: 80px;
"
id="projectName"
placeholder="Project name"
/>
<button
class="bigbutton"
id="exportCodeButton"
title="Save this project to a file on your computer."
>
<div class="icon" style="width: 1.25em; height: 1.25em">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
<path
fill="#511D91"
d="M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-242.7c0-17-6.7-33.3-18.7-45.3L352 50.7C340 38.7 323.7 32 306.7 32L64 32zm0 96c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32l0 64c0 17.7-14.3 32-32 32L96 224c-17.7 0-32-14.3-32-32l0-64zM224 288a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"
/>
</svg>
</div>
</button>
<select
id="exampleSelect"
class="bigbutton"
title="Choose an example project to load."
style="font-size: 14px"
disabled
>
<option value="" style="color: #511d91">Demo</option>
<option value="examples/new.json">New</option>
<option value="examples/starter.json">👋🏽 Starter</option>
<option value="examples/controller_starter.json">
🎮Controller Starter
</option>
<option value="examples/snow_globe.json">❄️ Snow globe</option>
<option value="examples/forest_base.json">🌲Forest Base</option>
<option value="examples/character_animation.json">
🎥Character Animation
</option>
<option value="examples/cube_art.json">🎨 Cube Art</option>
<option value="examples/physics_fun.json">👆🏾Physics Fun</option>
<option value="examples/collect_the_gems.json">
💎 Collect the Gems
</option>
<option value="examples/water_map.json">💧 Water Map</option>
<option value="examples/skittles.json">🎳 Skittles</option>
<option value="examples/beetle.json">🪲 Beetle</option>
<option value="examples/roominator.json">🛋️Roominator</option>
<option value="examples/ball_pit.json">🟠 Ball Pit</option>
<option value="examples/ur_enough.json">💗 UR Enough!</option>
<option value="examples/tallest_buildings.json">
📊 Tallest buildings
</option>
<option value="examples/candy_dash.json">🎃 Candy dash</option>
<option value="examples/flockenspiel.json">🎵 Flockenspiel</option>
<option value="examples/pendant.json">
📿 3D-printable pendant
</option>
<option value="examples/tent_lights.json">⛺Festival tent</option>
<option value="examples/my_place.json">🏠My place</option>
<option value="examples/microbit_monkey.json">
🐵 micro:bit monkey
</option>
</select>
</div>
<div id="menuright">
<button
class="bigbutton"
id="toggleDesign"
title="Design your project"
>
<div class="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
<path
fill="#511D91"
d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"
/>
</svg>
</div>
</button>
<button class="bigbutton" id="togglePlay" title="Use your project">
<div class="icon" style="width: 2em">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
<path
fill="#511D91"
d="M192 64C86 64 0 150 0 256S86 448 192 448l256 0c106 0 192-86 192-192s-86-192-192-192L192 64zM496 168a40 40 0 1 1 0 80 40 40 0 1 1 0-80zM392 304a40 40 0 1 1 80 0 40 40 0 1 1 -80 0zM168 200c0-13.3 10.7-24 24-24s24 10.7 24 24l0 32 32 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-32 0 0 32c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-32-32 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l32 0 0-32z"
/>
</svg>
</div>
</button>
<button
class="bigbutton"
title="Switch between fullscreen and normal views."
id="fullscreenToggle"
>
<div class="icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
<path
fill="#511D91"
d="M200 32L56 32C42.7 32 32 42.7 32 56l0 144c0 9.7 5.8 18.5 14.8 22.2s19.3 1.7 26.2-5.2l40-40 79 79-79 79L73 295c-6.9-6.9-17.2-8.9-26.2-5.2S32 302.3 32 312l0 144c0 13.3 10.7 24 24 24l144 0c9.7 0 18.5-5.8 22.2-14.8s1.7-19.3-5.2-26.2l-40-40 79-79 79 79-40 40c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l144 0c13.3 0 24-10.7 24-24l0-144c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2l-40 40-79-79 79-79 40 40c6.9 6.9 17.2 8.9 26.2 5.2s14.8-12.5 14.8-22.2l0-144c0-13.3-10.7-24-24-24L312 32c-9.7 0-18.5 5.8-22.2 14.8s-1.7 19.3 5.2 26.2l40 40-79 79-79-79 40-40c6.9-6.9 8.9-17.2 5.2-26.2S209.7 32 200 32z"
/>
</svg>
</div>
</button>
</div>
</div>
<div id="maincontent">
<div id="rightArea">
<canvas id="renderCanvas" touch-action="none" tabindex="0"></canvas>
<div class="gizmo-buttons" id="gizmoButtons">
<div id="shape-menu">
<!-- Gizmo button to toggle the shape menu -->
<button
class="gizmo-button"
id="showShapesButton"
style="margin-left: 5px"
disabled
>
<img
src="images/add.svg"
width="20px"
height="20px"
alt="position"
/>
</button>
<!-- Dropdown for shapes and models -->
<span id="shapes-dropdown" style="display: none">
<!-- Shape Row -->
<ul id="shape-row">
<li onclick="selectShape('create_box')">
<img src="./images/box.png" alt="Box" />
</li>
<li onclick="selectShape('create_sphere')">
<img src="./images/sphere.png" alt="Sphere" />
</li>
<li onclick="selectShape('create_cylinder')">
<img src="./images/cylinder.png" alt="Cylinder" />
</li>
<li onclick="selectShape('create_capsule')">
<img src="./images/capsule.png" alt="Capsule" />
</li>
<li onclick="selectShape('create_plane')">
<img src="./images/plane.png" alt="Plane" />
</li>
</ul>
<!-- Model Row with scroll buttons -->
<div class="scrollable-container">
<button
class="scroll-button left"
id="scrollModelsLeftButton"
disabled
>
⟪
</button>
<ul id="model-row">
<!-- Dynamically generated model items will be inserted here -->
</ul>
<button
class="scroll-button right"
id="scrollModelsRightButton"
disabled
>
⟫
</button>
</div>
<!-- Object Row -->
<div class="scrollable-container">
<button
class="scroll-button left"
id="scrollObjectsLeftButton"
disabled
>
⟪
</button>
<ul id="object-row">
<!-- Dynamically generated object items will be inserted here -->
</ul>
<button
class="scroll-button right"
id="scrollObjectsRightButton"
disabled
>
⟫
</button>
</div>
<!-- Character Row -->
<div class="scrollable-container">
<button
class="scroll-button left"
id="scrollCharactersLeftButton"
disabled
>
⟪
</button>
<ul id="character-row">
<!-- Dynamically generated character items will be inserted here -->
</ul>
<button
class="scroll-button right"
id="scrollCharactersRightButton"
disabled
>
⟫
</button>
</div>
</span>
</div>
<input type="color" id="colorPickerButton" disabled />
<button class="gizmo-button" id="positionButton" disabled>
<img
src="images/position.svg"
width="20px"
height="20px"
alt="position"
/>
</button>
<button class="gizmo-button" id="rotationButton" disabled>
<img
src="images/rotate.svg"
width="20px"
height="20px"
alt="rotate"
/>
</button>
<button class="gizmo-button" id="scaleButton" disabled>
<img
src="images/scale.svg"
width="20px"
height="20px"
alt="scale"
/>
</button>
<button class="gizmo-button" id="boundsButton" disabled>
<img
src="images/bounds.svg"
width="20px"
height="20px"
alt="bounds"
/>
</button>
<button class="gizmo-button" id="focusButton" disabled>
<img
src="images/focus.svg"
width="20px"
height="20px"
alt="focus"
/>
</button>
<button class="gizmo-button" id="hideButton" disabled>
<img
src="images/pointer.svg"
width="20px"
height="20px"
alt="select"
/>
</button>
<button class="gizmo-button" id="duplicateButton" disabled>
<img
src="images/duplicate.svg"
width="20px"
height="20px"
alt="duplicate"
/>
</button>
<button class="gizmo-button" id="deleteButton" disabled>
<img
src="images/delete.svg"
width="20px"
height="20px"
alt="delete"
/>
</button>
<button class="gizmo-button" id="cameraButton" disabled>
<img
src="images/camera2.svg"
width="20px"
height="20px"
alt="camera"
/>
</button>
</div>
<!---
<button class="gizmo-button" id="cutButton" disabled>
<img
src="images/cut.svg"
width="20px"
height="20px"
alt="cut"
/>
</button>
<button class="gizmo-button" id="copyButton" disabled>
<img
src="images/copy.svg"
width="20px"
height="20px"
alt="copy"
/>
</button>
<button class="gizmo-button" id="pasteButton" disabled>
<img
src="images/paste.svg"
width="20px"
height="20px"
alt="paste"
/>
</button>
-->
<!-- Info panel collapse starts -->
<div id="info-panel">
<button id="info-panel-toggle" style="cursor: pointer">
Show Info
</button>
<div id="info-panel-content" style="display: none">
<p>
Flock XR is a <strong>prototype</strong> made by
<a target="_blank" href="https://flipcomputing.com/flockxr/"
>Flip Computing</a
>. Please try it out but be aware that things may change and
some features aren't finished yet. We're currently looking for
support to develop Flock so that you can rely on it.
</p>
<div>
Take a look at the 🏝️ examples above to see what you can do.
Make some changes and click
<div
style="
display: inline-block;
margin-left: 2px;
margin-right: 2px;
"
>
<div
class="icon"
style="height: 1em; width: 1em; padding: 0px"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
>
<path
fill="#511D91"
d="M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c-7.6 4.2-12.3 12.3-12.3 20.9l0 176c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z"
/>
</svg>
</div>
</div>
run.
</div>
<p>
<a href="https://flipcomputing.com/contact/" target="_blank"
>Get in touch</a
>
</p>
<p>View the <a target="_blank" href="https://flockxr.com/privacy-policy/">privacy policy</a> for Flock XR.</p>
</div>
</div>
<script>
const toggleButton = document.getElementById("info-panel-toggle");
const infoContent = document.getElementById("info-panel-content");
toggleButton.addEventListener("click", () => {
if (infoContent.style.display === "none") {
infoContent.style.display = "block";
toggleButton.textContent = "Hide Info";
} else {
infoContent.style.display = "none";
toggleButton.textContent = "Show Info";
}
});
</script>
<!-- Info panel collapse ends -->
</div>
<div id="codePanel">
<!--button
value="Toolbox"
id="toolboxControl"
style="
z-index: 100000;
font-size: 16px;
border: none;
padding: 10px;
background-color: rgba(255, 101, 80, 0.45);
box-sizing: border-box;
"
>
<strong>+ Code</strong>
</button-->
<div id="blocklyDiv"></div>
</div>
</div>
<div id="bottomBar"><button id="switchViews">Code >></button></div>
</div>
<script type="module" src="/main.js"></script>
</body>
</html>