Open malaykeshav opened 4 years ago
Hi, it's not on the pipeline for now. I think it would be doable using a buffer canvas and globalCompositeOperation, but it is probably not worth to implement because it would have a big performance impact as well as increase the library file size. Any reason why you don't use the svg renderer instead?
Canvas player can be run on a worker thread with the help of an offscreencanvas thus allowing for a better performance on the main ui thread.
I am curious to know how the SVG renderer achieves the matte support? I would assume that the chrome API used by SVG, would be the same as the web canvas API; they are backed by the same SkCanvas internally in chrome.
it's probably leveraging lower level apis abstracted away as Mask svg elements
Thanks. I will take a look into that and maybe see if something similar can be leveraged.
In the meantime, the list of canvas supported features says that the alpha inverted matte is supported. But when creating a simple animation, the results are incorrect. Is this a bug?
Sample animation: https://codepen.io/malaykeshavchromium/project/editor/AKmWQq#
Expected: https://skottie.skia.org/985f2566d7dd6921aec108a343e50089?h=1080&w=1920
Yes, it's a bug. Canvas doesn't support any kind of track masks
@malaykeshav Can you share about this offscreencanvas?
@ape-casear You can build the lottie player for use in a worker thread. I am using it here: https://source.chromium.org/chromium/chromium/src/+/master:third_party/lottie/ However, that is version v5.5.2
If you want to use a newer version, you would have to use https://github.com/airbnb/lottie-web/blob/master/build/player/lottie_canvas_worker.js But since I haven't worked with the updated version, I don't know if it would work. It may have some minor bugs. You can give it a try.
any update on this issue?
@malaykeshav if I understand correctly, it was released recently
https://github.com/airbnb/lottie-web/pull/2917 https://jsfiddle.net/8zh4d6pr/3/
Looking at the supported features list for the canvas player, the matte support is very limited. What is the future of this feature for the canvas player? Is this something that has a roadmap to be developed in the future? Or is this simply not possible to be implemented on the canvas player?