Skip to main content

How to animate variable fonts

Updated November 2026

To animate a variable font, load a font with the axes you want, then transition or keyframe font-weight, font-stretch or font-variation-settings in CSS. For interaction, set the axis from JavaScript on hover, scroll or data. Keep animation to short display text and turn it off when the user prefers reduced motion.

Exode Kinetic: weight, width and slant axes with wide ranges, made for animation. Download it free.

1. A hover transition

The simplest animation: a heavier weight on hover. Use a grade axis instead of weight if the font has one, so the text does not get wider and push its neighbours.

.link {
  font-variation-settings: "wght" 400;
  transition: font-variation-settings 200ms ease-out;
}
.link:hover {
  font-variation-settings: "wght" 700;
}

2. A looping keyframe animation

Keyframes animate an axis on their own, for a headline that breathes or a loading label.

@keyframes breathe {
  0%, 100% { font-variation-settings: "wght" 200, "wdth" 100; }
  50%      { font-variation-settings: "wght" 900, "wdth" 125; }
}
.headline { animation: breathe 3s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .headline { animation: none; }
}

3. Driving an axis from scroll or data

Use a CSS custom property and update it from JavaScript. This works for scroll progress, pointer distance, audio level or any live value.

const h = document.querySelector(".headline");
addEventListener("scroll", () => {
  const p = Math.min(1, scrollY / 600);
  h.style.setProperty("--w", 300 + p * 600);
});
/* CSS: .headline { font-variation-settings: "wght" var(--w, 300); } */

Performance

Changing a font axis makes the browser re-shape and re-paint the text on every frame, so it costs more than animating transform or opacity. Animate short headings rather than paragraphs, and avoid animating weight or width on text that sits inside a layout, because each frame can also change line breaks. Grade and other width-neutral axes are the safest to animate.

Animating font axes in ExodeUI

In ExodeUI you keyframe a font’s axes on the timeline like any other property, or bind them to inputs, so a state machine can make a label heavier on hover, lighter in dark mode or pulse with a live value, with no CSS to maintain. The same file plays in React, Vue, Svelte, Flutter, SwiftUI and the other ExodeUI runtimes.

Animate font axes without CSS

Keyframe axes or bind them to inputs in ExodeUI, then play the file in any framework. Free to start.

We make ExodeUI. Free Community plan; Professional is $5 a month, billed yearly.

Frequently asked questions

Can you animate font-weight in CSS?
Yes, with a variable font. font-weight and font-variation-settings both transition and animate smoothly. With a static font, the weight only jumps between available styles.
Should I animate font-weight or font-variation-settings?
Use font-weight, font-stretch and font-style for registered axes when you can, because they combine better with other styles. Use font-variation-settings for custom axes such as grade.
Why does my text jump when the weight animates?
Heavier weights are usually wider, so lines rewrap. Use a grade axis, fixed-width containers, or animate only text that sits on its own line.
Is animating variable fonts bad for performance?
It is heavier than transform or opacity because text is re-rendered each frame. It is fine for short headings and interactions; avoid animating long paragraphs.
How do I respect reduced motion?
Wrap looping or large animations in @media (prefers-reduced-motion: reduce) and turn them off or make them instant.
Which free fonts are good to animate?
Fonts with wide axes, such as Roboto Flex, and Exode Kinetic, which we made for animation. Google Fonts lets you filter by variable axes.

Sources