Lay Theme Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    how to Lottie / json animations?

    General Discussion
    2
    2
    36
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      peterroden last edited by

      Hello I have been making vector animations using Cavalry App and would like to export them as a Lottie / JSON file and upload them as looping background video animations to page rows.
      Does anyone know how to do this?

      Thanks

      1 Reply Last reply Reply Quote 0
      • K
        kalamakumaran last edited by kalamakumaran

        Haven't tested out but you can try to:

        1. Include the Lottie library in your project via CDN Link
        <script src="lottie.min.js"></script>
        
        
        1. Give the row you would like to assign the animation to a class oder id (e.g. #animation-container)

        <script>
        window.laytheme.on("newpageshown", function(){
        const animationContainer = document.getElementById('animation-container'); // replace with your div ID
        const animationData = {
          container: animationContainer,
          renderer: 'svg',
          loop: true,
          autoplay: true,
          path: 'your-animation.json' // replace with the path to your Lottie JSON file
        };
        
        const animation = lottie.loadAnimation(animationData);
        });
        </script>
        
        1. Add this to your Custom CSS
        #animation-container {
          background-image: url("data:image/svg+xml;utf8," + encodeURIComponent(animationData.container.innerHTML));
        }
        

        to make the created SVG your background-image

        Good luck ;)

        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        Post a link to where the problem is if possible, please <3
        I don't answer or check forum DMs, please just post on the forum.
        Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com

        Before you post:

        Use the Search Feature. Maybe there is already a solution to your issue.

        1. Update Lay Theme and all Lay Theme Addons
        2. Disable all Plugins
        3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
        4. When using a WordPress Cache plugin, disable it or clear your cache. Now see if your problem solved itself.
        Go here, see if your problem is listed here:
        Troubleshooting

        When you post:
        1. Post a link to where the problem is
        2. If the problem is difficult to explain, post screenshots / link to a video to explain it

        Thanks!

        Online Users

        J
        U
        P
        H
        L
        S

        Recent Topics

        • B

          Portrait images are cut off in carousel

        • J

          Images Size when scale Browser

        • Search as icon instead of text?

        • FILTER Categories showing all projects

        laytheme.com