Skip to content
animorio
IT
Back to the library

Guitar chord chart

SVG, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.0 KBGSAP 28 KBFreeDownload the zip

A guitar chord chart: six strings, four frets, the nut at the top and the fingers as mint green pads with their number. Pick a chord among C, G, A minor and F and the fingers slide to their new frets on a spring, the first finger stretches into F’s barre, above the nut the rings of the open strings and the crosses of the muted ones change, and a strum makes the strings vibrate one after the other.

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>
<!--
  "Guitar chord chart" 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>Guitar chord chart</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">
    <!-- a guitar chord chart: pick a chord and the fingers slide to their new frets, the open and muted strings
         change above the nut, and a strum makes the strings that sound vibrate one after the other -->
    <section class="cc" data-cc aria-labelledby="cc-title">
      <header class="cc__head">
        <span class="cc__name"><b id="cc-title">Chord chart</b><span>Guitar, standard tuning</span></span>
        <span class="cc__chord" aria-live="polite"><b class="cc__roll"><span data-chord>C</span></b><span class="cc__roll cc__roll--sub"><span data-notes>C major, C E G</span></span></span>
      </header>

      <button class="cc__board" type="button" data-board aria-label="Strum the chord">
        <svg viewBox="0 0 296 168" aria-hidden="true">
          <path class="cc__fret" d="M58 64H238"></path><path class="cc__fret" d="M58 94H238"></path><path class="cc__fret" d="M58 124H238"></path><path class="cc__fret" d="M58 154H238"></path>
          <path class="cc__nut" d="M56 34H240"></path>
          <path class="cc__string" data-string style="stroke-width:2.40" d="M58 34V160"></path><path class="cc__string" data-string style="stroke-width:2.12" d="M94 34V160"></path><path class="cc__string" data-string style="stroke-width:1.84" d="M130 34V160"></path><path class="cc__string" data-string style="stroke-width:1.56" d="M166 34V160"></path><path class="cc__string" data-string style="stroke-width:1.28" d="M202 34V160"></path><path class="cc__string" data-string style="stroke-width:1.00" d="M238 34V160"></path>
          <g data-mark transform="translate(58 17)"><circle class="cc__open" r="5"></circle><path class="cc__mute" d="M-4.500-4.500l9 9M4.500-4.500l-9 9"></path></g><g data-mark transform="translate(94 17)"><circle class="cc__open" r="5"></circle><path class="cc__mute" d="M-4.500-4.500l9 9M4.500-4.500l-9 9"></path></g><g data-mark transform="translate(130 17)"><circle class="cc__open" r="5"></circle><path class="cc__mute" d="M-4.500-4.500l9 9M4.500-4.500l-9 9"></path></g><g data-mark transform="translate(166 17)"><circle class="cc__open" r="5"></circle><path class="cc__mute" d="M-4.500-4.500l9 9M4.500-4.500l-9 9"></path></g><g data-mark transform="translate(202 17)"><circle class="cc__open" r="5"></circle><path class="cc__mute" d="M-4.500-4.500l9 9M4.500-4.500l-9 9"></path></g><g data-mark transform="translate(238 17)"><circle class="cc__open" r="5"></circle><path class="cc__mute" d="M-4.500-4.500l9 9M4.500-4.500l-9 9"></path></g>
          <g class="cc__dot" data-dot><rect data-pad x="-11" y="-11" width="22" height="22" rx="11"></rect><text data-fn y="4">1</text></g><g class="cc__dot" data-dot><rect data-pad x="-11" y="-11" width="22" height="22" rx="11"></rect><text data-fn y="4">2</text></g><g class="cc__dot" data-dot><rect data-pad x="-11" y="-11" width="22" height="22" rx="11"></rect><text data-fn y="4">3</text></g><g class="cc__dot" data-dot><rect data-pad x="-11" y="-11" width="22" height="22" rx="11"></rect><text data-fn y="4">4</text></g>
        </svg>
      </button>

      <div class="cc__picks" role="group" aria-label="Chord" data-picks>
        <span class="cc__pill" data-pill aria-hidden="true"></span>
        <button class="cc__pick" type="button" data-pick aria-pressed="true">C</button>
        <button class="cc__pick" type="button" data-pick aria-pressed="false">G</button>
        <button class="cc__pick" type="button" data-pick aria-pressed="false">Am</button>
        <button class="cc__pick" type="button" data-pick aria-pressed="false">F</button>
      </div>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

24 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Guitar chord chart” 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 black, a dark card: “Chord chart”, “Guitar, standard tuning” and on the right the chord’s name in mint green, “C”, with “C major, C E G” below. In the middle the chart: a thick line at the top, the nut, six vertical strings getting thinner and four frets. Three green pads numbered 1, 2 and 3 sit on the strings, above the nut a cross on the muted string and two rings on the open ones. On opening the fingers pop out one after the other and a strum goes off: the strings bend and vibrate from left to right, less and less, except the muted one which only gives a small thud. At the bottom four chords, “C”, “G”, “Am”, “F”. Tap “G” and the three fingers slide to their new frets going slightly past, crosses and rings change, the name rolls and the chord sounds. With “F” the first finger stretches across all six strings, the barre, and the fourth finger appears. Tap the chart to strum again.

How it works

The chord is a list

For each chord: what every string does (muted, open or which fret) and where each finger goes, as first string, last string and fret. A barre is just a finger whose first and last strings differ.

The fingers

Each finger has four numbers: x, y, width and scale. GSAP takes them to the new values, x and y on an elastic spring, and writes them on every frame into the group’s transform and the rounded rectangle’s width.

The vibrating string

Each string is a quadratic curve: the control point moves sideways by a value that is a sine times a decay. The strings start one after the other, STRUM seconds apart.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#5fe3b3The colour of the fingers and of the chord’s name.
SLIDEscript.js0.9How long the fingers take to slide from one chord to the next.
RINGscript.js1.2For how many seconds a string vibrates after the strum.

Try them in the Playground

When to use it

In apps and sites for learning guitar, on the pages of a course or a music school, next to a song’s lyrics with chords and on a luthier’s site; with four strings it works for ukulele and bass.

On phones

The same card, as wide as the screen minus the margins: the chart shrinks with the card and is tappable all over for the strum, the four chords are buttons 36 pixels tall. The card is about 300 pixels tall and fits the phone box.

With reduced motion

No sliding and no vibrating strings: on changing chord the fingers, crosses and rings are in their new place at once and the name changes without rolling. The demo’s pointer does not start.

Pitfalls

  • Nothing is heard: the strum is only drawn. Real sound needs six samples or the Web Audio API, started with the same delay between strings.
  • The fingerings are the most common ones in first position; for chords higher up the neck the starting fret number has to be added next to the nut.
  • The chart is an image for screen reader users: the chord’s name and notes are in the text beside it, and the strum button says which chord it plays.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 25 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