flutter_svg icon indicating copy to clipboard operation
flutter_svg copied to clipboard

Performance to render many SVG in an animation

Open tbarbette opened this issue 3 years ago • 5 comments

Hi all,

I have an animation with basically many leaves falling of a tree and staying on the ground (in a 2D animation). Each leaf is an instance of one of 14 leaves, which are DrawableRoot read using this package. Now, with the leaves staying on the ground it gets slower and slower. And as leaves keep falling, I must render the picture many times per second.

Would it be more performant to convert the DrawableRoot to a ui.Image, Picture, a Bitmap? And then use those instead of the DrawableRoot? Or another solution?

Thanks, Tom

tbarbette avatar Mar 10 '21 15:03 tbarbette

I got the same problem. FPS on list with too much svg that allways under 15fps eventhough I cached image

phuongtinhbien avatar Apr 22 '21 08:04 phuongtinhbien

I reverted to using pre-loaded PNGs... It's much more efficient.

tbarbette avatar Apr 22 '21 09:04 tbarbette

It really depends on the complexity of what you're drawing - sometimes using a rasterized version is more efficient, especially if there's a lot of complicated graphics ops in the drawing :\

dnfield avatar Apr 22 '21 16:04 dnfield

I apologize to dust up this old issue. I have complex set of SVG files that take bit of time (3-4 seconds) to render. Once the svg files are loaded into memory (on drawn in canvas), the subsequent rendering is quick in other screens. Is there a way to preload the svg assets? I can show a loading screen upfront to the user when loading the svg files.

somavoyager avatar Jul 19 '21 00:07 somavoyager

Rasterize it to an image.

dnfield avatar Jul 19 '21 04:07 dnfield