Animation

Tilt Card

Cursor-tracked 3D tilt. Use <wr-tilt-card> for a ready-made card host, or [wrTilt] to add the tilt behaviour to any element.

Angular adaptation of an effect by David Haz / reactbits.dev.

Import

import { WrTiltCard, WrTilt } from 'ngwr/tilt-card';

Playground

Hover me

Move the cursor across me.

<wr-tilt-card
  [maxTilt]="12"
  [perspective]="800"
  [scale]="1.03"
  [glare]="false"
>
  <h3>Hover me</h3>
  <p>Move the cursor across me.</p>
</wr-tilt-card>

Customize

Max Tilt (°)
12 °
Perspective (px)
800 px
Scale
1.03
Glare

Directive variant ([wrTilt])

// Directive variant — same package, drops on any element.
import { WrTilt } from 'ngwr/tilt-card';

<img wrTilt [maxTilt]="10" [scale]="1.02" src="…" />
[wrTilt] on a plain <div> — same behaviour, no card chrome.

API

NameDescriptionTypeDefault
maxTiltMaximum tilt in degrees.number12
perspectiveCSS perspective in pixels.number800
scaleScale applied while hovered.number1.03
glareAdd a moving glare highlight overlay.booleanfalse
[wrTilt]Directive variant — same inputs as <wr-tilt-card>. Drops on any element.directive