Jump to content
GreenSock

elegantseagulls

iOS and DrawSVG performance on sized SVG vs sized container

Moderator Tag
Go to solution Solved by Carl,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi GSAP Friends, 

 

Question/Observation/Bug:

 

Working on a DrawSVG animation and was having some huge performance issues on iOS mobile. It turns out that adding a size directly to the SVG element was causing the issue (adding a size to a div wrapper helped eliminate the issue). 

 

Size on SVG pen (awful on iOS):

 

Size on div wrapper pen (much better on iOS):

See the Pen mErPEK by ryan_labar (@ryan_labar) on CodePen

 

Any reason for this issue (am I doing something wrong)? Not needing to wrap an SVG in a div would really be idea.  Is it a GSAP bug, or the fault of the browser (or both)?

 

Thanks!

 

**UPDATE** even with the div wrapper, performance isn't great on mobile, what should I do? From my understanding, resizing my SVG's viewbox/internals may help, but IDK if that will eliminate the problem, it's not exactly a huge svg file--size or otherwise 

See the Pen wWqGZk by ryan_labar (@ryan_labar) on CodePen

Link to comment
Share on other sites

  • Solution

Hi,

 

Thanks for the demos. I believe this is all just a rendering bottle-neck on iOS due to the filters you are using. 

Here is a version without the filters and it runs great.

 

http://s.codepen.io/GreenSock/debug/OXjXzN

 

DrawSVG is extremely optimized for performance. Ultimately all it is doing is changing numbers over time, it doesn't handle any of the rendering. It seems iOS is definitely struggling with the SVG filters. 

  • Like 1
Link to comment
Share on other sites

Thanks as always, Carl!

 

I suppose I should have checked that, but never guessed that would have caused it as it seemed like a small filter! I think I'll end up only adding the filters for the desktop experience. 

 

Have a great day!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×