Jump to content
Search Community

mousemove event on "A" <div> connect to draggable type:rotation of "B" img

Ali Farooq test
Moderator Tag

Recommended Posts

i can rotate my image using draggable, but now as i only move my mouse up and down in specific area , i want same rotation to happen as it happens on dragable plugin type : rotation. 
I want this to happen because of its "snap" and "inertia" functionality.
sharing simplistic code to show what i am trying to do.

See the Pen vYKbXqX?editors=0110 by irfansaeedkhan (@irfansaeedkhan) on CodePen

Link to comment
Share on other sites

14 hours ago, Ali Farooq said:

i am unable to snap it where i want it

The easiest way to snap it would be to make use of GSAP's snapping functionality.

 

14 hours ago, Ali Farooq said:

there is no innertia applied in my approach

The easiest way to add it would be to use GSAP's inertia functionality. Or create a tween that does something similar. Either way you probably need to create some way of tracking the mouse movement's velocity.

 

In regards to the snapping and the inertia you'll have to write some custom functionality. Draggable was not created to allow vertical mouse movement to rotate an object by default, so you'll have to build that part yourself.

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