Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.
Rive’s web runtime comes in two main packages: @rive-app/webgl2 and @rive-app/canvas. They expose the same API. The only difference is how they draw.For most use cases, use @rive-app/webgl2. It draws with the Rive Renderer, the same renderer as the Rive Editor, so everything you can author in Rive renders the way you designed it. @rive-app/canvas uses the browser’s own 2D renderer, which brings its own advantages (particularly for performance), but it does not yet support every Editor feature.Switching is a one-line import change, so you can try both and measure against your own content.
Note that if you’re using @rive-app/webgl2, browsers cap how many WebGL contexts a page can hold at once. The exact number varies by browser and device, and the oldest context is typically dropped once the cap is reached — which limits how many new Rive({...}) instances you can run. See WebGL Context Limits for more details.If you show several graphics on one page, set useOffscreenRenderer: true on each Rive object. Every instance then shares a single offscreen context instead of creating its own, which keeps you under the cap:
const r = new rive.Rive({ src: "https://cdn.rive.app/animations/vehicles.riv", canvas: document.getElementById("canvas"), artboard: "Truck", stateMachine: "bumpy", useOffscreenRenderer: true,});
This limit does not apply to @rive-app/canvas.
Fill rules
@rive-app/canvas uses the Canvas2D renderer, which offers the non-zero and even-odd fill rules, so Rive’s clockwise fill rule draws as non-zero. The result is identical unless a path has self-intersecting, reversed, or overlapping contours. This applies to both fills and clipping paths.
Performance
Today, @rive-app/webgl2 by default draws through a multisample anti-aliasing (MSAA) path.The Rive Renderer has a faster path to draw that relies on a GPU capability Metal and Vulkan already expose to native apps. On web browsers, it comes from WEBGL_shader_pixel_local_storage, a draft WebGL extension that Rive is helping to standardize. As browsers adopt it, @rive-app/webgl2 will pick it up automatically and draw faster.Until then, there are a few things you can do to get the most out of @rive-app/webgl2:
Use additive blending instead of advanced blend modes
On the MSAA path, any blend mode other than Normal (such as Screen, Multiply, or Color Dodge) forces the renderer to re-read the frame as it draws, and that cost adds up very quickly on mobile browsers.Additive blending doesn’t have that cost. In the Editor, it’s authored on a fill, stroke, or drawable set to the Normal blend mode, using the Additive strength slider, from 0% (ordinary Normal blending) to 100% (fully additive). The Rive Renderer draws it with the GPU’s standard hardware blending, the same as Normal, so it doesn’t re-read the frame. Additive strength can also be animated and data bound.If you use blend modes to brighten content, such as glows, fire, light effects, or particles, try additive blending first and keep advanced blend modes for effects that truly need them.
@rive-app/canvas draws additive blending at full strength and ignores the Additive strength amount, since Canvas2D can’t express partial additive blending.
Inkbleed antialiasing
@rive-app/webgl2 can draw with inkbleed, an antialiasing mode in the Rive Renderer offered as an alternative to MSAA. Instead of rendering multiple samples per pixel, it renders one and antialiases edges by bleeding them out about half a pixel, which avoids MSAA’s multisampled buffers.Opt in with enableInkbleed when you create the Rive instance:
import { Rive } from "@rive-app/webgl2";const r = new Rive({ canvas: document.getElementById("canvas"), src: "my-file.riv", stateMachine: "State Machine 1", autoplay: true, autoBind: true, enableInkbleed: true,});
Things to know before turning it on:
It disables the canvas’s native MSAA. The instance creates its WebGL2 context without MSAA so inkbleed can draw instead.
Edges bleed out by about half a pixel. This is most noticeable on thin strokes.
Fills are converted to the clockwise fill rule. Fills that use a different fill rule are converted on a best-effort basis, so check your content for visual differences.
It needs its own WebGL context. Inkbleed doesn’t apply when using the shared offscreen renderer (useOffscreenRenderer: true), so each instance with inkbleed counts toward the browser’s WebGL context limit.
If the renderer can’t use inkbleed, the runtime logs a one-time console warning and renders without it. Read inkbleed on the Rive instance to check whether it is in effect, or set it to toggle inkbleed at runtime.
Choosing a package for performance
Advanced blend modes on mobile are the case where @rive-app/canvas can be meaningfully faster, because Canvas2D blends natively. If your file still leans on them after moving what you can to additive blending, it is worth comparing the two.
Measure on real devices. Swapping packages is a one-line change, so testing each option is cheap.
Settling
By default, a playing Rive instance keeps requesting animation frames and advances its state machines on every one, even when nothing on screen is moving. It skips redrawing unchanged frames, but the per-frame advance still runs.When setting enableSettling: true on the Rive instance, the runtime notices when every playing state machine has nothing left to animate and stops there: it no longer advances or draws the graphic, and stops requesting animation frames for it. A graphic that sits idle between interactions then costs no per-frame work until something changes. If a gamepad is connected, the runtime still checks it each frame, but doesn’t advance or draw.The runtime wakes a settled instance and restarts the render loop when something changes, for example:
Pointer movement, clicks or scrolling on the canvas, when the graphic has listeners
Keyboard input and focus changes
Gamepad input
Setting state machine inputs or text runs
Setting view model property values from JavaScript
An asset changing after load, such as an image that finishes decoding
Changing the layout or resizing the canvas
If you change something the runtime can’t see, such as writing canvas.width directly, call drawFrame() to resume. You can check isSettled to see whether an instance is currently settled.enableSettling works in both @rive-app/canvas and @rive-app/webgl2. It’s off by default in v2 of the runtime, and will be on by default in the next major version.
const r = new rive.Rive({ src: "my_file.riv", canvas: document.getElementById("canvas"), stateMachine: "State Machine 1", autoplay: true, enableSettling: true,});
Deferred decoding
By default, the runtime decodes the whole .riv file when it loads. With deferDecoding: true set when instantiating Rive, it decodes only what it needs to start, and decodes artboards, animations and view model instances the first time they’re used. The first artboard in the file always decodes at load.This optimization shortens the work done at load for files that hold many artboards, animations or view model instances that a page doesn’t all use. Parts of the .riv the page never uses, apart from the first artboard, generally stay undecoded.deferDecoding works in both canvas and WebGL2 runtime variants. Set it on a RiveFile, or on Rive when it loads the file itself with src or buffer. If you pass a riveFile, set it on the RiveFile instead. It’s off by default.
const r = new rive.Rive({ src: "my_file.riv", canvas: document.getElementById("canvas"), stateMachine: "State Machine 1", autoplay: true, deferDecoding: true,});
Canvas package variants
Two variants of the canvas package are available if you have specific bundling needs.
@rive-app/canvas-lite
@rive-app/canvas-lite is the smallest Rive web package. It has the same API and renderer as @rive-app/canvas, but drops the text, layout, audio, and scripting engines, as well as Vector Feathering, to save space.Use it when your files do not rely on those features. If a file does use them, the affected content will not appear.
@rive-app/canvas-single
@rive-app/canvas-single bundles rive.wasm directly into the JavaScript file, so loading Rive takes one network request instead of two.Use it when you want to avoid a separate WASM request. The tradeoff is a larger JavaScript bundle.
Deprecated package
@rive-app/webgl is deprecated and receives no updates after v2.37.0. Move to @rive-app/webgl2, or to @rive-app/canvas if your file does not need the Rive Renderer. Neither move requires API changes — see the migration guide.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Rive","colors":{"primary":"#ffa41c","light":"#ffa41c","dark":"#ffa41c"},"logo":{"light":"https://mintcdn.com/rive/tBktbqSaEr9ZwywZ/logo/rive_top_logo_black.svg?fit=max\u0026auto=format\u0026n=tBktbqSaEr9ZwywZ\u0026q=85\u0026s=e09b8659935986a837947ae7c3b104e0","dark":"https://mintcdn.com/rive/tBktbqSaEr9ZwywZ/logo/rive_top_logo_white.svg?fit=max\u0026auto=format\u0026n=tBktbqSaEr9ZwywZ\u0026q=85\u0026s=d2ccc2c4dec459d584f578475de89248","href":"https://rive.app?utm_source=docs\u0026utm_medium=header_nav"},"favicon":"https://mintcdn.com/rive/IGEy4oJSivuQmjey/favicon_black.png?fit=max\u0026auto=format\u0026n=IGEy4oJSivuQmjey\u0026q=85\u0026s=986c81e5b82e1138420d773296030a3a","appearance":{"default":"dark"},"background":{"decoration":"grid"},"navbar":{"links":[{"href":"/tutorials/learn-rive","label":"Learn"},{"href":"/community/support","label":"Support"}],"primary":{"type":"button","label":"Get Rive","href":"https://rive.app/downloads?utm_source=docs\u0026utm_medium=header_nav"}},"footer":{"socials":{"youtube":"https://www.youtube.com/channel/UCPal2R1FxwRTPylhP_7ofEg","x":"https://twitter.com/rive_app","instagram":"https://www.instagram.com/rive.app","github":"https://github.com/rive-app","discord":"https://discord.gg/rive-app"},"links":[{"header":"Resources","items":[{"label":"Community","href":"https://community.rive.app?utm_source=docs\u0026utm_medium=footer_nav"},{"label":"Blog","href":"https://rive.app/blog?utm_source=docs\u0026utm_medium=footer_nav"},{"label":"Case Studies","href":"https://rive.app/blog/case-studies?utm_source=docs\u0026utm_medium=footer_nav"},{"label":"Marketplace","href":"https://rive.app/marketplace?utm_source=docs\u0026utm_medium=footer_nav"},{"label":"Feature Requests","href":"https://community.rive.app/c/feature-requests"}]},{"header":"Company","items":[{"label":"Careers","href":"https://rive.app/careers?utm_source=docs\u0026utm_medium=footer_nav"},{"label":"Terms of Service","href":"/docs/legal/terms-of-service"},{"label":"Acceptable Use Policy","href":"/docs/legal/acceptable-use-policy"},{"label":"Privacy Policy","href":"/docs/legal/privacy-policy"},{"label":"Data Protection Addendum","href":"/docs/legal/data-protection-addendum"},{"label":"Your Privacy Choices","href":"https://rive.app/?cookie-settings"}]}]},"fonts":{"heading":{"family":"Tomorrow Placeholder","weight":500,"source":"https://framerusercontent.com/assets/nCpxWS6DaPlPe0lHzStXAPCo3lw.woff2","format":"woff2"}},"integrations":{"amplitude":{"apiKey":"38803036884a752b104ee4bf501e0945"},"cookies":{"key":"rive_analytics","value":"granted"}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"variables":{"runtimeCurrentNameApple":"New Runtime","runtimeLegacyNameApple":"Legacy Runtime","monthlyCreditsVoyager":"$20","monthlyCreditsEnterprise":"$40","pricingCadetMonthly":"$17","pricingCadetYearly":"$108","pricingVoyagerMonthly":"$49","pricingVoyagerYearly":"$384","pricingEnterpriseYearly":"$1,440","cliAllowanceFree":"50","cliAllowanceCadet":"500","cliAllowanceVoyager":"5,000","versionWeb":"2.40.1","versionReact":"4.33.0","versionApple":"6.24.0","versionAndroid":"11.17.0","versionReactNative":"0.5.5","versionFlutter":"0.14.11","versionDevFlutter":"0.15.0-dev.4","versionUnity":"0.4.5","versionUnreal":"0.4.25","supportForm":"https://forms.rive.app/support?utm_medium=support_page","supportFormEducational":"https://forms.rive.app/education?utm_medium=support_page"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"rive","hasAudioNarration":false,"actualSubdomain":"rive","customDomains":["rive.app"],"gitSource":{"type":"github","owner":"rive-app","repo":"rive-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"edits":true,"issues":true,"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b0db37967c5598ea6b7537e","clientVersion":"0.0.4377","searchFilterCounts":[{"language":"default","tag":"Runtimes","count":293},{"language":"default","tag":"Scripting","count":194},{"language":"default","tag":"Scripting API","count":171},{"language":"default","tag":"Editor","count":108},{"language":"default","tag":"Fundamentals","count":94},{"language":"default","tag":"GPU","count":45},{"language":"default","tag":"Design","count":39},{"language":"default","tag":"Artboards","count":27},{"language":"default","tag":"Interfaces","count":26},{"language":"default","tag":"React Native","count":20}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":"p{font-size:14px}ul li{font-size:14px}ol li{font-size:14px}.signature .code-block{border:none}.signature .code-block [data-floating-buttons=\"true\"]{display:none}.signature .code-block [data-component-part=\"code-block-root\"]{background:none;padding:0}.dark .card{background-color:var(--background-dark)!important;border-color:rgb(255 255 255 / 0.1)!important}.dark .card:hover{border-color:var(--primary-light)!important}.prose tbody th[scope=\"row\"]{padding:0.5714286em 0.5714286em 0.5714286em 0;vertical-align:baseline;font-weight:600;color:var(--tw-prose-headings)}#footer a{max-width:none}"}]}
{"page":{"pagePath":"runtimes/web/canvas-vs-webgl","slug":"/runtimes/web/canvas-vs-webgl","pageMetadata":{"title":"Canvas vs WebGL2","description":"Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.","href":"/runtimes/web/canvas-vs-webgl"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Rive’s web runtime comes in two main packages: `,_jsx(_components.a,{href:`https://www.npmjs.com/package/@rive-app/webgl2`,children:_jsx(_components.code,{children:`@rive-app/webgl2`})}),` and `,_jsx(_components.a,{href:`https://www.npmjs.com/package/@rive-app/canvas`,children:_jsx(_components.code,{children:`@rive-app/canvas`})}),`. They expose the same API. The only difference is how they draw.`]}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[`For most use cases, use `,_jsx(_components.code,{children:`@rive-app/webgl2`}),`.`]}),` It draws with the Rive Renderer, the same renderer as the Rive Editor, so everything you can author in Rive renders the way you designed it. `,_jsx(_components.code,{children:`@rive-app/canvas`}),` uses the browser’s own 2D renderer, which brings its own advantages (particularly for performance), but it does not yet support every Editor feature.`]}),`\n`,_jsx(_components.p,{children:`Switching is a one-line import change, so you can try both and measure against your own content.`}),`\n`,_jsx(Heading,{level:`2`,id:`comparison`,children:`Comparison`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{}),_jsxs(_components.th,{children:[_jsx(_components.code,{children:`@rive-app/webgl2`}),` (recommended)`]}),_jsx(_components.th,{children:_jsx(_components.code,{children:`@rive-app/canvas`})})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Draws with`}),_jsxs(_components.td,{children:[`The `,_jsx(_components.a,{href:`https://rive.app/renderer?utm_source=docs\u0026utm_medium=content`,children:`Rive Renderer`}),` on WebGL2`]}),_jsxs(_components.td,{children:[`The browser’s `,_jsx(_components.a,{href:`https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API`,children:`Canvas2D`}),` API`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Rendering features`}),_jsx(_components.td,{children:`✅ All supported`}),_jsxs(_components.td,{children:[`🟡 Some features are not available (see `,_jsx(_components.a,{href:`/feature-support#feature-support-by-runtime`,children:`Feature Support`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Editor fidelity`}),_jsx(_components.td,{children:`✅ The same renderer the Rive Editor uses`}),_jsxs(_components.td,{children:[`🟡 Matches for nearly all content (see `,_jsx(_components.a,{href:`#fill-rules`,children:`Fill Rules`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Blend modes`}),_jsxs(_components.td,{children:[`🟡 All blend modes supported. Normal and additive are highly recommended, as advanced blend modes are expensive (see `,_jsx(_components.a,{href:`#use-additive-blending-instead-of-advanced-blend-modes`,children:`Performance`}),`)`]}),_jsx(_components.td,{children:`🟡 All blend modes at no extra cost, but additive always draws at full strength`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Graphics per page`}),_jsxs(_components.td,{children:[`🟡 Bound by the browser’s WebGL context limit (see `,_jsx(_components.a,{href:`#webgl-context-limits`,children:`WebGL Context Limits`}),`)`]}),_jsx(_components.td,{children:`✅ No practical limit`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`other-notable-tradeoffs`,children:`Other notable tradeoffs`}),`\n`,_jsx(Heading,{level:`3`,id:`webgl-context-limits`,children:`WebGL context limits`}),`\n`,_jsxs(_components.p,{children:[`Note that if you’re using `,_jsx(_components.code,{children:`@rive-app/webgl2`}),`, browsers cap how many WebGL contexts a page can hold at once. The exact number varies by browser and device, and the oldest context is typically dropped once the cap is reached — which limits how many `,_jsx(_components.code,{children:`new Rive({...})`}),` instances you can run. See `,_jsx(_components.a,{href:`https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_context_limits`,children:`WebGL Context Limits`}),` for more details.`]}),`\n`,_jsxs(_components.p,{children:[`If you show several graphics on one page, set `,_jsx(_components.code,{children:`useOffscreenRenderer: true`}),` on each Rive object. Every instance then shares a single offscreen context instead of creating its own, which keeps you under the cap:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` rive`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Rive`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` src:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://cdn.rive.app/animations/vehicles.riv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` canvas:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getElementById`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"canvas\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` artboard:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Truck\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stateMachine:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"bumpy\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` useOffscreenRenderer:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This limit does not apply to `,_jsx(_components.code,{children:`@rive-app/canvas`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`fill-rules`,children:`Fill rules`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`@rive-app/canvas`}),` uses the Canvas2D renderer, which offers the non-zero and even-odd `,_jsx(_components.a,{href:`/editor/fundamentals/fill-and-stroke#fill-rules`,children:`fill rules`}),`, so Rive’s clockwise fill rule draws as non-zero. The result is identical unless a path has self-intersecting, reversed, or overlapping contours. This applies to both fills and clipping paths.`]}),`\n`,_jsx(Heading,{level:`2`,id:`performance`,children:`Performance`}),`\n`,_jsxs(_components.p,{children:[`Today, `,_jsx(_components.code,{children:`@rive-app/webgl2`}),` by default draws through a multisample anti-aliasing (MSAA) path.`]}),`\n`,_jsxs(_components.p,{children:[`The Rive Renderer has a faster path to draw that relies on a GPU capability Metal and Vulkan already expose to native apps. On web browsers, it comes from `,_jsx(_components.a,{href:`https://www.khronos.org/registry/webgl/extensions/WEBGL_shader_pixel_local_storage/`,children:_jsx(_components.code,{children:`WEBGL_shader_pixel_local_storage`})}),`, a draft WebGL extension that Rive is helping to standardize. As browsers adopt it, `,_jsx(_components.code,{children:`@rive-app/webgl2`}),` will pick it up automatically and draw faster.`]}),`\n`,_jsxs(_components.p,{children:[`Until then, there are a few things you can do to get the most out of `,_jsx(_components.code,{children:`@rive-app/webgl2`}),`:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`#use-additive-blending-instead-of-advanced-blend-modes`,children:`Use additive blending instead of advanced blend modes`}),` where your design allows it.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`#inkbleed-antialiasing`,children:`Opt in to inkbleed antialiasing`}),` and measure it against MSAA on your content.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`use-additive-blending-instead-of-advanced-blend-modes`,children:`Use additive blending instead of advanced blend modes`}),`\n`,_jsxs(_components.p,{children:[`On the MSAA path, any blend mode other than `,_jsx(_components.strong,{children:`Normal`}),` (such as Screen, Multiply, or Color Dodge) forces the renderer to re-read the frame as it draws, and that cost adds up very quickly on mobile browsers.`]}),`\n`,_jsxs(_components.p,{children:[`Additive blending doesn’t have that cost. In the Editor, it’s authored on a fill, stroke, or drawable set to the `,_jsx(_components.strong,{children:`Normal`}),` blend mode, using the `,_jsx(_components.strong,{children:`Additive strength`}),` slider, from 0% (ordinary Normal blending) to 100% (fully additive). The Rive Renderer draws it with the GPU’s standard hardware blending, the same as Normal, so it doesn’t re-read the frame. Additive strength can also be animated and data bound.`]}),`\n`,_jsx(_components.p,{children:`If you use blend modes to brighten content, such as glows, fire, light effects, or particles, try additive blending first and keep advanced blend modes for effects that truly need them.`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`@rive-app/canvas`}),` draws additive blending at full strength and ignores the `,_jsx(_components.strong,{children:`Additive strength`}),` amount, since Canvas2D can’t express partial additive blending.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`inkbleed-antialiasing`,children:`Inkbleed antialiasing`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`@rive-app/webgl2`}),` can draw with `,_jsx(_components.strong,{children:`inkbleed`}),`, an antialiasing mode in the Rive Renderer offered as an alternative to MSAA. Instead of rendering multiple samples per pixel, it renders one and antialiases edges by bleeding them out about half a pixel, which avoids MSAA’s multisampled buffers.`]}),`\n`,_jsxs(_components.p,{children:[`Opt in with `,_jsx(_components.code,{children:`enableInkbleed`}),` when you create the Rive instance:`]}),`\n`,_jsx(CodeBlock,{filename:``,highlight:`[9]`,numberOfLines:`10`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Rive`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"@rive-app/webgl2\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Rive`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` canvas:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getElementById`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"canvas\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` src:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"my-file.riv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stateMachine:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"State Machine 1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autoplay:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autoBind:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` enableInkbleed:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Things to know before turning it on:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`It disables the canvas’s native MSAA.`}),` The instance creates its WebGL2 context without MSAA so inkbleed can draw instead.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Edges bleed out by about half a pixel.`}),` This is most noticeable on thin strokes.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Fills are converted to the clockwise `,_jsx(_components.a,{href:`/editor/fundamentals/fill-and-stroke#fill-rule`,children:`fill rule`}),`.`]}),` Fills that use a different fill rule are converted on a best-effort basis, so check your content for visual differences.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`It needs its own WebGL context.`}),` Inkbleed doesn’t apply when using the shared offscreen renderer (`,_jsx(_components.code,{children:`useOffscreenRenderer: true`}),`), so each instance with inkbleed counts toward the browser’s `,_jsx(_components.a,{href:`#webgl-context-limits`,children:`WebGL context limit`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`If the renderer can’t use inkbleed, the runtime logs a one-time console warning and renders without it. Read `,_jsx(_components.a,{href:`/runtimes/web/rive-parameters#inkbleed`,children:_jsx(_components.code,{children:`inkbleed`})}),` on the Rive instance to check whether it is in effect, or set it to toggle inkbleed at runtime.`]}),`\n`,_jsx(Heading,{level:`3`,id:`choosing-a-package-for-performance`,children:`Choosing a package for performance`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Advanced blend modes on mobile are the case where `,_jsx(_components.code,{children:`@rive-app/canvas`}),` can be meaningfully faster, because Canvas2D blends natively. If your file still leans on them after moving what you can to additive blending, it is worth comparing the two.`]}),`\n`,_jsx(_components.li,{children:`Measure on real devices. Swapping packages is a one-line change, so testing each option is cheap.`}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`settling`,children:`Settling`}),`\n`,_jsxs(_components.p,{children:[`By default, a playing `,_jsx(_components.code,{children:`Rive`}),` instance keeps requesting animation frames and advances its state machines on every one, even when nothing on screen is moving. It skips redrawing unchanged frames, but the per-frame advance still runs.`]}),`\n`,_jsxs(_components.p,{children:[`When setting `,_jsx(_components.a,{href:`/runtimes/web/rive-parameters`,children:_jsx(_components.code,{children:`enableSettling: true`})}),` on the Rive instance, the runtime notices when every playing state machine has nothing left to animate and stops there: it no longer advances or draws the graphic, and stops requesting animation frames for it. A graphic that sits idle between interactions then costs no per-frame work until something changes. If a gamepad is connected, the runtime still checks it each frame, but doesn’t advance or draw.`]}),`\n`,_jsx(_components.p,{children:`The runtime wakes a settled instance and restarts the render loop when something changes, for example:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Pointer movement, clicks or scrolling on the canvas, when the graphic has listeners`}),`\n`,_jsx(_components.li,{children:`Keyboard input and focus changes`}),`\n`,_jsx(_components.li,{children:`Gamepad input`}),`\n`,_jsx(_components.li,{children:`Setting state machine inputs or text runs`}),`\n`,_jsx(_components.li,{children:`Setting view model property values from JavaScript`}),`\n`,_jsx(_components.li,{children:`An asset changing after load, such as an image that finishes decoding`}),`\n`,_jsx(_components.li,{children:`Changing the layout or resizing the canvas`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`If you change something the runtime can’t see, such as writing `,_jsx(_components.code,{children:`canvas.width`}),` directly, call `,_jsx(_components.code,{children:`drawFrame()`}),` to resume. You can check `,_jsx(_components.a,{href:`/runtimes/web/rive-parameters#issettled`,children:_jsx(_components.code,{children:`isSettled`})}),` to see whether an instance is currently settled.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`enableSettling`}),` works in both `,_jsx(_components.code,{children:`@rive-app/canvas`}),` and `,_jsx(_components.code,{children:`@rive-app/webgl2`}),`. It’s off by default in v2 of the runtime, and will be on by default in the next major version.`]}),`\n`,_jsx(CodeBlock,{filename:``,highlight:`[6]`,numberOfLines:`7`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` rive`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Rive`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` src:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"my_file.riv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` canvas:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getElementById`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"canvas\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stateMachine:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"State Machine 1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autoplay:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` enableSettling:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`deferred-decoding`,children:`Deferred decoding`}),`\n`,_jsxs(_components.p,{children:[`By default, the runtime decodes the whole `,_jsx(_components.code,{children:`.riv`}),` file when it loads. With `,_jsx(_components.a,{href:`/runtimes/web/rive-parameters`,children:_jsx(_components.code,{children:`deferDecoding: true`})}),` set when instantiating Rive, it decodes only what it needs to start, and decodes artboards, animations and view model instances the first time they’re used. The first artboard in the file always decodes at load.`]}),`\n`,_jsxs(_components.p,{children:[`This optimization shortens the work done at load for files that hold many artboards, animations or view model instances that a page doesn’t all use. Parts of the `,_jsx(_components.code,{children:`.riv`}),` the page never uses, apart from the first artboard, generally stay undecoded.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`deferDecoding`}),` works in both canvas and WebGL2 runtime variants. Set it on a `,_jsx(_components.code,{children:`RiveFile`}),`, or on `,_jsx(_components.code,{children:`Rive`}),` when it loads the file itself with `,_jsx(_components.code,{children:`src`}),` or `,_jsx(_components.code,{children:`buffer`}),`. If you pass a `,_jsx(_components.code,{children:`riveFile`}),`, set it on the `,_jsx(_components.code,{children:`RiveFile`}),` instead. It’s off by default.`]}),`\n`,_jsx(CodeBlock,{filename:``,highlight:`[6]`,numberOfLines:`7`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` rive`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Rive`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` src:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"my_file.riv\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` canvas:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getElementById`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"canvas\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` stateMachine:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"State Machine 1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autoplay:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` deferDecoding:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`canvas-package-variants`,children:`Canvas package variants`}),`\n`,_jsx(_components.p,{children:`Two variants of the canvas package are available if you have specific bundling needs.`}),`\n`,_jsx(Heading,{level:`3`,id:`@rive-app/canvas-lite`,children:_jsx(_components.code,{children:`@rive-app/canvas-lite`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://www.npmjs.com/package/@rive-app/canvas-lite`,children:_jsx(_components.code,{children:`@rive-app/canvas-lite`})}),` is the smallest Rive web package. It has the same API and renderer as `,_jsx(_components.code,{children:`@rive-app/canvas`}),`, but drops the text, layout, audio, and scripting engines, as well as Vector Feathering, to save space.`]}),`\n`,_jsx(_components.p,{children:`Use it when your files do not rely on those features. If a file does use them, the affected content will not appear.`}),`\n`,_jsx(Heading,{level:`3`,id:`@rive-app/canvas-single`,children:_jsx(_components.code,{children:`@rive-app/canvas-single`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://www.npmjs.com/package/@rive-app/canvas-single`,children:_jsx(_components.code,{children:`@rive-app/canvas-single`})}),` bundles `,_jsx(_components.code,{children:`rive.wasm`}),` directly into the JavaScript file, so loading Rive takes one network request instead of two.`]}),`\n`,_jsx(_components.p,{children:`Use it when you want to avoid a separate WASM request. The tradeoff is a larger JavaScript bundle.`}),`\n`,_jsx(Heading,{level:`2`,id:`deprecated-package`,children:`Deprecated package`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`@rive-app/webgl`}),` is deprecated and receives no updates after `,_jsx(_components.code,{children:`v2.37.0`}),`. Move to `,_jsx(_components.code,{children:`@rive-app/webgl2`}),`, or to `,_jsx(_components.code,{children:`@rive-app/canvas`}),` if your file does not need the Rive Renderer. Neither move requires API changes — see the `,_jsx(_components.a,{href:`/runtimes/web/migration-guides`,children:`migration guide`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Canvas vs WebGL2","description":"Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.","href":"/runtimes/web/canvas-vs-webgl"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Comparison","slug":"comparison","depth":2,"children":[]},{"title":"Other notable tradeoffs","slug":"other-notable-tradeoffs","depth":2,"children":[{"title":"WebGL context limits","slug":"webgl-context-limits","depth":3,"children":[]},{"title":"Fill rules","slug":"fill-rules","depth":3,"children":[]}]},{"title":"Performance","slug":"performance","depth":2,"children":[{"title":"Use additive blending instead of advanced blend modes","slug":"use-additive-blending-instead-of-advanced-blend-modes","depth":3,"children":[]},{"title":"Inkbleed antialiasing","slug":"inkbleed-antialiasing","depth":3,"children":[]},{"title":"Choosing a package for performance","slug":"choosing-a-package-for-performance","depth":3,"children":[]},{"title":"Settling","slug":"settling","depth":3,"children":[]},{"title":"Deferred decoding","slug":"deferred-decoding","depth":3,"children":[]}]},{"title":"Canvas package variants","slug":"canvas-package-variants","depth":2,"children":[{"title":"@rive-app/canvas-lite","slug":"@rive-app/canvas-lite","depth":3,"children":[]},{"title":"@rive-app/canvas-single","slug":"@rive-app/canvas-single","depth":3,"children":[]}]},{"title":"Deprecated package","slug":"deprecated-package","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/rive/6157a238f0df2356/rive-init.js","/docs/_mintlify/custom/rive/c97753ebb7d5aae6/rive-consent.js"],"subdomain":"rive","siteName":"Rive","title":"Canvas vs WebGL2 - Rive","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-24T22:26:15.027Z","originalFileLocation":"runtimes/web/canvas-vs-webgl.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Rive\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Canvas vs WebGL2 - Rive\">\u003cmeta data-mint-head property=\"og:description\" content=\"Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Rive\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://rive.app/docs/runtimes/web/canvas-vs-webgl\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://rive.mintlify.site/docs/_mintlify/api/og/v2?division=Web+%28JS%29\u0026amp;title=Canvas+vs+WebGL2\u0026amp;description=Choose+between+the+%40rive-app%2Fwebgl2+and+%40rive-app%2Fcanvas+runtime+packages.\u0026amp;theme=2e225578d6f0bf137ea455bc\u0026amp;signature=2a44a3cb8e89ee45ab477c14978514cc96089ecce408ad952745c5505cb2520b\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Canvas vs WebGL2 - Rive\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://rive.mintlify.site/docs/_mintlify/api/og/v2?division=Web+%28JS%29\u0026amp;title=Canvas+vs+WebGL2\u0026amp;description=Choose+between+the+%40rive-app%2Fwebgl2+and+%40rive-app%2Fcanvas+runtime+packages.\u0026amp;theme=2e225578d6f0bf137ea455bc\u0026amp;signature=2a44a3cb8e89ee45ab477c14978514cc96089ecce408ad952745c5505cb2520b\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/rive/QOppeg00QlFTw5Bu/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Rive\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#ffa41c\">\u003clink data-mint-head rel=\"canonical\" href=\"https://rive.app/docs/runtimes/web/canvas-vs-webgl\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/runtimes/web/canvas-vs-webgl.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://rive.app/#organization\",\"name\":\"Rive\",\"url\":\"https://rive.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/rive/tBktbqSaEr9ZwywZ/logo/rive_top_logo_black.svg?fit=max\u0026auto=format\u0026n=tBktbqSaEr9ZwywZ\u0026q=85\u0026s=e09b8659935986a837947ae7c3b104e0\"}},{\"@type\":\"WebSite\",\"@id\":\"https://rive.app/docs#website\",\"name\":\"Rive\",\"url\":\"https://rive.app/docs\",\"publisher\":{\"@id\":\"https://rive.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://rive.app/docs/runtimes/web/canvas-vs-webgl#webpage\",\"url\":\"https://rive.app/docs/runtimes/web/canvas-vs-webgl\",\"name\":\"Canvas vs WebGL2\",\"description\":\"Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.\",\"dateModified\":\"2026-11-24T22:26:15.027Z\",\"isPartOf\":{\"@id\":\"https://rive.app/docs#website\"},\"breadcrumb\":{\"@id\":\"https://rive.app/docs/runtimes/web/canvas-vs-webgl#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://rive.app/docs/runtimes/web/canvas-vs-webgl#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Runtimes\",\"item\":\"https://rive.app/docs/runtimes/web/web-js\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web (JS)\",\"item\":\"https://rive.app/docs/runtimes/web/web-js\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Canvas vs WebGL2\",\"item\":\"https://rive.app/docs/runtimes/web/canvas-vs-webgl\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://rive.app/docs/runtimes/web/canvas-vs-webgl#article\",\"headline\":\"Canvas vs WebGL2\",\"name\":\"Canvas vs WebGL2\",\"description\":\"Choose between the @rive-app/webgl2 and @rive-app/canvas runtime packages.\",\"url\":\"https://rive.app/docs/runtimes/web/canvas-vs-webgl\",\"mainEntityOfPage\":{\"@id\":\"https://rive.app/docs/runtimes/web/canvas-vs-webgl#webpage\"},\"dateModified\":\"2026-11-24T22:26:15.027Z\",\"publisher\":{\"@id\":\"https://rive.app/#organization\"},\"isPartOf\":{\"@id\":\"https://rive.app/docs#website\"}}]}\u003c/script>","agentPointerHref":"/docs/runtimes/web/canvas-vs-webgl.md","siteName":"Rive","nav":{"global":null,"tabs":[{"tab":"Home","pages":[{"title":"Home","href":"/getting-started/introduction"}]},{"tab":"Editor","pages":[{"title":"Editor","href":"/editor/get-rive"}]},{"tab":"Scripting","pages":[{"title":"Scripting","href":"/scripting/getting-started"}]},{"tab":"Runtimes","groups":[{"group":" ","pages":[{"title":"Getting Started with the Rive Runtimes","sidebarTitle":"Getting Started","href":"/runtimes/getting-started"},{"title":"Rive Runtime Demos \u0026 Starters","sidebarTitle":"Demos","mode":"wide","href":"/runtimes/demos"},{"title":"Feature Support","href":"/feature-support"},{"title":"Runtime Sizes","href":"/runtimes/runtime-sizes"},{"title":"Choosing a Renderer","href":"/runtimes/choose-a-renderer/overview"},{"group":"File formats","pages":[{"title":".riv File Format","href":"/runtimes/advanced-topic/format"},{"title":"Rive Markup Language (RML)","sidebarTitle":"RML","href":"/runtimes/advanced-topic/rml"}]}]},{"group":"Runtimes","pages":[{"group":"Web (JS)","pages":[{"title":"Getting Started","description":"JavaScript/WASM runtime for Rive.","href":"/runtimes/web/web-js"},{"title":"Canvas vs WebGL2","href":"/runtimes/web/canvas-vs-webgl"},{"title":"Rive Parameters","description":"API docs for the Rive instance.","href":"/runtimes/web/rive-parameters"},{"title":"Artboards","href":"/runtimes/web/artboards"},{"title":"Layout","href":"/runtimes/web/layouts"},{"title":"State Machine Playback","href":"/runtimes/web/state-machines"},{"title":"Data Binding","href":"/runtimes/web/data-binding"},{"title":"Loading Assets","href":"/runtimes/web/loading-assets"},{"title":"Fonts","href":"/runtimes/web/fonts"},{"title":"Semantics","href":"/runtimes/web/semantics"},{"title":"Focus","href":"/runtimes/web/focus"},{"title":"Text and key input","sidebarTitle":"Text and Key Input","href":"/runtimes/web/text-and-key-input"},{"title":"Gamepad Input","href":"/runtimes/web/gamepad"},{"title":"GPU Canvas","href":"/runtimes/web/gpu-canvas"},{"title":"Preloading WASM","href":"/runtimes/web/preloading-wasm"},{"title":"Caching a Rive File","href":"/runtimes/web/caching-a-rive-file"},{"title":"Playing Audio","href":"/runtimes/web/playing-audio"},{"title":"Low-level API Usage","href":"/runtimes/web/low-level-api-usage"},{"group":"Legacy Features","pages":[{"title":"Animation Playback","href":"/runtimes/web/animation-playback"},{"title":"Inputs","href":"/runtimes/web/inputs"},{"title":"Text","href":"/runtimes/web/text"},{"title":"Rive Events","href":"/runtimes/web/rive-events"}]},{"title":"Migration Guides","href":"/runtimes/web/migration-guides"},{"title":"FAQ","href":"/runtimes/web/faq"}]},{"group":"React","pages":[{"title":"React","sidebarTitle":"Getting Started","href":"/runtimes/react/react"},{"title":"Parameters and Return Values","href":"/runtimes/react/parameters-and-return-values"},{"title":"Artboards","href":"/runtimes/react/artboards"},{"title":"Layout","href":"/runtimes/react/layouts"},{"title":"State Machine Playback","href":"/runtimes/react/state-machines"},{"title":"Data Binding","href":"/runtimes/react/data-binding"},{"title":"Loading Assets","href":"/runtimes/react/loading-assets"},{"title":"Fonts","href":"/runtimes/react/fonts"},{"title":"Semantics","href":"/runtimes/react/semantics"},{"title":"Focus","href":"/runtimes/react/focus"},{"title":"Text and key input","sidebarTitle":"Text and Key Input","href":"/runtimes/react/text-and-key-input"},{"title":"GPU Canvas","href":"/runtimes/react/gpu-canvas"},{"title":"Preloading WASM","href":"/runtimes/react/preloading-wasm"},{"title":"Caching a Rive File","href":"/runtimes/react/caching-a-rive-file"},{"title":"Playing Audio","href":"/runtimes/react/playing-audio"},{"title":"Rendering to a Bitmap","href":"/runtimes/react/rendering-to-a-bitmap"},{"title":"Best Practices","href":"/runtimes/react/best-practices"},{"group":"Legacy Features","pages":[{"title":"Animation Playback","href":"/runtimes/react/animation-playback"},{"title":"Inputs","href":"/runtimes/react/inputs"},{"title":"Text","href":"/runtimes/react/text"},{"title":"Rive Events","href":"/runtimes/react/rive-events"}]},{"title":"Migration Guides","href":"/runtimes/react/migration-guides"}]},{"group":"React Native","pages":[{"title":"React Native","href":"/runtimes/react-native/react-native"},{"title":"GPU Canvas","href":"/runtimes/react-native/gpu-canvas"},{"title":"Loading Rive Files","href":"/runtimes/react-native/loading-rive-files"},{"title":"Props","href":"/runtimes/react-native/props"},{"title":"Rive Ref Methods","href":"/runtimes/react-native/rive-ref-methods"},{"title":"Error Handling","href":"/runtimes/react-native/error-handling"},{"title":"Adding Rive to Expo","href":"/runtimes/react-native/adding-rive-to-expo"},{"title":"Native SDK Version Customization","sidebarTitle":"Custom SDK Version","href":"/runtimes/react-native/native-version-customization"},{"title":"Artboards","href":"/runtimes/react-native/artboards"},{"title":"Layout","href":"/runtimes/react-native/layouts"},{"title":"State Machine Playback","href":"/runtimes/react-native/state-machines"},{"title":"Data Binding","href":"/runtimes/react-native/data-binding"},{"title":"TypeScript Schemas","href":"/runtimes/react-native/typescript-schemas"},{"title":"Loading Assets","href":"/runtimes/react-native/loading-assets"},{"title":"Fonts","href":"/runtimes/react-native/fonts"},{"title":"Caching a Rive File","href":"/runtimes/react-native/caching-a-rive-file"},{"title":"Semantics","href":"/runtimes/react-native/semantics"},{"title":"Playing Audio","href":"/runtimes/react-native/playing-audio"},{"title":"Logging","href":"/runtimes/react-native/logging"},{"group":"Legacy Features","pages":[{"title":"Animation Playback","href":"/runtimes/react-native/animation-playback"},{"title":"Inputs","href":"/runtimes/react-native/inputs"},{"title":"Text","href":"/runtimes/react-native/text"},{"title":"Rive Events","href":"/runtimes/react-native/rive-events"}]},{"title":"Migration Guide","href":"/runtimes/react-native/migration-guide"}]},{"group":"Flutter","pages":[{"title":"Flutter","href":"/runtimes/flutter/flutter"},{"title":"Rive Native for Flutter","href":"/runtimes/flutter/rive-native"},{"title":"Artboards","href":"/runtimes/flutter/artboards"},{"title":"Layout","href":"/runtimes/flutter/layouts"},{"title":"State Machine Playback","href":"/runtimes/flutter/state-machines"},{"title":"Data Binding","href":"/runtimes/flutter/data-binding"},{"title":"Loading Assets","href":"/runtimes/flutter/loading-assets"},{"title":"Fonts","href":"/runtimes/flutter/fonts"},{"title":"Semantics","href":"/runtimes/flutter/semantics"},{"title":"Caching a Rive File","href":"/runtimes/flutter/caching-a-rive-file"},{"title":"Playing Audio","href":"/runtimes/flutter/playing-audio"},{"group":"Legacy Features","pages":[{"title":"Animation Playback","href":"/runtimes/flutter/animation-playback"},{"title":"Inputs","href":"/runtimes/flutter/inputs"},{"title":"Text","href":"/runtimes/flutter/text"},{"title":"Rive Events","href":"/runtimes/flutter/rive-events"}]},{"title":"Migration Guide","href":"/runtimes/flutter/migration-guide"},{"title":"FAQ","href":"/runtimes/flutter/faq"},{"title":"Flutter API Reference","sidebarTitle":"API Reference","href":"/runtimes/flutter/api-reference"}]},{"group":"Apple","pages":[{"title":"Apple","href":"/runtimes/apple/apple"},{"title":"GPU Canvas","href":"/runtimes/apple/gpu-canvas"},{"title":"FAQ","href":"/runtimes/apple/faq"},{"title":"Resource Usage","href":"/runtimes/apple/resource-usage"},{"title":"Artboards","href":"/runtimes/apple/artboards"},{"title":"Layout","href":"/runtimes/apple/layouts"},{"title":"State Machine Playback","href":"/runtimes/apple/state-machines"},{"title":"Data Binding","href":"/runtimes/apple/data-binding"},{"title":"Loading Assets","href":"/runtimes/apple/loading-assets"},{"title":"Fonts","href":"/runtimes/apple/fonts"},{"title":"Caching a Rive File","href":"/runtimes/apple/caching-a-rive-file"},{"title":"Deferred File Loading","href":"/runtimes/apple/deferred-file-loading"},{"title":"Semantics","href":"/runtimes/apple/semantics"},{"title":"Focus","href":"/runtimes/apple/focus"},{"title":"Playing Audio","href":"/runtimes/apple/playing-audio"},{"title":"Logging","href":"/runtimes/apple/logging"},{"group":"Legacy Features","pages":[{"title":"Animation Playback","href":"/runtimes/apple/animation-playback"},{"title":"Inputs","href":"/runtimes/apple/inputs"},{"title":"Text","href":"/runtimes/apple/text"},{"title":"Rive Events","href":"/runtimes/apple/rive-events"}]},{"title":"Migration Guides","href":"/runtimes/apple/migration-guides"},{"title":"Migrating from the Legacy Rive Apple Runtime","sidebarTitle":"Migrating from Legacy","href":"/runtimes/apple/migrating-from-legacy"}]},{"group":"Android","pages":[{"title":"Android","href":"/runtimes/android/android"},{"title":"GPU Canvas","href":"/runtimes/android/gpu-canvas"},{"title":"Artboards","href":"/runtimes/android/artboards"},{"title":"Layout","href":"/runtimes/android/layouts"},{"title":"State Machine Playback","href":"/runtimes/android/state-machines"},{"title":"Data Binding","href":"/runtimes/android/data-binding"},{"title":"Loading Assets","href":"/runtimes/android/loading-assets"},{"title":"Fonts","href":"/runtimes/android/fonts"},{"title":"Caching a Rive File","href":"/runtimes/android/caching-a-rive-file"},{"title":"Playing Audio","href":"/runtimes/android/playing-audio"},{"title":"Logging","href":"/runtimes/android/logging"},{"title":"Handling a lost render context","sidebarTitle":"Render Context Loss","href":"/runtimes/android/handling-render-context-loss"},{"title":"Rendering to a Bitmap","href":"/runtimes/android/rendering-to-a-bitmap"},{"group":"Legacy Features","pages":[{"title":"Getting Started (Legacy API)","href":"/runtimes/android/legacy-getting-started"},{"title":"Animation Playback","href":"/runtimes/android/animation-playback"},{"title":"Inputs","href":"/runtimes/android/inputs"},{"title":"Text","href":"/runtimes/android/text"},{"title":"Rive Events","href":"/runtimes/android/rive-events"}]},{"title":"Migrating from the Legacy Rive Android Runtime","sidebarTitle":"Migrating from Legacy","href":"/runtimes/android/migrating-from-legacy"},{"title":"API Reference","url":"https://api-docs.rive.app/android/latest/","href":"/runtimes/android/api-reference"}]},{"group":"Unity","pages":[{"title":"Unity","href":"/game-runtimes/unity/unity"},{"title":"Getting Started","href":"/game-runtimes/unity/getting-started"},{"title":"Fundamentals","href":"/game-runtimes/unity/fundamentals"},{"title":"Components","href":"/game-runtimes/unity/components"},{"title":"Best Practices","href":"/game-runtimes/unity/best-practices"},{"title":"Layouts","href":"/game-runtimes/unity/layouts"},{"title":"Listeners","href":"/game-runtimes/unity/listeners"},{"title":"State Machines","href":"/game-runtimes/unity/state-machines"},{"title":"Data Binding","href":"/game-runtimes/unity/data-binding"},{"title":"Loading Assets","href":"/game-runtimes/unity/loading-assets"},{"title":"Audio","href":"/game-runtimes/unity/audio"},{"group":"Tutorials","pages":[{"title":"Control a health bar with data binding in Unity","href":"/game-runtimes/unity/tutorials/health-bar"}]},{"title":"Procedural Rendering","href":"/game-runtimes/unity/procedural-rendering"},{"title":"Runtime Asset Swapping","href":"/game-runtimes/unity/runtime-asset-swapping"},{"title":"FAQ","href":"/game-runtimes/unity/faq"},{"group":"Legacy Features","pages":[{"title":"Inputs","href":"/game-runtimes/unity/inputs"},{"title":"Text","href":"/game-runtimes/unity/text"},{"title":"Rive Events","href":"/game-runtimes/unity/rive-events"}]}]},{"group":"Unreal","pages":[{"title":"Unreal Engine","href":"/game-runtimes/unreal/unreal"},{"title":"Getting Started","href":"/game-runtimes/unreal/getting-started"},{"title":"Observing ViewModel Changes","href":"/game-runtimes/unreal/observing-viewmodel-changes"},{"title":"Using Triggers","href":"/game-runtimes/unreal/using-triggers"},{"title":"Runtime Asset Swapping","href":"/game-runtimes/unreal/runtime-asset-swapping"},{"title":"World-Space RenderTargets","href":"/game-runtimes/unreal/in-world-textures"}]},{"group":"C++","pages":[{"title":"C++ Runtime","sidebarTitle":"Overview","href":"/runtimes/cpp/overview"},{"title":"Getting Started","href":"/runtimes/cpp/getting-started"},{"title":"File \u0026 Artboard","href":"/runtimes/cpp/file-and-artboard"},{"title":"State Machines","href":"/runtimes/cpp/state-machines"},{"title":"Data Binding","href":"/runtimes/cpp/data-binding"},{"title":"Asset Loading","href":"/runtimes/cpp/asset-loading"},{"title":"Rendering Loop","href":"/runtimes/cpp/rendering-loop"},{"title":"Command Queue","href":"/runtimes/cpp/command-queue"},{"title":"Renderers","href":"/runtimes/cpp/renderers"},{"title":"External Renderer","href":"/runtimes/cpp/external-renderer"}]},{"title":"Defold","href":"/game-runtimes/defold"},{"group":"Community Runtimes","pages":[{"title":"Angular","href":"/runtimes/community-runtimes/angular"},{"title":"C# (UWP)","href":"/runtimes/community-runtimes/c-sharp"},{"title":"Qt / QtQuick","href":"/runtimes/community-runtimes/qt-quick"},{"title":"RiveCMP","href":"/runtimes/community-runtimes/rive-cmp"}]}]},{"group":"Integrations","pages":[{"title":"3rd Party Integrations","href":"/integrations/overview"},{"title":"HTML Embed","href":"/integrations/html-embed"}]}]},{"tab":"CLI","pages":[{"title":"CLI","href":"/cli/overview"}]},{"tab":" ","pages":[{"title":" ","href":"/tutorials/learn-rive"}]},{"tab":" ","pages":[{"title":" ","href":"/community/support"}]}]},"basePath":"","title":"Canvas vs WebGL2 - Rive","deploymentId":"dpl_DPZjiNpvAcGiwobuijLfKPtJL4Ux","buildId":"dpl_DPZjiNpvAcGiwobuijLfKPtJL4Ux","dynamics":[],"chunks":[]}