Skip to content

Releases: processing/p5.js

v1.11.12

30 Mar 17:12

Choose a tag to compare

What's Changed

This p5.js v1 release reflects increasing stability of this version. Most of this patch is documentation updates, with a few bugfixes.

This patch also includes some notable updates in the project as a whole:

Bugfixes & FES

Documentation

New Contributors

Full Changelog: v1.11.11...v1.11.12

v2.2.3

23 Mar 21:46

Choose a tag to compare

What's Changed

This patch contains bugfixes, documentation updates, and improvements in developer experience:

  1. A decorator API for further customisation of p5.js by addons without needing to duplicate or directly modify internal implementation. It is already used internally by FES parameter validation and provides a route towards additional accessibility oriented features. It is based on this proposal. (@limzykenneth)
  2. A fix enabling p5 global-mode typescript use, such as in this non-trivial example (@nbogie)
  3. Extensive update to the contributor documentation for testing 2.x p5.js reference locally (@nbogie)
  4. Bugfixes for p5.strands and WebGL (@davepagurek and @aashu2006)
  5. Other bugfixes, docs updates, and improvement (@avinxshKD , @codervinitjangir, @imrinahru , @MASTERsj01, @Nitin2332)

Try it out!

To use this patch, you can use this starter sketch!

Or load both p5.js and WebGPU mode by adding these two script tags to your sketch:

<script src="https://cdn.jsdelivr.net/npm/p5@2.2.3/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p5@2.2.3/lib/p5.webgpu.js"></script>

Then load WebGPU mode in createCanvas - note the async/await, this is needed for WebGPU but not WebGL:

async function setup() {
  await createCanvas(400, 400, WEBGPU);
}

If you take any existing sketch, such as from the intro to strands tutorial, you can switch from WEBGL to WEBGPU (async/await will be needed!)

Read more about how the WebGPU-based renderer works and where we plan on taking it here!

Developer experience

Documentation updates

WebGL and p5.strands bugfixes

  • Handle booleans used as temp variables in p5.strands by @davepagurek in #8548
  • Fix usage of perspective() with no args by @davepagurek in #8564
  • Avoid unnecessary texture copies and fix flipped webcams in WebGL by @davepagurek in #8572
  • Handle strands set() calls in branches and loops by @davepagurek in #8576
  • Fix filter() crash on createGraphics(WEBGL) by mirroring strands API … by @aashu2006 in #8568
  • Fix a bug where shared strands variables are detected in the wrong spot by @davepagurek in #8641

Other bugfixes

New Contributors

Stewards & testers

Thanks to @nbogie @davepagurek for code review and @aashu2006 and @Jatin24062005 for additional support with testing the release candidates 🎉

Full Changelog: v2.2.2...v2.2.3

v1.11.12-rc.2

30 Mar 13:42

Choose a tag to compare

v1.11.12-rc.2 Pre-release
Pre-release

What's Changed

What's Changed 🎊

  • [TESTERS NEEDED] Rewrite AGENTS.md with community-first agent guidelines by @SableRaf in #8604
  • Update Discord invite links in p5.js by @Nitin2332 in #8658
  • Update contributor guidelines for issue usage and labels by @ksen0 in #8656
  • docs: add Nitin2332 as a contributor for code by @allcontributors[bot] in #8657
  • chore: update contributors.png from .all-contributorsrc by @p5js-bot in #8663

Full Changelog: v1.11.12-rc.1...v1.11.12-rc.2

v2.2.3-rc.1

16 Mar 20:53

Choose a tag to compare

v2.2.3-rc.1 Pre-release
Pre-release

What's Changed

This is a release candidate (RC), which means it is not yet live on the p5.js Editor. Please help us to improve the stability of the newest version of p5.js by trying out this release candidate, and reporting bugs. To test this patch, you can use this starter sketch.

<script src="https://cdn.jsdelivr.net/npm/p5@2.2.3-rc.1/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p5@2.2.3-rc.1/lib/p5.webgpu.js"></script>

What's Changed 🎊

  • Fix a bug where shared strands variables are detected in the wrong spot by @davepagurek in #8641
  • add export default p5 at end of global.d.ts by @nbogie in #8299
  • change strands examples to use millis() not uniform by @nbogie in #8648

Full Changelog: v2.2.3-rc.0...v2.2.3-rc.1

v2.2.3-rc.0

10 Mar 22:05

Choose a tag to compare

v2.2.3-rc.0 Pre-release
Pre-release

What's Changed

This is a release candidate (RC), which means it is not yet live on the p5.js Editor. Please help us to improve the stability of the newest version of p5.js by trying out this release candidate, and reporting bugs. To test this patch, you can use this starter sketch.

<script src="https://cdn.jsdelivr.net/npm/p5@2.2.3-rc.0/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p5@2.2.3-rc.0/lib/p5.webgpu.js"></script>

What's Changed 🎊

New Contributors

Full Changelog: v2.2.2...v2.2.3-rc.0

v1.11.12-rc.1

10 Mar 22:01

Choose a tag to compare

What's Changed 🎊

The next patch will contain various documentation improvements and WEBGL bugfixes. Highlight: the README now contain a single image of all the contributor icons! This allows both visibility and faster loading.

This is a release candidate (RC), which means it is not yet live on the p5.js Editor. Please help us to improve the stability of the newest version of p5.js by trying out this release candidate, and reporting bugs. To test this patch, you can use this starter sketch!

<script src="https://cdn.jsdelivr.net/npm/p5@1.11.12-rc.1/lib/p5.js"></script>

Bugfixes (WEBGL)

Docs and Error Messages

New Contributors

Full Changelog: v1.11.11...v1.11.12-rc.1

v2.2.2

22 Feb 20:56

Choose a tag to compare

What's Changed

This patch focuses on bugfixes, particularly on WebGPU performance and p5.strands. The goal is that all p5.strands shaders work with both WebGPU and WebGL canvases. This patch also adds millis() support inside strands code.

To use this patch, you can use this starter sketch!

Or load both p5.js and WebGPU mode by adding these two script tags to your sketch:

<script src="https://cdn.jsdelivr.net/npm/p5@2.2.2/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p5@2.2.2/lib/p5.webgpu.js"></script>

Then load WebGPU mode in createCanvas - note the async/await, this is needed for WebGPU but not WebGL:

async function setup() {
  await createCanvas(400, 400, WEBGPU);
}

If you take any existing sketch, such as from the intro to strands tutorial, iyou can switch from WEBGL to WEBGPU (async/await will be needed!)

Read more about how the WebGPU-based renderer works and where we plan on taking it here!

millis() supported in p5.strands

Here is a sketch (thanks @perminder-17!) showing millis() being used inside a strands shader. Previously, const t = uniformFloat(() => millis()); was needed. This can still be used, but you can instead use millis() directly:

// p5.js (WEBGL) sketch showing millis() driving a wavy displacement
let mat;

function setup() {
  createCanvas(600, 400, WEBGL);
  pixelDensity(1);

  mat = baseMaterialShader().modify(() => {
    // displace geometry in world-space based on y + time
    getWorldInputs((inputs) => {
      const wave = sin(inputs.position.y * 0.05 + millis() * 0.004);
      inputs.position += [20, 25, 20] * wave;
      return inputs;
    });
  });
}

function draw() {
  background(15);
  orbitControl();

  // lights so the material shader looks nice
  ambientLight(40);
  directionalLight(255, 255, 255, 0.3, 0.6, -1);

  // apply the modified material shader + draw some geometry
  shader(mat);
  noStroke();

  // some rotation so you can see the displacement depth
  rotateY(frameCount * 0.01);
  rotateX(-0.25);

  // a tall shape so Y-based waves are obvious
  sphere(120, 80, 60);
}

What does p5.strands make possible?

(Special thanks to @davepagurek for creating the sketches! Excerpted from a blog post about 2.2 updates.)

image

First, consider this sketch, which uses JavaScript loops to draw a cube of cubes. It is only 40 lines, but if there are many more cubes, it will slow down very much. If it is running smoothly, try changing all the “15” to a higher and higher number, such as “30.” As the scene grows, the sketch performance will suffer very noticeably.

The purpose of shader is to use parallel, GPU-based computation to speed this up. Instead of for loops, here is a second version of the same sketch using GLSL. It is 200 lines of code, and, if you are not familiar with GLSL, may be very difficult to read. Look for the “15” here, too, and try changing it to a larger number, like “30” or beyond. The shader-based animation remains smooth, showing the performance benefits of GPU rendering.

Finally, the p5.strands version of this sketch combines a more accessible, readable style of JavaScript with the performance of GLSL.

With the introduction of the WebGPU-based renderer, p5.strands sketches can seamlessly switch between WEBGL or WEBGPU renderer. Here is the same example as above, but using the WebGPU-based renderer. The only changes needed were to use async/await with createCanvas(...), and to import both the main library and the p5.webgpu.js add-on:

    <script src="https://cdn.jsdelivr.net/npm/p5@2.2.2/lib/p5.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/p5@2.2.2/lib/p5.webgpu.js"></script>

All Changes

  • Refactor global node handling and add millis function by @perminder-17 in #8530
  • 2.0 strands docs: add simple noise() example for buildFilterShader by @nbogie in #8521
  • Sketch verifier: parse using the latest supported ECMAScript version by @dontwanttothink in #8522
  • Add support for negative vertex indices in OBJ loader for 2.x by @avinxshKD in #8512
  • Fix Show actual type in strands hook error messages by @Anshumancanrock in #8505
  • Improve WebGL font error message to suggest textFont() usage by @yugalkaushik in #8513
  • Fix/webgpu crash pixel density by @saurabh24thakur in #8476
  • Fix WebGPU bugs surfaced by the Intro to Strands tutorial by @davepagurek in #8538
  • Fix build*Shader methods in instance mode by forwarding optional scope by @aashu2006 in #8523
  • Fix broken reference links in lerpColor() documentation (p5.js 2.0) by @rakesh2OO5 in #8518
  • Fix WebGPU filter shader parameters being named differently than in WebGL by @davepagurek in #8546
  • Updated readme and contributors for 2.0 branch by @ksen0 in #8556
  • Updated readme and contributors for 2.0 branch (with attribution for image) by @ksen0 in #8557

New Contributors

Stewards

Code review and additional support with testing the release candidates by:

Full Changelog: v2.2.1...v2.2.2

v2.2.2-rc.2

21 Feb 19:21

Choose a tag to compare

v2.2.2-rc.2 Pre-release
Pre-release

What's Changed

The upcoming patch focuses on bugfixes and documentation, particularly on strands and WebGPU. Specifically, the goal is that all strands shaders work with both WebGPU and WebGL canvases.

This is a release candidate (RC), which means it is not yet live on the p5.js Editor. Please help us to improve the stability of the newest version of p5.js by trying out this release candidate, and reporting bugs. You can also share your thoughts or get involved on Discord in the #webpgu or #p5strands channels!

To test this patch, you can use this starter sketch!

Or load both p5.js and WebGPU mode by adding these two script tags to your sketch:

<script src="https://cdn.jsdelivr.net/npm/p5@2.2.2-rc.2/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p5@2.2.2-rc.2/lib/p5.webgpu.js"></script>

Then load WebGPU mode in createCanvas - note the async/await, this is needed for WebGPU but not WebGL:

async function setup() {
  await createCanvas(400, 400, WEBGPU);
}

Read more about how it works and where we plan on taking it here!

What's Changed 🎊

  • Fix WebGPU filter shader parameters being named differently than in WebGL by @davepagurek in #8546

Full Changelog: v2.2.2-rc.1...v2.2.2-rc.2

v2.2.2-rc.1

19 Feb 17:02

Choose a tag to compare

v2.2.2-rc.1 Pre-release
Pre-release

What's Changed

The upcoming patch focuses on bugfixes and documentation, particularly on strands and WebGPU. Specifically, the goal is that all strands shaders work with both WebGPU and WebGL canvases.

This is a release candidate (RC), which means it is not yet live on the p5.js Editor. Please help us to improve the stability of the newest version of p5.js by trying out this release candidate, and reporting bugs. You can also share your thoughts or get involved on Discord in the #webpgu or #p5strands channels!

To test this patch, you can use this starter sketch!

Or load both p5.js and WebGPU mode by adding these two script tags to your sketch:

<script src="https://cdn.jsdelivr.net/npm/p5@2.2.2-rc.1/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p5@2.2.2-rc.1/lib/p5.webgpu.js"></script>

Then load WebGPU mode in createCanvas - note the async/await, this is needed for WebGPU but not WebGL:

async function setup() {
  await createCanvas(400, 400, WEBGPU);
}

Read more about how it works and where we plan on taking it here!

What's Changed 🎊

  • Fix broken reference links in lerpColor() documentation (p5.js 2.0) by @rakesh2OO5 in #8518
  • Refactor global node handling and add millis function by @perminder-17 in #8530

Full Changelog: v2.2.2-rc.0...v2.2.2-rc.1

v2.2.2-rc.0

18 Feb 12:01

Choose a tag to compare

v2.2.2-rc.0 Pre-release
Pre-release

What's Changed

The upcoming patch focuses on bugfixes and documentation, particularly on strands and WebGPU. Specifically, the goal is that all strands shaders work with both WebGPU and WebGL canvases.

This is a release candidate (RC), which means it is not yet live on the p5.js Editor. Please help us to improve the stability of the newest version of p5.js by trying out this release candidate, and reporting bugs. You can also share your thoughts or get involved on Discord in the #webpgu or #p5strands channels!

To test this patch, you can load both p5.js and WebGPU mode by adding these two script tags to your sketch:

<script src="https://cdn.jsdelivr.net/npm/p5@2.2.2-rc.0/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p5@2.2.2-rc.0/lib/p5.webgpu.js"></script>

Then load WebGPU mode in createCanvas - note the async/await, this is needed for WebGPU but not WebGL:

async function setup() {
  await createCanvas(400, 400, WEBGPU);
}

Read more about how it works and where we plan on taking it here!

What's Changed 🎊

New Contributors

Full Changelog: v2.2.1...v2.2.2-rc.0