Jump to content
Search Community

Rotated Div width animation

ifahrentholz test
Moderator Tag

Recommended Posts

Hi,
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 😅

x-animation.gif

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

Link to comment
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
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...