Map and motion

3D tilt

Cards that lean toward the mouse with a moving light and floating layers. Desktop only, and it respects reduced motion.

Example

Move your mouse over the cards. The card leans toward the pointer, a soft light follows it, and the layers marked with data-tilt-depth float at different heights.

Floating title

Text at a lower height.

Button on top

Stronger tilt

data-tilt="14", no glare.

Only elements with data-tilt are affected. It does not run on touch screens or when the visitor prefers reduced motion. For glare, the element needs position: relative. It is used on the bento tiles of the modern home page.

Classes and attributes

NamePurpose
data-tilt or data-tilt="10"Makes the element lean toward the pointer. The number is the largest angle in degrees (default 8).
data-tilt-glareAdds a soft light that follows the pointer.
data-tilt-depth="40"On a child. Lifts it toward the viewer by that many pixels while tilting.
.tilt, .is-tilting, .tilt-glareClasses the script adds. Style them in tilt.css.