npm

lottie-jsdom
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

lottie-jsdom

Allows you to execute your lottie animations on a server, for example, for SSR.

Use this package in the same way like you use lottie-web on a client.

import lottieJSDOM from 'lottie-jsdom';

// in nodejs there is no document, so this package provides it for you
const container = lottieJSDOM.document.createElement('div'); 
const animation = lottieJSDOM.loadAnimation({
  container,
  renderer: 'svg',
  loop: false,
  autoplay: false,
  animationData: require('./animation.json'),
});

There are similar projects:

https://github.com/chadly/lottie-to-svg

  • pollutes global scope
  • does not export typescript definitions
  • hardcodes svg as renderer

https://github.com/friday/lottie-node

  • pollutes global scope
  • does not export typescript definitions
  • hardcodes canvas as renderer

You can not use them in SSR environment, because they pollute global scope.

Package Sidebar

Install

npm i lottie-jsdom

Weekly Downloads

0

Version

0.0.3

License

ISC

Unpacked Size

2.7 kB

Total Files

4

Last publish

Collaborators

  • stepancar