Opus Motion ★ Star on GitHub

Data · comparison-dumbbell

Comparison dumbbell

A dumbbell (before / after) chart: for each category a "before" dot appears on a shared axis, then the "after" dot slides away from it, stretching a connector coloured green for improvement and red for decline, with value labels and a change pill at the right.

A free, MIT-licensed animated chart from the Opus Motion Library — 616 motions for Remotion, React and plain HTML.

Comparison dumbbell: three frames of the animated chart, start, middle and end
Comparison dumbbell — start, middle and end of the 6.0-second motion.

What Comparison dumbbell is for

Change between two states per item: before vs after, last year vs this year, plan vs actual, men vs women, A vs B, scores pre- and post-launch. Pass data as [{label, before, after}], set the two series names, colours, prefix / suffix and which direction is good.

  • dumbbell
  • before after
  • comparison
  • change
  • chart
  • dot plot
  • slope
  • delta
  • infographic
  • data
  • overlay
  • statistics
  • progress

Details

Category
Animated charts & data visualisation
Length
6.0 s (180 frames at 30 fps)
Formats
16:9, 1:1, 9:16
Weight
light
Transparent overlay
yes
Seamless loop
no
Text props
title subtitle prefix
Colour props
beforeColor afterColor goodColor badColor background ink
Mood
hud
Roles
accent, subject

Use Comparison dumbbell in Remotion, React or HTML

Remotion project

terminal
# copy this motion into your Remotion project
node cli/mgl.mjs add comparison-dumbbell --to ../my-app/src

# render an mp4 (run in the library folder)
node cli/mgl.mjs render comparison-dumbbell --props '{"title":"Satisfaction by area","subtitle":"Score out of 100, before and after the redesign","prefix":"","beforeColor":"#9AA3AD","afterColor":"#2F6FED","goodColor":"#12A150","badColor":"#E5484D","background":"#F5F3EE","ink":"#18212B"}'

# or export for apps / editors: mp4 | webm-alpha | prores-alpha | gif | png | poster
node cli/mgl.mjs export comparison-dumbbell --as webm-alpha --props '{"title":"Satisfaction by area","subtitle":"Score out of 100, before and after the redesign","prefix":"","beforeColor":"#9AA3AD","afterColor":"#2F6FED","goodColor":"#12A150","badColor":"#E5484D","background":"#F5F3EE","ink":"#18212B"}'

React / Next.js

tsx
import {MotionPlayer} from 'opus-motion-library/web';

<MotionPlayer
  motion="comparison-dumbbell"
  props={{
    title: 'Satisfaction by area',
    subtitle: 'Score out of 100, before and after the redesign',
    prefix: '',
    beforeColor: '#9AA3AD',
    afterColor: '#2F6FED',
    goodColor: '#12A150',
    badColor: '#E5484D',
    background: '#F5F3EE',
    ink: '#18212B',
  }}
  playOnView
  loop="auto"
/>

Plain HTML / WordPress

html
<script src="opus-motion.element.js" defer></script>

<opus-motion motion="comparison-dumbbell"
  props='{"title":"Satisfaction by area","subtitle":"Score out of 100, before and after the redesign","prefix":"","beforeColor":"#9AA3AD","afterColor":"#2F6FED","goodColor":"#12A150","badColor":"#E5484D","background":"#F5F3EE","ink":"#18212B"}'>
</opus-motion>

Compose spec (multi-scene video)

json
{
  "width": 1920,
  "height": 1080,
  "fps": 30,
  "scenes": [
    {
      "motion": "comparison-dumbbell",
      "props": {
        "title": "Satisfaction by area",
        "subtitle": "Score out of 100, before and after the redesign",
        "prefix": "",
        "beforeColor": "#9AA3AD",
        "afterColor": "#2F6FED",
        "goodColor": "#12A150",
        "badColor": "#E5484D",
        "background": "#F5F3EE",
        "ink": "#18212B"
      }
    }
  ]
}

Comparison dumbbell props

23 parameters — change any of them to make the motion yours.

PropDefaultWhat it does
data[{"label":"Onboarding","before":42,"after":78},{"label":"Checkout","before":55,"after":…rows [{label, before, after}]; any count
title"Satisfaction by area"headline (empty = none)
subtitle"Score out of 100, before and after the redesign"small line under the headline (empty = none)
beforeLabel"Before"legend name of the first dot
afterLabel"After"legend name of the second dot
prefix""text before every number, e.g. "$"
suffix""text after every number, e.g. "%", " pts"
decimals0decimal places on the numbers
sort"none""none", "delta" (biggest change first), "after" or "before" (largest first)
showValuestrueprint the before and after values beside the dots
showDeltatrueshow the change pill at the right
deltaMode"absolute""absolute" (after minus before) or "percent"
goodDirection"up""up" (increase is green) or "down" (decrease is green, e.g. cost, time)
zeroBasedfalsestart the axis at zero (otherwise it zooms to the data range)
beforeColor"#9AA3AD"colour of the before dot
afterColor"#2F6FED"colour of the after dot
goodColor"#12A150"connector and pill colour for a good change
badColor"#E5484D"connector and pill colour for a bad change
background"#F5F3EE"page colour, or "transparent" to sit over other content
ink"#18212B"text and grid colour
fontFamily""CSS font family (empty = Space Grotesk)
startAt10frame the first row starts
speed1animation speed multiplier

Notes & credits

Technique sources:

  • original round-3 chart motion