question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animation works locally but not in production (no minification)

See original GitHub issue

Tell us about your environment

  • Machine Mac OS Monterey 12.2.1 Intel Core i9

  • Browser and Browser Version: Chrome 99.0.4844.51 (Official Build) (x86_64)

  • After Effects Version: Latest

What did you do? Please explain the steps you took before you encountered the problem.

  • We have a Next.js app using Next version 12.1.0
  • We have downloaded https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.9.1/lottie.min.js and serve it out of the public folder using <Script src="/scripts/lottie.min.js" strategy="afterInteractive" />. The library file is being loaded correctly and with no modifications. console.log(lottie) returns the lottie object correctly.
  • We are calling the lottie library in the product thusly:
import intro from './lottie/reportGenIntro';
lottie.loadAnimation({
  container: document.getElementById('lottie_intro'),
  renderer: 'svg',
  loop: false,
  autoplay: true,
  animationData: intro,
});

We have tried adding the lottie json to the public directory and importing it from there. We also tried converting to TypeScript and importing directly. Same outcome either way.

Animation data as exported from AE: https://gist.github.com/adamrneary/f00d06f58711fb9b1cb5f65bfa9d29e9 Animation data as converted to TypeScript: https://gist.github.com/adamrneary/f430ad9556142f8a90d47fdb7d380511

console.log(intro) returns the same object locally and in production.

What did you expect to happen?

We want the animation to work locally and in production

What actually happened? Please include as much relevant detail as possible.

The animation works perfectly in local development. The same code in production renders an <svg /> containing an empty <g/> No errors log to the console

<div id="lottie_intro">
  <svg
    xmlns="http://www.w3.org/2000/svg"
    viewBox="0 0 200 200"
    width="200"
    height="200"
    preserveAspectRatio="xMidYMid meet"
    style="
      width: 100%;
      height: 100%;
      transform: translate3d(0px, 0px, 0px);
      content-visibility: visible;
    "
  >
    <defs>
      <clipPath id="__lottie_element_2">
        <rect width="200" height="200" x="0" y="0"></rect>
      </clipPath>
    </defs>
    <g clip-path="url(#__lottie_element_2)"></g>
  </svg>
</div>

Very strange that it seems to be the same code in both environments running the same animation data input. Not sure where to start!

Very happy to collaborate on a fix, document learnings, etc. Any help would be great!

Please provide a download link to the After Effects file that demonstrates the problem.

File available here

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
adamrnearycommented, Mar 25, 2022

Awesome. Thanks again for helping us diagnose this, and for explaining the nuances. We can take it from here!

0reactions
bodymovincommented, Mar 25, 2022

it depends on the animator. Some make use of them extensively and others don’t use them at all. In this case, it seems there is only one expression used and it should be very simple to replace it with some extra keyframes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[solved] Why Css-transitions dont work in PW ? but on local ...
Looking at your site, I noticed that all JS references are wrong, i.e. the paths to your Javascript files are incorrect and therefore...
Read more >
Svg animation showing locally but not in deploy - Support
It is showing locally but not in the deployment. I see the lights element in the dev tools but they don't appear.
Read more >
CSS Keyframes Animation Working locally, but not on my site
I have the following code in use on a Wordpress installation, and it's not working on my live site, but functions fine locally...
Read more >
Animation doesn't trigger in production (webpack bundle)
In development the animation works just fine, but when deployed it just doesn't trigger. Code is bundled and minified with webpack. The weird ......
Read more >
CSS Animations Not Working? Try These Fixes - HubSpot Blog
Non -Animatable CSS Properties ... Another reason why your animation isn't working might be that you're attempting to animate a CSS property that ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found