Fade In On Scroll
Content that fades and rises into place as it enters the viewport.
6 फ्रेमवर्कमध्यम
A card that tilts in 3D toward the pointer as it moves across it.
<!-- Tilt is scoped to the card and gated on (pointer: fine); touch stays flat. -->
<div class="tilt-card rounded-2xl border border-gray-200 bg-white p-6 shadow-lg transition-transform duration-200 ease-out will-change-transform motion-reduce:transition-none dark:border-gray-800 dark:bg-gray-900">
<div class="mb-4 h-10 w-10 rounded-xl bg-gradient-to-br from-blue-500 to-indigo-600"></div>
<h3 class="text-base font-semibold text-gray-900 dark:text-gray-100">Tilt me</h3>
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">Move your cursor across the card to see it respond in 3D.</p>
</div>
<script>
(function () {
var node = document.querySelector('.tilt-card');
if (!node) return;
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
if (!window.matchMedia('(pointer: fine)').matches) return;
node.addEventListener('pointermove', function (e) {
var rect = node.getBoundingClientRect();
var px = (e.clientX - rect.left) / rect.width - 0.5;
var py = (e.clientY - rect.top) / rect.height - 0.5;
node.style.transform = 'perspective(800px) rotateY(' + px * 24 + 'deg) rotateX(' + -py * 24 + 'deg)';
});
node.addEventListener('pointerleave', function () {
node.style.transform = 'perspective(800px) rotateY(0deg) rotateX(0deg)';
});
})();
</script>| Prop | टाइप | डिफ़ॉल्ट | विवरण |
|---|---|---|---|
childrenआवश्यक | ReactNode | - | कंपोनेंट के अंदर रेंडर होने वाला कंटेंट। |
maxTiltDeg | number | 12 | Max tilt deg |
className | string | '' | रूट एलिमेंट पर मर्ज होने वाली अतिरिक्त क्लासेज़। |
Set `maxTiltDeg` for the tilt range. Tracking is scoped to the card and gated on `(pointer: fine)`, so touch devices and reduced motion get a flat card.