vantajs
它能做什么
这个技能帮助 AI 借助 Vanta.js 库,为网站某个区域添加移动背景。适合希望获得醒目首屏区域、又不想从头构建完整三维场景的人。
适用场景
- ✓当你希望首页页眉后面有动态的波浪背景时。
- ✓当 React 或 Next.js 页面需要快速添加装饰效果时。
- ✓当背景效果拖慢手机速度,或导致区域空白时。
技能链接
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/vantajs/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在我首页的标题后面加一个动态波浪背景,并确保它在手机上不会太占资源。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能说明如何把效果指定到页面的某个区域,选择颜色和设置,并在页面切换时进行清理。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Vanta.js — Animated WebGL Backgrounds Skill
When to use
- Decorative animated backgrounds behind hero sections
- You want “wow” quickly without building a full three.js scene
- Lightweight integration into static sites or React/Vue
How it works
- Vanta injects a canvas into a container element and renders an effect (many use three.js).
- Typical usage: include
three.min.js(or provide THREE) + one Vanta effect bundle.
Key APIs/patterns
- Init:
const effect = VANTA.WAVES({ el: "#hero", ...options })
- Update after init:
effect.setOptions({ color: 0xff88cc })
- Resize:
effect.resize()(if container size changes)
- Cleanup:
effect.destroy()(important in SPAs)
Common pitfalls
- Container has no size → nothing visible
- Ensure the target element has explicit width/height (or is laid out).
- Multiple WebGL canvases on one page → GPU load
- Keep to 1–2 effects/page.
- Mobile/older GPU issues
- Provide a fallback background color/image; consider disabling on small screens.
- Bundling in frameworks
- Some builds require
window.THREEor passingTHREEin options.
- Some builds require
Quick recipes
1) Minimal waves background
<div id="hero" style="height: 70vh;"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanta/dist/vanta.waves.min.js"></script>
<script>
const effect = VANTA.WAVES({ el: "#hero", color: 0x0b1220, shininess: 40, waveHeight: 16, zoom: 0.9 });
</script>
2) React cleanup pattern (concept)
- Create effect in
useEffect, store in ref, calldestroy()on unmount.
What to ask the user
- Which effect (waves, birds, fog, net, etc.) and brand colors?
- Must it run on mobile? If yes, what’s acceptable FPS/quality?
- Is it behind text (needs contrast/readability)?
常见问题
它和 Three.js 技能一样吗?
Vanta.js 是更简单的选择。它提供现成的效果,而 Three.js 允许你构建自定义场景。
之后可以更改颜色吗?
可以。该技能说明了效果启动后如何更新设置。
如果某些手机上效果不显示怎么办?
该技能建议为旧设备提供简单的纯色背景或图片作为备用。
详情
作者的原始描述
Use when adding animated WebGL background effects with Vanta.js (setup, parameters, resizing, performance, integration in React/Next.js).
repo: MengTo/Skills
热度
- GitHub 星标
- 7.2k
- 排名
- #13480
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
3d-cloth-material
7.2k帮你的智能体在 Three.js 中制作逼真的编织织物,包括纱线编织纹理、柔和光泽、自然褶皱、下摆和缝线。
3d-falling-leaves
7.2k帮你的智能体在 3D 场景中添加逼真的飘落树叶,树叶会翻滚、随风飘动,并在镜头移动时循环利用。
3d-four-seasons
7.2k帮你的智能体为 3D 场景添加春夏秋冬四季效果,无需重建场景即可改变植被、光线、天空和积雪。
3d-high-poly-models
7.2k帮你的智能体构建形状平滑、边缘可信的精细 3D 模型,然后制作在网页上运行流畅的轻量版本。