Custom Animations for Cookie Consent in Webflow: A Step-by-Step Guide

Published on
November 4, 2021

How to Create Custom Animations for Cookie Consent in Webflow

Webflow is a powerful tool for building websites with its intuitive visual interface and robust design capabilities. In this tutorial, we will learn how to create custom animations for cookie consent using Webflow. The FinnSuite cookie consent library comes with simple fade-in and fade-out effects applied to all components. However, for those who love interactions, Webflow allows you to create your own in and out animations for all FinnSuite cookie consent components.

Getting Started

To begin, let's understand how to animate the FinnSuite cookie consent components, including the banner, manager, and preference popup. For this tutorial, we will focus on animating the cookie banner component.

Accessing the Symbols

First, access the symbols section in Webflow where the cookie banner is located. Make the cookie banner visible for easier editing and manipulation.

Applying Interactions

When creating custom animations for the cookie consent in Webflow, the process involves applying interactions to a separate div block rather than directly to the cookie banner. This allows for more flexibility and control over the animation effects.

  1. Create a new div block to hold the interaction for the cookie banner.

  2. Apply the tap interaction to the div block.

Creating the In Animation

Initial State:

  • Set the display value to "none" to initially hide the cookie banner.
  • Add a scale property to increase the size of the banner for a dynamic entrance effect.

Animation Effects:

  • Set the display value back to "flex" to make the banner visible.
  • Add a scale property with a duration for a smooth expansion effect.
  • Adjust the scale properties to achieve the desired animation outcome.
  • Apply easing for a more natural transition.

Creating the Out Animation

Reverse Animation:

  • Create a custom animation for when the cookie banner is leaving the screen.
  • Reverse the effects applied in the in animation to contract the banner for an exit effect.
  • Incorporate scaling and duration adjustments for a seamless contraction effect.
  • Apply a show/hide display property to hide the element after the exit animation.

Finalizing the Interactions

After creating the custom in and out animations for the cookie banner, finalize the interaction trigger and settings in Webflow.

  1. Give the interaction trigger a unique class name, such as "interaction-trigger-banner."

  2. Add the "fs-cc-interaction" attribute to the element to signal it as the interaction holder for the FinnSuite cookie consent script.

  3. Check that the trigger is set to the element's class and not the element itself within the interactions settings.

  4. Optionally, hide the interaction trigger in the designer view to declutter the workspace.

Testing the Custom Animations

Once the custom animations are set up, preview the website in Webflow to see the cookie consent banner's entrance and exit animations in action. Test the interactions by clicking the accept or deny buttons to trigger the exit animation.

Conclusion

In conclusion, Webflow provides the flexibility to create custom animations for cookie consent components using its intuitive visual interface and interactions settings. With the ability to customize in and out animations, users can enhance the user experience of their websites while complying with cookie consent regulations.

By following the steps outlined in this tutorial, you can unleash your creativity and build compelling animations for cookie consent in Webflow. We hope you found this tutorial helpful in expanding your knowledge of Webflow interactions and look forward to seeing the impressive projects and interactions you create using the FinnSuite cookie consent library. Cheers to building seamless and engaging user experiences with Webflow!

For more tutorials and resources, continue learning with Webflow and explore the endless possibilities of web design and development.