2D and 3D transforms - tilts, cubes, perspective and chained motion - driven only by hover and keyframes.
1Skew Parallax
On hover the card skews one way and its image drifts the other, creating a quick sense of depth. Class: fx-skew-parallax
How to pack for two weeks with one bag
$149.87
<div class="flex flex-wrap items-center justify-center gap-4 p-4 h-full" style="min-height:200px">
<div class="card border-0 shadow-sm fx-skew-parallax" style="width:12rem">
<img src="https://images.unsplash.com/photo-1554366347-897a5113f6ab?auto=format&fit=crop&w=1200&h=800&q=70" alt="Card cover" class="card-img-top object-cover" style="height:100px">
<div class="card-body py-2">
<h3 class="h6 mb-0">How to pack for two weeks with one bag</h3>
<p class="small text-muted mb-0">$149.87</p>
</div>
</div>
</div>
/* CSS (already in assets/css/effects.css) */
.fx-skew-parallax { overflow: hidden; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.fx-skew-parallax img { transform: scale(1.12); transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.fx-skew-parallax:hover { transform: skewY(-2deg) translateY(-3px); }
.fx-skew-parallax:hover img { transform: scale(1.18) skewY(2deg) translateY(-6px); }
@media (prefers-reduced-motion: reduce) {
.fx-skew-parallax, .fx-skew-parallax::before, .fx-skew-parallax::after, .fx-skew-parallax *, .fx-skew-parallax *::before, .fx-skew-parallax *::after { animation: none !important; transition: none !important; }
}23D Rotating Cube
A spinning six-sided cube; give the element six children for the faces and set --fx-size if needed. Class: fx-3d-rotating-cube
<div class="flex flex-wrap items-center justify-center gap-4 p-4 h-full" style="min-height:200px">
<div class="fx-3d-rotating-cube" aria-hidden="true">
<div>
<i class="bi bi-box-fill" aria-hidden="true"></i>
</div>
<div>
<i class="bi bi-gem" aria-hidden="true"></i>
</div>
<div>
<i class="bi bi-star-fill" aria-hidden="true"></i>
</div>
<div>
<i class="bi bi-heart-fill" aria-hidden="true"></i>
</div>
<div>
<i class="bi bi-trophy-fill" aria-hidden="true"></i>
</div>
<div>
<i class="bi bi-bell-fill" aria-hidden="true"></i>
</div>
</div>
</div>
/* CSS (already in assets/css/effects.css) */
.fx-3d-rotating-cube {
--fx-half: calc(var(--fx-size, 6rem) / 2);
position: relative; width: var(--fx-size, 6rem); height: var(--fx-size, 6rem);
transform-style: preserve-3d;
animation: fx-3d-rotating-cube-spin 12s linear infinite;
}
.fx-3d-rotating-cube:hover { animation-play-state: paused; }
.fx-3d-rotating-cube > * {
position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem;
color: var(--wt-on-primary, #fff); border: 1px solid rgba(255, 255, 255, .35);
background: rgba(var(--wt-primary-rgb), .88);
}
.fx-3d-rotating-cube > :nth-child(1) { transform: translateZ(var(--fx-half)); }
.fx-3d-rotating-cube > :nth-child(2) { transform: rotateY(180deg) translateZ(var(--fx-half)); background: rgba(var(--wt-secondary-rgb), .88); }
.fx-3d-rotating-cube > :nth-child(3) { transform: rotateY(90deg) translateZ(var(--fx-half)); background: rgba(var(--wt-accent-rgb), .88); }
.fx-3d-rotating-cube > :nth-child(4) { transform: rotateY(-90deg) translateZ(var(--fx-half)); background: rgba(var(--wt-secondary-rgb), .88); }
.fx-3d-rotating-cube > :nth-child(5) { transform: rotateX(90deg) translateZ(var(--fx-half)); background: rgba(var(--wt-accent-rgb), .88); }
.fx-3d-rotating-cube > :nth-child(6) { transform: rotateX(-90deg) translateZ(var(--fx-half)); }
@keyframes fx-3d-rotating-cube-spin {
from { transform: perspective(700px) rotateX(-22deg) rotateY(0deg); }
to { transform: perspective(700px) rotateX(-22deg) rotateY(360deg); }
}
@media (prefers-reduced-motion: reduce) {
.fx-3d-rotating-cube, .fx-3d-rotating-cube::before, .fx-3d-rotating-cube::after, .fx-3d-rotating-cube *, .fx-3d-rotating-cube *::before, .fx-3d-rotating-cube *::after { animation: none !important; transition: none !important; }
}3Scale & Rotate
A springy scale-and-twist on hover for icons, avatars, logos and small buttons. Class: fx-scale-rotate
<div class="flex flex-wrap items-center justify-center gap-4 p-4 h-full" style="min-height:200px">
<img src="../assets/img/avatar-4.svg" alt="Avatar" class="fx-scale-rotate rounded-full shadow-sm" style="width:72px;height:72px">
<button type="button" class="btn btn-primary btn-lg rounded-full fx-scale-rotate" aria-label="Favourite"><i class="bi bi-star-fill" aria-hidden="true"></i></button>
<img src="../assets/img/logo-3.svg" alt="Brand logo" class="fx-scale-rotate" style="width:110px">
</div>
/* CSS (already in assets/css/effects.css) */
.fx-scale-rotate { transition: transform .45s cubic-bezier(.34, 1.8, .64, 1); }
.fx-scale-rotate:hover, .fx-scale-rotate:focus-visible { transform: scale(1.15) rotate(-8deg); }
@media (prefers-reduced-motion: reduce) {
.fx-scale-rotate, .fx-scale-rotate::before, .fx-scale-rotate::after, .fx-scale-rotate *, .fx-scale-rotate *::before, .fx-scale-rotate *::after { animation: none !important; transition: none !important; }
}