geomotion 是做什么的?
gcomotion 将 JSON 规范(spec)—— 即一个关键帧列表,每个关键帧包含一组形状 —— 转化为手绘风格的动画。相同 id 的形状会在关键帧之间互相变形;线条会持续“沸腾”(约 12 帧/秒 重新描画),使最终效果如同手绘一般。
网站与工作室:https://hacimertgokhan.github.io/geomotion · 仓库:https://github.com/hacimertgokhan/geomotion
工作流程
- 选择途径(使用第一个可用的):
- MCP 工具(
geomotion_guide、geomotion_get_preset、geomotion_render、geomotion_share_link):先调用一次geomotion_guide,然后渲染。 - CLI(Node 18+ 并有网络连接):
npx -y github:hacimertgokhan/geomotion render spec.json --both --formats svg,lottie,html - 无工具:编写规范,然后运行
python scripts/link.py spec.json(在本技能文件夹中),得到一个播放器/工作室链接,用户可以直接打开、编辑和导出。
- MCP 工具(
- 如果某个预设比较接近,就以其为基础(见下方目录)并调整 id、位置和颜色。
- 按照以下规则编写规范。进行验证(MCP
geomotion_validate或geomotion check spec.json)。 - 交付:文件路径和/或播放器链接。提供工作室链接,方便用户自行调整。当动画将用于网站时,建议提供透明版本(
transparent: true或"both")。
规范要点
{
"name": "idea",
"size": [1200, 1200],
"fps": 24, "boil": 12, "loop": true,
"background": "ivory",
"hold": 0.7, "duration": 0.9, "ease": "inOutCubic",
"style": { "width": 24, "wobble": 1, "misregister": [-14, 10] },
"keyframes": [
{ "shapes": [ { "id": "bulb", "type": "circle", "cx": 600, "cy": 520, "r": 220, "fill": "oat" } ] },
{ "hold": 1.2, "shapes": [
{ "id": "bulb", "type": "circle", "cx": 600, "cy": 520, "r": 240, "fill": "sun" },
{ "id": "ray", "type": "line", "from": [600, 200], "to": [600, 110], "enter": "draw", "delay": 0.3 }
] }
]
}
- 关键帧:
hold(显示秒数)、duration(变形到下一个关键帧的时间)、ease。 - 形状类型:
circle {cx,cy,r}、ellipse {cx,cy,rx,ry}、rect {x,y,w,h,radius?}或{cx,cy,w,h}、line {from,to}、polyline {points,closed?}、polygon {points}、regular {cx,cy,r,sides}、triangle {cx,cy,r}、star {cx,cy,r,inner?,points?}、heart {cx,cy,size}、blob {cx,cy,r,seed?}、crescent {cx,cy,r,thickness?,angle?}、wave {from,to,amplitude?,waves?,phase?}、spiral {cx,cy,r,turns?}、arc {cx,cy,r,start,end}(角度,0 度=右侧,顺时针)、path {d}(任意 SVG 路径)。 - 形状选项:
id(跨关键帧匹配 —— 务必设置)、fill、stroke(颜色或false)、width、opacity、enter/exit(grow|pop|draw|fade|cut)、delay(0–0.95,交错使用)、ease、transform {translate, rotate, scale, origin}、misregister: false(用于微小的实心点)。 - 调色板名称:ink, slate, ivory, paper, oat, kraft, clay, coral, fig, sky, cactus, olive, heather, sun, white(或任意 hex 颜色)。
- 缓动函数:linear, in/out/inOut Quad·Cubic·Sine, inOutQuart, outExpo, inOutExpo, outBack, inOutBack, outElastic, outBounce。
让效果更好的设计规则
- 画布 1200×1200,边距约 120 px,每个姿势 2–5 个粗体形状。小细节会显得模糊。
- 每个轮廓使用 ink,每个姿势使用 一到两种强调填充色(oat, clay, sun, sky, cactus, coral)。
- 通过 id 讲故事:同一个元素发生变换(太阳→月亮,信封→纸飞机,点→心形)。
- 使用
delay0 / 0.15 / 0.3 实现交错效果;需要书写感的线条使用"enter": "draw",俏皮的出现使用"pop"。 - 停留时间 0.5–1.2 秒,变形时间 0.5–1.2 秒。
inOutCubic= 平静,inOutBack/outBack= 俏皮,outElastic= 果冻感。 - 两个关键帧之间旋转 > 30° 会导致线条切角——将大旋转拆分为多个关键帧(参见
spinner、gears、orbit预设)。 - 实心点(眼睛、打字点):
"stroke": false, "fill": "ink", "misregister": false。
预设目录(起点)
- 界面:loader, spinner, success, error, toggle, bell, search
- 自然:sunrise, sprout, rain, night, sea
- 沟通:chat, send, like, connect
- 创意:idea, growth, target, gears, house
- 角色:smile, ghost, sparkle
- 抽象:drift, orbit, kaleido, pebbles
- 运动:bounce, pendulum, jelly
所有预设可直接打开:https://hacimertgokhan.github.io/geomotion/play/#preset=<名称>
(添加 &bg=0 可获得透明背景)或在工作室中打开:/studio/#preset=<名称>。
嵌入网页
<script type="module" src="https://hacimertgokhan.github.io/geomotion/src/embed.js"></script>
<geo-motion preset="success" transparent style="width:160px"></geo-motion>
<geo-motion code="z…"></geo-motion> <!-- 分享链接中的 #s=… 部分 -->