{"schemaVersion":"1.0","record":{"label":"p5.js","description":"JavaScript creative-coding library for interactive graphics and browser-based sketches.","aliases":["p5js"],"kind":"software","website":"https://p5js.org/","overview":"p5.js is a free JavaScript library for creative coding, including interactive graphics and animation on a web page. It can be used through an online editor or as a library in a locally developed web project. Its sketch-oriented model offers an alternative to desktop creative-coding environments when browser delivery is part of the requirement.","license":"GNU Lesser General Public License 2.1 for the library; website and example content have separate terms","lifecycle":"active","example":false,"features":[{"name":"Browser sketch development","status":"supported","detail":"The library supports interactive JavaScript sketches through online or local web-development workflows.","useCase":"Creating interactive visual sketches for the web","platforms":["Web browser"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://p5js.org/tutorials/setting-up-your-environment/","locator":"Web Editor, local development and browser preview","retrievedAt":"2026-10-07T19:11:03Z","kind":"vendor"}]},{"name":"Accessible canvas descriptions","status":"supported","detail":"describe adds an author-written description for screen readers or a visible label.","useCase":"Creating interactive visual sketches for the web","platforms":["Web browser"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://p5js.org/reference/p5/describe/","locator":"Author-provided screen-reader-accessible canvas descriptions","retrievedAt":"2026-10-07T19:11:12Z","kind":"vendor"}]},{"name":"Version-1 compatibility","status":"limited","detail":"Version 2 changes input events and asset loading; optional compatibility add-ons cover documented older patterns.","useCase":"Creating interactive visual sketches for the web","platforms":["Web browser"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://p5js.org/tutorials/v2_transition/","locator":"Input-event and asset-loading changes; compatibility add-ons","retrievedAt":"2026-10-07T19:11:03Z","kind":"vendor"}]}],"alternatives":[],"slug":"p5-js","draftAlternatives":[{"targetSlug":"processing","status":"limited","detail":"Can replace desktop visual-sketch authoring when a JavaScript/browser result is desired; Java code, libraries and export assumptions require porting.","useCase":"Creating interactive visual sketches for the web","platforms":["Web browser"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://p5js.org/tutorials/setting-up-your-environment/","locator":"Web Editor, local development and browser preview","retrievedAt":"2026-10-07T19:11:03Z","kind":"vendor"},{"url":"https://processing.org/environment/","locator":"Desktop Java-mode sketch workflow","retrievedAt":"2026-10-07T19:08:52Z","kind":"vendor"}]}],"evidence":[{"url":"https://p5js.org/","locator":"JavaScript creative-coding library and learning scope","retrievedAt":"2026-10-07T19:08:40Z","kind":"vendor"},{"url":"https://p5js.org/tutorials/setting-up-your-environment/","locator":"Web Editor, local development and browser preview","retrievedAt":"2026-10-07T19:11:03Z","kind":"vendor"},{"url":"https://p5js.org/reference/p5/createCanvas/","locator":"P2D/WebGL modes, browser context and WebGPU add-on requirements","retrievedAt":"2026-10-07T19:11:12Z","kind":"vendor"},{"url":"https://p5js.org/reference/p5/describe/","locator":"Author-provided screen-reader-accessible canvas descriptions","retrievedAt":"2026-10-07T19:11:12Z","kind":"vendor"},{"url":"https://p5js.org/tutorials/v2_transition/","locator":"Input-event and asset-loading changes; compatibility add-ons","retrievedAt":"2026-10-07T19:11:03Z","kind":"vendor"},{"url":"https://p5js.org/download/","locator":"Current pinned 2.3.3 CDN URL and separate compatible p5.sound distribution","retrievedAt":"2026-10-07T19:09:05Z","kind":"vendor"},{"url":"https://p5js.org/copyright/","locator":"LGPL 2.1 library versus MIT website and CC BY-NC-SA reference/examples","retrievedAt":"2026-10-07T19:09:37Z","kind":"vendor"},{"url":"https://processing.org/environment/","locator":"Desktop Java-mode sketch workflow","retrievedAt":"2026-10-07T19:08:52Z","kind":"vendor"}],"document":{"version":1,"references":[{"url":"https://p5js.org/","locator":"JavaScript creative-coding library and learning scope","retrievedAt":"2026-10-07T19:08:40Z","id":"home","title":"p5.js overview","kind":"vendor"},{"url":"https://p5js.org/tutorials/setting-up-your-environment/","locator":"Web Editor, local development and browser preview","retrievedAt":"2026-10-07T19:11:03Z","id":"environment","title":"Setting up a p5.js environment","kind":"vendor"},{"url":"https://p5js.org/reference/p5/createCanvas/","locator":"P2D/WebGL modes, browser context and WebGPU add-on requirements","retrievedAt":"2026-10-07T19:11:12Z","id":"canvas","title":"p5.js createCanvas reference","kind":"vendor"},{"url":"https://p5js.org/reference/p5/describe/","locator":"Author-provided screen-reader-accessible canvas descriptions","retrievedAt":"2026-10-07T19:11:12Z","id":"access","title":"p5.js describe reference","kind":"vendor"},{"url":"https://p5js.org/tutorials/v2_transition/","locator":"Input-event and asset-loading changes; compatibility add-ons","retrievedAt":"2026-10-07T19:11:03Z","id":"migration","title":"Teachers' guide to p5.js version 2","kind":"vendor"},{"url":"https://p5js.org/download/","locator":"Current pinned 2.3.3 CDN URL and separate compatible p5.sound distribution","retrievedAt":"2026-10-07T19:09:05Z","id":"download","title":"p5.js downloads","kind":"vendor"},{"url":"https://p5js.org/copyright/","locator":"LGPL 2.1 library versus MIT website and CC BY-NC-SA reference/examples","retrievedAt":"2026-10-07T19:09:37Z","id":"license","title":"p5.js copyright and acknowledgements","kind":"vendor"},{"url":"https://processing.org/environment/","locator":"Desktop Java-mode sketch workflow","retrievedAt":"2026-10-07T19:08:52Z","id":"processing","title":"Processing environment","kind":"vendor"}],"overviewCitations":["home","environment","canvas"],"licenseCitations":["license"],"sections":[{"id":"workflow","heading":"Writing and delivering a sketch","paragraphs":[{"id":"workflow-detail","content":[{"text":"A p5.js sketch is JavaScript source used in a web page. The online editor provides a direct authoring route, while the local-development tutorial describes editing project files and viewing them through a development server in a browser. The library is distinct from the editor: downloading its complete distribution does not include an installed editing application."}],"citations":["environment","download"]}]},{"id":"rendering","heading":"Canvas and rendering choices","paragraphs":[{"id":"rendering-detail","content":[{"text":"createCanvas establishes the sketch's drawing surface, with P2D or WebGL rendering options. WebGL2 is used when supported by the browser, with a WebGL1 option also documented. WebGPU requires its own mode add-on and asynchronous canvas creation. These are environment-dependent rendering paths, so the presence of a drawing API does not establish identical graphics behavior across every browser and device."}],"citations":["canvas"]}]},{"id":"accessibility","heading":"Describing visual output","paragraphs":[{"id":"accessibility-detail","content":[{"text":"The describe function attaches an author-supplied explanation to the canvas for screen readers. It can also display that text beside the canvas as a visible label. This provides a practical accessibility mechanism for visual sketches, but its usefulness depends on the description written for the actual work; the function does not automatically infer the meaning of a generated image or interaction."}],"citations":["access"]}]},{"id":"migration","heading":"Migrating to version 2","paragraphs":[{"id":"migration-detail","content":[{"text":"The version-2 teaching guide identifies input events and asset loading as common migration points. Mouse-button handling becomes an object with individual button states, and the guide moves loading from preload into asynchronous setup with await. Optional Data & Events and Preload compatibility add-ons can retain older patterns. The guide is deliberately scoped to common educational code, rather than a claim that these are the only changes affecting every existing application."}],"citations":["migration"]}]},{"id":"dependencies","heading":"Pinning the library and sound support","paragraphs":[{"id":"dependencies-detail","content":[{"text":"The download page offers a pinned 2.3.3 library URL separately from a floating latest-version URL. Sound is maintained in p5.sound rather than the main library. It warns that a sound file included in a complete download may be outdated and incompatible with p5.js 2.x. Reproducing a working audiovisual sketch therefore requires recording the sound dependency as well as the core version."}],"citations":["download"]}]},{"id":"license","heading":"Licensing boundaries","paragraphs":[{"id":"license-detail","content":[{"text":"The p5.js library is licensed under LGPL 2.1. The website has a different license, and its reference and example pages use CC BY-NC-SA 4.0. Those distinctions matter when distributing library code, adapting documentation examples or supplying original artwork: the library's availability does not put every adjacent asset under the same terms. This article is original research prose rather than a copied example sketch."}],"citations":["license"]}]},{"id":"comparison","heading":"Substitution considerations","paragraphs":[{"id":"comparison-detail","content":[{"text":"p5.js can substitute for "},{"text":"Processing","targetSlug":"processing"},{"text":" for interactive visual experiments where browser access is preferable to distributing a desktop Java application. The shared sketch concept provides a useful conceptual bridge, but it does not establish source compatibility. Java-specific libraries, filesystem assumptions and renderer behavior need separate replacements or revisions. The assessment is based on documented development models; no port, installation or performance comparison was executed."}],"citations":["environment","processing","canvas"]}]}]},"id":"Q307","revision":293,"updatedAt":"2026-10-11T19:40:36Z","sourceUrl":"https://substitutefor.net/entities/Q307?revision=293"}}