geomotion 是做什麼的?
geomotion 將一個 JSON 規格(spec)——一個關鍵影格(keyframes)列表,每個影格包含一系列形狀——轉換為手繪風格的動畫。相同 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(或任何十六進位色碼)。
- 緩動函數:linear, in/out/inOut Quad·Cubic·Sine, inOutQuart, outExpo, inOutExpo, outBack, inOutBack, outElastic, outBounce。
讓它看起來更好的設計規則
- 1200×1200 畫布,約 120 像素邊距,每個姿勢使用 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=<name>
(加上 &bg=0 以獲得透明背景)或在工作室中:/studio/#preset=<name>。
在網站上嵌入
<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=… 部分 -->