figma
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFigma → HyperFrames
Figma → HyperFrames
Bring the user's Figma work into a composition. MCP-first: you (the agent) call the Figma MCP tools, then hand their output to the pure helpers in , freezing every asset locally so renders stay deterministic.
@hyperframes/core/figma将用户的Figma作品导入合成项目中。优先使用MCP:你(Agent)调用Figma MCP工具,然后将输出结果交给中的纯辅助工具,将所有资源本地固化,确保渲染结果的确定性。
@hyperframes/core/figmaAuth
授权
Requires the Figma MCP connector (one-click OAuth). If tools error unauthenticated, tell the user to connect Figma and stop.
需要Figma MCP连接器(一键式OAuth)。如果工具因未授权报错,请告知用户连接Figma并停止操作。
Routing
路由
Parse the user's figma link with . Then by intent:
parseFigmaRef- "use this layer / logo / image" → Asset import
- "import this animation / motion" → Motion import
- brand tokens / components → not in this skill version (see the design spec roadmap).
使用解析用户的Figma链接。然后根据意图处理:
parseFigmaRef- "使用此图层/标志/图片" → 资源导入
- "导入此动画/动效" → 动效导入
- 品牌令牌/组件 → 当前技能版本不支持(请查看设计规范路线图)。
Asset import
资源导入
- → confirm the node, capture width/height.
get_metadata(fileKey, nodeId) - Export it: (or node image export) for PNG; prefer SVG for vectors.
download_assets - Freeze: write the bytes with where
freezeBytes(bytes, join(typeDirPath(projectDir,"image"), id + ext)).id = nextId(projectDir,"image") - Ledger: .
appendRecord(projectDir, { id, type:"image", path, source:"figma", width, height, provenance:{ source:"figma", fileKey, nodeId, format } }) - Emit into the composition. Re-import guard:
buildAssetSnippet(record).htmlbefore re-fetching.findByFigmaNode
- → 确认节点,获取宽/高。
get_metadata(fileKey, nodeId) - 导出资源:使用(或节点图片导出)获取PNG;矢量图优先选择SVG格式。
download_assets - 固化:使用写入字节数据,其中
freezeBytes(bytes, join(typeDirPath(projectDir,"image"), id + ext))。id = nextId(projectDir,"image") - 台账:。
appendRecord(projectDir, { id, type:"image", path, source:"figma", width, height, provenance:{ source:"figma", fileKey, nodeId, format } }) - 将输出到合成项目中。重复导入防护:重新获取前先调用
buildAssetSnippet(record).html。findByFigmaNode
Motion import
动效导入
- → read the
get_motion_context(fileKey, nodeId)(andcodeSnippets.motionDev)..css - Normalize it into a : for each animated property build a
MotionDoc{ property (motion.dev name), values, times (0..1), ease[] (named strings orMotionTrackbezier arrays), duration, repeat }. Selector = the target element's stable id ([x1,y1,x2,y2]from the component's#<id>/data-figma-id).id const spec = motionToGsap(doc);- → inject as a
const script = emitTimelineScript(spec);in the composition (after the GSAP + CustomEase CDN tags). The timeline is paused, finite, registered on<script>.window.__timelines - If a track uses shader/spring/effect props with no GSAP mapping, bake instead: → freeze MP4 → embed as
export_video. Say which path you used.<video class="clip">
- → 读取
get_motion_context(fileKey, nodeId)(以及codeSnippets.motionDev)。.css - 将其标准化为:为每个动画属性构建一个
MotionDoc{ property(motion.dev中的名称), values, times(0..1), ease[](命名字符串或MotionTrack贝塞尔数组), duration, repeat }。选择器为目标元素的稳定ID(来自组件[x1,y1,x2,y2]/data-figma-id的id)。#<id> const spec = motionToGsap(doc);- → 将其作为
const script = emitTimelineScript(spec);注入合成项目中(位于GSAP + CustomEase CDN标签之后)。时间轴处于暂停状态,为有限时长,已注册到<script>。window.__timelines - 如果轨道使用了无GSAP映射的着色器/弹簧/特效属性,则改为烘焙:→ 固化MP4 → 嵌入为
export_video。说明你使用的路径。<video class="clip">
Determinism
确定性
Never leave a Figma URL in the composition — freeze first. Never emit . Timelines paused.
repeat: -1切勿在合成项目中保留Figma URL——先固化。切勿输出。时间轴需处于暂停状态。
repeat: -1