2d-inc / Flare-JS

Flare Javascript ES6 runtime with Canvas rendering.

Home Page:https://flare.rive.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[CRITICAL REQUEST] Please make npm library!

jjangga0214 opened this issue · comments

Hi, thank you for creating such a cool tool like Flare!

However, I found the way of using it, at least currently, with javascript is very far from the standard.

In my opinion, being able to install Flare as npm dependency(like the below) is neccessary.

npm install flare

Then developers could use it with well defined, clean API like this.

<script>
  import Flare from 'flare'

  const flareObject = new Flare({
    target: "#canvas-id",
    file: "example.flr",
    width: 128, // default to full parent width if unspecified
    height: 128, // default to full parent height if unspecified
    onSomeEvent: () => { ... },
    onAnotherEvent: () => { ... }
  })
</script>
<body>
  <canvas id="canvas-id"></canvas>
</body>

If Flare provides clean vanilla js API, then community would possibly create ecosystem, like vue or angular component by themselves.

This is a good idea. We have a flare-react one, we should do this for flare-js too! Thanks!

@luigi-rosso May I ask when the library(at least alpha or beta) would be released? If you have something that requires help from others, please describe it in detail, then I (or other people who could see it) might be able to help.

This would be really helpful!

When can we expect the feature?

+1

+1

Give this a try! npm install @2dimensions/flare-js

We're also looking into externalizing our slimmed down CanvasKit so you can link it externally. Currently it's bundled with the JS. We could trim almost 2MB by doing this, but it would require a slightly more tedious setup for end users.