Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Develop interactive PaperJS applications for visual drawing, animation, and vector graphics. Create canvas-based experiences with JavaScript and PaperJS framework.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Undeveloped: Canvas basics; difficult coordinate math.
Target: Using PaperJS vector operations, handling paths and shapes, basic interaction.
Optimized: Complex interactive tools, optimized rendering, efficient event handling.
PaperJS simplifies vector graphics. Instead of manual canvas drawing and math, PaperJS provides high-level abstractions for paths, shapes, and transformations—enabling faster interactive graphics development.
Install PaperJS:
npm install paper
# or via CDN in HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.15/paper-full.min.js"></script>
Create canvas:
<canvas id="myCanvas"></canvas>
<script>
// Get paper ready
paper.setup('myCanvas');
// Create a simple circle
const circle = new paper.Path.Circle({
center: [100, 100],
radius: 50,
fillColor: 'blue'
});
// Render
paper.view.draw();
</script>
Create and manipulate shapes:
// Circle
const circle = new paper.Path.Circle({
center: [100, 100],
radius: 50,
fillColor: 'blue'
});
// Rectangle
const rect = new paper.Path.Rectangle({
point: [50, 50],
size: [100, 50],
fillColor: 'green'
});
// Custom path
const path = new paper.Path();
path.add([10, 10]);
path.add([20, 20]);
path.add([30, 10]);
path.closed = true;
path.fillColor = 'red';
Handle mouse events:
const path = new paper.Path();
paper.tool.onMouseDown = (event) => {
path.add(event.point);
path.strokeColor = 'black';
path.strokeWidth = 2;
};
paper.tool.onMouseDrag = (event) => {
path.add(event.point);
path.smooth(); // Smooth the path
};
paper.tool.onMouseUp = () => {
// Path is complete
console.log('Draw complete');
};
Transform shapes:
const circle = new paper.Path.Circle({
center: [100, 100],
radius: 50,
fillColor: 'blue'
});
// Rotate
circle.rotate(45);
// Scale
circle.scale(2);
// Move
circle.position.x += 50;
Create animated effects:
let angle = 0;
paper.view.onFrame = (event) => {
angle += 1;
// Update position based on angle
circle.position.x = 100 + Math.cos(angle * Math.PI / 180) * 50;
circle.position.y = 100 + Math.sin(angle * Math.PI / 180) * 50;
};
Detect clicks on shapes:
paper.tool.onMouseDown = (event) => {
// Find item at point
const hitResult = paper.project.hitTest(event.point);
if (hitResult) {
console.log('Clicked:', hitResult.item.name);
hitResult.item.selected = true;
}
};
Deliver:
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate 2chat tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate Ably tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate Abstract tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate Abuselpdb tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate Abyssale tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。