feat(examples): add Prism Atelier creative surface example#39
Merged
Conversation
Add Prism Atelier as a vanilla TypeScript example that demonstrates DOM-authored HTML/CSS/SVG surfaces as creative canvas material. Atelier preserves the visual prototype's studio/gallery direction while replacing the prototype rendering and export path with Prism canvas composition. The default public artwork uses SURFACE as the source word. What changed: - Add apps/prism-atelier. - Use CanvasRuntime from @synthesisengineering/prism. - Register DOM-authored source nodes as Prism surfaces: - type-surface - glyph-surface - css-surface - pattern-surface - Draw the active source repeatedly inside runtime.onPaint() using canvas transforms, alpha, shadows, blend modes, and pointer-driven offsets. - Add creative modes: - Extrude - Orbit - Trail - Split - Grid - Add source-aware draw budgets so expensive CSS/pattern sources avoid accidental worst-case draw counts. - Add Prism-ready PNG export: - document.fonts.ready - runtime.paintOnce() - canvas.toBlob(..., "image/png") - Add a native-support gate for non-native environments. - Add explicit surface registration and disposal helpers. - Add pagehide/beforeunload cleanup for runtime teardown. - Add focused teaching comments around Prism surface registration, readiness, repeated drawSurface() composition, and cleanup. This example does not use React, Next.js, Three.js, WebGL, WebGPU, html2canvas, screenshots, iframe, foreignObject export, or a UI library. Verification: - pnpm --filter @prism/example-atelier build - pnpm e2e - pnpm test - pnpm typecheck - pnpm lint - pnpm build Native smoke: - Confirmed window.prismRuntime.backendKind === "native" with canvas-draw-element enabled. - Confirmed await window.prismRuntime.paintOnce() resolves successfully. Note: - Full artwork requires Chromium/Chrome Canary with chrome://flags/#canvas-draw-element enabled.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Prism Atelier, a vanilla TypeScript creative-coding example that demonstrates DOM-authored HTML/CSS/SVG surfaces as canvas-composited visual material.
What changed
apps/prism-atelier.SURFACE.Prism usage
Atelier:
CanvasRuntimeruntime.onPaint()drawSurface()under canvas transforms, alpha, shadows, and blend modesRegistered DOM surfaces:
type-surface: HTML/CSS typographyglyph-surface: inline SVG prism glyphcss-surface: CSS gradient/blob surfacepattern-surface: SVG/CSS geometric pattern tileImplemented modes:
ExtrudeOrbitTrailSplitGridExport
Export uses the Prism-ready canvas path only: