Pencil-hatched letters with two loose outlines that never sit still, the 'line boil' of hand-drawn animation. Three stacked copies jump between poses with steps(1), so nothing tweens.
Also known as: hand drawn text effect css, line boil animation, pencil sketch text.
<div class="txt-sketchy-outline-text"><span>Sketchy</span><span aria-hidden="true">Sketchy</span><span aria-hidden="true">Sketchy</span></div>
.txt-sketchy-outline-text {
--c: var(--txt-color, #3b82f6);
font-size: calc(var(--txt-size, 32px) * 1.7);
font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
font-weight: 800;
line-height: 1.2;
display: inline-grid;}
.txt-sketchy-outline-text > span {
grid-area: 1 / 1;
color: transparent;
-webkit-text-stroke: 0.022em var(--c);
animation: txt-sketchy-outline-text-a 0.45s steps(1) infinite;
}
/* the hatching: diagonal pencil lines clipped to the letters */
.txt-sketchy-outline-text > span:nth-child(1) {
background: repeating-linear-gradient(-55deg, color-mix(in srgb, var(--c) 55%, transparent) 0 0.02em, transparent 0.02em 0.09em);
-webkit-background-clip: text;
background-clip: text;
}
.txt-sketchy-outline-text > span:nth-child(2) {
opacity: 0.75;
animation-name: txt-sketchy-outline-text-b;
}
.txt-sketchy-outline-text > span:nth-child(3) {
opacity: 0.5;
animation-name: txt-sketchy-outline-text-c;
}
@keyframes txt-sketchy-outline-text-a {
0% { transform: translate(0, 0); }
33% { transform: translate(0.008em, -0.006em); }
66% { transform: translate(-0.006em, 0.008em); }
}
@keyframes txt-sketchy-outline-text-b {
0% { transform: translate(0.02em, 0.012em) rotate(0.5deg); }
33% { transform: translate(-0.016em, 0.018em) rotate(-0.4deg); }
66% { transform: translate(0.012em, -0.018em) rotate(0.2deg); }
}
@keyframes txt-sketchy-outline-text-c {
0% { transform: translate(-0.022em, -0.01em) rotate(-0.6deg); }
33% { transform: translate(0.018em, -0.02em) rotate(0.5deg); }
66% { transform: translate(-0.012em, 0.022em) rotate(-0.3deg); }
}
@media (prefers-reduced-motion: reduce) {
.txt-sketchy-outline-text, .txt-sketchy-outline-text *, .txt-sketchy-outline-text::before, .txt-sketchy-outline-text::after, .txt-sketchy-outline-text *::before, .txt-sketchy-outline-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.