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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@developer-hub/hover-glitch-shader

v1.0.6

Published

React + R3F shader hover glitch video effect

Readme

@developer-hub/glitch-video-shader

Interactive hover glitch video shader built with React Three Fiber and custom GLSL shaders. Creates a mesmerizing RGB displacement glitch effect on looping video content with smooth mouse-following interactions and 3D displacement morphing.

🌌 Demo

Click here to view demo


✨ Features

  • 🎬 Video texture mapping with seamless looping
  • 🎨 RGB channel separation glitch effects
  • 🖱️ Smooth mouse tracking with UV coordinate mapping
  • 📐 3D surface displacement that follows cursor proximity
  • ⏱️ Smart hover delays to prevent flickering
  • 🎯 Localized glitch zones with customizable falloff
  • 🔧 Fully customizable dimensions and textures

📦 Installation

npm install @developer-hub/glitch-video-shader

or

yarn add @developer-hub/glitch-video-shader

🧩 Usage

"use client";
import { Canvas } from "@react-three/fiber";
import { GlitchVideo } from "@developer-hub/glitch-video-shader";

export default function MyScene() {
  return (
    <div className="h-screen w-screen bg-black">
      <Canvas orthographic camera={{ zoom: 200, position: [0, 0, 100] }}>
        <GlitchVideo
          videoSrc="/your-video.mp4"
          noiseTextureSrc="/noise-texture.jpg"
          width={6}
          height={4}
        />
      </Canvas>
    </div>
  );
}

⚙️ Props

| Prop | Type | Default | Description | | ----------------- | -------- | --------------- | -------------------------------------- | | videoSrc | string | "/video3.mp4" | Path to the video file to be looped | | noiseTextureSrc | string | "/noise5.jpg" | Path to grayscale displacement texture | | width | number | 4 | Width of the video plane in R3F units | | height | number | 4 | Height of the video plane in R3F units |


📁 Asset Requirements

Video Files

  • Place video files in your public/ folder
  • Supported formats: .mp4, .webm, .mov
  • Recommended: compressed, web-optimized videos for better performance

Noise Textures

  • Grayscale images work best for displacement
  • Formats: .jpg, .png, .webp
  • Higher contrast = more dramatic glitch effects
  • Recommended size: 512x512 or 1024x1024

🧠 How It Works

The component uses a sophisticated dual-shader approach:

Vertex Shader

  • 3D Displacement: Creates surface bumps that follow mouse position
  • Smooth Falloff: Uses smoothstep for natural height transitions
  • Hover Animation: Animates displacement intensity based on interaction state

Fragment Shader

  • RGB Channel Separation: Samples each color channel with slight offsets
  • Noise-Based Displacement: Uses grayscale texture for organic distortion patterns
  • Localized Effects: Glitch intensity is masked to areas near the cursor
  • Real-time Updates: All effects respond to live mouse coordinates in UV space

Interaction System

  • Smart Delays: 200ms delay before glitch activation prevents flickering
  • Auto-timeout: Effects fade after 300ms of mouse inactivity
  • Smooth Interpolation: Mouse position and hover states are smoothly animated
  • UV Coordinate Mapping: Converts 3D mouse position to texture coordinates

🎮 Dependencies

Ensure these are installed in your project:

{
  "peerDependencies": {
    "@react-three/fiber": ">=8.0.0",
    "@react-three/drei": ">=9.0.0",
    "three": ">=0.150.0",
    "react": ">=18.0.0"
  }
}

🛠️ Advanced Usage

// Custom styling with Tailwind classes
<div className="relative overflow-hidden">
  <Canvas
    orthographic
    camera={{ zoom: 200, position: [0, 0, 100] }}
    className="absolute inset-0"
  >
    <GlitchVideo
      videoSrc="/hero-video.mp4"
      noiseTextureSrc="/custom-noise.jpg"
      width={8}
      height={6}
    />
  </Canvas>
  <div className="relative z-10 p-8">{/* Your overlay content */}</div>
</div>

📄 License

MIT License © developer-hub

For detailed license information, see the LICENSE file in the repository.


🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

✅ Next Steps

  • ✅ Add this README.md to your package root
  • ✅ Create demo GIF or CodeSandbox example
  • ✅ Push to GitHub for public sharing
  • ✅ Run npm publish to update package documentation

🐛 Issues & Support

Found a bug or have a feature request? Please open an issue on GitHub.

💬 Community & Discussions

Join the community discussion for tips, showcase your projects, and get help from other developers: 👉 GitHub Discussions


Built with ❤️ using React Three Fiber and WebGL shaders