Jump to content
GreenSock

marcmorales.ca

IE Support for attr{x: val}

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, I'm fairly new to this SVG animation and getting by mostly by copying someones work and modifying it. (Still learning alot).

For that codepen link that I've provided - it works smoothly in almost all browsers except IE and IE Edge.

 

Its basically moving the pattern from SVG horizontally and repeating it. It seems like IE cannot recognize attr:{x} for some reason.

 

advance thanks!

See the Pen gLEGmJ by marcmorales345 (@marcmorales345) on CodePen

Link to comment
Share on other sites

Thank you Dipscom!

 

So for some reason, IE and Edge ignore pattern's viewbox (as per your examples). However, whatever I animate inside <pattern> works.

Off to the experiment lab! (aka - change every code until it works)

Link to comment
Share on other sites

Hey Marc,

 

I haven't been at my office much these days, it's where my test machines are. I'm a tad curious about this attr:{x:val} thing in Edge and IE, will be having a look when I have a chance. Let us know if you come up with something before that.

Link to comment
Share on other sites

@Dipscom

 

Sure thing, based on what I've done so far - you can see that the <pattern> attr changes in IE and Edge via dev tools but for some reason - it doesn't reflect to its graphic. All other known browsers doesnt seem to have this problem (haven't tried it in Safari).

 

SVG doc itself is being injected to its parent element via Ajax...so it's techincally inline. (Tried hardcoding SVG to HTML and still the same issue). - Just an added info if needed.

Link to comment
Share on other sites

Maybe You have to transform the translateX. attr animation won't work in a few cases in every browser. At least not working with clip-path, mask and possibly in this case.

Link to comment
Share on other sites

You're going to see the attribute change even if it's not valid. What's important to understand about attributes is that they initialize a value on an element if they are valid.

<circle id="myCircle" r="5" />

console.log(myCircle.r.baseVal.value); // => 5

You can even animate it using that method. Funny thing with IE/Edge though, it doesn't work without the circle animation.

See the Pen zogjqj?editors=0010 by osublake (@osublake) on CodePen

 

If all you're trying to do is that loader animation, just use the ModifiersPlugin...

See the Pen QEdpLe by GreenSock (@GreenSock) on CodePen

  • Like 3
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.
×