Skip to content

Commit bf117ed

Browse files
author
TechStack Global
committed
feat: dial in ultra-premium deck swipe physics and optimize mobile sizing
1 parent c6eb073 commit bf117ed

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

index.html

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ <h1>Make Smarter <br /><span class="gradient-text">Tech Decisions.</span>
138138
user-select: none;
139139
will-change: transform, opacity;
140140
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
141-
/* Smooth transitions when dropping or clicking next */
142-
transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s linear;
141+
/* Ultra-smooth springy transitions when dropping or clicking next */
142+
transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.2), opacity 0.4s ease-out;
143143
}
144144

145145
.deck-card:active {
@@ -214,15 +214,15 @@ <h1>Make Smarter <br /><span class="gradient-text">Tech Decisions.</span>
214214
}
215215

216216
.deck-card[data-depth="1"] {
217-
transform: translateZ(-80px) translateY(25px) scale(0.95);
217+
transform: translateZ(-60px) translateY(20px) scale(0.92);
218218
z-index: 2;
219-
opacity: 0.8;
219+
opacity: 0.7;
220220
}
221221

222222
.deck-card[data-depth="2"] {
223-
transform: translateZ(-160px) translateY(50px) scale(0.9);
223+
transform: translateZ(-120px) translateY(40px) scale(0.84);
224224
z-index: 1;
225-
opacity: 0.4;
225+
opacity: 0.3;
226226
}
227227

228228
/* Thrown away states */
@@ -281,26 +281,39 @@ <h1>Make Smarter <br /><span class="gradient-text">Tech Decisions.</span>
281281

282282
@media (max-width: 767px) {
283283
.deck-container {
284-
height: 420px;
284+
height: 330px;
285285
}
286286

287287
.deck-card {
288-
height: 380px;
289-
padding: 1.5rem;
288+
height: 300px;
289+
padding: 1.25rem;
290290
}
291291

292292
.deck-card img {
293-
height: 160px;
293+
height: 110px;
294294
margin-bottom: 0.5rem;
295+
border-radius: 6px;
296+
padding: 0.25rem;
297+
}
298+
299+
.deck-card h3 {
300+
font-size: 1.1rem;
301+
margin-bottom: 0.25rem;
295302
}
296303

297304
.deck-card p {
298-
font-size: 0.85rem;
299-
margin-bottom: 1rem;
305+
font-size: 0.8rem;
306+
margin-bottom: 0.5rem;
307+
line-height: 1.3;
300308
}
301309

302310
.deck-controls {
303-
margin-top: -15px;
311+
margin-top: -20px;
312+
}
313+
314+
.deck-controls button {
315+
width: 40px;
316+
height: 40px;
304317
}
305318
}
306319

@@ -411,7 +424,7 @@ <h3>Alienware AW3423DWF</h3>
411424
topIndex = (topIndex - 1 + total) % total;
412425
}
413426
updateDeck();
414-
}, 300); // 300ms matches CSS transition timing
427+
}, 450); // matches CSS transition timing
415428
}
416429

417430
nextBtn.addEventListener('click', () => throwCard('left'));
@@ -460,8 +473,9 @@ <h3>Alienware AW3423DWF</h3>
460473

461474
if (e && !isScrolling) e.preventDefault(); // Stop scroll when dragging sideways
462475

463-
const rotate = diffX * 0.05;
464-
cards[topIndex].style.transform = `translateZ(0) translateY(0) translateX(${diffX}px) rotate(${rotate}deg)`;
476+
const rotateZ = diffX * 0.08;
477+
const scale = Math.max(0.9, 1 - Math.abs(diffX) * 0.0003); // Slightly shrink while dragging
478+
cards[topIndex].style.transform = `translateZ(0) translateY(0) translateX(${diffX}px) rotateZ(${rotateZ}deg) scale(${scale})`;
465479
}
466480

467481
function onEnd() {

0 commit comments

Comments
 (0)