airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
34.96k stars 5.4k forks source link

Add support for layer blend mode "bm" for NORMAL, SCREEN, OVERLAY, DARKEN, LIGHTEN, and ADD #2408

Closed kudanai closed 10 months ago

kudanai commented 10 months ago

Adds support for "bm" (BlendMode) on layers. Possibly addresses #1055 Might need a little bit of a refactor. Relies on Paint.setBlendMode() available in android Q and up.

Sample before & after

IMAGE 2023-10-30 12:28:18 Screenshot 2023-10-30 at 12 27 39

github-actions[bot] commented 10 months ago

Snapshot Tests API 23: Report Diff API 31: Report Diff

kudanai commented 10 months ago

Thank you for the feedback.

I understand what you mean by the version check. I could suggest rolling back a little and only supporting the blend modes that have lower minsdk requirements, and continue working on it from there. Does that seem like a more prudent approach?

Also I wasn't entirely sure about the structure of that enum, it feels overly verbose to me. However since bm can also appear for shapes, figured it might be useful to leave the enum itself in place.

Done! Meanwhile, I will collect some sample lotties with specific blend modes and drop them in the directory.

github-actions[bot] commented 10 months ago

Snapshot Tests API 23: Report Diff API 31: Report Diff

kudanai commented 10 months ago

Pushing new changes:

github-actions[bot] commented 10 months ago

Snapshot Tests API 23: Report Diff API 31: Report Diff

kudanai commented 10 months ago

The supported modes look consistent to me on 23 and 31 now

github-actions[bot] commented 10 months ago

Snapshot Tests API 23: Report Diff API 31: Report Diff