Closed blaxbla123 closed 4 years ago
have you tried not passing the wrapper?
When wrapper or container isn't passed, after finding it out from #1215, lottie successfully uses the canvas context, but ignores:
- the canvas size - just renders out the full composition size from after effects, cropping it on the canvas:
- preserveAspectRatio - scaling the canvas down manually reveals that it all starts to render at (0, 0)
That comment was lighting fast tho, thanks for that xd
If you are providing the canvas, the player assumes you'll apply the appropriate transformations to the canvas element before delegating the render to the library. That way you can compose your pieces of the canvas drawing with the animation itself.
Tell us about your environment
What did you do? Please explain the steps you took before you encountered the problem.
I wanted to use only one canvas to render an animation as the compositing time in chrome with multiple canvases took too much resources. (I'm trying to do animation that fills the browser window) Here's the jist of the code I used:
*After reading through the source code, I saw it was looking for the
wrapper
property instead of thecontainer
property when deciding if it wants to create acanvas
tag (atCanvasRenderer.configAnimation
), unfortunately switching to that didn't work either.What did you expect to happen?
Lottie would use the canvas context provided and do its magic there.
What actually happened? Please include as much relevant detail as possible.
When
wrapper
orcontainer
is passed, lottie creates a new canvas element for every time i execute 'loadAnimation'. It then proceeds to use the context of the newly created elements instead.When
wrapper
orcontainer
isn't passed, after finding it out from #1215, lottie successfully uses the canvas context, but ignores:preserveAspectRatio
- scaling the canvas down manually reveals that it all starts to render at (0, 0)Please provide a download link to the After Effects file that demonstrates the problem.
https://drive.google.com/drive/folders/1QN2TncgGWrATUA_h_L8ySYIk3vDZD9if?usp=sharing
(There are some things wrong in the project from performance troubleshooting but it should be sorta working)