Skip to content
animorio
IT
Back to the library

Venn diagram scroll

SVG, ScrollGSAPMediumCompressed weight: Demo 6.0 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

A minimal scroll animation: two thin circles, Design and Code, start apart on warm white. Scrolling brings them together on a spring; they touch with a small blue tick, the edges that end up inside each other turn dashed like hidden lines, then the shared part floods with ultramarine and the word Product lands in it, one letter at a time, gaining weight. When the scroll stops the circles settle one pixel past and back.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Venn diagram scroll" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The Venn diagram that closes in on scroll</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- two thin circles, Design and Code, drawn apart on warm white. Scrolling brings them together: they touch with a
       small tick, the edges that fall inside each other turn dashed, then the overlap floods with the accent and the
       word that lives there, Product, lands in it letter by letter. The circles ride a spring, one pixel past and back -->
  <main class="pagina">
    <section class="corsa" data-corsa aria-label="Venn diagram: Design and Code overlap in Product">
      <div class="palco">
        <div class="pezzo" data-pezzo>
          <p class="sopra" data-sopra>Halden Studio, how we work</p>
          <div class="diagramma" data-diagramma>
            <svg class="venn" data-venn aria-hidden="true">
              <path class="venn__dentro" data-dentro-a></path>
              <path class="venn__dentro" data-dentro-b></path>
              <path class="venn__lente" data-lente></path>
              <path class="venn__fuori" data-fuori-a></path>
              <path class="venn__fuori" data-fuori-b></path>
              <line class="venn__bacio" data-bacio></line>
            </svg>
            <span class="nome nome--a" data-nome-a>Design</span>
            <span class="nome nome--b" data-nome-b>Code</span>
            <span class="incontro" data-incontro>Product</span>
          </div>
          <p class="sotto" data-sotto>We work where they overlap.</p>
        </div>
        <p class="scendi" data-scendi>Scroll</p>
      </div>
    </section>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/ScrollTrigger.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/lenis@1.3.26/dist/lenis.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

18 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Venn diagram scroll” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On empty warm white two thin circles draw themselves from the points that face each other, one upwards to the left and the other to the right: inside them it says Design and Code, and above, in grey, “Halden Studio, how we work”. Scrolling the page, which stays pinned, brings the circles together while they grow, so the drawing always fills its width. When they touch, a small blue tick flicks at the meeting point and is gone. Then they move into each other: the bits of edge that end up inside the other circle turn dashed, like the hidden edges of a technical drawing, and the names slide to the middle of their crescent. The wider the shared part gets, the more it fills with ultramarine, and the dashes disappear under it; the two names give a little weight away. Near the end Product lands in the blue part, one letter at a time from below, with a bounce and its weight rising, and “We work where they overlap.” appears underneath. The circles follow the scroll on a spring: when the scroll stops they go one pixel past and back, with a small breath. With the pointer on a circle its line thickens and its name gains weight; on the shared part the word widens. Scrolling back undoes it all: the word leaves, the blue withdraws, the circles come apart with their tick.

How it works

Two circles, one number

Everything depends on the distance between the centres measured in radii: 2.3 at the start (apart), 0.96 at the end (half overlapping). The radius is the width divided by (2 + distance), so the circles grow as they close in and the drawing stays the same width.

Four arcs and the lens

When they overlap, the two meeting points sit on the vertical through the centre, at a height of the square root of r² minus (d/2)². From there each circle is two SVG arcs: the outer one (large-arc 1) solid and the inner one (large-arc 0) dashed; the blue lens is the two inner arcs together.

The rising blue

The overlap goes from 0 to 1; the lens fill is a smooth curve between 0.35 and 0.95, and the dashes fade as much as the blue grows. The word starts from a paused timeline above 0.86 and reverses below 0.74: the gap keeps it from flickering on the edge.

The spring and the tick

ScrollTrigger only gives the progress. The distance chases the wanted value on a spring integrated in steps of 1/120 of a second in the GSAP ticker; when it reaches zero the overlap changes sign and the tick fires, lighting up and fading in 0.7 seconds.

The pointer without :hover

As the pointer moves the script measures its distance from both centres: inside one only, that circle gains weight; inside both, the word widens on the wdth axis. Each state chases its value on a small spring.

Values to change

NameFileDefaultWhat it changes
LEFTscript.js'Design'The name in the left circle.
RIGHTscript.js'Code'The name in the right circle.
MIDDLEscript.js'Product'The word that lands in the shared part.
GAPscript.js0.3The space between the circles at the start, as a share of the radius.
OVERLAPscript.js0.52How far they overlap at the end, as a share of the diameter.
STIFFNESSscript.js150The spring that moves the circles: higher is quicker.
BOUNCEscript.js0.3How far they go past before settling (0 = not at all).
SMOOTHscript.js1.1Seconds of the smooth scroll; 0 for the browser’s own.

Try them in the Playground

When to use it

For the “how we work” section of a studio or an agency, to say where two crafts meet (design and code, food and wine, data and people), on a service page or in the pitch of a product that joins two worlds.

On phones

The same animation with adapted sizes: the drawing is as wide as the box allows, in width and height, and the names and the word shrink if they do not fit their part.

With reduced motion

No movement: the circles already overlap, the shared part is blue with Product inside, and it all appears in a fade.

Pitfalls

  • The large-arc flag of the arcs: the part of a circle outside the other is always more than half a turn and the part inside always less, at any overlap; swapping them flips the drawing to the other side.
  • The word has to fit the lens at the end, not at the start: the lens width is worked out from the final overlap and the type shrinks only when it must.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, Lenis 1.3.26, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 6.0 KB; the libraries: GSAP + ScrollTrigger 45 KB, Lenis 5.3 KB.

Testing

Tested on 1 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations