AI CSS Animations

Hand-Drawn Arrow Annotation

A curved pen arrow swoops up to a label, the head flicks on, and the words give a small nudge as it lands. Two SVG paths drawn one after the other; the nudge waits for the arrowhead.

Also known as: arrow pointing at text, curved arrow animation svg, doodle arrow css.

Start here

HTML

<div class="txt-hand-drawn-arrow-text"><svg viewBox="0 0 100 60" aria-hidden="true"><path pathLength="1" d="M6 54 C14 24, 40 10, 88 28" /><path pathLength="1" d="M80 16.4 L88 28 L74.4 31.6" /></svg><span class="txt-hand-drawn-arrow-text-label">Start here</span></div>

CSS

.txt-hand-drawn-arrow-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;
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  white-space: nowrap;}
.txt-hand-drawn-arrow-text svg {
  width: 2.4em;
  height: 1.44em;
  overflow: visible;
  transform: translateY(0.25em);
  fill: none;
  stroke: var(--c);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.txt-hand-drawn-arrow-text path {
  stroke-dasharray: 1 1.1;
  stroke-dashoffset: 1.05;
  animation: txt-hand-drawn-arrow-text-draw 0.6s cubic-bezier(0.5, 0, 0.3, 1) 0.3s forwards;
}
.txt-hand-drawn-arrow-text path:nth-child(2) {
  animation-duration: 0.22s;
  animation-timing-function: ease-out;
  animation-delay: 0.88s;
}
.txt-hand-drawn-arrow-text-label {
  display: inline-block;
  animation: txt-hand-drawn-arrow-text-nudge 0.5s ease-out 1.05s;
}
@keyframes txt-hand-drawn-arrow-text-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes txt-hand-drawn-arrow-text-nudge {
  30% { transform: translateX(0.12em) rotate(1.5deg); }
  65% { transform: translateX(-0.03em); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-hand-drawn-arrow-text, .txt-hand-drawn-arrow-text *, .txt-hand-drawn-arrow-text::before, .txt-hand-drawn-arrow-text::after, .txt-hand-drawn-arrow-text *::before, .txt-hand-drawn-arrow-text *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar text animations