Skip to content
animorio
IT
Back to the library

Gantt chart drag

SVG, Hover, PhysicsGSAP, CSS onlyMediumCompressed weight: Demo 9.3 KBGSAP 28 KBFreeDownload the zip

The timeline of a project app, six weeks and five tasks: drag one along the days and the tasks that depend on it follow on a spring, one after the other, the dependency lines redraw themselves and the launch date at the bottom rolls to its new day, with how many days late. In the style of product micro-interactions, one gesture only: Drag.

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>
<!--
  "Gantt chart drag" 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 Gantt chart with tasks to drag</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>
  <main class="stage" data-stage>
    <!-- the timeline of a project tool: drag a task along the weeks and the tasks that depend on it follow on a spring,
         the dependency lines redraw themselves and the launch date at the bottom rolls to its new day -->
    <section class="card" data-card aria-label="Project timeline">
      <header class="head">
        <div class="head__left">
          <span class="logo" aria-hidden="true"><svg viewBox="0 0 20 20"><path d="M4 15.5 10 4.5l6 11"></path><path d="M6.6 11h6.8"></path></svg></span>
          <div>
            <p class="head__app">Quillwork</p>
            <h1 class="head__title">Website relaunch</h1>
          </div>
        </div>
        <div class="head__right">
          <span class="seg" aria-hidden="true"><span class="seg__on">Weeks</span><span>Months</span></span>
        </div>
      </header>

      <div class="chart" data-chart>
        <div class="axis" data-axis aria-hidden="true"></div>
        <div class="body" data-body>
          <div class="grid" data-grid aria-hidden="true"></div>
          <div class="today" data-today aria-hidden="true"><span>Today</span></div>
          <svg class="links" data-links aria-hidden="true"></svg>
          <ul class="rows" data-rows></ul>
        </div>
      </div>

      <footer class="foot">
        <div class="foot__label">
          <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M5 17V3.5"></path><path d="M5 4h9.5l-2 3 2 3H5"></path></svg>
          <span>Launch</span>
        </div>
        <p class="foot__date" data-date aria-live="polite"></p>
        <span class="chip" data-chip></span>
      </footer>
    </section>

    <div class="tip" data-tip aria-hidden="true"><span data-tip-text></span></div>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></svg>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.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.

25 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 “Gantt chart drag” 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 a very light grey there is the white card of Quillwork, an invented project app, with the Website relaunch project. On the left five tasks, each with the name of the person in charge: Research, Wireframes, Copywriting, Build and Launch; on the right six weeks from 26 October, with the weekends lightly veiled and an indigo line reading Today. Each task is a light bar with the part already done slightly fuller, the dates or the days inside and the person’s initials in a circle; the launch is the solid indigo bar. The grey dependency lines run in an elbow from the end of a task to the start of the one waiting for it, with a drawn arrowhead. Grab a bar and drag it: it lifts by a pixel with a wider shadow, and above it a black label shows the dates, which change at every day. If the task ends after the start of one that depends on it, that one follows on a spring, and so does the next, a little later, like a queue moving along; the lines that move turn indigo and redraw themselves as the bars slide. At the bottom the launch date rolls only the digits that change and next to it 4 days late appears in red; bring the task back and everything returns to its place and the date rolls backwards to On track, in green. A drawn pointer does it all by itself: it moves Wireframes forward and back, then Copywriting, and starts again.

How it works

The plan in days

Each task has a start day, a length and the list of tasks it depends on. At every change the plan is redone in order: a task starts on its own day or, if later, the day after the end of the last one it depends on, plus GAP. The bars are as wide as their length times the width of a day, measured again on every resize.

The drag

The grabbed bar follows the finger in pixels and its day is the nearest one: as soon as it changes, the plan is redone and the label with the dates updates. Before the last task it depends on and after the last day the bar only lets itself be pulled a little, like a rubber band, and when let go it goes back to the right day.

The queue on springs

Every free bar chases its day with a damped spring, integrated in four steps per frame in GSAP’s ticker; SPRING makes it stiffer, BOUNCE takes away damping. A task further down the chain waits LAG seconds more per level before starting, so they move one after the other.

The lines that redraw themselves

On every frame the dependency lines are recomputed from the real positions of the bars, not from the plan: an elbow with six pixel curves if there is room between the two tasks, a loop under the row if they touch, and the arrowhead as a drawn triangle. The ones that move take the accent colour.

The rolling date

The launch date is made of separate letters: when it changes, only the different ones leave upwards and the new ones come in from below, or the other way round if the date goes back. Next to it, the delay against the starting plan.

Values to change

NameFileDefaultWhat it changes
SPRINGscript.js1How stiff the spring the dependent tasks follow with: higher is snappier.
BOUNCEscript.js0.18How much the tasks bounce when they reach their day.
GAPscript.js0The days of slack between a task and the one that depends on it.
LAGscript.js0.06The delay with which each task further down the chain starts after the one before.
ACCENTscript.js#4f46e5The colour of the launch bar, the today line and the active dependencies.
HOLDscript.js1.4The seconds of pause before the autopilot starts again.

Try them in the Playground

When to use it

For the page of a project app or a team tool, for a dashboard with deadlines, or as a piece of a prototype: it shows in one gesture what happens to the launch when a task slips.

On phones

The same animation with adapted sizes: the names column narrows, the days shrink with the width, short bars keep only the number of days, and the bars are dragged with a finger.

With reduced motion

No springs and no movement: the bars go straight to their day, the autopilot changes the plan with a fade, and the launch date changes by fading.

Pitfalls

  • Lines computed from the plan instead of from the bars came apart from the bars while the spring carried them: they are recomputed on every frame from the real positions.
  • Two tasks that touch, one ending on the start day of the other, leave no room for the elbow: the line loops under the row.
  • Measurements are taken after document.fonts.ready: with the fallback font the names column had a different width and the bars started out of place.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.3 KB; the libraries: GSAP 28 KB.

Testing

Tested on 28 October 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