Skip to content

Commit 4a99d7b

Browse files
committed
trying to get phone tilt working
1 parent 87bd2f1 commit 4a99d7b

File tree

2 files changed

+72
-73
lines changed

2 files changed

+72
-73
lines changed

CSS/numberRoll.css

Lines changed: 62 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
body {
1+
body{
22
margin: 0;
33
padding: 20px;
44
font-family: "Comic Sans MS", "Comic Sans", cursive;
55
background-color: #9999FF;
66
color: #000066;
77
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="50" height="50" x="0" y="0" fill="%239999FF"/><rect width="50" height="50" x="50" y="50" fill="%239999FF"/><rect width="50" height="50" x="50" y="0" fill="%23AAAAFF"/><rect width="50" height="50" x="0" y="50" fill="%23AAAAFF"/></svg>');
88
overflow-x: hidden;
9-
}
9+
}
1010

11-
.container {
11+
.container{
1212
max-width: 800px;
1313
margin: 0 auto;
1414
text-align: center;
1515
background-color: #CCFFFF;
1616
border: 6px double #00CCCC;
1717
padding: 20px;
1818
box-shadow: 10px 10px 0 #330066;
19-
}
19+
}
2020

21-
h1 {
21+
h1{
2222
color: #FF00FF;
2323
text-shadow: 2px 2px 0 #FFFF00;
2424
font-size: 28px;
2525
margin-bottom: 5px;
26-
}
26+
}
2727

28-
.subtitle {
28+
.subtitle{
2929
color: #009900;
3030
font-weight: bold;
3131
margin-bottom: 20px;
32-
}
32+
}
3333

34-
.maze-container {
34+
.maze-container{
3535
position: relative;
3636
width: 100%;
3737
height: 300px;
@@ -42,30 +42,30 @@ body {
4242
overflow: hidden;
4343
perspective: 800px;
4444
transform-style: preserve-3d;
45-
}
45+
}
4646

47-
.maze-inner {
47+
.maze-inner{
4848
position: relative;
4949
width: 100%;
5050
height: 100%;
5151
transform-style: preserve-3d;
5252
transition: transform 0.1s ease-out;
53-
}
53+
}
5454

55-
.ball {
55+
.ball{
5656
position: absolute;
5757
width: 30px;
5858
height: 30px;
5959
background: radial-gradient(circle at 10px 10px, #FF3333, #990000);
6060
border-radius: 50%;
61-
top: 50px;
62-
left: 50px;
61+
top: 20px;
62+
left: 20px;
6363
z-index: 10;
6464
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
6565
transition: left 0.05s linear, top 0.05s linear;
66-
}
66+
}
6767

68-
.hole {
68+
.hole{
6969
position: absolute;
7070
width: 40px;
7171
height: 40px;
@@ -79,15 +79,15 @@ body {
7979
font-size: 18px;
8080
box-shadow: inset 0px 0px 10px #000000;
8181
border: 2px solid #00FFFF;
82-
}
82+
}
8383

84-
.obstacle {
84+
.obstacle{
8585
position: absolute;
8686
background-color: #CC6600;
8787
border: 2px solid #FFCC33;
88-
}
88+
}
8989

90-
.phone-number {
90+
.phone-number{
9191
margin: 20px 0;
9292
min-height: 40px;
9393
background-color: #000000;
@@ -98,26 +98,26 @@ body {
9898
letter-spacing: 3px;
9999
border: 3px inset #999999;
100100
font-weight: bold;
101-
}
101+
}
102102

103-
.instructions {
103+
.instructions{
104104
background-color: #FFFF99;
105105
border: 2px dashed #FF9900;
106106
padding: 10px;
107107
font-size: 14px;
108108
margin-bottom: 20px;
109109
text-align: left;
110-
}
110+
}
111111

112-
.blink {
112+
.blink{
113113
animation: blinker 1s step-end infinite;
114-
}
114+
}
115115

116-
@keyframes blinker {
117-
50% { opacity: 0; }
118-
}
116+
@keyframes blinker{
117+
50%{opacity: 0;}
118+
}
119119

120-
button {
120+
button{
121121
background: linear-gradient(to bottom, #FF9900, #FF6600);
122122
border: 3px outset #FF9900;
123123
color: #FFFFFF;
@@ -127,42 +127,41 @@ body {
127127
font-family: "Comic Sans MS", "Comic Sans", cursive;
128128
margin: 5px;
129129
box-shadow: 3px 3px 0 #660033;
130-
}
130+
}
131131

132-
button:active {
132+
button:active{
133133
border-style: inset;
134134
transform: translate(1px, 1px);
135-
}
135+
}
136136

137-
.footer {
137+
.footer{
138138
margin-top: 20px;
139139
font-size: 12px;
140140
color: #660066;
141-
}
141+
}
142142

143-
.marquee {
143+
.marquee{
144144
background-color: #FFCC99;
145145
padding: 5px;
146146
white-space: nowrap;
147147
overflow: hidden;
148148
border: 1px solid #FF6600;
149149
margin-top: 10px;
150-
}
150+
}
151151

152-
.marquee p {
152+
.marquee p{
153153
display: inline-block;
154154
padding-left: 100%;
155155
animation: marquee 15s linear infinite;
156156
margin: 0;
157-
}
157+
}
158158

159-
@keyframes marquee {
160-
0% { transform: translate(0, 0); }
161-
100% { transform: translate(-100%, 0); }
162-
}
159+
@keyframes marquee{
160+
0%{transform: translate(0, 0);}
161+
100%{transform: translate(-100%, 0);}
162+
}
163163

164-
/* Joystick styling */
165-
.joystick-container {
164+
.joystick-container{
166165
position: relative;
167166
width: 150px;
168167
height: 150px;
@@ -173,9 +172,9 @@ body {
173172
box-shadow: inset 0 0 10px #333399;
174173
margin-bottom: 20px;
175174
touch-action: none;
176-
}
175+
}
177176

178-
.joystick-base {
177+
.joystick-base{
179178
position: absolute;
180179
top: 50%;
181180
left: 50%;
@@ -185,9 +184,9 @@ body {
185184
background-color: #9999CC;
186185
border-radius: 50%;
187186
border: 2px solid #6666AA;
188-
}
187+
}
189188

190-
.joystick-handle {
189+
.joystick-handle{
191190
position: absolute;
192191
top: 50%;
193192
left: 50%;
@@ -202,36 +201,36 @@ body {
202201
user-select: none;
203202
z-index: 10;
204203
animation: glow 1.5s ease-in-out infinite alternate;
205-
}
204+
}
206205

207-
@keyframes glow {
208-
from {
206+
@keyframes glow{
207+
from{
209208
box-shadow: 0 0 5px #FF0099, 0 0 10px #FF33CC;
210209
}
211-
to {
210+
to{
212211
box-shadow: 0 0 10px #FF0099, 0 0 20px #FF33CC, 0 0 30px #FF66DD;
213212
}
214-
}
213+
}
215214

216-
.joystick-handle:active {
215+
.joystick-handle:active{
217216
cursor: grabbing;
218217
animation: none;
219-
}
218+
}
220219

221-
.device-motion-notice {
220+
.device-motion-notice{
222221
background-color: #FFCCFF;
223222
border: 2px solid #FF66FF;
224223
padding: 10px;
225224
margin-top: 10px;
226225
display: none;
227-
}
226+
}
228227

229-
/* For devices with device orientation */
230-
@media (max-width: 768px) {
231-
.joystick-container {
228+
/* For devices with device orientation */
229+
@media(max-width: 2700px){
230+
.joystick-container{
232231
display: none;
233232
}
234-
.device-motion-notice {
233+
.device-motion-notice{
235234
display: block;
236235
}
237-
}
236+
}

js/numberRoll.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ let collectedHoles = [];
1313

1414
let rotationX = 0;
1515
let rotationY = 0;
16-
let ballX = 50;
17-
let ballY = 50;
16+
let ballX = 20;
17+
let ballY = 20;
1818
let velocityX = 0;
1919
let velocityY = 0;
2020
let isMobile = window.innerWidth <= 768;
@@ -174,10 +174,10 @@ enableMotionBtn.addEventListener('click', function(){
174174
rotationY = Math.min(Math.max(gamma, -15), 15);
175175

176176
mazeInner.style.transform = `rotateY(${rotationY}deg) rotateX(${-rotationX}deg)`;
177-
}
177+
}
178178

179-
// Ball physics
180-
function updateBall(timestamp) {
179+
// Ball physics
180+
function updateBall(timestamp){
181181
if (!lastTimestamp) {
182182
lastTimestamp = timestamp;
183183
}
@@ -279,7 +279,7 @@ enableMotionBtn.addEventListener('click', function(){
279279

280280
// Check hole collisions
281281
holePositions.forEach((hole, index) => {
282-
if (collectedHoles.includes(index)) return;
282+
// if (collectedHoles.includes(index)) return;
283283

284284
const holeX = parseInt(hole.x);
285285
const holeY = parseInt(hole.y);
@@ -294,8 +294,8 @@ enableMotionBtn.addEventListener('click', function(){
294294
collectDigit(index, hole.num);
295295

296296
// Reset ball position
297-
newX = 50;
298-
newY = 50;
297+
newX = 20;
298+
newY = 20;
299299
velocityX = 0;
300300
velocityY = 0;
301301
}
@@ -371,8 +371,8 @@ enableMotionBtn.addEventListener('click', function(){
371371
resetBtn.addEventListener('click', function() {
372372
phoneNumber = '';
373373
phoneDisplay.innerText = 'Enter your number...';
374-
ballX = 50;
375-
ballY = 50;
374+
ballX = 20;
375+
ballY = 20;
376376
velocityX = 0;
377377
velocityY = 0;
378378
ball.style.left = ballX + 'px';

0 commit comments

Comments
 (0)