pilicorp Posted October 22, 2020 Share Posted October 22, 2020 Hi there! I've spent a few days trying to find out how to delay a motion based on mouse movement. In my example (which is a POC with dirty hacks, please don't mind them), there is my failed attempt to do it, but I only succeed in resetting the object back to its position. What I'm trying to achieve is the "added" motion, including the easing effect. If anyone is able to pinpoint what I'm missing (probably something obvious), I would be very grateful. See the Pen ExyNJdG by anaelbe (@anaelbe) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted October 22, 2020 Share Posted October 22, 2020 Hey pilicorp and welcome to the GreenSock forums. Can you please try to be a little more clear about your goal? Do you have an example of the effect that you're trying to create? Link to comment Share on other sites More sharing options...
pilicorp Posted October 22, 2020 Author Share Posted October 22, 2020 Hello ZachSaucier, and thank you! Here is more or less what I have in mind, the hover effect on picture + caption, minus the css transition hack they use : https://designobjekt.se/ Link to comment Share on other sites More sharing options...
ZachSaucier Posted October 22, 2020 Share Posted October 22, 2020 To create that sort of effect you should Set a variable (or variables) to determine the max distance the object (to be moved) can go. Set a variable (or variables) to determine the max distance away from the center of the measurement object the mouse should be tracked. Measure the distance from the current mouse position to the center of the measurement object. Get the percent of the distance measured in 3. compared to the variable(s) set in 2. Multiply the distance from 1. by the percent obtained in 4. and apply that to the object(s) to be moved. Make sense? Link to comment Share on other sites More sharing options...
pilicorp Posted October 22, 2020 Author Share Posted October 22, 2020 It does, i'll try to implement it to see if I'm getting near. Updated codepen, seems pretty neat! Thank you very much for your advice 🙇♂️ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now