airbnb / lottie-ios

An iOS library to natively render After Effects vector animations
http://airbnb.io/lottie/
Apache License 2.0
25.76k stars 3.75k forks source link

Bezier paths with absolute in/out tangents render incorrectly #2345

Closed rsereir closed 4 months ago

rsereir commented 7 months ago

Hello !

We are lot people with render issue on a lot of LottieFiles in react native. This issue is the continuation of another issue opened here https://github.com/lottie-react-native/lottie-react-native/issues/1194

This is the current render:

Lottie animation issue

This is the animation:

https://app.lottiefiles.com/animation/822c47f1-f147-4114-97ba-dd9e4f2ef8d0?channel=web&source=public-animation&panel=download

calda commented 7 months ago

Can you upload the animation file directly to this issue? I don't have permission to view the link you shared:

image
rsereir commented 7 months ago

Hello @calda, Thanks for you quick answer !

Sorry i give you a private url, this is the public url with all features used, etc:

https://lottiefiles.com/animations/astronaut-light-theme-keS0ihnMAU?from=search

calda commented 7 months ago

The animation you linked renders as expected when I test it in our sample app:

image

Please share a sample Xcode project that demonstrates the animation rendering incorrectly.

matinzd commented 7 months ago

It seems like the animation that you are sharing is different than the one that is actually in your app 😅

This is the one you are using:

https://app.lottiefiles.com/share/5052c0b3-ed25-46c1-9db4-b7911c352073

rsereir commented 7 months ago

@matinzd hello ! No, it's my first link used here, but i just custom colors in my lottie files editor.. Otherwise, in itself it doesn't change anything I think the link you provided seems to be someone who did like me, starting from the same lottie and only changing the colors

matinzd commented 7 months ago

This is your json file that I imported from the project into lottiefiles editor. You need to share the one that you modified not the original one. The original one is working as expected but the modified version is having some rendering issues on iOS and Android, not on web ...

rsereir commented 7 months ago

@matinzd It may be simpler to work with the original lottiefile, I can provide you with the same rendering problem screens with the original one if it allows us to move forward

Capture d’écran   2024-03-21 à 8 29 07 AM

matinzd commented 7 months ago

Can you share the code that you are using here as well? Just the <LottieView /> component with its props would be enough. @rsereir

rsereir commented 7 months ago
        <LottieView
          source={require('assets/lottiefiles/spinner.json')}
          style={{ width: '35%', aspectRatio: 1 }}
          autoPlay
          loop
        />

        This is the usage @matinzd 
matinzd commented 7 months ago

Can you try with renderMode={'SOFTWARE'} or renderMode={'HARDWARE'} ?

matinzd commented 7 months ago

I am not sure which one you are using! :D I created a pull request on your repo and you can also check it out in your login screen. It seems you are using a wrong animation.

simulator_screenshot_D8597E18-B528-4789-B309-E9F48F9CE453

rsereir commented 7 months ago

Can you try with renderMode={'SOFTWARE'} or renderMode={'HARDWARE'} ?

With both suggestions it's not working correctly.. I use the good lottie file ( from download link in the offical lottie marketplace ), i tried on my login screen and inside my dashboard app and render is breaked on both

matinzd commented 7 months ago

This is your app's screenshot and I even made a pull request on your fork repo. I cannot reproduce the issue you are having. Try checking out to the branch and see your login screen there.

https://github.com/rsereir/fork-lottie-error/pull/1

calda commented 7 months ago

I can reproduce the rendering issue with the animation that was modified in the LottieFiles editor:

Screenshot 2024-03-21 at 8 14 59 AM

issue_2345.json

matinzd commented 7 months ago

Yes I could also reproduce the rendering issue with the modified file but not with the original file.

rsereir commented 7 months ago

@matinzd / @calda It's mandatory to add LottieFile in workspace to download, if i didn't edit anything but i add this on my workspace it's already corrupted or non ? someone can share the working json here ?

Thanks a lot for your investigations !

matinzd commented 7 months ago

The working animation is in the PR I shared in your repo. Please check out there and try running the app.

rsereir commented 7 months ago

@matinzd Wow, i just try with the json given in PR of my fork and it's working correctly, juste to be understand how you download the public lottie: you add lottiefile to your workspace and download from workspace ? or you use other method to download it

This issue is also on files edited by author directly on lottiefiles.com and posted publicly in marketplace ?

rsereir commented 7 months ago

Thank you for your investigation, it still shows that it works correctly if you download without going through the editor, that's good news

pariah140 commented 5 months ago

Thank you for your investigation, it still shows that it works correctly if you download without going through the editor, that's good news

@rsereir - what do you mean by download without going through the editor? I can't see another way to download it.

rsereir commented 5 months ago

@pariah140 you have to "share" the lottie, and a public json url is generated by lottiefiles website. You have to go on the json file in your browser and copy content ( or download file directly from this page )

Don't use the standard " Download " button or add to workspace button

pariah140 commented 5 months ago

amazing thanks so much @rsereir for such a fast reply! I will try it now.

pariah140 commented 5 months ago

@pariah140 you have to "share" the lottie, and a public json url is generated by lottiefiles website. You have to go on the json file in your browser and copy content ( or download file directly from this page )

Don't use the standard " Download " button or add to workspace button

@rsereir sorry to ask again. Once you are on the share page where are you downloading it from? I've looked in the network tab but all I see is a loader.json (which I presume is the lottie loading spinner).

jrlmontejo commented 5 months ago

I found that merely changing the color palette of the lottie file in the website editor will cause it to break. If you don't make any changes in the editor and download the lottie file directly, there won't be any issues.

pariah140 commented 5 months ago

I found that merely changing the color palette of the lottie file in the website editor will cause it to break. If you don't make any changes in the editor and download the lottie file directly, there won't be any issues.

Yeah that works for me! Thanks a lot!

dlwogus0128 commented 5 months ago

I found that merely changing the color palette of the lottie file in the website editor will cause it to break. If you don't make any changes in the editor and download the lottie file directly, there won't be any issues.

Thanks. That works for me too 😄

Ruslan-BG commented 4 months ago

@jrlmontejo can you tell me how you got it json

matinzd commented 4 months ago

@jrlmontejo Please report this issue to lottie team. Seems like there is a bug in their editor causing the animation to break.

calda commented 4 months ago

I figured out the underlying issue -- this animation's bezier paths are expressed differently than other animations. The inTangent and outTangent values are normally relative to each individual path vertex, but in this case the tangent points are absolute points in the same coordinate spaces as the vectors themselves. If I correct for this in the bezier path parsing code, the animation renders as expected:

Screenshot 2024-06-03 at 10 10 25 AM

However, I don't currently know how to detect this automatically.

kudanai commented 4 months ago

Cross posting response to similar issue on Android here: https://github.com/airbnb/lottie-android/issues/2508#issuecomment-2154252323

Can I quickly confirm two things:

If exporting from AfterEffects (bodymovin?) works as expected? If the broken Lottie came through the LottieFiles pipeline (editor/workflow etc)? Looking demo attached, I can see a bunch of "_render": True keys appearing in the Lottie, which is indicative of an incorrect export. This seems to have been a regression on LottieFiles for a minute there.

We've deployed a patch across the platform as well, so do give it another go now and see if the problem still persists.

calda commented 4 months ago

We believe this was an issue with the lottiefiles.com exporter, and not an issue with the iOS and Android renderer implementations.

rsereir commented 3 months ago

Personally i solved this issue by downloading directly the lottie file from the "official" json without lottie file editor ( i bypass completely the download button )

himanshu1721 commented 1 month ago

Personally i solved this issue by downloading directly the lottie file from the "official" json without lottie file editor ( i bypass completely the download button )

Hey how do you do that. I am having a hard time figuring this out.