2D and 3D transforms - tilts, cubes, perspective and chained motion - driven only by hover and keyframes.
1Matrix Transform
Uses a single matrix() to scale, skew and lift a tile at once on hover. Class: fx-matrix-transform
<div class="flex flex-wrap items-center justify-center gap-4 p-4 h-full" style="min-height:200px">
<a href="#" class="fx-matrix-transform block no-underline rounded-xl p-6 text-white" style="width:13rem;background:linear-gradient(135deg, var(--wt-primary), var(--wt-secondary))">
<div class="text-3xl">
<i class="bi bi-bounding-box" aria-hidden="true"></i>
</div>
<div class="font-semibold">
Secure checkout
</div>
<div class="small opacity-75">
Hover me
</div>
</a>
</div>
/* CSS (already in assets/css/effects.css) */
.fx-matrix-transform { transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), box-shadow .5s; }
.fx-matrix-transform:hover, .fx-matrix-transform:focus-visible { transform: matrix(1.05, -.08, .12, 1.05, 0, -8); box-shadow: 0 20px 30px -16px rgba(var(--wt-primary-rgb), .5); }
@media (prefers-reduced-motion: reduce) {
.fx-matrix-transform, .fx-matrix-transform::before, .fx-matrix-transform::after, .fx-matrix-transform *, .fx-matrix-transform *::before, .fx-matrix-transform *::after { animation: none !important; transition: none !important; }
}2Translate 3D
Stacked layers separate along the Z axis on hover, like an exploded view of your interface. Class: fx-translate-3d
Hover me
<div class="flex flex-wrap items-center justify-center gap-4 p-4 h-full" style="min-height:200px">
<div class="fx-translate-3d" style="width:150px;height:110px">
<div class="absolute top-0 start-0 w-full h-full rounded-lg border bg-surface-3">
</div>
<div class="absolute top-0 start-0 w-full h-full rounded-lg" style="background:rgba(var(--wt-secondary-rgb), .45)">
</div>
<div class="absolute top-0 start-0 w-full h-full rounded-lg" style="background:rgba(var(--wt-primary-rgb), .55)">
</div>
<div class="absolute top-0 start-0 w-full h-full rounded-lg grid text-white font-semibold" style="place-items:center">
Hover me
</div>
</div>
</div>
/* CSS (already in assets/css/effects.css) */
.fx-translate-3d { position: relative; transform-style: preserve-3d; transform: perspective(800px); transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.fx-translate-3d > * { transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.fx-translate-3d:hover { transform: perspective(800px) rotateX(48deg) rotateZ(-28deg); }
.fx-translate-3d:hover > :nth-child(1) { transform: translate3d(0, 0, 0); }
.fx-translate-3d:hover > :nth-child(2) { transform: translate3d(0, 0, 30px); }
.fx-translate-3d:hover > :nth-child(3) { transform: translate3d(0, 0, 60px); }
.fx-translate-3d:hover > :nth-child(4) { transform: translate3d(0, 0, 90px); }
@media (prefers-reduced-motion: reduce) {
.fx-translate-3d, .fx-translate-3d::before, .fx-translate-3d::after, .fx-translate-3d *, .fx-translate-3d *::before, .fx-translate-3d *::after { animation: none !important; transition: none !important; }
}