Skip to content

Commit

Permalink
Add a canvas-lite and canvas-advanced-lite package for the web runtime
Browse files Browse the repository at this point in the history
Creating a few "lite" variants of the canvas runtime to publish in our workflow:
- `@rive-app/canvas-lite` - high-level JS api
- `@rive-app/canvas-advanced-lite` - low-level WASM

The `lite` versions of the web runtime will not support Rive Text for now. It will also be ~3x smaller than it is today (relevant for those who want a small footprint on their app and want to use Rive for small animations)

Because the example apps in this runtime test against local `*-single` builds (which compiles WASM in the JS so no need to load in WASM yourself), also building `*-single` variants of these lite packages, BUT we probably don't care to publish these, so just building them in gitignored `build/` folders that the example apps can reference when wanting to test the "lite" runtime variants.

TODO:
- [x] Test Text APIs to make sure we can still call them and it won't break rendering

Diffs=
014af5fff Add a canvas-lite and canvas-advanced-lite package for the web runtime (#6079)

Co-authored-by: Zachary Plata <[email protected]>
  • Loading branch information
zplata and zplata committed Oct 19, 2023
1 parent 67fb4b5 commit f5da1b4
Show file tree
Hide file tree
Showing 18 changed files with 8,620 additions and 13,662 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ node_modules
/build
.cache
/js/npm/canvas_advanced_single/canvas_advanced_single.mjs
/js/npm/canvas_advanced_lite_single/canvas_advanced_single.mjs
/js/npm/canvas_advanced/canvas_advanced.mjs
/js/npm/canvas_advanced_lite/canvas_advanced.mjs
/js/npm/**/rive.wasm
/js/npm/**/rive.js
/js/npm/**/rive.js.map
Expand Down
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3b32d24314be7d877a11b8069622d6d6115383b7
014af5fff6e1a58788636f220b7ddace2fb8ba7f
11 changes: 9 additions & 2 deletions js/examples/_frameworks/parcel_example_canvas/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "regenerator-runtime";
import { Rive, Fit, Alignment, Layout, EventType } from "@rive-app/canvas";
// import { Rive, Fit, Alignment, Layout, EventType } from "@rive-app/canvas";
import { Rive, Fit, Alignment, Layout, EventType } from "@rive-app/canvas-lite";
//import { Rive, Fit, Alignment, Layout } from "@rive-app/webgl";
import AvatarAnimation from "./look.riv";
import TapeMeshAnimation from "./tape.riv";
Expand All @@ -10,6 +11,7 @@ import NestedDefaultAnimation from "./nested_default.riv";
import JigSaw from "./jigsaw.riv";
import StringRive from "./string.riv";
import RatingAnimation from "./rating_animation.riv";
import TextAnimation from "./text_test_2.riv";

const RIVE_EXAMPLES = {
0: {
Expand Down Expand Up @@ -54,6 +56,11 @@ const RIVE_EXAMPLES = {
hasStateMachine: true,
stateMachine: "String",
},
9: {
riveFile: TextAnimation,
hasStateMachine: true,
stateMachine: "State Machine 1",
},
};

async function loadFile(num) {
Expand Down Expand Up @@ -87,6 +94,6 @@ async function main(num) {
r.on(EventType.RiveEvent, onRiveEventReceived);
}

for (let i = 0; i < 9; i++) {
for (let i = 0; i < 10; i++) {
main(i);
}
Loading

0 comments on commit f5da1b4

Please sign in to comment.