A loose pen circle draws itself around one word in a sentence and overshoots where it started, like a real hand. One SVG path with pathLength="1", so the dash math is a single number.
Also known as: circle around word animation, rough notation circle, scribble circle text.
<div class="txt-hand-drawn-circle-text">Save <span class="txt-hand-drawn-circle-text-word">50%<svg viewBox="0 0 120 60" aria-hidden="true"><path pathLength="1" d="M22 13 C45 3, 95 2, 112 18 C124 33, 106 53, 68 56 C34 59, 5 50, 7 33 C9 17, 34 7, 62 6" /></svg></span> today</div>
.txt-hand-drawn-circle-text {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
white-space: nowrap;}
.txt-hand-drawn-circle-text-word {
position: relative;
display: inline-block;
margin: 0 0.4em;
color: var(--c);
}
.txt-hand-drawn-circle-text-word svg {
position: absolute;
left: 50%;
top: 50%;
width: 3.2em;
height: 1.6em;
overflow: visible;
transform: translate(-50%, -50%) rotate(-3deg);
fill: none;
stroke: var(--c);
stroke-width: 3.2;
stroke-linecap: round;
/* the gap is a hair longer than the path, so no round cap shows before the draw */
stroke-dasharray: 1 1.1;
stroke-dashoffset: 1.05;
animation: txt-hand-drawn-circle-text-draw 0.9s cubic-bezier(0.55, 0, 0.35, 1) 0.3s forwards;
}
@keyframes txt-hand-drawn-circle-text-draw {
to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
.txt-hand-drawn-circle-text, .txt-hand-drawn-circle-text *, .txt-hand-drawn-circle-text::before, .txt-hand-drawn-circle-text::after, .txt-hand-drawn-circle-text *::before, .txt-hand-drawn-circle-text *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--txt-color on the element or a parent.
Currently previewing #3b82f6.--txt-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 40px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.