'use client'; import { forwardRef, HTMLAttributes, useId } from 'react'; export interface ScreenDistortionProps extends HTMLAttributes { /** Distortion type */ type?: 'wave' | 'glitch' | 'chromatic' | 'noise'; /** Distortion intensity */ intensity?: 'subtle' | 'medium' | 'intense'; /** Animation speed */ speed?: 'slow' | 'normal' | 'fast'; /** Only show on hover (requires parent with :hover) */ hoverOnly?: boolean; /** Fixed or absolute positioning */ position?: 'fixed' | 'absolute'; } export const ScreenDistortion = forwardRef( ( { type = 'glitch', intensity = 'medium', speed = 'normal', hoverOnly = false, position = 'fixed', className = '', style, ...props }, ref ) => { const id = useId(); const intensityValues = { subtle: { shift: '2px', opacity: 0.01 }, medium: { shift: '5px', opacity: 0.02 }, intense: { shift: '10px', opacity: 0.04 }, }[intensity]; const durationValues = { slow: 6, normal: 4, fast: 2, }[speed]; return ( <>