This is the complete prop reference for FragCanvas — the main adapter entrypoint for using Motion GPU in Svelte, React, and Vue.
Import
import { FragCanvas } from '@motion-core/motion-gpu/svelte';Usage
<FragCanvas
material={myMaterial}
clearColor={[0, 0, 0, 1]}
outputColorSpace="srgb"
renderMode="always"
passes={[vignettePass]}
onError={handleError}
>
<Runtime />
</FragCanvas>Adapter-specific naming differences (class vs className vs canvasClass, style type, children/slots) are listed below.
Props
Required
Rendering
Post-processing
WebGPU configuration
Error handling
Error history behavior
- History is disabled when
errorHistoryLimit <= 0. - History stores the latest
Nreports whenerrorHistoryLimit > 0. - Consecutive identical reports are deduplicated (
phase/title/message/rawMessagekey). - Reducing
errorHistoryLimittrims existing history immediately.
Styling and children
Lifecycle
Canvas sizing
FragCanvas renders a <canvas> inside a container <div>. The canvas fills its container using width: 100%; height: 100% CSS. The container determines the effective canvas dimensions.
The physical size (GPU resolution) is containerSize × dpr.
Example: full configuration
<FragCanvas
material={material}
clearColor={[0.05, 0.05, 0.1, 1]}
outputColorSpace="srgb"
renderMode="on-demand"
autoRender={true}
maxDelta={0.05}
dpr={2}
passes={[tonePass, vignettePass]}
renderTargets={{ halfRes: { scale: 0.5 } }}
adapterOptions={{ powerPreference: 'high-performance' }}
showErrorOverlay={true}
errorRenderer={myErrorRenderer}
onError={(report) => sendToTelemetry(report)}
errorHistoryLimit={20}
onErrorHistory={(history) => sendErrorHistory(history)}
class="my-canvas-container"
style="border-radius: 12px; overflow: hidden;"
>
<Runtime />
</FragCanvas>{#snippet myErrorRenderer(report)}
<aside class="my-error-banner">
<strong>{report.title}</strong>
<p>{report.message}</p>
</aside>
{/snippet}