Jump to content
Search Community

Recommended Posts

joris-rotteveel
Posted

Hi,

 

I just bought a subscription to GSAP in order to use the InertiaPlugin. Unfortunately I am running into issues with the track function

 

var tracker = InertiaPlugin.track(slider, 'x');
const vel = tracker.getVelocity('x');

The function track seems to be returning an Array and not a VelocityTracker object? I've created a codepen that demonstrates what I mean.

Can someone point out what the correct  way is to grab the velocity using the InertiaPlugin please?

See the Pen YzPbJxw?editors=1111 by joris-rotteveel (@joris-rotteveel) on CodePen.

Posted

It now returns an array of trackers. Check out the first item in the array.

  • Like 2
Posted

The format will be like this.

 

var vx = tracker.get("x");

 

  • Like 2
Posted

Thanks for pointing that out, @joris-rotteveel. I just updated that function in the docs. Sorry about any confusion there. 

 

The reason it returns an Array is because you could pass selector text as the "target" that results in multiple targets, like:

var trackers = InertiaPlugin.track(".class", "x,y"); // returns an array with one VelocityTracker per .class element.

console.log(trackers.length); // however many ".class" elements there are. 

Happy tweening!

  • Like 1
joris-rotteveel
Posted

For anyone who is still in doubt wether or not they should get a subscription, this issue was reported and solved within the hour! Great service and very knowledgeable people on the forum. 

 

Thanks for the explanation and help guys. 

 

  • Like 1
  • Thanks 2

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