Community图像github.com

Pixerate矢量编辑器

如何在Pixerate矢量编辑器中通过vector.*命令绘制和编辑矢量图形——添加形状、SVG路径、文字、符号、CAD约束、画板、连接线、图层填充与描边、画笔、阴影、渐变、布尔运算等。

Pixerate矢量编辑器 是什么?

Pixerate矢量编辑器技能为AI代理提供了全面的矢量图形创建和编辑能力。通过使用`vector.*`命令,AI可以生成图标、Logo、插画、字形、徽章或贝塞尔路径艺术作品,并支持导入和编辑SVG文件。该编辑器基于画板(`width` x `height`)和节点树结构工作,节点类型包括路径、文字、实例(符号副本)和组。高级功能包括:实时布尔运算、路径效果、封套扭曲、混合与变形、锚点编辑(连接、平滑、简化)、CAD式几何约束、响应式画框和连接线。技能强调“非破坏性优先”的工作流程——先使用实时效果,最后再“展平”以获得最终输出。最佳实践包括:为可调整大小的UI组件使用画框、为重复元素使用符号、为可换行文字使用区域文字。该技能支持批量操作(`run_commands`加`atomic: true`),确保撤消步骤原子化,并能导出SVG、PDF和Lottie格式。

兼容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/Pixerate/editor/tree/HEAD/packages/core/skills/pixerate-vector

Installed? Explore more 图像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Pixerate矢量编辑器 是做什么的?

矢量文档是一个画板(以文档单位表示的 width × height,Y轴向下),包含一个节点树:path节点(一个或多个贝塞尔锚点子路径,带有填充、描边和描边设置)、text节点(字符串,可设置为点文字、区域文字或沿路径文字,使用相同的填充和描边进行绘制)、instance节点(符号的副本)和group组。组也可以是实时布尔对象、实时混合、蒙版组,或带有实时效果堆栈。每个命令都是一个vector.*命令,通过run_command / run_commands执行(参见pixerate-agent-tools以了解使用"$0.id"引用、atomic: true和错误代码的批处理方法)。

  • 节点ID来自vector.list以及写入操作返回的结果({ id }、{ ids })。
  • 锚点表示为{ nodeId, subpath, index }:子路径编号(从0开始),然后是子路径内的锚点编号(从0开始)。接受anchors的命令默认使用直接选择工具选中的点;接受ids的命令默认使用当前选择。
  • 绘图是一个CSS颜色值,null表示无,或一个渐变对象{ type, stops: [{ offset, color, opacity?, midpoint? }], ... }。
  • 外观:一个路径可以堆叠多个填充和多个描边(从下到上;所有填充绘制在所有描边之下),每个填充/描边都有自己的paint、opacity、blendMode和visible,每个描边有自己的宽度、对齐方式、虚线、端点、连接、箭头和轮廓,或者是一个画笔描边(vector.addBrushstroke、vector.setBrushstroke、vector.listBrushes),沿着轮廓使用干画笔、湿画笔、混合器画笔、涂抹或混合工具、渐变绘图、种子抖动和纸纹进行绘制。图层通过其在堆栈中的index 进行寻址,0 为最底层。vector.setStyle中的fill / stroke以及描边设置是顶层图层的简写;null会清除整个堆栈。任何节点都可以拥有blendMode和filters(投影/内阴影、外发光/内发光、图层模糊、羽化),这些不会改变几何形状。
  • 蒙版:一个蒙版组的第一个(最底层)子节点是其蒙版;其上的子节点仅在蒙版的轮廓内(clip)、或蒙版明亮的区域(luminance)或不透明区域(alpha)显示。invert 交换显示和隐藏区域。vector.list 为蒙版组提供 mask 信息 { type, invert, maskId, contents, enabled };隐藏的蒙版(enabled: false)不遮蔽任何内容。
  • 文本具有基础font(字体族、粗细、斜体、字号、字距、行距、基线偏移、下划线、删除线),可选的运行覆盖范围(start / end,以UTF-16代码单元为单位,加上范围fill)、paragraph样式和frame:point(第一行基线的x、y坐标)、area(文本环绕的方框)或path(文本跟随的线条)。
  • 符号是与文档一起存储的可重用图稿(vector.listSymbols),通过instance节点使用一个可缩放和倾斜的变换(与其他节点不同)进行绘制。编辑一个符号(vector.editSymbol … vector.exitSymbolEdit)会更改所有实例。
  • 约束(CAD风格)保持锚点、线段和圆形路径之间的几何关系和尺寸;它们在每次编辑后都会重新求解,因此后续移动会保持它们的关系。
  • 画框是带有frame矩形的组(vector.listFrames):它们绘制背景、裁剪子节点并通过其矩形进行选择;顶层画框就是画板。当调整画框大小时,其子节点会遵循其调整大小约束(水平:left / right / leftRight / center / scale,垂直:top / bottom / topBottom / center / scale)而不是缩放。
  • 连接线是带有connector的开放路径,其端点粘附到其他对象的站点(边的中点或中心);它们会在每次编辑后重新布线,因此会跟随它们所连接的对象。自由端会保持原位。
  • 对称组绘制其子节点以及镜像或旋转的副本。通过在vector.addShape / vector.addPath上设置parentId来向对称组添加图形;只存储和编辑原始图形。
  • 坐标为文档单位。旋转后的节点在其自己的空间中存储几何形状:vector.list报出的bounds是文档空间中的,其d是节点自身的。

参数细节(渐变字段、效果参数、宽度轮廓、封套)在references/commands.md中。

工作流技能

对于这些任务,请同时加载工作流技能:它包含方法、步骤间的检查和陷阱,并使用下面的命令。

  • pixerate-vector-icon-set:统一网格上的图标,统一的描边和样式,清晰,作为符号和SVG输出。
  • pixerate-vector-logo:布尔运算生成的标志,组合字标,颜色变体,轮廓版交付文件。
  • pixerate-vector-illustration:勾画草稿,渐变和堆叠填充,蒙版,混合,阴影。

工作方法

  1. 读取。 vector.list 提供画板尺寸、每个节点的深度优先信息(id、类型、名称、边界、旋转、填充、描边、d、效果、混合和布尔信息、堆栈、混合模式和滤镜)以及当前选择。vector.getAppearance 给出一个节点的完整堆栈和滤镜。
  2. 分层规划。 在绘制之前决定形状、其堆叠顺序(从下到上)及其分组。从基本图元(vector.addShape)开始并组合它们;仅对基本图元无法创建的曲线编写原始d字符串。
  3. 批量写入。 将构建序列放入一个带有atomic: true和label的run_commands中,链接ID("$0.id"、"$last.ids"),使其成为一个原子性的撤消步骤,要么全部应用,要么全部不应用。
  4. 优先实时,最后展平。 在设计时使用live: true布尔运算、路径效果、封套、实时圆角和混合;仅在用户需要纯路径时使用vector.expandAppearance、vector.expandBlend或vector.outlineStroke进行烘焙处理。
  5. 检查。 再次使用vector.list:检查边界是否在预期位置,没有多余的节点,名称是否合理。vector.exportSvg提供最终的标记;在交付前检查它,如果可能,进行渲染。

最佳实践

  • 为任何需要调整大小的内容使用画框。 在画框(vector.addFrame 或 vector.frameSelection)内构建屏幕、卡片、按钮和横幅,使用 vector.setResizing 设置每个子节点的约束(背景和分隔符使用 leftRight,图标固定在其角落,标题使用 center),然后使用 vector.setFrame 调整大小,从一个设计产生多种尺寸。使用 vector.exportFrameSvg 导出每个画板。
  • 为重复元素使用符号。 当同一图形出现多次时(图标集、场景中的树木、项目符号、Logo标志),创建一次并放置实例(vector.makeSymbol,然后使用 vector.placeSymbol 并指定 x / y 或 transform),这样一次隔离编辑即可更改所有实例。为每个实例赋予清晰的名称。使用 vector.setInstanceOptions 的 fill / stroke 进行颜色变体,使用 hidden 来丢弃某个部分,而不是分离实例;仅当一个副本必须永久偏离时才分离。
  • 文本。 为标签和标题使用点文字,为需要自动换行的内容使用区域文字(width、height),为徽章和印章使用路径文字。检查每次文本写入返回的摘要中的 overflow:隐藏的行或字符表示框或路径太小。每个设计保持一到两个字体族(vector.listFonts 列出字体塑造器可用的字体;缺失的字体族会使用后备字体绘制,并会出现在 missingFonts 中)。使用 vector.setTextStyle 设置样式范围,而不是将文本拆分成单独的节点,这样它仍然作为一个段落进行编辑。仅为最终需要不依赖字体的图稿或Logo创建轮廓;如果可能更改,请保留一份文本副本。
  • 路径、描边、画笔描边、布尔运算、渐变、堆栈、蒙版、阴影、连接线、约束和垂直文本: 首先阅读 references/best-practices.md。
  • 优先非破坏性。 实时布尔运算(vector.boolean 加 live: true)、路径效果和封套保持操作数可编辑。破坏性布尔运算或Pathfinder会替换其输入;最后一步再执行,并且仅在要求平面输出时才执行。
  • 分组与命名。 将一个对象的部件进行分组(使用 vector.group 并赋予 name),为重要的路径命名(在添加时使用 name),并保持树状结构浅层。
  • SVG卫生。 使用 precision 2 或 3(默认 3)导出;仅为极小的画板使用更高精度。在将SVG交给不读取Pixerate的 data-vector-* 属性的工具之前,展开效果、混合和可变宽度描边;其他阅读器可以查看绘制的外观,但无法查看实时源。

命令

读取

命令用途
vector.list读取文档:{ width, height, nodes, selection, tool }。每个节点具有id、类型、名称、深度、文档空间下的bounds、rotation(顺时针度数)、visible、locked、selected,对于路径还有fill、stroke、strokeWidth和d;组列出children、blend、liveBoolean、effects、mask。蒙版组的bounds是其蒙版后的结果。首先调用此命令,并在任何批次之后调用。
vector.shapeBuilderFaces列出给定路径将平面分割成的区域:路径数据、面积、每个区域内部的一个点以及填充该区域的路径ID。将点与 vector.shapeBuilder 一起使用。
vector.exportSvg获取独立SVG标记形式的文档({ svg });precision 0 到 8 位小数(默认 3)。
vector.exportPdf获取一个准备打印的矢量PDF,以base64数据URL形式返回:一页,或使用 pages: "artboards" 时每个画板一页。返回 { pdf, pages, bytes, notes };检查 notes(滤镜、不透明度蒙版和没有加载字体的文本被排除在外)。
vector.exportLottie获取文档(或 ids)作为Lottie JSON,用于动画播放器:路径效果作为Lottie修改器保持实时,渐变作为渐变填充。返回 { lottie, notes };阅读 notes 以了解哪些内容近似处理(滤镜、网格渐变、未创建轮廓的文本)。

创建与删除

命令用途
vector.traceImage将PNG(数据URL)转换为一个组中的矢量路径:threshold 模式用于单色图稿(Logo、扫描件、剪影;对于抠图使用 channel: "alpha"),color 模式用于每个颜色的堆叠路径(colors 2–32)。增加 tolerance 以减少锚点,设置 cornerRoundness 为 0 以获得尖锐多边形。使用 x、y、width 放置。返回 { id, paths };检查 subpaths 计数,并在之后简化或删除斑点。
vector.mosaicImage将PNG风格化为马赛克瓷砖(cell 像素,shape 正方形/圆形,gap,colors):像素艺术,瓷砖壁画。返回 { id, paths },每种颜色一个复合路径。
vector.halftoneImage将PNG风格化为在旋转网屏上的半色调点(cell、angle、墨水 color 或为 null 以使用图片的颜色):漫画和波普艺术外观,打印效果。
vector.lowPolyImage将PNG风格化为低多边形三角形(cell、jitter、seed、colors):几何肖像和背景。
vector.hatchImage将PNG风格化为在暗部膨胀的雕刻线条(cell 间距,angle,墨水 color):钞票、木刻和线条艺术外观。
vector.addPathByDimensions以CAD用户输入的方式绘制路径:从 start 开始,每个步骤 { length, angle }(在页面上逆时针度数:0 向右,90 向上)、{ dx, dy } 或 { x, y };closed 连接两端。用于精确的技术轮廓(支架、平面图、给定长度和角度),而不是手动计算坐标。返回 { id, anchors }。
vector.addShape在 x、y、width、height(全部必需;对于直线,宽度和高度是终点的偏移)处添加一个 kind 为 rect、ellipse、polygon(sides,至少 3 条边)、star(points,innerRatio 0 到 1)或 line 的形状。cornerRadius 和 cornerKind 提供实时圆角;任何样式字段和 name 都适用。未给出的任何内容使用编辑器的默认样式。返回 { id }。
vector.addPath从SVG路径数据 d(绝对或相对M、L、H、V、C、S、Q、T、A、Z;弧线和二次贝塞尔曲线将转换为三次贝塞尔曲线)以文档单位添加路径,并可选择 name 和样式字段;未设置的样式来自编辑器默认值。当 d 没有点时失败。返回 { id }。
vector.importSvg在文档顶部添加SVG标记 svg 的形状,或使用 replace: true 替换文档。读取路径、基本形状、组、变换、线性和径向渐变、clip-path / mask 引用(作为蒙版组)、<text>(作为点文字:内容、字体、锚点和填充)以及 <use>(作为由它们引用的内容创建的符号实例);跳过图像和外部滤镜。
vector.importLottie将Lottie动画(对象或文本)的一个 frame 添加为可编辑组,或替换文档(replace: true)。修改器变为实时效果。返回 { ids, notes }。
vector.delete删除节点(ids)。
vector.rename将节点 id 重命名为 name(其在图层面板中的名称)。用其实际内容命名你创建的内容;仅在被要求时重命名用户的图层。返回 { id, name }。

样式

命令用途
vector.setStyle在 ids 上设置 fill、stroke、strokeWidth、strokeLinecap (butt, round, square)、strokeLinejoin (miter, round, bevel)、strokeDasharray、fillRule (nonzero, evenodd)、strokeAlign (center, inside, outside; 仅适用于闭合形状)、startArrow / endArrow (triangle, arrow, open, circle, square, bar, 或 null)、arrowAlign (extend, tip)、startArrowScale / endArrowScale (描边宽度的倍数, 默认 1)、strokeWidthProfile。组会应用到其中的每个路径。至少传递一个字段。
vector.setGradient编辑 ids 的填充(target 默认)或描边的渐变:type (linear, radial, conic, reflected, diamond)、stops、angle (度数, 0 向上, 顺时针)、cx / cy / r、显式的 start / end / width / focal、units、spread、interpolation (srgb 默认, linear, oklab)、smoothness、strokeMode、aspect、reverse。缺失的字段保持其值;纯色会变为此颜色到白色的渐变。返回

…

[为翻译截断]

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

Pixerate/pixerate-animation-editor

How to author and edit vector animations (motion graphics, logo reveals, animated icons, explainer scenes, UI micro-interactions) in the Pixerate animation editor through its agent tools - artwork SVG with ids, shots of commands (enter, exit, draw, move, rotate, scale, fade, morph, Smart Animate match, follow a path, pulse, shake, wiggle), easing and springs, stagger, camera, beat and voiceover cues, drivers, reusable clips, checking, rendering frames and contact sheets, and exporting to Flair or Lottie. Use when animation tools such as get_animation, insert_shots or edit_animation are available, or when asked to animate, time, ease, stagger or export vector motion, and provider motion and vector effects (for example Flair) applied to nodes.

Pixerate/pixerate-brushes

How to find, describe, create, change, check and share brushes in the Pixerate brush library through list_brush_presets, describe_brush, create_brush, update_brush, duplicate_brush, remove_brush, check_brush, export_brushes, import_brushes, import_brush_pack, preview_brush, add_brush_source and list_brush_sources - brushes made of facets (kind, medium and variety or tool, tip, marks, dynamics, behaviour, light, motion, colour), image tips and tip grain made from image sources, the built-in presets, and the host profiles that say what the paint editor, image editor, canvas and vector strokes can render. Use when asked to make, design, tweak, save, copy, delete, export, import or check a brush, make a brush from an image (a scanned mark, a leaf, a texture), give a brush grain, bring in a Photoshop .abr or Procreate .brush / .brushset pack, find a brush for a medium (pencil, ink, watercolour, oil, airbrush, highlighter), or make a brush work in another editor.

Pixerate/pixerate-canvas

How to build and edit a Pixerate design canvas or node graph through its agent tools - drawing freehand pen, highlighter and dry-brush strokes (canvas.drawFreehand), annotating with hand-drawn circles, underlines, arrows, brackets, strikes, crosses and ticks (canvas.circle, canvas.arrow), adding, connecting, updating and laying out nodes (canvas_add_node, canvas_layout), reading state with get_editor_state and looking at it with view_editor, reusable components with variants, instances and overrides (create_component, add_variant, set_instance_properties), align, distribute, lock and layer order, shape boolean operations (unite, subtract, offset path, outline stroke), auto layout frames, and keyframe animation with easing and CSS export. Use when working on a canvas, whiteboard, flow chart, node graph, frame, design system, component library, button variants, layout, alignment, z-order or a canvas animation in a Pixerate editor.

Pixerate/pixerate-video-editor

How to edit video projects in the Pixerate non-linear video editor through its agent tools - adding video, audio and image assets, building a rough cut on video and audio tracks, inserting, overwriting, moving, trimming, splitting and ripple-deleting clips, slip, slide and roll edits, lift and extract of a time range, razor cuts across tracks, sync-locked tracks, keyframed opacity, volume and transform, closing gaps, titles and colour clips, fades, volume and speed, crossfade, dip and wipe transitions with handles, J and L cuts, markers, checking the project, adjustment clips over tracks, clip masks, skin-tone protected LUTs, edit plans proposed for review before they apply, provider effects (clip effects, effect clips, effect transitions), rendering frames and contact sheets, and exporting an ffmpeg command or a CMX 3600 EDL. Use when video tools such as get_video_project, add_video_clip or edit_video are available, or when asked to cut, trim, assemble, sequence or export footage on a timeline.

相关技能