webdevpuneet.com

SVG Logo Draw-In Loader — Stroke-Dashoffset Wordmark Loading Animation

SVG Logo Draw-In Loader · Loaders · Plain HTML & CSS · Live preview

CategoryLoaders

Copy & paste

Source Code

<div class="ld-stage">
  <svg class="ld-svg" viewBox="0 0 200 200" fill="none">
    <!-- Abstract geometric mark: an interlocking triangle + diamond outline,
         a stand-in for a real brand wordmark/logo. -->
    <path class="ld-path ld-outer" d="M100 20 L172 70 L146 158 L54 158 L28 70 Z" stroke-linecap="round" stroke-linejoin="round"/>
    <path class="ld-path ld-inner" d="M100 62 L134 116 L66 116 Z" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
  <div class="ld-label" id="ldLabel">Loading</div>
</div>

Extend with AI

Take This Snippet Further With AI

The AI prompt for this one is for Patreon supporters ($3 a month, 7 days free), along with a site with no ads. Supporters enter the passcode once and it is remembered in this browser.

· Become a supporter

What's included

Features

Stroke-dashoffset draw-in
The path outline itself draws in over time — no separate spinner overlay.
Three-phase loop
Draw in, hold fully formed, then draw back out before resetting.
Directional undraw
The line retracts the same direction it drew, not a reversed animation.
Two independently-timed paths
The inner and outer shapes draw with a subtle offset rhythm.
Zero JavaScript
The entire animation is CSS @keyframes on stroke-dashoffset.
Brand-mark friendly
Swap the path data for any real logo outline with the same mechanics.
Animated ellipsis label
A steps() keyframe grows a "…" beneath the mark without extra markup.
Reduced-motion safe
Paths render fully drawn and static under prefers-reduced-motion.

About this UI Snippet

SVG Logo Draw-In Loader — The Outline Itself Is the Loading Animation

Screenshot of the SVG Logo Draw-In Loader snippet rendered live

Most loading indicators are generic — a spinner or bar that could belong to any product. A logo draw-in loader instead uses the brand's own mark as the animation: its outline draws itself stroke by stroke, holds fully formed for a beat, then draws back out and repeats, so the wait itself reinforces the brand rather than showing an interchangeable spinner borrowed from any other site. This snippet builds the technique with an abstract geometric mark (a triangle-and-diamond outline, standing in for a real logo shape) in plain HTML, CSS, and SVG — no JavaScript required, the whole animation is stroke-dashoffset keyframes.

The stroke-dasharray / stroke-dashoffset trick

Each <path> is given a stroke-dasharray equal to its own total path length (measured by inspecting the rendered path, or approximated), which turns the stroke into one dash exactly as long as the path with no gap. Setting stroke-dashoffset to that same length shifts the entire dash out of view, so nothing is visible — the path is present in the DOM but invisible. Animating stroke-dashoffset from that full length down to 0 slides the dash back into view along the path, which reads as the line drawing itself in real time, tip to tail. This is the same fundamental technique used for animated SVG checkmarks and signature effects, applied here as a continuously looping loader instead of a one-shot reveal.

Draw in, hold, draw out — not just a fade

The keyframes don't stop at a drawn-in state; ldDrawOuter and ldDrawInner animate to stroke-dashoffset: 0 by roughly 40% of the loop, hold there until about 60%, and then continue past 0 to a negative offset equal to the path length — which slides the dash back out the far end, undrawing the line in the same direction it was drawn, rather than reversing the draw motion backward. That three-phase shape (draw in, hold, draw out) is what makes the loop read as a deliberate, repeating gesture instead of a shape that merely fades or flickers.

Two paths, gently offset

The inner diamond's keyframes are nudged so it begins drawing slightly after the outer shape and finishes its hold slightly earlier, giving the two strokes a small independent rhythm rather than animating in perfect lockstep — a subtlety that keeps a two-part mark from reading as one flat, single-timed animation.

Why an abstract mark here

The shape in this snippet is a simple interlocking geometric outline, deliberately generic so the pattern is obviously a demonstrable technique rather than tied to any specific company. Swap the <path> data for your own logo's outline (most vector logo files export as SVG path data directly, or can be traced from one), recompute stroke-dasharray to match the new path's length, and the draw-in mechanics carry over unchanged.

A no-JavaScript, CSS-only loader

Because the entire effect is expressed as CSS @keyframes on stroke-dashoffset, there's no JavaScript driving the animation at all — it's as lightweight and dependency-free as a spinner, but branded. Pair it with a top loading bar for a route transition underneath, or an orbit loader as a non-branded fallback where a wordmark doesn't fit.

Step by step

How to Use

  1. 1
    Paste HTML, CSS, and JSThe outline mark begins invisible and starts drawing itself in immediately.
  2. 2
    Watch the full cycleIt draws in, holds fully formed for a moment, then draws back out and repeats.
  3. 3
    Swap in your own logoReplace the path "d" data with your logo's outline (export as SVG path data).
  4. 4
    Recompute the dash lengthSet stroke-dasharray/stroke-dashoffset to match your new path's total length.
  5. 5
    Tune the timingAdjust the keyframe percentages to change how long it holds versus draws.
  6. 6
    Restyle itChange the stroke colors and width to match your brand.

Real-world uses

Common Use Cases

Branded splash and boot screens
Make a first-paint loader out of your own logo, with its outline drawing itself in through stroke-dashoffset.
App and site preloaders
Show while assets or authentication load, with a three-phase loop of draw in, hold fully formed, then draw back out.
Sign-in transitions
Give a polished wait during login, where the line retracts in the same direction it was drawn instead of replaying in reverse.
Agency and marketing sites
Create a signature loading moment, with inner and outer paths drawn on a subtle offset so the mark feels hand-built.
Overlay-based loading
Place inside a loading overlay, and reuse an existing vector logo by pasting its path data into the SVG.
Related: Multi-File Upload Queue
See the Multi-File Upload Queue for a related loaders pattern worth pairing with this one.

Got questions?

Frequently Asked Questions

Each path's stroke-dasharray is set to its own total length, turning the stroke into one dash exactly as long as the path with no visible gap. Setting stroke-dashoffset to that same length shifts the dash entirely out of view. Animating dashoffset down to 0 slides the dash back into view along the path, which reads as the line drawing itself in from start to end.

Render the path in a browser and read its length via the DOM API: document.querySelector('path').getTotalLength(). Use that number for both stroke-dasharray and the starting stroke-dashoffset. Since this snippet is CSS-only, you would either hardcode the measured value or add a small script that sets it from getTotalLength() once on load.

The keyframes continue past stroke-dashoffset: 0 to a negative value equal to the path length, which slides the dash out the far end in the same direction it drew in, undrawing the line rather than reversing the draw motion. This keeps the loop reading as one continuous directional gesture rather than a draw-then-fade that would look like two different effects stitched together.

Yes — export your logo as an SVG and use its path data directly in the path d attribute (most vector logo files, including ones from Illustrator or Figma, export cleanly to SVG paths). This snippet uses an abstract geometric mark specifically so the pattern reads as a demonstrable technique rather than being tied to any one company's branding.

Render the SVG markup as-is inside a component — the animation is pure CSS with no JavaScript dependency, so it needs no lifecycle hooks or state. If your logo path length varies per instance, compute it once with getTotalLength() in a mount effect and set the dasharray/dashoffset as inline styles or CSS custom properties instead of hardcoding them.