What are the steps to integrate full page animated transitions using Webflow's built-in Lottie functionality and smoothstate.js?

Published on
September 22, 2023

Webflow's built-in Lottie functionality allows users to seamlessly integrate full page animated transitions into their websites. By combining this feature with smoothstate.js, users can create a smooth and engaging browsing experience for their visitors. Here are the steps to integrate full page animated transitions using Webflow's Lottie functionality and smoothstate.js:

  1. Create your animation: Start by designing and animating your desired transitions using an animation software, such as Adobe After Effects or LottieFiles. Export your animation as a JSON file.

  2. Upload the animation to Webflow: In your Webflow project, go to the Assets panel and click the "Upload" button to import your JSON animation file. Make sure to set the interaction setting to "Lottie" for the uploaded file.

  3. Prepare your pages: Determine which pages you want to include the animated transitions on and make sure they are all separate pages in your Webflow project.

  4. Install smoothstate.js: In the Webflow Designer, go to your project's settings and then to the "Custom Code" tab. Paste the latest version of the smoothstate.js code into the "Footer Code" section.

  5. Add script tags: Create a new HTML embed component on your Webflow project and paste the following code inside the <script> tags:

<script>  $(document).ready(function() {    // Initialize smoothstate.js    $(document).smoothState();  });</script>
  1. Create a custom smoothstate.js configuration: Using the smoothstate.js documentation as a reference, customize the smoothstate.js configuration to fit your desired animation and transition effects. This includes defining the animation elements, hooks, and settings like animation duration and easing.

  2. Markup your animation containers: On each relevant page of your Webflow project, add a div container where you want the animation to be displayed. Give each container a unique class or ID for easier targeting.

  3. Apply Lottie animation to containers: In the Webflow Designer, select each animation container you created and apply the Lottie animation as a background image instead of a traditional image. Use the class or ID assigned in the previous step to target the appropriate container.

  4. Update smoothstate.js selectors: In your smoothstate.js configuration, update the selectors to target the appropriate animation containers using their assigned class or ID.

  5. Preview and test: Use the Webflow Preview mode to test your animated transitions. Make sure that the animations trigger correctly and that the smoothstate.js transitions work smoothly between pages.

By following these steps, you can successfully integrate full page animated transitions using Webflow's built-in Lottie functionality and smoothstate.js. Remember to fine-tune the animation details and optimize your animations' file size for optimal performance.

Additional Questions:

  1. How can I create Lottie animations for Webflow?
  2. Are there any other animation libraries I can use with Webflow?
  3. Can I customize the loading animation between pages using smoothstate.js?