Webflow sync, pageviews & more.
NEW

How can I achieve the image distortion mouse hover effect in Webflow, similar to what I saw on a showcased website?

TL;DR
  • Design the layout in Webflow with an image container and apply a specific class for targeting.
  • Embed custom JavaScript using WebGL libraries like Curtains.js or Pixi.js to apply a shader-based distortion effect on hover using mouse input and a displacement map.

To create an image distortion effect on mouse hover in Webflow similar to advanced showcase websites, you’ll need to integrate custom JavaScript and WebGL shaders using tools like Curtains.js or Pixi.js. Webflow's native tools alone can’t achieve this complex effect, but here’s how to implement it.

1. Understand the Core Requirements

  • This effect typically uses WebGL fragment shaders for real-time image distortion.
  • Libraries like Curtains.js or Pixi.js allow you to apply those effects to HTML elements.
  • Webflow will serve as the layout/UI builder; the effect is injected using custom code embeds.

2. Set Up Your Webflow Structure

  • Add a Div Block where the image will be placed.
  • Set the background image or Image element inside the div.
  • Give this element a specific class (e.g., .distorted-image).
  • If needed, add a hover trigger animation using Webflow’s Interactions (optional, for fallback).

3. Prepare the Custom Code

  • Use the Before Tag custom code area in Page Settings.
  • Include required libraries (e.g., load Curtains.js with a <script src="https://..."></script> tag).
  • Write JS code that:
  • Selects the image container by class.
  • Initializes the distortion shader using a displacement map (grayscale PNG).
  • Handles mouse movement as input for interactive distortion.

Note: Raw JavaScript or shader code can't be included here per formatting rules.

4. Upload Assets

  • Host the image, displacement map, and any other assets using Webflow’s Assets panel or external hosting.
  • Copy public URLs and reference these paths in your JS code.

5. Test and Adjust

  • Publish your project to a staging domain.
  • Test mouse hover behavior—ensure smooth distortion without performance issues.
  • Fine-tune shader strength, transition speed, and displacement resolution.

Summary

To add an image distortion hover effect in Webflow, build the layout in Webflow and layer on a WebGL-based effect using Curtains.js or Pixi.js via a custom embed. Webflow handles structure and style, while a custom script distorts the image on hover using shaders and mouse interactions.

Rate this answer

Other Webflow Questions