Update index.html
Browse files- index.html +46 -9
index.html
CHANGED
|
@@ -18,17 +18,33 @@
|
|
| 18 |
border-radius:16px; padding:12px; display:none; flex-direction:column; gap:8px;
|
| 19 |
z-index:1002;
|
| 20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
button {
|
| 22 |
background:rgba(255,50,50,0.15); color:#ff99aa; border:1px solid #ff3366;
|
| 23 |
box-shadow:0 0 12px #ff3366; padding:12px 14px; border-radius:10px;
|
| 24 |
font-size:15px; text-align:left;
|
| 25 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
</style>
|
| 27 |
</head>
|
| 28 |
<body>
|
| 29 |
|
| 30 |
<a-scene background="color: #000000">
|
| 31 |
<a-sky id="sky" src="galaxy.jpg"></a-sky>
|
|
|
|
| 32 |
</a-scene>
|
| 33 |
|
| 34 |
<div id="bead" onclick="togglePanel()"></div>
|
|
@@ -40,6 +56,16 @@
|
|
| 40 |
<button onclick="resizeAll(0.7)">🔍 Make All Smaller</button>
|
| 41 |
</div>
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
| 44 |
|
| 45 |
<script>
|
|
@@ -58,23 +84,19 @@
|
|
| 58 |
const scene = document.querySelector('a-scene');
|
| 59 |
const screen = document.createElement('a-curvedimage');
|
| 60 |
|
| 61 |
-
const x = (Math.random() *
|
| 62 |
-
const z = -
|
| 63 |
|
| 64 |
screen.setAttribute('position', `${x} 3 ${z}`);
|
| 65 |
-
screen.setAttribute('theta-length', '
|
| 66 |
screen.setAttribute('radius', '8');
|
| 67 |
screen.setAttribute('height', '5');
|
|
|
|
| 68 |
screen.setAttribute('material', 'shader: flat; side: double');
|
| 69 |
-
|
| 70 |
scene.appendChild(screen);
|
| 71 |
screens.push(screen);
|
| 72 |
|
| 73 |
-
// Force it to face the camera
|
| 74 |
-
setTimeout(() => {
|
| 75 |
-
screen.setAttribute('look-at', '#camera');
|
| 76 |
-
}, 100);
|
| 77 |
-
|
| 78 |
const input = document.createElement('input');
|
| 79 |
input.type = 'file';
|
| 80 |
input.accept = 'video/*,image/*';
|
|
@@ -113,6 +135,21 @@
|
|
| 113 |
});
|
| 114 |
}
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
document.getElementById('skyInput').addEventListener('change', function(e) {
|
| 117 |
const file = e.target.files[0];
|
| 118 |
if (file) document.getElementById('sky').setAttribute('src', URL.createObjectURL(file));
|
|
|
|
| 18 |
border-radius:16px; padding:12px; display:none; flex-direction:column; gap:8px;
|
| 19 |
z-index:1002;
|
| 20 |
}
|
| 21 |
+
.joystick {
|
| 22 |
+
position:fixed; bottom:90px; left:30px; width:90px; height:90px;
|
| 23 |
+
background:rgba(255,50,50,0.15); border:3px solid #ff3366; border-radius:50%;
|
| 24 |
+
z-index:1010; box-shadow:0 0 20px #ff3366;
|
| 25 |
+
}
|
| 26 |
+
.joy-knob {
|
| 27 |
+
position:absolute; top:50%; left:50%; width:38px; height:38px;
|
| 28 |
+
background:#ff3366; border-radius:50%; transform:translate(-50%, -50%);
|
| 29 |
+
box-shadow:0 0 15px #ff3366;
|
| 30 |
+
}
|
| 31 |
button {
|
| 32 |
background:rgba(255,50,50,0.15); color:#ff99aa; border:1px solid #ff3366;
|
| 33 |
box-shadow:0 0 12px #ff3366; padding:12px 14px; border-radius:10px;
|
| 34 |
font-size:15px; text-align:left;
|
| 35 |
}
|
| 36 |
+
.control-btn {
|
| 37 |
+
position:fixed; background:rgba(255,50,50,0.2); color:white; border:2px solid #ff3366;
|
| 38 |
+
width:48px; height:48px; border-radius:50%; display:flex; align-items:center; justify-content:center;
|
| 39 |
+
font-size:24px; z-index:1010; box-shadow:0 0 15px #ff3366;
|
| 40 |
+
}
|
| 41 |
</style>
|
| 42 |
</head>
|
| 43 |
<body>
|
| 44 |
|
| 45 |
<a-scene background="color: #000000">
|
| 46 |
<a-sky id="sky" src="galaxy.jpg"></a-sky>
|
| 47 |
+
<a-camera id="camera" position="0 2 0" wasd-controls look-controls></a-camera>
|
| 48 |
</a-scene>
|
| 49 |
|
| 50 |
<div id="bead" onclick="togglePanel()"></div>
|
|
|
|
| 56 |
<button onclick="resizeAll(0.7)">🔍 Make All Smaller</button>
|
| 57 |
</div>
|
| 58 |
|
| 59 |
+
<!-- N64-style movement -->
|
| 60 |
+
<div class="joystick" id="joystick">
|
| 61 |
+
<div class="joy-knob" id="knob"></div>
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
<div class="control-btn" style="bottom:160px; right:30px;" onclick="moveHeight(1)">▲</div>
|
| 65 |
+
<div class="control-btn" style="bottom:90px; right:30px;" onclick="moveHeight(-1)">▼</div>
|
| 66 |
+
<div class="control-btn" style="bottom:125px; right:90px;" onclick="rotateCamera(-15)">↺</div>
|
| 67 |
+
<div class="control-btn" style="bottom:125px; right:-30px;" onclick="rotateCamera(15)">↻</div>
|
| 68 |
+
|
| 69 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
| 70 |
|
| 71 |
<script>
|
|
|
|
| 84 |
const scene = document.querySelector('a-scene');
|
| 85 |
const screen = document.createElement('a-curvedimage');
|
| 86 |
|
| 87 |
+
const x = (Math.random() * 12 - 6);
|
| 88 |
+
const z = -13 - Math.random() * 7;
|
| 89 |
|
| 90 |
screen.setAttribute('position', `${x} 3 ${z}`);
|
| 91 |
+
screen.setAttribute('theta-length', '110');
|
| 92 |
screen.setAttribute('radius', '8');
|
| 93 |
screen.setAttribute('height', '5');
|
| 94 |
+
screen.setAttribute('look-at', '#camera');
|
| 95 |
screen.setAttribute('material', 'shader: flat; side: double');
|
| 96 |
+
|
| 97 |
scene.appendChild(screen);
|
| 98 |
screens.push(screen);
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
const input = document.createElement('input');
|
| 101 |
input.type = 'file';
|
| 102 |
input.accept = 'video/*,image/*';
|
|
|
|
| 135 |
});
|
| 136 |
}
|
| 137 |
|
| 138 |
+
// Simple movement helpers
|
| 139 |
+
function moveHeight(dir) {
|
| 140 |
+
const cam = document.getElementById('camera');
|
| 141 |
+
let pos = cam.getAttribute('position');
|
| 142 |
+
pos.y += dir * 0.5;
|
| 143 |
+
cam.setAttribute('position', pos);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
function rotateCamera(deg) {
|
| 147 |
+
const cam = document.getElementById('camera');
|
| 148 |
+
let rot = cam.getAttribute('rotation') || {x:0, y:0, z:0};
|
| 149 |
+
rot.y += deg;
|
| 150 |
+
cam.setAttribute('rotation', rot);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
document.getElementById('skyInput').addEventListener('change', function(e) {
|
| 154 |
const file = e.target.files[0];
|
| 155 |
if (file) document.getElementById('sky').setAttribute('src', URL.createObjectURL(file));
|