Jump to content
Search Community

Workarounds for animation for IE or Edge

Karma Blackshaw test
Moderator Tag

Recommended Posts

Hey @Karma Blackshaw. When I built DrawSVGPlugin I put a lot of effort into working around various browser bugs and inconsistencies. There are quite a few and I don't even remember them all. Firefox, Safari, and Microsoft browsers all had bugs/quirks when animating strokeDashoffset. One of my goals with GSAP is to deliver tools that work really well across browsers so you don't have to worry about that stuff. 

 

This probably won't solve your browser issues but you can definitely simplify your code into a single tween like this: 

gsap.fromTo("#solution", {
  attr: { pathLength: 1 },
  strokeDasharray: 1, 
  strokeDashoffset: 1
}, {
  duration: 15, 
  strokeDashoffset: 0,
  autoRound: false // otherwise, px-based values (which strokeDashoffset defaults to) are rounded to the closest whole pixel.
});

Notice I'm using regular CSS, camelCased values for strokeDasharray and strokeDashoffset because those are valid CSS. I don't think pathLength is, though, so that's an attribute.

 

Anyway, I wish you luck with the project! Hopefully you'll be able to join Club GreenSock soon and just use DrawSVGPlugin for stuff like this. My guess is that it'll pay for itself within one project when you factor in all the time you may spend wrestling with browser issues. :) But I totally get it - sometimes the budget just doesn't allow for something no matter how much you'd like it. No worries!

  • Like 2
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...