Jump to content
Search Community

How to make Draggable slightly delayed behind mouse

Johnny test
Moderator Tag

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



I'm loving the new draggable component - works great. I have a full-bleed infinite wall that is draggable with no bounds. I see that dragResistance effects how much the content will move in respect to your mouse movement, and by setting it to zero the content will move the content the same distance as your mouse delta. This is as expected, but what I'm looking for is how to keep it the draggable content move a distance 1:1 (dragResistance:0), but have the content follow the mouse slightly behind to give it a slightly softer responsiveness. How can this be achieved?

Link to comment
Share on other sites

Here's an idea for you: use a proxy object of sorts, like a <div> that has an opacity of 0 and is the same size as your "real" object, but it sits in front of it. You make the proxy draggable (instead of your "real" object), and use an "onDrag" callback to tween the real object to wherever the proxy is. The longer the duration of the tween, the more "soft" the responsiveness. 


Kinda like:

Draggable.create(yourProxy, {
    onDrag:function(e) {
        TweenLite.to(yourRealObject, 1, {x:this.x, y:this.y});
  • Like 4
Link to comment
Share on other sites

  • 2 months later...

I use this method all the time - I kind of stole it from this idea/behaviour from After Effects' Null object. It's very flexible in that you can assign any object to the position/rotation/scale of the proxy (or null object) and thus create some great parallax/delayed effects.


I tend to give the null object no height or width and add in the trigger property. I also tend not to refer to 'this' in the function in case I want to call doDrag from a manual tween on nullObject using onUpdate:

var nullObject = document.createElement('div');

Draggable.create(nullObject, {



function doDrag (e){
 var posX = nullObject._gsTransform.x;
 var posY = nullObject._gsTransform.y;

 TweenLite.to(realObject1, 1, {

 TweenLite.to(realObject2, 1, {


 }); //...etc 
I've added in throwProps so you can see how that works too
  • Like 2
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...