2d-inc / Flare-JS

Flare Javascript ES6 runtime with Canvas rendering.
https://flare.rive.app
MIT License
265 stars 59 forks source link

Another way to initialize Graphics object #14

Open chatpongs opened 5 years ago

chatpongs commented 5 years ago

I am working on a project created with create-react-app and would like to embed Flare animation. I am stuck because looking at the example, to initialize Graphics object, I have to supply a build folder

this._Graphics.initialize("../build/", handler);

I don't think webpack will understand this. Is there another way to initialize or an example to use JS framework like React, Angular with Flare?

luigi-rosso commented 5 years ago

Hi @chatpongs this is currently due to the wasm file for Skia being deployed manually instead of webpacked as a resource. While the code is webpacked, we don't have all the dependencies webpacked with it. You could look into implementing something like this: https://github.com/ballercat/wasm-loader

In the meantime, we'll add to our roadmap a plan for a webpacked npm package that should be turn key.

Feel free to make contributions to improve this, we're a tiny team and contributions are extremely welcomed.