Jump to content
Search Community

Poor performance on mobile safari (both iPad and iPhone) when animating SVG path's stroke-dashoffset.

Vincent Riemer test
Moderator Tag

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

Hello there,

 

So I've been working on an outline drawing animation using gsap and svg that involves animating the stroke-dashoffset of <path>'s and the width of <rect>'s.

 

This runs great on my desktop and laptop but when it comes to mobile performance it really starts to chug. I've also noticed that if I remove the paths from the animation the performance skyrockets but when I remove the rects (and even reduce the number of paths to the number of rects there are) the performance is still not great.

 

A last thing that I noticed is that the animation's performance seemed to get get worse over time on my mobile devices (iphone 5 and ipad 3rd generation) which to me feels like a memory leak of some sort.

 

Here's a codepen of the animation: 

See the Pen obcAm by vincentriemer (@vincentriemer) on CodePen

 

Do you guys have any suggestions on improving this animation's performance? If not I'll probably just disable the animation for mobile devices.

 

Thanks,

 

-Vincent

 

EDIT: Sorry it seems like I posted this in the AS forum instead of the JS one, is there any way to delete/move this post to the JS forum?

Link to comment
Share on other sites

This doesn't seem to have anything to do with GSAP specifically - I suspect it's just that drawing paths is a pretty CPU-intensive thing, and mobile devices have weak processors, hence the degraded performance. I didn't notice any particular mistakes/problems in your code, although setting force3D on an element's style object is useless. 

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.
×
×
  • Create New...