0

I am using bodyworks and lottie to load a custom SVG animation, and for some reason it is throwing a GET error. The path to the file is correct as it loads it fine when i copy and paste it into the browser so I am unsure what is going wrong?

var animation = bodymovin.loadAnimation({
    container: document.getElementById("animationContainer"), // the dom element that will contain the animation
    renderer: 'svg',
    loop: true,
    autoplay: true,
    path: 'data.json' // the path to the animation json
});

The file was originally in a nested folder but i thought that may be a cause of some of the errors so I moved it, however it is still unable to load it. Any help would be appreciated

> bodymovin.js:1300 GET file:///G:/My%20Drive/YetiTech/YetiTechNewSite/YetiTech/The%20Fresh%20Site%20of%20Bel%20Air/data.jsonnet::ERR_FAILED
David McIntyre
  • 218
  • 1
  • 9
  • 1
    Your browser is blocking access to local files because security. The right thing to do is to spin up a small dev http-server (often integrated in popular code-editors, or available as plugin). You can't do web dev without it really. – ippi Aug 05 '20 at 02:34

1 Answers1

0

try to download and install mamp web server to create your local web server https://www.mamp.info/, then move the folder animation inside of the localhost folder and open it directly on the browser, for example localhost/animation-example/

Esteban A
  • 66
  • 2
  • 5