Jump to content
GreenSock

zachschnackel

Combining the Attr and Bezier plugins for SVG clip path animations

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 all,

Referencing http://greensock.com/forums/topic/12272-animating-svg-masks-clip-path-not-working-in-firefox/ it appears that using the Attr plugin when animating SVG clip masks resolves a long-standing issue with Firefox not being able to target these properties correctly. My issue however is that I am animating elements that are within an SVG clip mask, not solely by the attributes plugin, but with the Bezier plugin. Is there a way to combine these two plugins to correct this behavior in Firefox? Thanks!

Link to comment
Share on other sites

Hi zachschnackel :)

 

you can simply use onUpdate callback with a tween of simple object , like this :

 

var XY = {x:0,y:0};

TweenLite.to(XY,1,{bezier:{values:[...]},onUpdate:function(){
  console.log(XY.x)
  yourElem.setAttribute( "attribute" , XY.x );
}})
  • Like 2
Link to comment
Share on other sites

Hi @Diaco,

Thanks for the reply! It appears you might be talking about grabbing the updated `cx` or `cy` attribute from the element, but it is being changed via the transform property. If I do something like:

      onUpdate: function() {
        this.target[0].attributes.style.cssText = this.target[0].attributes.style.nodeValue;
      },

Then I can see the style node being updated just fine, but the attribute itself never moves.

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.
×