p5js

Generates interactive and generative visual art as self-contained p5.js HTML sketches.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/CHENHUI-X/toolbox --skill p5js-chenhui-x
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: p5js
Source: https://github.com/CHENHUI-X/toolbox/tree/main/official-skills/creative/p5js
Command: npx skills add https://github.com/CHENHUI-X/toolbox --skill p5js-chenhui-x

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires puppeteer, ffmpeg, and includes scripts (resource) and references (resource) components.

What problem does it solve? Creating browser-based generative art, interactive visualizations, and motion graphics requires deep knowledge of p5.js APIs, color theory, animation techniques, and export pipelines. This Skill handles the full production workflow from creative concept to exported HTML, PNG, GIF, MP4, or SVG output. ## Core Features & Use Cases - Generative Art Production: Creates seeded, reproducible procedural compositions using noise fields, particle systems, flow fields, and custom GLSL shaders with intentional color palettes and layered composition. - Multi-Format Export Pipeline: Exports sketches as self-contained HTML, high-resolution PNG, GIF loops, MP4 video via Puppeteer and ffmpeg, or SVG vector output for print. - Interactive & Audio-Reactive Visuals: Builds mouse, keyboard, touch, and microphone-driven experiences including data visualizations, kinetic typography, 3D WebGL scenes, and image processing. - Use Case: Ask for a generative art piece with a specific mood and palette, and receive a complete HTML file with seeded randomness, export key bindings, and a headless render path for producing a 30-second MP4 loop. ## Quick Start Create a p5.js generative art sketch of flowing particle trails over a dark noise-textured background and export it as a PNG.

Frequently Asked Questions about p5js

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

FAQPage Schema
How do I create generative art with p5.js?

Write a single HTML file loading p5.js from a CDN, define a seeded setup() with randomSeed() and noiseSeed(), and render procedural visuals in draw() using noise fields, particles, and HSB color palettes. Export stills with saveCanvas() or animations with saveGif().

How to export p5.js sketches as MP4 video?

Capture frames headlessly with Puppeteer using noLoop() and redraw() for deterministic frame control, then encode the PNG sequence with ffmpeg using libx264. The render.sh script automates this full pipeline from HTML to MP4.

Should I use p5.js 1.x or 2.x for my sketch?

Use p5.js 1.11.3 by default for stability and broad library compatibility including p5.js-svg. Choose 2.x only when you need async setup(), OKLCH color modes, splineVertex(), shader .modify(), or the p5.brush natural media library.

Why is my p5.js sketch running slowly?

The Friendly Error System adds up to 10x overhead, so set p5.disableFriendlyErrors = true before setup(). Also call pixelDensity(1), use Math.* functions instead of p5 wrappers in hot loops, and batch particle rendering with beginShape(POINTS) or pixel buffers.

Can p5.js export vector SVG files for print?

Yes, using the p5.js-svg library with createCanvas(w, h, SVG) and save('output.svg'). It requires p5.js 1.x and only supports vector operations, so pixel manipulation, blend modes, filters, and WebGL are unavailable.

How do I make p5.js generative art reproducible?

Call randomSeed(seed) and noiseSeed(seed) in setup() so every random() and noise() call becomes deterministic. Never use Math.random() for visual elements, and for platforms like fxhash replace p5's PRNG with the platform's deterministic random function.