dotlottie / dotlottie-js

dotLottie-js is the primary library for creating and abstracting dotLotties.
18 stars 4 forks source link

Passed in Animation Data Object Gets Mutated #84

Open naaish-adam opened 1 month ago

naaish-adam commented 1 month ago

I passed in a Lottie JSON with encoded images but it was mutated and the data URI for the images in the assets array was replaced with relative URLs.

const dotLottie = new DotLottie();
  dotLottie.addAnimation({
    id: "default",
    data: animationData // This gets mutated
});

Before:

"assets": [{
    "id": "2dd5bfdae9efbf11e27d9d5046c3c14629b81d94",
    "e": 1,
    "w": 300,
    "h": 406,
    "p": "data:image/png;base64,iVBORw0KGgoAAAA...",
    "u": ""
}]

After:

"assets": [{
    "id": "gbpoBJVn-f",
    "e": 0,
    "w": 300,
    "h": 406,
    "p": "gbpoBJVn-f.png",
    "u": "/images/"
}]