friday / lottie-node

Export lottie animations in Node.js
MIT License
56 stars 11 forks source link

node-canvas 2 support #6

Closed friday closed 6 years ago

friday commented 6 years ago

node-canvas v2 has been released, and jsdom-support is coming. This may not affect this repo since v2 is primarily about font rendering, and lottie uses glyphs. Testing is needed however, and the version strings used may need to be restricted.

friday commented 6 years ago

To upgrade you need to use at least:

The lottie-node API is the same, but you have to change how node-canvas is imported.

From this:

const Canvas = require('canvas');

To either

const {Canvas} = require('canvas');

or

const {createCanvas} = require('canvas');

createCanvas is a function, so when you use it you must not use the new keyword.

And that's it. To use the old version, see https://github.com/friday/lottie-node/tree/v0.2.0