Jump to content
Search Community

Animating Clip Path Polygon

JPM82 test
Moderator Tag

Recommended Posts

Sorry about any confusion there - it looks like a regression since 3.6.0 that'd cause only CSS variables that are complex values (more than one number) to neglect animating the others beyond the first value, but that has already been fixed in the next release which you can preview at https://assets.codepen.io/16327/gsap-latest-beta.min.js

 

In the meantime, you can either use that beta file or I whipped together this cssVars plugin that'll work around it for you: 

gsap.registerPlugin({
  name: "cssVars",
  init(target, vars) {
    this.t = {};
    this.target = target;
    for (let p in vars) {
      this.t[p] = gsap.getProperty(target, p);
      this.add(this.t, p, this.t[p], vars[p]);
    }
  },
  render(ratio, data) {
    let pt = data._pt;
		while (pt) {
			pt.r(ratio, pt.d);
      data.target.style.setProperty(pt.p, data.t[pt.p]);
			pt = pt._next;
		}
  }
});

See the Pen RwjYqaZ?editors=0010 by GreenSock (@GreenSock) on CodePen

  • Like 5
Link to comment
Share on other sites

  • 1 month later...

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