Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Rotated Div width animation

Recommended Posts

I want to make an animation with two lines.
Basically the two lines should increase their width and form an "X". My problem is the rotation AND the fact that the animation should NOT start in the center of each line but on the "top-left" and "top-right" of the corresponding lines.
When I rotate the lines and then perform the width animation strange things happen. I tried to get things work correct by using the "transform-origin" and "transform: translate()" properties but without success. I've attached an GIF with the X animation I want to achieve. 
Maybe someone can enlighten me since I'm at the very beginning of my animation career 😅


See the Pen XWbPgQz?editors=1100 by ifahrentholz (@ifahrentholz) on CodePen

Share this post

Link to post
Share on other sites

Hi and welcome to the forum.


I'm not sure what you've tried because your demo doesn't have any animation in it. ;) You could make this work with some divs, but IMHO it would be easier with a SVG. Animating line attributes, using GSAP's svgOrigin and simpler masks and clip-paths for the text reveal would lead me to something like this. 


See the Pen MWwqrjO by PointC (@PointC) on CodePen


Hopefully that gets you started. Happy tweening.



  • Like 5

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.