Loading...
Loading...
Extract WebGL/Canvas/Shader visual effect code from web pages, deobfuscate it and port it into an independent native JS project. Trigger conditions: The user provides a URL and requests to extract shader, extract special effects, extract animation effects, extract canvas effects, replicate the visual effects of a website, "rip the background effect of this website", etc.
npx skill4agent add lixiaolin94/skills web-shader-extractor# 1. 检查 Node.js
node --version 2>/dev/null || {
echo "Node.js not found, installing..."
# macOS
brew install node 2>/dev/null || {
# fallback: 直接下载 LTS
curl -fsSL https://nodejs.org/dist/v22.15.0/node-v22.15.0-darwin-arm64.tar.gz | tar xz -C /usr/local --strip-components=1
}
}
# 2. Playwright 及浏览器(fetch-rendered-dom.mjs 内置自动安装,但这里预检可提前发现问题)
RUNNER_DIR="$HOME/.cache/playwright-runner"
if [ ! -d "$RUNNER_DIR/node_modules/playwright" ]; then
echo "Installing Playwright (one-time setup)..."
mkdir -p "$RUNNER_DIR"
echo '{"type":"module"}' > "$RUNNER_DIR/package.json"
npm install playwright --prefix "$RUNNER_DIR"
npx --prefix "$RUNNER_DIR" playwright install chromium
echo "Playwright + Chromium installed."
fi--prefixPLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright# Playwright(获取 canvas 引擎版本、组件树、运行时网络请求)
node ~/.claude/skills/web-shader-extractor/scripts/fetch-rendered-dom.mjs '<URL>'
# → /tmp/rendered/: dom.html, canvas-info.json, network.json, screenshot.png, console.log
# curl(获取原始 HTML,用于提取内嵌配置和密钥)
curl -s -L --compressed '<URL>' > /tmp/page.htmlcanvas-info.json 的 dataEngine 字段:
├─ "three.js rXXX" → Three.js(r170+ 可能是 TSL → references/tsl-extraction.md)
├─ "Babylon.js vX.X" → Babylon.js
├─ null → Raw WebGL / PixiJS,看 bundle 扫描
└─ 无 canvas → CSS/SVG 动画
URL 或 HTML 特征匹配已知平台 → 直接跳转专用工作流(跳过通用 Phase 3-4):
├─ unicorn.studio → references/unicorn-studio.md(Firestore REST API 直取配置+shader)
└─ shaders.com → references/shaders-com.md(Nuxt payload + XOR 解码 + TSL→GLSL 翻译)
扫描确认:bash scripts/scan-bundle.sh /tmp/*.js
→ 框架特征速查 references/tech-signatures.md1. 搜索公开 API → 直接获取配置(API 返回可能是编码的 → references/encoded-definitions.md)
2. 从 Nuxt payload / __NEXT_DATA__ / HTML 内嵌 JSON 提取
3. 从 JS bundle 提取默认值
→ 详见 references/config-extraction.mdreferences/extraction-workflow.md纯 2D 全屏 shader → 原生 WebGL2(零依赖)
3D / PBR / GPGPU → 保留原始框架(CDN importmap)
不确定 → 先用原始框架,Phase 6 再评估
→ 详见 references/porting-strategy.mdEXTRACTION-REPORT.md# 提取报告:{项目名}
**来源/作者/平台/时间**
## 目标效果(一句话描述)
## 提取思路与时间线(每个迭代的问题→修复)
## 场景结构(组件树/图层结构)
## 最终渲染管线(pass 列表)
## 关键资源文件
## 发现的关键经验(表格:经验/影响/沉淀位置)
## 剩余已知差异
## 技术栈(原始 vs 移植)ascii-glyph-dither/EXTRACTION-REPORT.md| When needed | Read |
|---|---|
| Identify frameworks (Three.js/WebGL/PixiJS features) | |
| Agent extraction prompt + deobfuscation rules | |
| Obtain configuration parameters (API/payload/embedded) | |
| Three.js TSL node shader reconstruction | |
| Encoded/encrypted configuration decoding | |
| onBeforeCompile GLSL injection pitfalls | |
| Porting framework selection + project structure | |
| Unicorn Studio dedicated workflow (curtains.js + Firestore) | |
| shaders.com dedicated workflow (TSL + XOR encoding + Y-flip pitfalls) | |