Update dependency p5 to v2 #29
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^1.4.0
->^2.0.0
Release Notes
processing/p5.js (p5)
v2.0.4
Compare Source
What's Changed 🎊
p5.strands Improvements 🧵
p5.strands is an experimental new feature in in p5.js 2.0 for authoring shaders with JavaScript. You can check out the tutorials if you're interested in trying it out. If you're interested in diving deeper and contributing, you're welcome to join the discussion in the the #p5strands channel on our Discord, or work on the open p5.strands issues
Bug Fixes 🐞
Documentation 📚
code
in the refrence. by @perminder-17 in https://github.com/processing/p5.js/pull/7902New Contributors
Full Changelog: processing/p5.js@v2.0.3...v2.0.4-rc.2
v2.0.3
Compare Source
What's Changed
What's Changed 🎊
New Contributors
Full Changelog: processing/p5.js@v2.0.2...v2.0.3
v2.0.2
Compare Source
What's Changed
Documentation and Tests
Improvements
Bugfixes and Test(s) 🐞 💚
Full Changelog
v2.0.1
Compare Source
What's Changed 🎊
Documentation and Tests
Bugfixes
Bugfix with Test 🐞 💚
New Contributors
Full Changelog: processing/p5.js@v2.0.0...v2.0.1
v2.0.0
Compare Source
We are releasing p5.js 2.0 to the community for testing and development! Here’s what you need to know.
npm latest
will default to 2.x, but the git branches are still separated withmain
on 1.x anddev-2.0
on 2.x. We will switch the branches when we have updated all automations (including deploying updated documentation to the website). Want to contribute ideas or implementation? Check the 2.x project board for an overview of what still needs discussion, and what’s ready for work!Start exploring 🌱
WEBGL
, and textWeight() for variable fonts!More details of the changes 🌳
You can also checkout Dave Pagurek's reflections on p5.js 2.0 and an open source philosophy!
Typography
Support for more color spaces in
p5.Color
(thanks to @limzykenneth and @dianamgalindo)p5.js 2.0 now supports more color modes in addition to the existing RGB, HSB, and HSL color modes. Here are the list of new supported color mode and brief description of them:
RGBHDR
- High Dynamic Range RGB color defined within the Display P3 color space. You will need to use the HDR canvas described below to draw this color on the canvas accurately.HWB
- Hue, Whiteness, Blackness. This is similar toHSL
andHSB
in that you will define a hue angle however instead of saturation and lightness, you will define the percentage of whiteness and blackness. It is the color model of the GUI color picker used by Chrome.LAB
- Also called CIE Lab, defines color with Lightness, Alpha, and Beta. The color space is often used in professional color measuring context.LCH
- An easier to use representation of a CIE Lab color with definition of Lightness, Chroma, and Hue instead.OKLAB
- OkLab is a slight adjustment to CIE Lab color space mainly to fix a non-uniformity issue that exist in CIE Lab. This difference is more visible in the example below.OKLCH
- An easier to use representation of an OkLab color with definition of Lightness, Chroma, and Hue instead.Comparing

HSL
,LCH
, andOKLCH
in a sketch below:From left to right are color wheels of
HSL
,LCH
, andOKLCH
respectively. Notice the evenness of color distribution between each wheel with OkLCH having the most even distribution. It can be noted that the LCH wheel has a large blue section that is fixed by OkLCH.To use these new color spaces in p5.js 2.0, the respective constants have been added and the
colorMode()
function can be used with these constants in the same way asRGB
,HSL
, andHSB
.Support for wide-gamut colors with the
display-p3
mode (thanks to @limzykenneth)You can now create a 2D canvas that supports HDR colors that will give you a more vibrant sketch and also HDR images. To use a HDR canvas you will need to create it using the
P2DHDR
constant like below:When a
P2DHDR
canvas is created, the default color mode will be switched to the newRGBHDR
color mode instead ofRGB
. In practice you can continue to use the same RGB color definition you have always used.This example sketch shows a direct comparison between HDR and non-HDR colors, you should see three bands of red, green, and blue colors with a slightly dimmer red, green, and blue circles within. However, both your browser and your screen will need to support HDR to see the difference. Currently Firefox on desktop does not support HDR canvas so if you do not see a difference, try a different browser such as Safari or Chrome.
You can also now load HDR images and have them be displayed in full HDR in a HDR canvas. If you see a dark image on the linked sketch, your browser or screen does not support HDR and you should try a different browser/device.
A new simple lines mode for WebGL (thanks to contributions from @perminder-17)
If you are drawing lots of shapes, and don't need stroke caps or joins, you can use a simple lines mode for increased performance in WebGL. You can activate this mode by calling
linesMode(SIMPLE)
in your sketch.Custom shaders for fills, strokes, images (thanks to @Garima3110 and @perminder-17)
You can now create your own shaders for fills, strokes, and images, and have them all applied at once! Use
shader()
to set a fill shader,strokeShader()
to set a stroke shader, andimageShader()
to set an image shader. Try usingbaseMaterialShader().modify(...)
andbaseStrokeShader().modify(...)
to create custom shaders.Updated bezier and curve drawing functions (thanks to @GregStanton)
First off: you can combine multiple types of curves in one
begin/endShape()
block now!Long cubic and quadratic bezier vertex calls are now split up into their individual control points. Both cubic and quadratic curves are done with
bezierVertex
now, and you can setbezierOrder()
to change from cubic (order 3) to quadratic (order 2). For WebGL mode, this also means you can also specify texture coordinates per control point, or change the fill, stroke, normal, and more between control points.We've renamed
curveVertex
tosplineVertex
and have given it more options. By default, it will now go through everysplineVertex
, so you no longer have to double up the first/last point to get it to go through it:Similarly,
endShape(CLOSE)
(orendContour(CLOSE)
if you're in a contour) will cause a spline to smoothly loop back on itself so you no longer need to double up any points:Async loading (thanks to @limzykenneth)
Rather than having a
preload
function, p5 2.0 hasasync setup
!🚧 Since this is a breaking change from 1.x to 2.0, you can weight in on the compatibility discussion here
Support for loading fonts via CSS (thanks to @dhowe)
In 2D mode, try loading fonts via a a path to a CSS font file, such as a Google Fonts link!
Support for variable font weight (thanks to contributions by @dhowe)
In 2D mode, if you've loaded a variable font, try changing its weight!
More ways to draw and manipulate text (thanks to @davepagurek)
Like how
textToPoints()
gives you points on text, the newtextToContours()
function lets you edit the points on text and then draw them with fills!In WebGL, you can use
textToModel
to extrude a 3D model out of your text:A new pointer event handling system (thanks to @diyaayay)
Instead of having separate methods for mouse and touch, we now use the browser's pointer API to handle both simultaneously. Try defining mouse functions as usual and accessing the global
touches
array to see what pointers are active for multitouch support!Custom shader attributes (thanks to @lukeplowden)
If you are using a shader and want custom per-vertex properties in addition to
uniform
s, which are the same across the whole shape, you can now callvertexProperty(name, value)
before vertices.What's Changed
What's Changed 🎊
colorMode()
. by @perminder-17 in https://github.com/processing/p5.js/pull/7654Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.