add_frame
Add a new animation frame to a pixel art layer in Piskel projects to create or extend animations.
Instructions
Add a new frame to a layer
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project identifier | |
| layerIndex | No | Index of the layer (default: 0) |
Implementation Reference
- src/server/PiskelServer.ts:989-1004 (handler)The implementation of the `add_frame` tool handler. It adds a new frame to all layers of the specified Piskel project.
private addFrame(projectId: string, _layerIndex: number): object { const piskel = this.getProject(projectId); // Add frame to all layers for (let i = 0; i < piskel.getLayerCount(); i++) { const layer = piskel.getLayerAt(i); if (layer) { layer.addFrame(new Frame(piskel.getWidth(), piskel.getHeight())); } } return { success: true, frameIndex: piskel.getFrameCount() - 1, }; }