Rotate on mouseover

Animate a rotational card movement based on the position of your mouse as it hovers over an element.

This video features an old UI. Updated version coming soon!
 
This video features an old UI. Updated version coming soon!

Set up a rotation based on mouse position. 

In this lesson: 

  1. Set perspective
  2. Set up the trigger
  3. Animate the rotation
  4. Configure the resting state
  5. Create a specular highlight

Set perspective

  1. Make sure a parent element of the child element you’ll be animating is selected
  2. In the Style panel under Transitions & transforms, change the Children perspective to 1000 pixels

Set up the trigger

  1. Select the element you’d like to act as the trigger (e.g., Card)
  2. In the Interactions panel, click the plus sign next to On Selected Element and choose Mouse move over element from the dropdown menu

Animate the rotation

  1. Click Interactions panel > On mouse move > Action > Play mouse animation
  2. Click the plus sign next to Mouse animations
  3. Name it (e.g., Rotate on Mouseover)
  4. Click the plus sign under Mouse X actions timeline at 0% and choose Rotate
  5. Under Rotate, change the y-axis to -5 degrees
  6. Click the Card element at 100% and under Rotate change its y-axis to 5 degrees
  7. Under Mouse Y actions, add a Rotate action
  8. At 0% under Rotate, change the x-axis to 5 degrees
  9. At 100% under Rotate, change the x-axis to -5 degrees
  10. Close out of the animation to adjust Smoothing

Configure the resting state

  1. In the Interactions panel under On mouse move, set the Mouse X position to 50%
  2. Set the Mouse Y position to 50%

Create a specular highlight

  1. Drag a new Div block onto the canvas inside the element you’re working with (Card)
  2. Create a Class and name it (e.g., Card-highlight)
  3. Set its width and height (e.g., to 400 pixels)
  4. Set the Position to absolute 
  5. Position it from the top left
  6. Set your Background color (e.g., white)
  7. Under Border, change the Radius to 50%
  8. Under Effects, change the Opacity to 10%
  9. Add a Blur filter and change the Radius to 50 pixels
  10. In the Interactions panel, click Rotate on mouseover
  11. In the Mouse X timeline at 0% add a Move animation and change its x-axis to 100%
  12. In the Mouse X timeline at 100%, add a Move animation and change its x-axis to -50%
  13. In the Mouse Y timeline at 0%, add a Move animation and change its y-axis to 50%
  14. In the Mouse Y timeline at 100%, add a Move animation and change its y-axis to -50%


Check your work in preview mode.


Clone this project
Try Webflow — it's free

Production for this lesson

Directed by

-

Produced by

-

Written by

-

Article by

-

Edited by

-

Designs by

-

Need more help? Want to report a bug? Contact support
Have feedback on the feature? Submit feature feedback