Module p5_sys::global [−][src]
Statics
abs | Calculates the absolute value (magnitude) of a number. Maps to Math.abs(). |
acos | The inverse of cos(), returns the arc cosine of a value. |
alpha | Extracts the alpha value from a color or pixel array. |
ambientLight | Creates an ambient light with a color. Ambient light is light that comes from everywhere on the canvas. |
ambientMaterial | Ambient material for geometry with a given color. Ambient material defines the color the object reflects under any lighting. |
angleMode | Sets the current mode of p5 to given mode. Default mode is RADIANS. |
append | Adds a value to the end of an array. Extends the length of |
applyMatrix | Multiplies the current matrix by the one specified through the parameters. |
arc | Draw an arc to the screen. If called with only x, y, w, h, start and stop, |
arrayCopy | Copies an array (or part of an array) to another array. The src array is |
asin | The inverse of sin(), returns the arc sine of a value. |
atan | The inverse of tan(), returns the arc tangent of a value. |
atan2 | Calculates the angle (in radians) from a specified point to the coordinate |
background | The background() function sets the color used |
beginContour | Use the beginContour() and |
beginShape | Using the beginShape() and endShape() functions allow creating more |
bezier | Draws a cubic Bezier curve on the screen. These curves are defined by a |
bezierDetail | Sets the resolution at which Bezier's curve is displayed. The default value is 20. |
bezierPoint | Given the x or y co-ordinate values of control and anchor points of a bezier |
bezierTangent | Evaluates the tangent to the Bezier at position t for points a, b, c, d. |
bezierVertex | Specifies vertex coordinates for Bezier curves. Each call to |
blend | Copies a region of pixels from one image to another, using a specified |
blendMode | Blends the pixels in the display window according to the defined mode. |
blue | Extracts the blue value from a color or pixel array. |
boolean | Converts a number or string to its boolean representation. |
box | Draw a box with given width, height and depth |
brightness | Extracts the HSB brightness value from a color or pixel array. |
byte | Converts a number, string representation of a number, or boolean to its byte |
camera | Sets the camera position for a 3D sketch. Parameters for this function define |
ceil | Calculates the closest int value that is greater than or equal to the |
changed | The .changed() function is called when the value of an |
char | Converts a number or string to its corresponding single-character |
circle | Draws a circle to the screen. A circle is a simple closed shape.It is the set |
clear | Clears the pixels within a buffer. This function only clears the canvas. |
clearStorage | Clears all local storage items set with storeItem() |
color | Creates colors for storing in variables of the color datatype. The |
colorMode | colorMode() changes the way p5.js interprets |
concat | Concatenates two arrays, maps to Array.concat(). Does not modify the |
cone | Draw a cone with given radius and height |
constrain | Constrains a value between a minimum and maximum value. |
copy | Copies a region of the canvas to another region of the canvas |
cos | Calculates the cosine of an angle. This function takes into account the |
createA | |
createAudio | Creates a hidden HTML5 |
createButton | Creates a button element in the DOM. |
createCamera | Creates a new p5.Camera object and tells the |
createCanvas | Creates a canvas element in the document, and sets the dimensions of it |
createCapture | Creates a new HTML5 video element that contains the audio/video feed |
createCheckbox | Creates a checkbox input element in the DOM. |
createColorPicker | Creates a colorPicker element in the DOM for color input. |
createConvolver | Create a p5.Convolver. Accepts a path to a soundfile |
createDiv | Creates a element in the DOM with given inner HTML. |
createElement | Creates element with given tag in the DOM with given content. |
createFileInput | Creates an input element in the DOM of type 'file'. |
createGraphics | Creates and returns a new p5.Renderer object. Use this class if you need |
createImage | Creates a new p5.Image (the datatype for storing images). This provides a |
createImg | Creates an element in the DOM with given src and |
createInput | Creates an input element in the DOM for text input. |
createNumberDict | Creates a new instance of p5.NumberDict using the key-value pair |
createP | Creates a element in the DOM with given inner HTML. Used |
createRadio | Creates a radio button element in the DOM.It also helps existing radio buttons |
createSelect | Creates a dropdown menu select element in the DOM. |
createShader | No description available |
createSlider | Creates a slider input element in the DOM. |
createSpan | Creates a element in the DOM with given inner HTML. |
createStringDict | Creates a new instance of p5.StringDict using the key-value pair |
createVector | Creates a new p5.Vector (the datatype for storing vectors). This provides a |
createVideo | Creates an HTML5 video element in the DOM for simple playback |
createWriter | No description available |
cursor | Sets the cursor to a predefined symbol or an image, or makes it visible |
curve | Draws a curved line on the screen between two points, given as the |
curveDetail | Sets the resolution at which curves display. The default value is 20 while |
curvePoint | Evaluates the curve at position t for points a, b, c, d. |
curveTangent | Evaluates the tangent to the curve at position t for points a, b, c, d. |
curveTightness | Modifies the quality of forms created with curve() |
curveVertex | Specifies vertex coordinates for curves. This function may only |
cylinder | Draw a cylinder with given radius and height |
day | p5.js communicates with the clock on your computer. The day() function |
debugMode | debugMode() helps visualize 3D space by adding a grid to indicate where the |
degrees | Converts a radian measurement to its corresponding value in degrees. |
describe | Creates a screen-reader accessible description for the canvas. |
describeElement | This function creates a screen-reader accessible |
deviceMoved | The deviceMoved() function is called when the device is moved by more than |
deviceShaken | The deviceShaken() function is called when the device total acceleration |
deviceTurned | The deviceTurned() function is called when the device rotates by |
directionalLight | Creates a directional light with a color and a direction |
displayDensity | Returns the pixel density of the current display the sketch is running on. |
dist | Calculates the distance between two points, in either two or three dimensions. |
doubleClicked | The doubleClicked() function is executed every time a event |
ellipse | Draws an ellipse (oval) to the screen. By default, the first two parameters |
ellipseMode | Modifies the location from which ellipses are drawn by changing the way in |
ellipsoid | Draw an ellipsoid with given radius |
emissiveMaterial | Sets the emissive color of the material used for geometry drawn to |
endContour | Use the beginContour() and endContour() functions to create negative |
endShape | The endShape() function is the companion to beginShape() and may only be |
erase | All drawing that follows erase() will subtract from |
exitPointerLock | The function exitPointerLock() |
exp | Returns Euler's number e (2.71828...) raised to the power of the n |
fill | Sets the color used to fill shapes. For example, if you run fill(204, 102, 0), |
filter | Applies a filter to the canvas. The presets options are: |
float | Converts a string to its floating point representation. The contents of a |
floor | Calculates the closest int value that is less than or equal to the |
fract | Calculates the fractional part of a number. |
frameRate | Specifies the number of frames to be displayed every second. For example, |
freqToMidi | Returns the closest MIDI note value for |
frustum | Sets a perspective matrix as defined by the parameters. |
fullscreen | If argument is given, sets the sketch to fullscreen or not based on the |
get | Get a region of pixels, or a single pixel, from the canvas. |
getAudioContext | Returns the Audio Context for this sketch. Useful for users |
getItem | Returns the value of an item that was stored in local storage |
getURL | Gets the current URL. |
getURLParams | Gets the current URL params as an Object. |
getURLPath | Gets the current URL path as an array. |
green | Extracts the green value from a color or pixel array. |
hex | Converts a number to a string in its equivalent hexadecimal notation. If a |
hour | p5.js communicates with the clock on your computer. The hour() function |
httpDo | Method for executing an HTTP request. If data type is not specified, |
httpGet | Method for executing an HTTP GET request. If data type is not specified, |
httpPost | Method for executing an HTTP POST request. If data type is not specified, |
hue | Extracts the hue value from a color or pixel array. |
image | Draw an image to the p5.js canvas. |
imageMode | Set image mode. Modifies the location from which images are drawn by |
input | The .input() function is called when any user input is |
int | Converts a boolean, string, or float to its integer representation. |
isLooping | By default, p5.js loops through draw() continuously, |
join | Combines an array of Strings into one String, each separated by the |
keyIsDown | The keyIsDown() function checks if the key is currently down, i.e. pressed. |
keyPressed | The keyPressed() function is called once every time a key is pressed. The |
keyReleased | The keyReleased() function is called once every time a key is released. |
keyTyped | The keyTyped() function is called once every time a key is pressed, but |
lerp | Calculates a number between two numbers at a specific increment. The amt |
lerpColor | Blends two colors to find a third color somewhere between them. The amt |
lightFalloff | Sets the falloff rates for point lights. It affects only the elements which are created after it in the code. |
lightness | Extracts the HSL lightness value from a color or pixel array. |
lights | Sets the default ambient and directional light. The defaults are ambientLight(128, 128, 128) and directionalLight(128, 128, 128, 0, 0, -1). Lights need to be included in the draw() to remain persistent in a looping program. Placing them in the setup() of a looping program will cause them to only have an effect the first time through the loop. |
line | Draws a line (a direct path between two points) to the screen. If called with |
loadBytes | This method is suitable for fetching files up to size of 64MB. |
loadFont | Loads an opentype font file (.otf, .ttf) from a file or a URL, |
loadImage | Loads an image from a path and creates a p5.Image from it. |
loadJSON | Loads a JSON file from a file or a URL, and returns an Object. |
loadModel | Load a 3d model from an OBJ or STL file. |
loadPixels | Loads the pixel data for the display window into the pixels[] array. This |
loadShader | Loads a custom shader from the provided vertex and fragment |
loadSound | loadSound() returns a new p5.SoundFile from a specified |
loadStrings | Reads the contents of a file and creates a String array of its individual |
loadTable | Reads the contents of a file or URL and creates a p5.Table object with |
loadXML | Reads the contents of a file and creates an XML object with its values. |
log | Calculates the natural logarithm (the base-e logarithm) of a number. This |
loop | By default, p5.js loops through draw() continuously, executing the code within |
mag | Calculates the magnitude (or length) of a vector. A vector is a direction |
map | Re-maps a number from one range to another. |
match | This function is used to apply a regular expression to a piece of text, |
matchAll | This function is used to apply a regular expression to a piece of text, |
max | Determines the largest value in a sequence of numbers, and then returns |
midiToFreq | Returns the frequency value of a MIDI note value. |
millis | Returns the number of milliseconds (thousandths of a second) since |
min | Determines the smallest value in a sequence of numbers, and then returns |
minute | p5.js communicates with the clock on your computer. The minute() function |
model | Render a 3d model to the screen. |
month | p5.js communicates with the clock on your computer. The month() function |
mouseClicked | The mouseClicked() function is called once after a mouse button has been |
mouseDragged | The mouseDragged() function is called once every time the mouse moves and |
mouseMoved | The mouseMoved() function is called every time the mouse moves and a mouse |
mousePressed | The mousePressed() function is called once after every time a mouse button |
mouseReleased | The mouseReleased() function is called every time a mouse button is |
mouseWheel | The function mouseWheel() is executed every time a vertical mouse wheel |
nf | Utility function for formatting numbers into strings. There are two |
nfc | Utility function for formatting numbers into strings and placing |
nfp | Utility function for formatting numbers into strings. Similar to nf() but |
nfs | Utility function for formatting numbers into strings. Similar to nf() but |
noCanvas | Removes the default canvas for a p5 sketch that doesn't require a canvas |
noCursor | Hides the cursor from view. |
noDebugMode | Turns off debugMode() in a 3D sketch. |
noErase | Ends erasing that was started with erase(). |
noFill | Disables filling geometry. If both noStroke() and noFill() are called, |
noLights | This function will remove all the lights from the sketch for the |
noLoop | Stops p5.js from continuously executing the code within draw(). |
noSmooth | Draws all geometry with jagged (aliased) edges. Note that smooth() is |
noStroke | Disables drawing the stroke (outline). If both noStroke() and noFill() |
noTint | Removes the current fill value for displaying images and reverts to |
noise | Returns the Perlin noise value at specified coordinates. Perlin noise is |
noiseDetail | Adjusts the character and level of detail produced by the Perlin noise |
noiseSeed | Sets the seed value for noise(). By default, noise() |
norm | Normalizes a number from another range into a value between 0 and 1. |
normalMaterial | Normal material for geometry is a material that is not affected by light. |
orbitControl | Allows movement around a 3D sketch using a mouse or trackpad. Left-clicking |
ortho | Sets an orthographic projection for the camera in a 3D sketch and defines a |
p5 | The |
perspective | Sets a perspective projection for the camera in a 3D sketch. This projection |
pixelDensity | Sets the pixel scaling for high pixel density displays. By default |
plane | Draw a plane with given a width and height |
point | Draws a point, a coordinate in space at the dimension of one pixel. |
pointLight | Creates a point light with a color and a light position |
pop | The push() function saves the current drawing style |
pow | Facilitates exponential expressions. The pow() function is an efficient |
The print() function writes to the console area of | |
push | The push() function saves the current drawing style |
quad | Draws a quad on the canvas. A quad is a quadrilateral, a four sided polygon. It is |
quadraticVertex | Specifies vertex coordinates for quadratic Bezier curves. Each call to |
radians | Converts a degree measurement to its corresponding value in radians. |
random | Return a random floating-point number. |
randomGaussian | Returns a random number fitting a Gaussian, or |
randomSeed | Sets the seed value for random(). |
rect | Draws a rectangle on the canvas. A rectangle is a four-sided closed shape with |
rectMode | Modifies the location from which rectangles are drawn by changing the way |
red | Extracts the red value from a color or pixel array. |
redraw | Executes the code within draw() one time. This |
removeElements | Removes all elements created by p5, except any canvas / graphics |
removeItem | Removes an item that was stored with storeItem() |
requestPointerLock | The function requestPointerLock() |
resetMatrix | Replaces the current matrix with the identity matrix. |
resetShader | This function restores the default shaders in WEBGL mode. Code that runs |
resizeCanvas | Resizes the canvas to given width and height. The canvas will be cleared |
reverse | Reverses the order of an array, maps to Array.reverse() |
rotate | Rotates a shape by the amount specified by the angle parameter. This |
rotateX | Rotates a shape around X axis by the amount specified in angle parameter. |
rotateY | Rotates a shape around Y axis by the amount specified in angle parameter. |
rotateZ | Rotates a shape around Z axis by the amount specified in angle parameter. |
round | Calculates the integer closest to the n parameter. For example, |
sampleRate | Returns a number representing the sample rate, in samples per second, |
saturation | Extracts the saturation value from a color or pixel array. |
save | Saves a given element(image, text, json, csv, wav, or html) to the client's |
saveCanvas | Save the current canvas as an image. The browser will either save the |
saveFrames | Capture a sequence of frames that can be used to create a movie. |
saveJSON | Writes the contents of an Array or a JSON object to a .json file. |
saveSound | Save a p5.SoundFile as a .wav file. The browser will prompt the user |
saveStrings | Writes an array of Strings to a text file, one line per String. |
saveTable | Writes the contents of a Table object to a file. Defaults to a |
scale | Increases or decreases the size of a shape by expanding or contracting |
second | p5.js communicates with the clock on your computer. The second() function |
select | Searches the page for the first element that matches the given CSS selector string (can be an |
selectAll | Searches the page for elements that match the given CSS selector string (can be an ID a class, |
set | Changes the color of any pixel, or writes an image directly to the |
setAttributes | Set attributes for the WebGL Drawing context. |
setBPM | Set the global tempo, in beats per minute, for all |
setCamera | Sets rendererGL's current camera to a p5.Camera object. Allows switching |
setMoveThreshold | The setMoveThreshold() function is used to set the movement threshold for |
setShakeThreshold | The setShakeThreshold() function is used to set the movement threshold for |
shader | The shader() function lets the user provide a custom shader |
shearX | Shears a shape around the x-axis by the amount specified by the angle |
shearY | Shears a shape around the y-axis the amount specified by the angle |
shininess | Sets the amount of gloss in the surface of shapes. |
shorten | Decreases an array by one element and returns the shortened array, |
shuffle | Randomizes the order of the elements of an array. Implements |
sin | Calculates the sine of an angle. This function takes into account the |
smooth | Draws all geometry with smooth (anti-aliased) edges. smooth() will also |
sort | Sorts an array of numbers from smallest to largest, or puts an array of |
soundFormats | List the SoundFile formats that you will include. LoadSound |
specularColor | Set's the color of the specular highlight when using a specular material and |
specularMaterial | Specular material for geometry with a given color. Specular material is a shiny reflective material. |
sphere | Draw a sphere with given radius. |
splice | Inserts a value or an array of values into an existing array. The first |
split | The split() function maps to String.split(), it breaks a String into |
splitTokens | The splitTokens() function splits a String at one or many character |
spotLight | Creates a spotlight with a given color, position, direction of light, |
sq | Squares a number (multiplies a number by itself). The result is always a |
sqrt | Calculates the square root of a number. The square root of a number is |
square | Draws a square to the screen. A square is a four-sided shape with every angle |
storeItem | Stores a value in local storage under the key name. |
str | Converts a boolean, string or number to its string representation. |
stroke | Sets the color used to draw lines and borders around shapes. This color |
strokeCap | Sets the style for rendering line endings. These ends are either rounded, |
strokeJoin | Sets the style of the joints which connect line segments. These joints |
strokeWeight | Sets the width of the stroke used for lines, points and the border around |
subset | Extracts an array of elements from an existing array. The list parameter |
tan | Calculates the tangent of an angle. This function takes into account |
text | Draws text to the screen. Displays the information specified in the first |
textAlign | Sets the current alignment for drawing text. Accepts two |
textAscent | Returns the ascent of the current font at its current size. The ascent |
textDescent | Returns the descent of the current font at its current size. The descent |
textFont | Sets the current font that will be drawn with the text() function. |
textLeading | Sets/gets the spacing, in pixels, between lines of text. This setting will be |
textSize | Sets/gets the current font size. This size will be used in all subsequent |
textStyle | Sets/gets the style of the text for system fonts to NORMAL, ITALIC, BOLD or BOLDITALIC. |
textWidth | Calculates and returns the width of any character or text string. |
texture | Texture for geometry. You can view other possible materials in this |
textureMode | Sets the coordinate space for texture mapping. The default mode is IMAGE |
textureWrap | Sets the global texture wrapping mode. This controls how textures behave |
tint | Sets the fill value for displaying images. Images can be tinted to |
torus | Draw a torus with given radius and tube radius |
touchEnded | The touchEnded() function is called every time a touch ends. If no |
touchMoved | The touchMoved() function is called every time a touch move is registered. |
touchStarted | The touchStarted() function is called once after every time a touch is |
translate | Specifies an amount to displace objects within the display window. |
triangle | Draws a triangle to the canvas. A triangle is a plane created by connecting |
trim | Removes whitespace characters from the beginning and end of a String. In |
unchar | Converts a single-character string to its corresponding integer |
unhex | Converts a string representation of a hexadecimal number to its equivalent |
updatePixels | Updates the display window with the data in the pixels[] array. |
userStartAudio | It is not only a good practice to give users control over starting |
vertex | All shapes are constructed by connecting a series of vertices. vertex() |
windowResized | The windowResized() function is called once |
year | p5.js communicates with the clock on your computer. The year() function |