Jump to content
Search Community

Problem with Intertia resistance

Olilou

Go to solution Solved by GreenSock,

Recommended Posts

Posted

Hi there,

 

I use Draggable + InertiaPlugin and everything works as expected with inertia: true.
But when I set inertia: {resistance:200, duration: {min: 0.2, max: 0.8}}the inertia behavior doesn't seem to work : the dragged image stops right after I release it.

Anyone can help me to get why please ? :) 

See the Pen 019fb311-8bc7-7253-80c3-fc835dcf4cd4 by infoliv (@infoliv) on CodePen.

  • Solution
GreenSock
Posted

That's because if you pass in a custom inertia value, it leaves everything to you but you didn't define any value for "x" or "y" so there won't be any inertia applied to those. I think it'd be much cleaner for you to let Draggable handle those, and just set inertia to true and then set a throwResistance, minDuration, and maxDuration: 

Draggable.create(images, {
  type: "left,top",
  bounds: container,
  inertia: true,
  throwResistance: 200,
  minDuration: 0.2,
  maxDuration: 0.8,
  edgeResistance: 0.65,
});

Does that work the way you wanted? 

  • Like 2
Posted

Thank you so much!

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