본문으로 건너뛰기
cccskills
무료GitHub에 공개

paperjsx

Develop interactive PaperJS applications for visual drawing, animation, and vector graphics. Create canvas-based experiences with JavaScript and PaperJS framework.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md3.8 KB
  • references/json-schema.md13.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

PaperJS Development

Use This Skill When

  • Building interactive drawing or sketching applications
  • Creating vector graphic visualizations
  • Developing canvas-based animations
  • Building tools for visual content creation
  • Creating geometric visualization tools
  • Developing interactive graphic editors

When NOT to Use

  • Simple 2D games (consider Phaser or Three.js)
  • Complex 3D graphics (use Three.js)
  • Non-interactive vector graphics (use SVG directly)

Context: PaperJS Development Maturity

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.

Core Principle

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.

Instructions

Step 1: Setup and Initialization

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>

Step 2: Basic Shapes and Paths

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';

Step 3: Interactive Drawing

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');
};

Step 4: Transformations

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;

Step 5: Animation

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;
};

Step 6: Hit Testing and Selection

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;
  }
};

Output

Deliver:

  1. PaperJS Setup (HTML canvas, initialization)
  2. Basic Shapes (circles, rectangles, paths)
  3. Interactive Drawing (mouse event handlers)
  4. Transformations (rotate, scale, move)
  5. Animation Loop (frame-based updates)
  6. Hit Testing (click detection on shapes)

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

manu14357/zskills162026년 7월 24일 업데이트

Automate 2chat tasks via Rube MCP (Composio). Always search tools first for current schemas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

manu14357/zskills162026년 7월 24일 업데이트

Automate Ably tasks via Rube MCP (Composio). Always search tools first for current schemas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

manu14357/zskills162026년 7월 24일 업데이트

Automate Abstract tasks via Rube MCP (Composio). Always search tools first for current schemas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

manu14357/zskills162026년 7월 24일 업데이트

Automate Abuselpdb tasks via Rube MCP (Composio). Always search tools first for current schemas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

manu14357/zskills162026년 7월 24일 업데이트

Automate Abyssale tasks via Rube MCP (Composio). Always search tools first for current schemas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

manu14357/zskills162026년 7월 24일 업데이트

manu14357의 스킬 모두 보기

이 스킬의 문제 신고