shaders README

项目的 README,来自 github.com/shader-effects-inc/shaders。合并为一个 markdown 文件:README.md。

Shaders

Design WebGPU effects with your AI agent,
then ship them as components in your web projects

npm version npm downloads per month jsDelivr hits (npm) NPM License

Shaders

Shaders is a desktop app for designing interactive effects with your coding agent. You ask Claude Code, Cursor, Codex or any other MCP agent for what you want, watch it build on an infinite canvas, and adjust it by hand. When it looks right, your agent installs it in your project as ordinary component code.

That code runs on the engine in this repository: a WebGPU renderer and 200+ components (gradients, noise, glass, metal, light, distortions, transitions, blurs, cursor effects) that you nest, blend and mask like any other component. The engine and components are MIT licensed and published as the shaders npm package. You can use them without the app, and everything the app makes runs on them.

npm install shaders

Contents

  1. Design with your agent
  2. Use the components directly
  3. The CLI
  4. Writing Shaders code with an agent
  5. Build your own component
  6. Free and Pro
  7. License
  8. Contribute

Design with your agent

Download Shaders for macOS, Windows or Linux and create an account. Then connect your agent:

npx shaders mcp

The command finds the agents on your machine and adds the Shaders MCP server to each one. Sign in with the same account as the app when your agent asks. Keep the app open while your agent works, since it builds in the editor you have open.

Then tell it what you're designing, for example "Design three shader ideas for my hero background." Each idea gets its own frame on the canvas, so you can compare them side by side. Click any shader to see its layers and change colors, speed and other settings yourself, or ask your agent for changes in plain words. If the shader is for a specific place, like a hero or a pricing card, your agent can draw the page around it so you see it in context.

If nothing in the library fits, your agent can write a new component and give it props you can adjust in the editor. It can also add entrance, exit, hover and scroll animations.

Once a shader is ready, ask your agent to install it. It writes the shader as a component for your framework and adds it to your page, where you and your agent can keep editing it like the rest of your code.

Getting started · Working with your agent

Use the components directly

<Shader> renders the canvas. Its children are layers, drawn top to bottom and blended on the GPU.

import { Shader, LinearGradient, CursorTrail } from 'shaders/react'

<Shader className="w-full h-64">
  <LinearGradient colorA="#0f172a" colorB="#7c3aed" />
  <CursorTrail />
</Shader>

The same components and props work everywhere. Import them from shaders/react, shaders/vue, shaders/svelte or shaders/solid, which also covers projects built on those, like Next.js, Nuxt, Astro and Framer. Without a framework, use createShader from shaders/js:

import { createShader } from 'shaders/js'

await createShader(document.getElementById('my-shader'), {
  components: [
    { type: 'LinearGradient', props: { colorA: '#0f172a', colorB: '#7c3aed' } },
    { type: 'CursorTrail' },
  ],
})

Everything is typed, props update reactively, and the components are safe to server render. Visitors need a browser with WebGPU; without it the canvas stays transparent and the rest of the page works as normal.

Quickstart · All 200+ components, each with a live preview and every prop documented

The CLI

The CLI links a codebase to your Shaders account, so the shaders you design land in your project as component files and stay in sync. It runs through npx, so there's nothing to install globally, and your agent can run it for you.

npx shaders                # guided menu: shows what's set up and offers the next step
npx shaders connect        # link this codebase to a Shaders project
npx shaders install        # pick shaders from that project; writes component files
npx shaders search "..."   # find a shader in the Pro library by describing it
npx shaders update         # pull in what changed in the editor
npx shaders open           # open your project in the Shaders app
npx shaders mcp            # add the Shaders MCP server to your agents

It detects your framework, writes to your components folder, and records what it installed in a lock file.

CLI guide

Writing Shaders code with an agent

For work in your codebase away from the canvas, give your agent the engine's skill: npx shaders skill, or npx skills add shader-effects-inc/shaders. The skill covers how layers stack and blend, masking, dynamic props, shape effects, every component, and writing new ones. npx shaders connect adds it for you. When the Shaders MCP is connected too, the skill tells your agent to design on the canvas and come back to the code once the shader is installed.

shaders.com/llms.txt indexes every docs page, and shaders.com/llms-full.txt has the full component reference with props, defaults and ranges.

Agent skill guide

Build your own component

A component is a plain object passed to defineShader: a name, its props, and what to draw at each pixel. Mount it with <CustomShader> like any other component.

import { defineShader, wgsl, transformColor, transformPosition } from 'shaders/std'

export const Halo = defineShader({
  name: 'Halo',
  props: {
    color: { default: '#ffd166', transform: transformColor },
    center: { default: { x: 0.5, y: 0.5 }, transform: transformPosition },
    radius: { default: 0.6 },
  },
  paint: wgsl`
    let d = length((uv - center) * vec2f(aspect, 1.0)) / radius;
    return vec4f(color.rgb, 1.0 - smoothstep(0.8, 1.0, d));
  `,
})

You can write the pixel part in WGSL (stable) or compose it from the std primitives (experimental). This is also what your agent writes when it designs a custom component in the app.

Custom components · Primitives reference

Free and Pro

The engine and components in this repository are free, with no account needed. The desktop app is free too: design on the canvas, export what you make, and let your agent make 200 edits a week. Reading shaders and installing code don't count toward that.

Shaders Pro is billed monthly or yearly and adds:

License

Contribute

Issues and pull requests are welcome. Read the contributing guide before starting, and for anything more than a bug fix, open an issue to discuss it before the PR.

The engine lives in packages/core, with one folder per component under src/shaders/. The framework packages are generated from it.

pnpm install
pnpm lib:build   # build every package (regenerates the registry and framework components)
pnpm test        # the engine's test suite

Say hello on Discord.


Shaders © Shader Effects, Inc.

shaders (shader-effects-inc/shaders)

正在搜索数据库…

这是什么?Shaders 是一个包含 200 多种 WebGPU 视觉效果的库(渐变、噪点、玻璃、金属、光效、扭曲、转场、模糊、光标效果),以开箱即用的组件形式提供给 React、Vue、Svelte、Solid 和纯 JavaScript。
这是单一框架,还是每个框架都有各自的包?它是一个跨框架组件库:React、Vue、Svelte、Solid 和纯 JS 各自拥有一等公民的入口,暴露相同的 props。
怎么把 Shaders 添加到我的项目里?为你的框架安装相应的包并放入效果组件,或者使用 Shaders CLI,它会连接你的 Shaders 账户、检测你的框架,并把设计好的组件写入你的 components 文件夹,同时生成锁文件以保持同步。
我需要支持 WebGPU 的浏览器吗?需要,这些效果通过真正的 WebGPU 声明式 API 渲染,因此目标浏览器需要支持 WebGPU;这些组件基于 TypeScript、SSR 安全,已在数千个生产环境中使用。
它完全是免费的,还是有一部分收费?核心引擎、全部 200 多个组件、设计编辑器、CLI 和 MCP 服务器都免费。Shaders Pro 则额外提供 1,000 多个预设、55 个以上的现成网站区块、无水印高清导出、Framer 插件和无限版本历史。
整个项目都是 MIT 许可吗?本仓库和 npm 包中的引擎、组件和框架绑定才是 MIT 许可。设计编辑器、预设、网站区块以及 shaders.com 平台的其他功能是独立的,有各自的条款。
可视化设计编辑器是做什么的?在 shaders.com 上,你可以在无限画布上设计效果,用实时控件调整每个 prop,用光标或时间线驱动 prop,然后点击 Export Code 获得与你的框架匹配的组件树,注册账户即可免费使用。
AI 编程代理能使用 Shaders 吗?可以,运行 npx shaders@latest install-mcp 会为 Claude Code、Cursor、Codex、Windsurf、Copilot 等设置 MCP 服务器,shaders.com/llms.txt 和 llms-full.txt 则为代理提供完整文档和组件参考。
我能构建自定义 shader 组件吗?可以,通过 defineShader,你创建一个包含名称、props 和逐像素绘制逻辑的普通对象,直接用 WGSL 编写(稳定)或由 std 原语组合而成(实验性),然后像其他组件一样挂载。
它面向哪些人?流行程度如何?它面向想要 GPU 效果但不想手写 WGSL 的前端和设计工程师;项目方称已有超过 16,000 名设计工程师在数千个网站上使用它。
大小
8.8 MB
星标
6.1K
时长
2个月
提交 · 90 天