Import CSS animations into Figma

Last updated

html.to.design imports a page’s CSS animations into Figma as Figma Motion. The imported frame gets a timeline, and each animated layer gets its tracks, so spinners spin, cards flip and banners fade in Figma as they do in the browser. Animations that turn in 3D play in Figma’s 3D.

There is nothing to turn on: every import carries its animations, from the Web, Extension, File and Editor tabs, and when you paste a capture from the browser extension.

Play the animations in Figma

  1. Import the page as usual, in a Figma Design file
  2. Select the imported frame: its animations are on its Figma Motion timeline, ready to play
  3. Each animated layer has a track per animated property, with the page’s keyframes and easing

The layers themselves show the page as it was captured.

What plays

CSS @keyframes animations of the properties below play on the element they animate:

  • Properties: opacity, rotation, position (translate), scale, width, height, corner radius (the same on every corner) and border width (the same on every side). transform, rotate, translate and scale all count, and combine as they do in CSS
  • Timing: duration, delay (a negative one too), iteration count, alternate and reverse directions, fill modes
  • Easing: each keyframe’s curve, cubic-bezier() and the keywords (ease, ease-in-out…)
  • Arcs: an element that turns about a point other than its centre (an orbit around its transform-origin) follows that circle
  • SVG: an <svg> animated as a whole, such as a loading spinner

3D animations

When your Figma draws 3D (Figma’s 3D is in beta), animations that turn an element in depth play in Figma’s own 3D:

  • rotateX(), rotateY() and rotate3d() about any axis
  • translateZ()
  • in the perspective the element’s parent gives it, as in the browser

The animated layer is set in 3D in Figma, and its parent gets the page’s perspective. Card flips, split-flap tiles, tilting cards and spinning coins import this way.

3D needs the html.to.design plugin in a Figma that draws 3D. A capture you paste from the browser extension, or an import in a Figma without 3D, gets the same animations as flat 2D tracks.

Hover transitions

With For hover effects on in the import options, html.to.design imports each hover effect as a component with a Default and a Hover variant. When the element has a CSS transition on the properties its hover changes, the change between the variants uses Smart Animate, with the page’s duration and easing curve. Without a transition, the variant changes instantly, as on the page.

FAQ

Does html.to.design import CSS animations?

Yes. A page's CSS @keyframes animations of opacity, rotation, position, scale, size, corner radius and border width become Figma Motion tracks on the imported frame's timeline, with their duration, delay, repeat, direction and easing, so they play in Figma as in the browser.

Can html.to.design import 3D CSS animations?

Yes, when your Figma draws 3D (in beta). rotateX(), rotateY(), rotate3d() and translateZ() animations play in Figma's own 3D, in the perspective the page gives them. Elsewhere, and when you paste a capture from the browser extension, they import as flat 2D tracks.

Do hover transitions import into Figma?

Yes, with For hover effects turned on. When the element has a CSS transition, the Default to Hover variant change uses Smart Animate with the page's duration and easing curve.