LAP Motion
Dành cho trợ lý AI (hướng dẫn đầy đủ)
Updated 2026-11-30T16:51:35.443Z | LAP Motion: animation for AI agents. Characters, animations and Rive-style state machines, written as steps in a link.
You write the link; the person opens it and watches the result play. Nothing changes until they click Create or Apply. Check your link first with &lap=json (problems come with a corrected link).

LINKS
New project: https://motion.linkactionprotocol.com/new?ops=STEP;STEP;...  -> the person clicks Create and gets a project link https://motion.linkactionprotocol.com/p/ID
Change a project: https://motion.linkactionprotocol.com/p/ID/edit?ops=STEP;STEP  -> plays before and after; Apply makes a new version, undo on the receipt.
Read a project: https://motion.linkactionprotocol.com/p/ID/file.txt (parts with positions and boxes, animations, machines, and the ops that rebuild it)
See it: https://motion.linkactionprotocol.com/p/ID/board.png (start pose), https://motion.linkactionprotocol.com/p/ID/anim/NAME.png (8 frames), https://motion.linkactionprotocol.com/p/ID/machine/NAME.png?do=0.3:talk=1|1.5:wave (frames of a run; .txt for the trace)
Pictures of a link before it exists: https://motion.linkactionprotocol.com/new/board.png?ops=... and https://motion.linkactionprotocol.com/new/anim/NAME.png?ops=... (same for /p/ID/edit/...).
Agents with a key: the owner clicks "Tạo khóa cho agent" on the project page and gives you a key. POST the edit link itself (https://motion.linkactionprotocol.com/p/ID/edit?ops=...) or https://motion.linkactionprotocol.com/p/ID/apply with Authorization: Bearer KEY (JSON {"ops": "...", "version": N} in the body works too) -> 201 receipt JSON with undo_url. A post may carry 3000 steps and 120000 characters. Without a key, hand the person the link.

STEP FORMAT: op:target,key=value,...  Values with , ; or " go in double quotes. Names: letters, digits, _ (start with a letter), unique in the project.
Coordinates: pixels, x right, y down. Every part has a pivot at x/y inside its parent (board: from the top-left). Rotation (degrees, clockwise) and scale turn around the pivot. offset=dx/dy moves the drawing away from the pivot.

OPS
board: board:name=Hello,size=500/500,bg=cream  (name: title; size: W/H px; bg: colour or none)
add: add:ellipse,name=Head,at=250/200,size=160/150,fill=skin  (name: unique name; parent: parent name)
set: set:Head,fill=f2c6a0,stroke=ink,stroke_width=4
delete: delete:Hat  (kind: node (default) | anim | machine | state | input | go | on | bind)
rename: rename:Head,to=Face  (to: new name)
copy: copy:EyeL,name=EyeR,mirror=x  (name: name of the copy; mirror: x: flip around the parent pivot)
order: order:Hat,to=front  (to: front | back | up | down; above: sibling; below: sibling)
parent: parent:Hat,to=Head  (to: parent name or board)
anim: anim:Blink,dur=4,loop=loop  (dur: seconds; loop: loop | once | pingpong)
key: key:Blink,EyeL.scale_y,0=1,3.8=1,3.9=0.1~linear,4=1  (ease: default ease; T=V: time in seconds = value, ~ease after a value)
unkey: unkey:Blink,EyeL.scale_y  (at: one time only)
preset: preset:blink,node=Eyes,anim=Blink  (node: node; anim: animation (made if missing))
machine: machine:Main
input: input:Main,talk,type=bool  (type: bool | number | trigger; value: start value)
state: state:Main,Talk,anim=Talk,layer=mouth  (anim: animation; layer: layer name (default base); speed: play speed; blend: input:Anim@value|Anim@value; entry: 1 = start here; enter: event fired when the state starts)
go: go:Main,Idle>Talk,when=talk,fade=0.15  (when: condition, repeat for AND; fade: blend seconds; exit: 0..1 of the animation before it may leave)
on: on:Body,click,fire=wave  (machine: machine; fire: trigger; set: input:value; follow: inX/inY (move); emit: event name)
bind: bind:Pupils.x,input=lookX,from=-1/1,to=-6/6,mode=add  (input: number, bool or text input; from: in min/max; to: value min/max; mode: set | add; machine: machine)
constrain: constrain:Lower,type=ik,target=Goal  (type: ik | aim | follow | limit; target: part to reach, look at or follow; strength: 0..1; bend: ik: 1 or -1; angle: aim: extra degrees; rotation: follow: 1 copies rotation; min: limit: degrees; max: limit: degrees)
event: event:Wave,at=0.3,name=hello  (at: seconds; name: event name)

TYPES: group = container without a drawing; move, turn or scale many parts at once; bone = a joint pointing along its +x axis (rot=90 points down) for length px; rotate it to move what is inside, or skin a shape to it; rect = rectangle centred on the pivot, radius rounds the corners; ellipse = ellipse centred on the pivot; polygon = regular polygon in a width x height box; star = star with sides points, inner = inner radius ratio; path = points x/y|x/y|... around the pivot; smooth 0..1 rounds it; closed=0 for an open line; text = text centred on the pivot; \n in the text starts a new line, wrap=WIDTH breaks long lines.
PROPERTIES by type: rect: fill stroke stroke_width cap join offset_x offset_y trim_start trim_end dash_on dash_off dash_offset shadow_x shadow_y shadow_blur shadow_color blur skin width height radius | ellipse: fill stroke stroke_width cap join offset_x offset_y trim_start trim_end dash_on dash_off dash_offset shadow_x shadow_y shadow_blur shadow_color blur skin width height | polygon: fill stroke stroke_width cap join offset_x offset_y trim_start trim_end dash_on dash_off dash_offset shadow_x shadow_y shadow_blur shadow_color blur skin width height sides | star: fill stroke stroke_width cap join offset_x offset_y trim_start trim_end dash_on dash_off dash_offset shadow_x shadow_y shadow_blur shadow_color blur skin width height sides inner | path: fill stroke stroke_width cap join offset_x offset_y trim_start trim_end dash_on dash_off dash_offset shadow_x shadow_y shadow_blur shadow_color blur skin pts smooth closed | text: fill stroke stroke_width offset_x offset_y shadow_x shadow_y shadow_blur shadow_color blur text font_size font_weight align line_height wrap. Every type: x y rotation scale_x scale_y opacity visible behind clip. bone: length.
Shorthands: at=x/y, size=width/height, scale=scale_x/scale_y, offset=offset_x/offset_y, rot=rotation, dash=dash_on/dash_off, shadow=shadow_x/shadow_y/shadow_blur/shadow_color (scale=1.2 sets both).
Details: offset_x: moves the drawing away from the pivot (a limb hangs from its joint: offset_y = half its length); behind: draw behind the parent (ears behind a head, an arm behind a body); clip: NAME of a shape: this part and its children only show inside that shape (give the shape visible=0 if it is only a mask); smooth (0..1); inner (0.05..1); trim_start (0..1): draw only part of the outline: 0..1 (animate trim_end 0 to 1 to draw a line on); dash_on (0..2000): dashed outline: dash=ON/OFF px; animate dash_offset to march it; shadow_x: drop shadow: shadow=X/Y/BLUR/COLOR (colour with alpha, like 1f243040); blur (0..200): blurs the part, in px; wrap (0..20000): break text into lines no wider than this (px, 0 = never).
Colours: hex (ff8800), none, white black ink grey silver red orange yellow gold green mint teal sky blue navy purple lilac pink blush brown skin cream sand. Gradients: linear:c1/c2[/c3]@angle (CSS angles: 90 left to right, 180 top to bottom), radial:c1/c2.

ANIMATION
key:ANIM,Part.prop,TIME=VALUE,... sets keys (seconds). Shorthand props work: Part.at=x/y, Part.scale. Points animate too (same count): Mouth.pts. ~ease after a value eases the segment that starts there; ease=NAME sets all. Eases: linear (constant speed), hold (jump at the next key), in (slow start), out (slow end), inout (slow start and end (default)), back (overshoots a little, then settles), elastic (springs past the value and wobbles back), bounce (bounces at the end), bezier:x1/y1/x2/y2.
anim:NAME,dur=SECONDS,loop=loop|once|pingpong. A key past the end makes the animation longer.
Presets write ordinary keys you can edit: blink (eyes close and open (scale_y); every=4), breathe (slow up-down stretch from the pivot; amount=0.03 dur=3), bob (floats up and down; amount=8 dur=1.6), sway (rocks side to side (rotation); amount=6 dur=2.4), talk (mouth opens and closes (scale_y); amount=0.85 dur=0.36), wave (a limb waves (rotation, give the bone); amount=35 dur=1.4), spin (one full turn; dur=2), pulse (grows and shrinks; amount=0.12 dur=1), shake (quick shake left-right; amount=8 dur=0.5), jump (squash, jump, land (y and scale); amount=60 dur=0.9), pop (appears with a bounce (scale 0 to 1); dur=0.5), fade (fades in (opacity 0 to 1); dur=0.6), draw (draws the outline on (trim_end 0 to 1); dur=1.2). wave also takes raise=DEGREES (negative lifts a right-side arm, positive a left-side arm).

RIGGING
Bones point along their +x axis for length px (rot=90 points down). Rotate a bone and everything inside it turns. A shape with skin=Upper/Lower bends with those bones instead: draw it in its rest shape around the bones, next to them (not inside them).
Constraints run after the animations, in order: ik: two-bone IK on a bone and its parent: the bone tip reaches the target (bend=1 or -1 picks the elbow side); aim: turns the part so its +x axis points at the target (angle=DEGREES adds a turn); follow: moves the part onto the target (rotation=1 also copies its turn); limit: keeps the rotation between min and max degrees. IK goes on the lower bone; its parent is the upper bone; the target is any part, often a group you animate or bind to the pointer.

STATE MACHINES (like Rive)
machine:Main; input:Main,NAME,type=bool|number|trigger|text; state:Main,NAME,anim=ANIM,layer=LAYER; go:Main,FROM>TO,when=COND,fade=SECONDS,exit=SHARE.
Each layer plays one state at a time, starting at its first state (or entry=1). Layers run together; a later layer wins where two write the same property, so use one layer per body part or job (body, blink, mouth...). A state without anim holds still.
Conditions: talk (bool true), !talk, mood>0.5 (also >= < <= = !=), or a trigger name (fires once). Repeat when= for AND. FROM can be any. A go with no when leaves after the animation has played once (exit=1). blend=amount:Closed@0|Open@1 mixes animations by a number input.
Pointer: on:PART,EVENT,fire=TRIGGER | set=INPUT:VALUE | follow=inX/inY (move only; -1..1 from the part). Events: click, down, up, enter, leave, move. PART may be board. Listeners also catch events on the part's children.
bind:Part.prop,input=NAME,from=-1/1,to=-6/6,mode=add ties a property to a number or bool input after the animations (eyes that follow, a mouth driven by loudness). bind:Caption.text,input=caption shows a text input (captions, names, scores); \n starts a new line.
Events: event:ANIM,at=SECONDS,name=NAME fires while the animation plays; state:...,enter=NAME fires when a state starts; on:...,emit=NAME fires on a pointer event. Runs (.txt) list them; pages that embed the project get them as lapmotion DOM events.

USE IT ELSEWHERE
Any web page: <script type="module" src="https://motion.linkactionprotocol.com/js/lap-motion.js"></script> then <lap-motion src="https://motion.linkactionprotocol.com/p/ID/project.json"></lap-motion>; el.set('talk', true), el.fire('wave'). Offline file: https://motion.linkactionprotocol.com/p/ID/export.html. Transparent page for OBS: https://motion.linkactionprotocol.com/p/ID/embed?bg=0.

WORKFLOW
1. Plan the parts as a tree: a group for the whole character with its pivot at the feet, bones for limbs, a group for the eyes so one blink moves both. Put the face inside the body so a click on the face reaches the body's listener.
2. Use copy:EyeL,name=EyeR,mirror=x for left/right pairs; children and keys are copied and mirrored.
3. Open the link with &lap=json, read the issues and the picture links, look at the PNG strips, fix, repeat. Then give the person the final link.
4. Big projects: several links in a row (create, then edits), 160 steps and 8000 characters per link; or one post with a key.

Example: https://motion.linkactionprotocol.com/new?ops=board:name=Ball,size=400/300,bg=sky;add:ellipse,name=Shadow,at=200/262,...
Full samples with links (a talking character with 67 steps, an IK arm, a button): https://motion.linkactionprotocol.com/examples.txt; their projects: https://motion.linkactionprotocol.com/p/sampleti2222/file.txt https://motion.linkactionprotocol.com/p/samplearm222/file.txt https://motion.linkactionprotocol.com/p/sampleball22/file.txt https://motion.linkactionprotocol.com/p/samplebutton/file.txt
More samples: https://motion.linkactionprotocol.com/examples.txt | Manifest: https://motion.linkactionprotocol.com/.well-known/lap.json

Phần mềm hoạt ảnh cho AI agent

AI dựng hoạt ảnh.
Bạn chỉ việc xem.

Nhân vật, hoạt ảnh và state machine như Rive, nhưng giao diện chính là đường link: agent viết từng bước, đọc lại dự án bằng chữ, xem từng khung hình bằng ảnh. Bạn mở link là thấy chạy, ưng thì bấm Áp dụng, lỡ tay thì hoàn tác.

Chơi với TíDùng với AI

Thử ngay bên cạnh: rê chuột để Tí nhìn theo, bấm vào bụng để Tí nhảy, bấm tay phải để Tí vẫy.

Tí
1

Agent viết link

Mỗi bước một dòng: thêm hình, đặt khóa hình, tạo trạng thái. Sai tên thì trang chỉ chỗ và đưa link đã sửa.

2

Agent tự kiểm tra

Đọc file.txt, xem dải khung hình PNG, chạy thử state machine bằng kịch bản. Không cần trình duyệt.

3

Bạn xem và bấm

Trang chiếu trước và sau. Bấm Tạo hoặc Áp dụng mới đổi; mỗi lần có biên nhận và nút hoàn tác.

Mẫu

Dùng với trợ lý AI

Dán một câu dưới đây vào ChatGPT, Claude, Gemini hay Claude Code. AI đưa lại một đường link; mở ra là thấy hoạt ảnh chạy.

Làm cho agent trước

Không có bảng vẽ kéo thả. Mọi thứ là chữ: agent viết, đọc lại và sửa được từng bước, tốn ít token.

Agent nhìn được chuyển động

Agent không xem được video, nên mỗi hoạt ảnh có dải 8 khung hình PNG, mỗi lần chạy state machine có bản ghi chuyển trạng thái.

Người giữ quyền

Mặc định agent chỉ đề xuất. Muốn agent tự áp dụng thì bạn cấp khóa có hạn giờ, đếm số lần, thu hồi một nút.