Or, if you prefer, you could use clip-path instead. I’ve created a couple of fun little animations that play around with these properties – we’ll walk through some of the techniques involved in this article. It then animates into the shape of the first number. Let's understand the subtle details together. HTML / CSS (SCSS) About a code Neon Lights. Animating Clip-Path: Simple Shapes by Travis Almand (@talmand) Let’s break those out just like we did before. business, with a local development tool to match. Just for a quick explanation as to what the clip-path is and what it provides, MDN describes it like this: The clip-path CSS property creates a clipping region that sets what part of an element should be shown. So let’s begin. a decision I'm very happy with. The effect is a shrinking square that shifts to a shrinking circle wiping away the first element. clip-path comes with four shapes out of the box, plus the ability to use a URL to provide a source to some other SVG element. This comment thread is closed. Consider converting ID names to class names if you anticipate styling more than one path in the same way (IDs can only be used once). Bad: Use the CSS clip or clip-path properties. The path has ten circles placed strategically inside the area of the element. Understanding the subtle details of how this animation works at a high level is crucial before we actually go about creating it. Great demo. Each of the paths in the demo were actually taken from SVG I made by hand for each keyframe of the animations. The element you see at the start of the transition makes use of the “leave” animation to disappear while the second element uses the “enter” transition to appear. clip-path with CSS animation by Geoff Graham (@geoffgraham) That's a good thing! The leave transition starts with the square and then moves each vertex on a side to the opposite side. At first, these curves are made to be completely flat and then are animated downward to stop beyond the bottom of the shape. This demo shows various ways to have movement in a clip-path animation. See the Pen On the leave transition, the shape’s corners animate inwards to the center while the side’s midpoints animate inward halfway to the center. The top half-circle moves upward leaving a hole behind and the bottom half-circle does the same. Like the shapes and simple movements examples, I’ve made a demo that contains more complex animations. Each following keyframe animates the position values of the circle to move it to different points on the element until it moves out of view to the left. Therefore, the top vertex goes to the bottom, the bottom vertex goes to the top, and the vertices on the left and right do the same swap. The second, which is the enter animation, has the bottom value at 100% and then animates it down towards 0% providing the appearance of the entire square sliding downward into view. See the Pen The following keyframes do the same until the square is collapsed down to the center of the element. Coyier and a team of swell people. These four new paths actually draw something close to a circle! Updated on January 11, 2020 Published on January 11, 2017. The path for the above animation looks like this:And the code, something like this: