INFINITYUI
HomeComponentsDocsTemplates
Star

Getting Started

  • Introduction
  • Installation
  • CLI
  • Audit

Navigation

  • Spotlight Navbar
  • Glass DockNEW
  • Animated Tab Bar
  • Circle Menu
  • Magnet Tabs
  • Animated Sidebar
  • Apple Spotlight
  • Page TOC RailNEW

Text

  • Flip Text
  • Glitch Text
  • Liquid Text
  • Flip Fade Text
  • Mask Cursor Effect

Cards

  • Glow Border Card
  • Testimonials Card
  • Interactive Book
  • Trading CardsNEW
  • Hover Image
  • Chain of ThoughtNEW
  • Masonry Grid
  • Image Pile
  • Staggered Grid

Inputs

  • AI InputNEW
  • OTP Input
  • Leave Rating

Buttons

  • Social Flip Button
  • Creepy Button

Loaders

  • Jelly Loader
  • Rolling Ball Scroll
  • Glowing Scroll

Backgrounds

  • Light Lines
  • Perspective Grid
  • Liquid Ocean
  • Eagle Vision
  • Flow Scroll
  • Horizontal Scroll

Overlays

  • PersonaNEW
  • Infinite Moving Cards
  • Masked Avatars
  • Stacked Logos
  • Icon Wheel
  • Pixelated CarouselNEW
  • Pixelated Image Trail
  • Flip Scroll
  • Interactive Folder
  • Animated Folder IconNEW
  • Stack Scroll
  • Rubik Cube
Backgrounds

Eagle Vision

#background#zoom#cursor

Hover to magnify

Move your cursor around

×3
implementedInfinityUI component

This component is fully implemented in InfinityUI and wired into the docs and registry flow.

Installation

Use the registry command to add the component source, and install any package dependencies if needed.

Infinity Registry

Install the component source into your project with the shadcn CLI.

npx shadcn@latest add https://infinityui-pearl.vercel.app/r/eagle-vision
Package Dependencies

Install the npm packages used by this component source.

npm install framer-motion

Component Code

Copy and paste this code into your component file.

tsx
"use client";

import { useRef, useState } from "react";
import { motion, useMotionValue, useSpring } from "framer-motion";

interface EagleVisionProps {
    /** Zoom factor. Default: 2.5 */
    zoom?: number;
    /** Lens size in px. Default: 180 */
    lensSize?: number;
    children?: React.ReactNode;
    className?: string;
}

export function EagleVision({ zoom = 2.5, lensSize = 180, children, className = "" }: EagleVisionProps) {
    const containerRef = useRef<HTMLDivElement>(null);
    const [visible, setVisible] = useState(false);
    const rawX = useMotionValue(0);
    const rawY = useMotionValue(0);
    const lensX = useSpring(rawX, { stiffness: 400, damping: 40 });
    const lensY = useSpring(rawY, { stiffness: 400, damping: 40 });

    const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
        const rect = containerRef.current?.getBoundingClientRect();
        if (!rect) return;
        rawX.set(e.clientX - rect.left);
        rawY.set(e.clientY - rect.top);
    };

    return (
        <div
            ref={containerRef}
            onMouseMove={handleMouseMove}
            onMouseEnter={() => setVisible(true)}
            onMouseLeave={() => setVisible(false)}
            className={`relative overflow-hidden cursor-none select-none ${className}`}
        >
            {children}

            {/* Lens */}
            <motion.div
                style={{
                    x: lensX,
                    y: lensY,
                    width: lensSize,
                    height: lensSize,
                    translateX: "-50%",
                    translateY: "-50%",
                    opacity: visible ? 1 : 0,
                }}
                className="absolute top-0 left-0 rounded-full pointer-events-none overflow-hidden border-2 border-white/30 shadow-[0_0_0_4px_rgba(0,0,0,0.4),0_0_30px_rgba(99,102,241,0.3)] backdrop-blur-none z-20"
            >
                {/* Zoomed content */}
                <motion.div
                    style={{
                        x: lensX,
                        y: lensY,
                        translateX: "-50%",
                        translateY: "-50%",
                        scale: zoom,
                        width: "100%",
                        height: "100%",
                        transformOrigin: "center",
                    }}
                    className="absolute top-0 left-0 w-full h-full"
                >
                    <div className="w-full h-full bg-zinc-950/80 flex items-center justify-center">
                        <span className="text-indigo-400 text-xs font-mono">×{zoom}</span>
                    </div>
                </motion.div>
                {/* Crosshair */}
                <div className="absolute inset-0 flex items-center justify-center pointer-events-none">
                    <div className="w-3 h-px bg-indigo-400/60" />
                    <div className="absolute w-px h-3 bg-indigo-400/60" />
                </div>
            </motion.div>
        </div>
    );
}