29 / blog / patternsJune 20265 min read

5 scroll animation patterns, each under 10 lines

The five scroll animation patterns behind most real-world SVG scroll effects — each in 3 lines using svg-scroll-draw presets. No config, no GSAP, no boilerplate.

  • Patterns
  • preset: reveal
  • preset: sketch
  • preset: typewriter
  • preset: cinematic
  • preset: spring
Presets
5
Config
one option
Main entry
11.9 KB
Licence
MIT

presetpath drawn ↑ · scroll through the trigger →

01revealease-out · speed 1.2 · fade · once
02sketchease-in · speed 0.9 · stagger 0.1
03typewriterlinear · speed 1.5 · stagger 0.05
04cinematicease-in-out · speed 0.75 · fade
05springspring · speed 1.1
Fig. 1 — each preset's draw curve, computed from its real options — speed > 1 finishes early (the dashed tick), stagger draws later paths after the first, spring overshoots
01Preset: 'reveal'

Logo reveal

Use case: Hero sections, brand marks, above-the-fold SVG illustrations

The most common scroll animation. A logo or illustration draws in once as it enters the viewport, fades as it draws, and stays drawn. The reveal preset sets fade, ease-out, and once — the three options you'd set manually every time.

The preset sets
easing: 'ease-out', fade: true, speed: 1.2, once: true

vanillaJavaScript

app.js3 lines
import { scrollDraw } from 'svg-scroll-draw';

scrollDraw('#logo', { preset: 'reveal' });

reactsvg-scroll-draw/react

Component.tsx9 lines
import { ScrollDraw } from 'svg-scroll-draw/react';

function Logo() {
  return (
    <ScrollDraw preset="reveal">
      <svg>…</svg>
    </ScrollDraw>
  );
}
02Preset: 'sketch'

Sketch diagram

Use case: Technical diagrams, infographics, process flows, architectural illustrations

Multi-path SVGs — diagrams, flowcharts, architecture drawings — look best when paths trace in one by one rather than all at once. The sketch preset adds a 0.1 stagger and uses ease-in so each line feels like a pen stroke.

The preset sets
easing: 'ease-in', stagger: 0.1, speed: 0.9, fade: false

vanillaJavaScript

app.js4 lines
scrollDraw('#architecture-diagram', { preset: 'sketch' });

// Or slow it down slightly for dense diagrams
scrollDraw('#circuit', { preset: 'sketch', speed: 0.7 });

reactsvg-scroll-draw/react

Component.tsx8 lines
<ScrollDraw preset="sketch">
  <svg>{/* your diagram SVG */}</svg>
</ScrollDraw>

{/* Override stagger for fewer paths */}
<ScrollDraw preset="sketch" stagger={0.2}>
  <svg>{/* 3-step flow */}</svg>
</ScrollDraw>
03Preset: 'typewriter'

Typewriter / sequential

Use case: Code snippets drawn as SVG, timeline steps, sequential data labels

When you want paths to appear quickly in strict sequence — like text being typed or steps in a timeline — the typewriter preset uses linear easing (mechanical, no easing in/out) with a tight 0.05 stagger and fast speed.

The preset sets
easing: 'linear', stagger: 0.05, speed: 1.5

vanillaJavaScript

app.js7 lines
scrollDraw('#timeline-steps', { preset: 'typewriter' });

// Tighten the trigger window for a snappier effect
scrollDraw('#code-svg', {
  preset: 'typewriter',
  trigger: { start: 'top 70%', end: 'top 30%' },
});

reactsvg-scroll-draw/react

Component.tsx3 lines
<ScrollDraw preset="typewriter">
  <svg>{/* sequential path SVG */}</svg>
</ScrollDraw>
04Preset: 'cinematic'

Cinematic hero

Use case: Landing page heroes, scroll storytelling, large showcase illustrations

Slow, deliberate, and dramatic. The cinematic preset draws over a longer scroll range (speed: 0.75) with ease-in-out so it accelerates into and decelerates out of the draw, plus a fade for a film-like reveal. Perfect for full-width hero SVGs.

The preset sets
easing: 'ease-in-out', fade: true, speed: 0.75

vanillaJavaScript

app.js7 lines
scrollDraw('#hero-illustration', { preset: 'cinematic' });

// Add strokeColor for extra drama
scrollDraw('#hero', {
  preset: 'cinematic',
  strokeColor: ['#333', '#ff90e8'],
});

reactsvg-scroll-draw/react

Component.tsx6 lines
<ScrollDraw
  preset="cinematic"
  strokeColor={['#333', '#ff90e8']}
>
  <svg>{/* hero illustration */}</svg>
</ScrollDraw>
05Preset: 'spring'

Spring / playful

Use case: Icons, small decorative elements, UI feedback SVGs, loading indicators

Spring easing overshoots past 1.0 and settles back — giving small SVGs a bouncy, alive feeling that linear and ease-out never capture. Great for icons and micro-animations where you want personality, not polish.

The preset sets
easing: 'spring', speed: 1.1

vanillaJavaScript

app.js2 lines
scrollDraw('#check-icon',   { preset: 'spring' });
scrollDraw('#star-rating', { preset: 'spring', stagger: 0.08 });

reactsvg-scroll-draw/react

Component.tsx4 lines
{/* React icon with spring + stagger */}
<ScrollDraw preset="spring" stagger={0.08}>
  <svg>{/* star or check icon */}</svg>
</ScrollDraw>
06Bonus

Override any preset value

Presets are just defaults. Pass any option alongside preset to override:

app.js14 lines
// reveal but with spring easing instead of ease-out
scrollDraw('#logo', { preset: 'reveal', easing: 'spring' });

// sketch but slower and with color animation
scrollDraw('#diagram', {
  preset: 'sketch',
  speed:        0.6,
  strokeColor:  ['#aaa', '#ff90e8'],
});

// Inspect what a preset sets
import { PRESETS } from 'svg-scroll-draw';
console.log(PRESETS.cinematic);
// { easing: 'ease-in-out', fade: true, speed: 0.75 }

— / next

Try the presets live

Open the Playground, select a preset from the Motion tab, and see the effect instantly

npm i svg-scroll-drawPlayground →Examples →

Star on GitHubFound this useful? A star helps others find it.

→Parts list

Keep reading

More from the blog