npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@malte-hansen/magnify-r3f

v2.0.2

Published

Real time optic magnifying glass component for React Three Fiber.

Readme

Magnify R3F

version license

Real-time optical magnifying glass component for React Three Fiber. Get a high-res zoomed section of your 3D scene with a simple, easy-to-use React component.

Features

  • Easy to use - Drop-in React component with sensible defaults
  • Highly customizable - Control zoom, radius, outline, and glass shape
  • High performance - Optimized shader-based rendering
  • TypeScript support - Full type definitions included
  • Touch support - Works with mouse and touch events
  • Anti-aliasing - Optional FXAA for smooth edges

Installation

npm install @malte-hansen/magnify-r3f

Demo

Check out the live demo to see the magnifying glass in action!

Quick Start

import React, { useState, useEffect } from "react";
import { Canvas } from "@react-three/fiber";
import { Magnify } from "@malte-hansen/magnify-r3f";

function App() {
  const [mousePos, setMousePos] = useState(null);

  useEffect(() => {
    const handleMouseMove = (e) => {
      setMousePos({
        x: e.clientX,
        y: window.innerHeight - e.clientY,
      });
    };

    window.addEventListener("mousemove", handleMouseMove);
    return () => window.removeEventListener("mousemove", handleMouseMove);
  }, []);

  return (
    <Canvas>
      <mesh>
        <boxGeometry args={[1, 1, 1]} />
        <meshNormalMaterial />
      </mesh>

      <Magnify position={mousePos} zoom={3} radius={120} />
    </Canvas>
  );
}

API Reference

<Magnify /> Props

| Prop | Type | Default | Description | | ------------------ | ---------------------------------- | ---------- | ----------------------------------------------------------------------------------------------- | | position | { x: number, y: number } \| null | null | Position of the magnifying glass in client coordinates. Set to null to disable magnification. | | zoom | number | 2.0 | Zoom factor of the magnifying glass. Range: 1.0 - 15.0 | | exp | number | 35.0 | Exponent for calculating the glass shape. Higher values = flatter glass. Range: 1.0 - 100.0 | | radius | number | 100.0 | Radius of the magnifying glass in pixels. | | outlineColor | number | 0xcccccc | Color of the glass outline (hex value). | | outlineThickness | number | 8.0 | Thickness of the glass outline in pixels. Set to 0 to disable. | | antialias | boolean | true | Enable FXAA anti-aliasing pass for smoother edges. | | enabled | boolean | true | Enable/disable the magnifying effect. |

Usage Examples

Basic Usage

The simplest way to add a magnifying glass to your scene:

import { Canvas } from "@react-three/fiber";
import { Magnify } from "@malte-hansen/magnify-r3f";

function Scene() {
  const [mousePos, setMousePos] = useState(null);

  useEffect(() => {
    const handleMouseMove = (e) => {
      setMousePos({ x: e.clientX, y: window.innerHeight - e.clientY });
    };
    window.addEventListener("mousemove", handleMouseMove);
    return () => window.removeEventListener("mousemove", handleMouseMove);
  }, []);

  return (
    <Canvas>
      {/* Your 3D scene comes here */}

      {/* Magnifying glass */}
      <Magnify position={mousePos} />
    </Canvas>
  );
}

Properties

Customize the appearance of the magnifying glass:

<Magnify position={mousePos} zoom={4} radius={150} exp={50} outlineColor={0xff0000} outlineThickness={10} />

Development

Running the Demo

# Install dependencies
npm install

# Start development server
npm run dev

Building

# Build library
npm run build

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT © Amit Diamant (refactored and extended by Malte Hansen)

Acknowledgments