p5js

Creates p5.js sketches for generative art, interactive visuals, shaders, and 3D scenes.

1|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/maopujie10-sys/Bailongma --skill p5js-maopujie10-sys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: p5js
Source: https://github.com/maopujie10-sys/Bailongma/tree/main/skills/hermes-skills/creative/p5js
Command: npx skills add https://github.com/maopujie10-sys/Bailongma --skill p5js-maopujie10-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Turning a creative idea into a polished browser-based visual piece requires deep knowledge of p5.js rendering, noise functions, particle systems, shaders, and export pipelines. This Skill provides a complete production pipeline that takes a concept from creative vision to exported PNG, GIF, MP4, or SVG output. ## Core Features & Use Cases - Generative Art & Motion Graphics: Build seeded, reproducible compositions using multi-octave noise, flow fields, particle systems, and custom color palettes in HSB. - Interactive & Audio-Reactive Visuals: Create mouse, keyboard, touch, and microphone-driven sketches with p5.sound FFT analysis. - 3D & Shader Effects: Use WebGL mode with GLSL shaders, lighting, cameras, and post-processing for advanced scenes. - Deterministic Export: Render high-resolution frames headlessly via Puppeteer and stitch them into MP4 with ffmpeg, or export SVG for print. - Use Case: Ask for an audio-reactive particle visualization; the Skill writes a single self-contained HTML file with seeded randomness, layered offscreen buffers, and keyboard shortcuts to save PNG or GIF output. ## Quick Start Ask the assistant to create a p5.js generative art sketch of flowing particles over a dark gradient 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 CDN, then define setup() and draw() functions using noise(), particle classes, and HSB color palettes. Always call randomSeed() and noiseSeed() so the same seed reproduces the same output.

How to export p5.js sketches as video or GIF?

Use saveGif() for short GIF loops or saveFrames() plus ffmpeg for MP4 conversion. For deterministic headless capture, add noLoop() in setup and use Puppeteer to advance frames one at a time before stitching with ffmpeg.

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

p5.js 1.x (1.11.3) is the default choice with stable behavior and the broadest library compatibility. Use 2.x only when you need async setup(), OKLCH color modes, shader modify() API, 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 set pixelDensity(1), use Math.* functions instead of p5 wrappers in hot loops, and batch particles with beginShape(POINTS) or pixel buffers.

Can p5.js render 3D scenes and custom shaders?

Yes, createCanvas(w, h, WEBGL) enables 3D geometry, cameras, lighting, and materials. Custom GLSL shaders are created with createShader(vert, frag), but note the origin moves to center and the Y-axis is inverted compared to 2D mode.

Does p5.js support audio-reactive visuals?

Yes, the p5.sound addon provides FFT analysis, amplitude tracking, and microphone input. Load p5.sound.min.js from CDN and use the analysis values to drive visual parameters like particle size, color, or motion each frame.