p5js-setup

Set up P5.js with CDN, virtual resolution, and canvas placement.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/neighbor-game-ai/DreamCore-V2-sandbox --skill p5js-setup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: p5js-setup
Source: https://github.com/neighbor-game-ai/DreamCore-V2-sandbox/tree/main/.claude/skills/p5js-setup
Command: npx skills add https://github.com/neighbor-game-ai/DreamCore-V2-sandbox --skill p5js-setup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

このスキルは、複数デバイス間で一貫したP5.js開発体験を得るための基本セットアップを提供します。CDNの活用、仮想画面サイズ、キャンバスの配置、インスタンスモード、そしてタッチ/マウス入力の扱いを統一します。

Core Features & Use Cases

  • 固定仮想画面: VIRTUAL_WIDTHとVIRTUAL_HEIGHTを用いた端末横断の一貫性を確保。
  • キャンバス配置とUI層: canvasを特定のコンテナへ配置し、UI要素とのレイヤー管理を実現。
  • インスタンスモードの活用: 複数の小規模プロジェクトで再利用可能な基本設定を提供。
  • 実用例: 2Dゲームやインタラクティブデモでの安定した描画と入力処理を保証。

Quick Start

このスキルを使って、固定された仮想画面サイズとcanvas配置、インスタンスモードを適用したP5.jsの基本セットアップを新規プロジェクトに適用してください。

Frequently Asked Questions about p5js-setup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I keep a p5.js canvas consistent across different screen sizes?

Set up a fixed virtual resolution using defined VIRTUAL_WIDTH and VIRTUAL_HEIGHT variables to ensure consistent p5.js canvas scaling across devices. This baseline handles responsive windowResized events and translates coordinates relative to the fixed virtual screen.

How do I place a p5.js canvas inside a specific HTML UI container?

Use the canvas.parent binding method to attach the p5.js canvas to a specific HTML UI container. This ensures proper canvas containment, manages z-index layering, and allows interactive UI elements to overlay the rendering surface correctly.

Can I use p5.js instance mode for reusable game development setups?

Yes, p5.js instance mode is fully supported and provides a reusable baseline configuration for multiple small projects. It encapsulates the fixed virtual screen scaling, canvas placement, and touch input transformation logic within a single self-contained scope.

What is the best way to handle touch input transformation in a scaled p5.js canvas?

Apply coordinate translation utilities to map touch input accurately on a scaled p5.js canvas. The baseline setup translates raw touch coordinates back into the fixed virtual resolution space, ensuring accurate interaction detection across varying display sizes.

Do I need a CDN to set up a robust p5.js baseline?

Using a CDN is included in the robust p5.js baseline setup to ensure quick and reliable library loading. It pairs directly with the fixed virtual resolution and canvas containment configurations to provide a complete, stable starting point for development.