Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added shared to docs
dev_wandry89c0d2f31823
diff --git a/app/docs/layout.tsx b/app/docs/layout.tsxindex 5c4a3d40..1f130df1 100644--- a/app/docs/layout.tsx+++ b/app/docs/layout.tsx@@ -11,7 +11,7 @@ export default async function Layout({ children }: { children: ReactNode }) {// `withNewBadges`), then split it into the Components / Primitives tab trees// (see `splitDocsTree`). Both run on the server; `DocsShell` picks the tree// matching the active tab by pathname so each tab owns its own sidebar.- const { components, primitives } = splitDocsTree(+ const { components, primitives, shaders } = splitDocsTree(withNewBadges(source.pageTree),);@@ -23,7 +23,11 @@ export default async function Layout({ children }: { children: ReactNode }) {over the sidebar, tabs starting at the article column's left edge. */}<DocsHeader /><DocsTabsBar />- <DocsShell componentsTree={components} primitivesTree={primitives}>+ <DocsShell+ componentsTree={components}+ primitivesTree={primitives}+ shadersTree={shaders}+ >{children}</DocsShell></>diff --git a/components/docs/docs-shell.tsx b/components/docs/docs-shell.tsxindex 01a4b09a..38bb4f56 100644--- a/components/docs/docs-shell.tsx+++ b/components/docs/docs-shell.tsx@@ -34,17 +34,22 @@ import { baseOptions } from "@/lib/layout.shared";export function DocsShell({componentsTree,primitivesTree,+ shadersTree,children,}: {componentsTree: Root;primitivesTree: Root;+ shadersTree: Root;children: ReactNode;}) {const pathname = usePathname();+ const activeTab = getActiveDocsTab(pathname);const tree =- getActiveDocsTab(pathname) === "primitives"+ activeTab === "primitives"? primitivesTree- : componentsTree;+ : activeTab === "shaders"+ ? shadersTree+ : componentsTree;return (<DocsLayoutdiff --git a/content/docs/meta.json b/content/docs/meta.jsonindex 4064bb75..ae3ac085 100644--- a/content/docs/meta.json+++ b/content/docs/meta.json@@ -6,6 +6,7 @@"typography","ui","environment",+ "shaders","ui-blocks","ai","transitions",diff --git a/content/docs/shaders/index.mdx b/content/docs/shaders/index.mdxnew file mode 100644index 00000000..2168cdef--- /dev/null+++ b/content/docs/shaders/index.mdx@@ -0,0 +1,21 @@+---+title: Shaders+description: WebGL shader backdrops for Remotion, frozen to the current frame for deterministic renders+---++GPU shader backgrounds wrapped for Remotion. Each one is driven per-frame, so renders stay deterministic across every pass. Colors and motion are tunable, and every raw shader parameter stays available for full control.++Powered by [paper-design/shaders](https://github.com/paper-design/shaders) (Apache-2.0).++## Gradients++<ComponentCardGrid+ items={[+ {+ name: "ShaderMeshGradient",+ description: "WebGL mesh gradient backdrop with drifting color blobs, driven per-frame",+ status: "stable",+ href: "/docs/shaders/shader-mesh-gradient",+ },+ ]}+/>diff --git a/content/docs/shaders/meta.json b/content/docs/shaders/meta.jsonnew file mode 100644index 00000000..6bb1a83d--- /dev/null+++ b/content/docs/shaders/meta.json@@ -0,0 +1,5 @@+{+ "title": "Shaders",+ "collapsible": false,+ "pages": ["index", "shader-mesh-gradient"]+}diff --git a/content/docs/shaders/shader-mesh-gradient.mdx b/content/docs/shaders/shader-mesh-gradient.mdxnew file mode 100644index 00000000..59e86d26--- /dev/null+++ b/content/docs/shaders/shader-mesh-gradient.mdx@@ -0,0 +1,37 @@+---+title: Shader Mesh Gradient+description: WebGL mesh gradient backdrop driven per-frame for deterministic Remotion renders+---++<ComponentPreview name="shader-mesh-gradient" />++## Installation++<InstallBlock name="shader-mesh-gradient" />++## Usage++```tsx+// src/Root.tsx+import { Composition } from "remotion";+import { ShaderMeshGradient } from "@/components/remocn/shader-mesh-gradient";++const ShaderMeshGradientScene = () => (+ <ShaderMeshGradient speed={1} distortion={0.6} swirl={0.1} />+);++export const RemotionRoot = () => (+ <Composition+ id="ShaderMeshGradient"+ component={ShaderMeshGradientScene}+ durationInFrames={150}+ fps={30}+ width={1280}+ height={720}+ />+);+```++## Credits++Shader by [paper-design/shaders](https://github.com/paper-design/shaders) (Apache-2.0).diff --git a/lib/docs-tabs.ts b/lib/docs-tabs.tsindex 719636e6..3db4f2a1 100644--- a/lib/docs-tabs.ts+++ b/lib/docs-tabs.ts@@ -7,7 +7,7 @@ import type { Node, Root } from "fumadocs-core/page-tree";* unchanged from the flat docs structure. No files move and no URLs change —* the split is purely a view over the existing Fumadocs page tree.*/-export type DocsTabId = "components" | "primitives";+export type DocsTabId = "components" | "primitives" | "shaders";export type DocsTab = {id: DocsTabId;@@ -23,6 +23,7 @@ export const DOCS_TABS: DocsTab[] = [href: "/docs/getting-started/introduction",},{ id: "primitives", label: "Primitives", href: "/docs/ui" },+ { id: "shaders", label: "Shaders", href: "/docs/shaders" },];/** URL prefix that backs the Primitives tab (the remocn-ui section). */@@ -36,8 +37,18 @@ function isPrimitivesPath(pathname: string): boolean {);}+const SHADERS_PREFIX = "/docs/shaders";++function isShadersPath(pathname: string): boolean {+ return (+ pathname === SHADERS_PREFIX || pathname.startsWith(`${SHADERS_PREFIX}/`)+ );+}+export function getActiveDocsTab(pathname: string): DocsTabId {- return isPrimitivesPath(pathname) ? "primitives" : "components";+ if (isShadersPath(pathname)) return "shaders";+ if (isPrimitivesPath(pathname)) return "primitives";+ return "components";}/** True for the root-level folder node that holds the remocn-ui (ui) section. */@@ -51,6 +62,15 @@ function isPrimitivesNode(node: Node): boolean {);}+function isShadersNode(node: Node): boolean {+ if (node.type !== "folder") return false;+ if (node.index?.url === SHADERS_PREFIX) return true;+ return node.children.some(+ (child) =>+ child.type === "page" && child.url.startsWith(`${SHADERS_PREFIX}/`),+ );+}+/*** Hoists a matched folder's own index page and children up to the tab root, so* the Primitives sidebar reads its pages directly (Introduction / Concepts /@@ -85,17 +105,25 @@ function hoistPrimitives(nodes: Node[]): Node[] {export function splitDocsTree(tree: Root): {components: Root;primitives: Root;+ shaders: Root;} {return {components: {...tree,$id: "docs-tab-components",- children: tree.children.filter((node) => !isPrimitivesNode(node)),+ children: tree.children.filter(+ (node) => !isPrimitivesNode(node) && !isShadersNode(node),+ ),},primitives: {...tree,$id: "docs-tab-primitives",children: hoistPrimitives(tree.children.filter(isPrimitivesNode)),},+ shaders: {+ ...tree,+ $id: "docs-tab-shaders",+ children: hoistPrimitives(tree.children.filter(isShadersNode)),+ },};}