DEV Community

Cover image for πŸ“‹βœοΈ Hand-drawn border animation using clip-path and border-radius
Pascal Thormeier
Pascal Thormeier

Posted on

5 2

πŸ“‹βœοΈ Hand-drawn border animation using clip-path and border-radius

For the same side project I created the fully-responsive sticky note, I also created a hand-drawn border effect and animation:

The skewing of the border is achieved by using border-radius: With the / notation, I can make the border look like it was drawn by the stroke of a pen.

The animation was a lot of effort. Using clip-path, I had to create five different polygons (one for each line and one for the content) and combine them, so only the borders are cut out. Using calc() and min() I can work precisely around the content and guarantee that no bit of the border is left out, even with larger elements.

(The auto-animation in the CodePen is achieved by using setInterval and toggling two classes that do the animation forward and in reverse.)

For good measure, here's my post about the sticky note:

That's it, have a nice evening!

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay