Jump to content
Search Community

Move mouse + Rotational inertia feeling

jonForum 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

Hi, am trying to tween little bit physic inertia when the mouse move.

I don't know if is the good word in english. "inertness" ?

My target it when mouse are move, the sprite follow the mouse with inertia on rotation values.
But when mouse stop, call a elastic tween to give a physic feeling.
The result are not optimal here , and maybe no very performance friendly.
If any tweener or math pro can help me on this ?

A made a codePen


if you try Move mouse and stop it very fast , you will see the feeling am targeting.
It not work all time this is also weird, maybe bad code or math logics here.
Am no a pro in physic sorry. :)

thanks a lot for any help guys




See the Pen EJzBzV by djmisterjon (@djmisterjon) on CodePen

Link to comment
Share on other sites

Thank you both.
I took the time to study the demo 2, unfortunately they seem based on inertia with the x and y position.
They are very impressive! but on my side, I can not use this logic of interpolation to reach my idea, I have to tween with this with the rotation, the radian and the pivot.
As you can see, no position is used in the code code.


My issue, in the codePen is this.
When mouse stop move, it tween inertia the radian, but it not work fine.
I may have a bad logic or approach...


i really need when stop move the cursor, the item pinned give a more feeling of elastic .



here the pen link

it should work ?


i hope the gif can help to understand my issue :)
I explain myself bad in english

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