Jump to content
Search Community

Updating Draggable examples to GSAP3

Richard1604 test
Moderator Tag

Recommended Posts

Hello, 

i have been experimenting with the Draggable demos and I would like to upgrade them to the current version of green sock.

In particular  is of interest with its Responsive, Draggable, Scrollable AutoSlider.

It works fine when I use the gsap2 libraries and I am familiar with simple upgrades of Tweens and Timelines but in this case I get an error function updateProgress:

 

function updateProgress() {
  animation.progress(transform.x / wrapWidth);

}

 

Uncaught TypeError: Cannot read property 'x' of undefined
    at updateProgress (gsdraggable2.js:65)

 

I would really appreciate some general guidance on the process required to convert the old style demos to the current version.

Thanks.

 

 

 

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

Link to comment
Share on other sites

Sure, here's a ported version:

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

 

That old demo was using the _gsTransform object that was attached to elements to store their transform-related values, but that was removed in v3 in favor of a much more powerful and consistent gsap.getProperty() method. So you can do gsap.getProperty(proxy, "x") in this case. 

 

Happy tweening!

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