Webflow cloneable · Animation

Interactive Matter.js love button Webflow cloneable

Enhance user engagement with this interactive love button Webflow cloneable. Customize falling hearts and animations easily for a captivating website experience. Elevate user interaction and aesthetics with seamless integration on Webflow.

Interactive Matter.js Button Effect on a desktop screen
Interactive Matter.js Button Effect on a phone
Screenshots of the live preview, Nov 7, 2026 Open live preview

About cloneable

This Webflow cloneable features an interactive love button that utilizes the Matter.js library, a powerful 2D physics engine, to create a captivating visual experience. When the button is clicked, whimsical hearts cascade from above, bouncing and floating as if influenced by gravity, adding a delightful touch to any website.

Perfect for websites aiming to enhance user engagement, this cloneable offers easy customization options. Users can modify the shapes, control the speed of the falling hearts, or even unleash a playful rain of puppies—perfect for websites that prioritize fun, creativity, and user interaction.

The cloneable integrates seamlessly with Webflow, allowing developers to benefit from a visually stunning animation without extensive coding knowledge. Its responsive design means that the love button and accompanying effects will deliver an impressive user experience, regardless of the screen size. Through intuitive adjustments in the provided JavaScript and CSS, website owners can tailor the animations to suit their branding, always ensuring a captivating visitor experience.

Not only does this feature add a unique interactive element, but it also fosters a sense of delight and connection with the audience. Website users are likely to spend more time interacting with the content, ultimately enhancing overall engagement and potential conversions. By implementing this cloneable, Webflow users gain a charming component that elevates their website's aesthetic and user interaction, all with the benefit of simple implementation and extensive customization options.

About CSS

What is the purpose of the .matter-js-canvas class in this CSS code for Webflow?

The .matter-js-canvas class is designed to style an embedded canvas element that typically displays graphics or animations generated using the Matter.js physics engine. It ensures that the canvas covers the entire area of its container with properties like display: block, height: 100%, and width: 100%. The position: absolute property allows it to overlay other elements, while overflow: hidden prevents any content from spilling outside its boundaries. The pointer-events: none property disables mouse events for the canvas, which is useful in cases where other elements need to be interacted with instead.

How does the .span_love-button class enhance the interactive features of a button in Webflow?

The .span_love-button class provides a visually appealing design for a button, employing border-radius for soft, rounded edges, and transform-style: preserve-3d which is likely used for creating depth effects during interactions. This enhances the button's interactivity by creating a more engaging user experience.

What is the purpose of the :before pseudo-element within the .span_love-button class in this code?

The :before pseudo-element creates an additional layer for the button, providing a decorative effect that enhances its visual appearance. It features a solid border and a background color, contributing to a stylish look. The properties such as transform and transition enable the button to visually "activate" when clicked, providing feedback to the user. For example, in the :active state, it moves up to align with the button, giving an impression of depth and responsiveness.

How does the media query affect the styling of the .span_love-button class in responsive design for Webflow?

The media queries in the CSS code adjust the styling of the .span_love-button based on the screen width. For screens narrower than 767px, it increases the border size to 0.45vw, making the button appear bolder. For screens smaller than 479px, it further increases the border size to 0.6vw and shifts the top and left properties of the :before pseudo-element, enhancing its visual prominence on smaller devices. This ensures good responsiveness and user experience across various screen sizes.

About Javascript

How does this JavaScript code integrate with Webflow?

This JavaScript code is designed for a Webflow project and integrates multiple external libraries, notably Matter.js for physics simulations. The script implements a canvas where animated balls, represented as sprites, are generated upon a button click. It utilizes Webflow’s structure to seamlessly integrate dynamic content within a visually appealing interactive feature.

What external JavaScript libraries are included in this code?

The code includes several external libraries:

  1. Matter.js: This is the core physics engine that facilitates creating and managing objects (like the animated balls) within a physics world.

How does the Matter.js library function within this code?

Matter.js provides tools for creating a 2D physics engine that allows for the creation, simulation, and rendering of physical bodies. In this code, it is used to create bouncing balls that have realistic physical properties like friction, restitution, and gravity. The Engine, Render, and World components from Matter.js enable the setup and management of the physics simulation, allowing users to interact with dynamic elements on the canvas.

What happens when the button with the ID #love-button is clicked?

When the button with the ID #love-button is clicked, the handleClick function is triggered, which calls the createBall function. This function creates a new ball with a randomly chosen sprite texture from the provided array and adds it to the physics world. Each ball is set to disappear after 35 seconds, controllable through the setTimeout function.

How is the canvas size adjusted in this script?

The canvas size is dynamically set based on the viewport width and height using the following code:

var w = document.querySelector(".matter-js-canvas").clientWidth; var h = document.querySelector(".matter-js-canvas").clientHeight;

This ensures that the canvas size matches the container element’s dimensions, providing a responsive design appropriate for various screen sizes.

What are the visual attributes of the balls created in this script?

The balls generated by this script are circle-shaped bodies with various sprite textures (hearts in different colors). Each ball is created with specific physical properties such as:

  • Friction: Controls how the balls interact with surfaces.
  • Restitution: Affects how bouncy the balls are.
  • Sprite Rendering: Each ball's appearance uses a randomly selected texture from the textures array.

How does this code ensure that the canvas displays correctly?

By specifying options in the Render.create method, the canvas displays correctly without wireframes, providing a clean visual experience:

const render = Render.create({ canvas: world, engine: engine, options: { width: Math.min(w), height: Math.min(h), background: "transparent", wireframes: false } });

These settings create a visually appealing simulation that fits well within the overall Webflow-designed page.

What customizations can developers implement in this JavaScript code?

Developers can customize various aspects of this script, including:

  • Texture Changes: Adding or changing the sprites in the textures array.
  • Ball Behaviour: Modifying properties like friction, restitution, and the size of the balls.
  • Disappearance Time: Adjusting the duration before a ball disappears by changing the value in the setTimeout function.
  • Appearance on Interaction: Altering how balls are created based on different user interactions, such as adding animations or effects upon clicking the button.

This flexibility makes the code adaptable to different creative needs within a Webflow project.

Matter.js Physics-based interactions
Matter.js Physics-based interactions Elevate your website with dynamic physics-based interactions using this Webflow cloneable. Incorporating Matter.js, SVG animations, and a customizable CSS grid background, enhance user engagement and visual appeal effortlessly. Opt for this cloneable for seamless web design across all devices.
Clone
Vertical Webflow Splide Slider
Vertical Webflow Splide Slider Clone Webflow's dynamic and interactive Splide slider with this CMS powered vertical slider. Fully responsive and customizable with smooth navigation, scrolling, and animations. Get the Dribbble-inspired design for your website!
Clone
Looping CMS CSS Marquee with Pause on Hover
Looping CMS CSS Marquee with Pause on Hover Create an engaging Looping CMS Marquee with Pause on Hover effect on your website with this Webflow cloneable. Customize animation speed and enhance user engagement with this dynamic feature. Perfect for captivating your audience and adding flair to your site.
Clone
Splide.js 3D Slider
Splide.js 3D Slider Discover a captivating 3D slider gallery using Splide.js in this Webflow cloneable. Featuring Anime.js animations, control buttons, and interactive cursor effects for a modern touch. Elevate your website design with this dynamic and visually appealing slider experience.
Clone
Animated Timeline Interaction
Animated Timeline Interaction Discover a modern and engaging Animated Timeline Webflow cloneable by Relume. Showcase your company's history or product roadmap with this interactive scrolling effect. Perfect for creating captivating chronological stories.
Clone
CMS Logo Carousel
CMS Logo Carousel Enhance your website with a dynamic Logo Carousel Webflow cloneable. Easily showcase partners or clients with this smooth and customizable marquee effect. No custom code required, just plug in your logos and enjoy!
Clone
Page Loader Progress Bar
Page Loader Progress Bar Elevate user experience with this Loader progress bar Webflow cloneable. Engage visitors with a dynamic loading experience and progress percentage display. Enhance site performance and create seamless transitions between page loads. Ideal for captivating preloading screens.
Clone
Anime.js Pricing calculator
Anime.js Pricing calculator Enhance user experience with this Pricing Calculator Webflow cloneable by Timothy Ricks. Featuring animations, glassmorphism effects, and custom JavaScript/CSS for dynamic text and foggy glass effects. Optimize user engagement with noise effects and intuitive navigation. Perfect for Webflow users looking to boost site functionality and design. Explore advanced Webflow techniques with Timothy Ricks' tutorials for interactive design principles.
Clone