Introducing Aceternity UI Pro - 70+ premium component packs and templates to build amazing websites.
Logo

Pixelated Canvas

Convert any image to a pixelated canvas mouse distortion effects, as seen on Tailwind CSS Website.

Open in

Installation

Run the following command

npx shadcn@latest add https://ui.aceternity.com/registry/pixelated-canvas.json

Different Props

Open in

Props

PropTypeDefaultDescriptionRequired
srcstring-Source image URL to sample and render.Yes
widthnumber400Canvas display width in CSS pixels.No
heightnumber500Canvas display height in CSS pixels.No
cellSizenumber3Size of each sampling cell in CSS pixels.No
dotScalenumber0.9Dot size as a fraction of cell size (0..1).No
shape"circle" | "square""square"Shape of the dot drawn for each sample.No
backgroundColorstring"#000000"Background color to clear the canvas before drawing.No
grayscalebooleanfalseConvert colors to grayscale before drawing.No
classNamestringundefinedAdditional CSS classes applied to the canvas element.No
responsivebooleanfalseRedraw on window resize using the provided width/height.No
dropoutStrengthnumber0.40..1; removes dots in low-contrast regions.No
interactivebooleantrueEnable interactive pointer distortion animation.No
distortionStrengthnumber3Max per-dot offset (px) due to distortion.No
distortionRadiusnumber80Radius (px) around pointer influencing distortion.No
distortionMode"repel" | "attract" | "swirl""swirl"How pixels move near the pointer.No
followSpeednumber0.20..1 smoothing factor for pointer follow.No
sampleAveragebooleantrueAverage multiple samples per cell instead of single center.No
tintColorstring"#FFFFFF"Color tint applied to samples.No
tintStrengthnumber0.20..1 tint mix amount with original colors.No
maxFpsnumber60Cap animation frame rate to improve performance.No
objectFit"cover" | "contain" | "fill" | "none""cover"Object-fit behavior for the source image within the canvas.No
jitterStrengthnumber4Random motion amplitude for dots near the pointer.No
jitterSpeednumber4Speed factor for the random motion.No
fadeOnLeavebooleantrueSmoothly fade the distortion when the pointer leaves.No
fadeSpeednumber0.10..1 smoothing factor for leave fade. Higher = faster fade.No

Build websites faster and 10x better than your competitors with Aceternity UI Pro

With the best in class components and templates, stand out from the crowd and get more attention to your website. Trusted by founders and entrepreneurs from all over the world.

Go Pro
Manu was such a pleasure to work with. Talented, communicative and fast. Highly recommend!

Jonathan Barshop

Founder at Barshop Studios

A product by Aceternity
Building in public at @mannupaaji