// This file was auto-generated. Please do not edit it.
///
* Browsers may have different default
* behaviors attached to various mouse events.
*/
declare function mouseMoved(): void;
/**
* The mouseDragged() function is called once every time the mouse moves and
* a mouse button is pressed.
*/
declare function mouseDragged(): void;
/**
* The mousePressed() function is called once after every time a mouse button
* is pressed.
*/
declare function mousePressed(): void;
/**
* The mouseReleased() function is called every time a mouse button is
* released.
*/
declare function mouseReleased(): void;
/**
* The mouseClicked() function is called once after a mouse button has been
* pressed and then released.
* Browsers may have different default
* behaviors attached to various mouse events.
*/
declare function mouseClicked(): void;
/**
* The function mouseWheel() is executed every time a vertical mouse wheel
* event is detected either triggered by an actual mouse wheel or by a
* touchpad.
* The event.delta property returns the amount the mouse wheel
* have scrolled.
*/
declare function mouseWheel(): void;
// src/events/touch.js
/**
* The system variable touchX always contains the horizontal position of
* one finger, relative to (0, 0) of the canvas.
*/
declare var touchX: any;
/**
* The system variable touchY always contains the vertical position of
* one finger, relative to (0, 0) of the canvas.
*/
declare var touchY: any;
/**
* The system variable ptouchX always contains the horizontal position of
* one finger, relative to (0, 0) of the canvas, in the frame previous to the
* current frame.
*/
declare var ptouchX: any;
/**
* The system variable ptouchY always contains the vertical position of
* one finger, relative to (0, 0) of the canvas, in the frame previous to the
* current frame.
*/
declare var ptouchY: any;
// TODO: Property "touches[]", defined in src/events/touch.js, is not a valid JS symbol name
/**
* The boolean system variable touchIsDown is true if the screen is
* touched and false if not.
*/
declare var touchIsDown: any;
/**
* The touchStarted() function is called once after every time a touch is
* registered.
*/
declare function touchStarted(): void;
/**
* The touchMoved() function is called every time a touch move is registered.
*/
declare function touchMoved(): void;
/**
* The touchEnded() function is called every time a touch ends.
*/
declare function touchEnded(): void;
// src/image/image.js
/**
* Creates a new p5.Image (the datatype for storing images).
*/
declare function createImage(width: number, height: number): p5.Image;
// TODO: Fix saveCanvas() errors in src/image/image.js:
//
// param "canvas" has invalid type: [selectedCanvas]
// param "filename" has invalid type: [String]
// param "extension" has invalid type: [String]
//
// declare function saveCanvas(canvas: [selectedCanvas], filename: [String], extension: [String]): void;
/**
* Capture a sequence of frames that can be used to create a movie.
*/
declare function saveFrames(filename: string, extension: string, duration: number, framerate: number, callback?: () => any): void;
// src/image/loading_displaying.js
// TODO: Fix loadImage() errors in src/image/loading_displaying.js:
//
// param "successCallback" has invalid type: Function(p5.Image)
// param "failureCallback" has invalid type: Function(Event)
//
// declare function loadImage(path: string, successCallback?: Function(p5.Image), failureCallback?: Function(Event)): p5.Image;
/**
* Draw an image to the main canvas of the p5js sketch
*/
declare function image(img: p5.Image, sx?: number, sy?: number, sWidth?: number, sHeight?: number, dx?: number, dy?: number, dWidth?: number, dHeight?: number): void;
/**
* Sets the fill value for displaying images.
*/
declare function tint(v1: number|any[], v2?: number|any[], v3?: number|any[], a?: number|any[]): void;
/**
* Removes the current fill value for displaying images and reverts to
* displaying images with their original hues.
*/
declare function noTint(): void;
/**
* Set image mode.
*/
declare function imageMode(m: string): void;
// src/image/pixels.js
// TODO: Property "pixels[]", defined in src/image/pixels.js, is not a valid JS symbol name
// TODO: Fix blend() errors in src/image/pixels.js:
//
// param "srcImage" has invalid type: p5.Image|undefined
//
// declare function blend(srcImage: p5.Image|undefined, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number, blendMode: number): void;
// TODO: Fix copy() errors in src/image/pixels.js:
//
// param "srcImage" has invalid type: p5.Image|undefined
//
// declare function copy(srcImage: p5.Image|undefined, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
/**
* Applies a filter to the canvas.
*/
declare function filter(filterType: string, filterParam: number): void;
/**
* Returns an array of [R,G,B,A] values for any pixel or grabs a section of
* an image.
*/
declare function get(x?: number, y?: number, w?: number, h?: number): any[]|p5.Image;
/**
* Loads the pixel data for the display window into the pixels[] array.
*/
declare function loadPixels(): void;
/**
*
Changes the color of any pixel, or writes an image directly to the * display window.
*The x and y parameters specify the pixel to change and the c parameter * specifies the color value. */ declare function set(x: number, y: number, c: number|any[]|any): void; // TODO: Fix updatePixels() errors in src/image/pixels.js: // // param "w" is defined multiple times // // declare function updatePixels(x?: number, y?: number, w?: number, w?: number): void; // src/io/files.js /** * Loads an opentype font file (.otf, .ttf) from a file or a URL, * and returns a PFont Object. */ declare function loadFont(path: string, callback?: () => any): any; /** * Loads a JSON file from a file or a URL, and returns an Object or Array. */ declare function loadJSON(path: string, callback?: () => any, errorCallback?: () => any, datatype?: string): any|any[]; /** * Reads the contents of a file and creates a String array of its individual * lines. */ declare function loadStrings(filename: string, callback?: () => any, errorCallback?: () => any): any[]; // TODO: Fix loadTable() errors in src/io/files.js: // // param "options" has invalid type: String|Strings // // declare function loadTable(filename: string, options?: string|Strings, callback?: () => any): any; /** * Reads the contents of a file and creates an XML object with its values. */ declare function loadXML(filename: string, callback?: () => any, errorCallback?: () => any): any; /** * Method for executing an HTTP GET request. */ declare function httpGet(path: string, data?: any, datatype?: string, callback?: () => any, errorCallback?: () => any): void; /** * Method for executing an HTTP POST request. */ declare function httpPost(path: string, data?: any, datatype?: string, callback?: () => any, errorCallback?: () => any): void; /** * Method for executing an HTTP request. */ declare function httpDo(path: string, method?: string, data?: any, datatype?: string, callback?: () => any, errorCallback?: () => any): void; // TODO: Fix save() errors in src/io/files.js: // // param "objectOrFilename" has invalid type: [Object|String] // param "filename" has invalid type: [String] // param "options" has invalid type: [Boolean/String] // // declare function save(objectOrFilename: [Object|String], filename: [String], options: [Boolean/String]): void; /** * Writes the contents of an Array or a JSON object to a .json file. */ declare function saveJSON(json: any[]|any, filename: string, optimize?: boolean): void; /** * Writes an array of Strings to a text file, one line per String. */ declare function saveStrings(list: any[], filename: string): void; /** * Writes the contents of a Table object to a file. */ declare function saveTable(Table: p5.Table, filename: string, options?: string): void; // src/math/calculation.js /** * Calculates the absolute value (magnitude) of a number. */ declare function abs(n: number): number; /** * Calculates the closest int value that is greater than or equal to the * value of the parameter. */ declare function ceil(n: number): number; /** * Constrains a value between a minimum and maximum value. */ declare function constrain(n: number, low: number, high: number): number; // TODO: Fix dist() errors in src/math/calculation.js: // // required param "x2" follows an optional param // required param "y2" follows an optional param // // declare function dist(x1: number, y1: number, z1?: number, x2: number, y2: number, z2?: number): number; /** * Returns Euler's number e (2.71828...) raised to the power of the n * parameter. */ declare function exp(n: number): number; /** * Calculates the closest int value that is less than or equal to the * value of the parameter. */ declare function floor(n: number): number; /** * Calculates a number between two numbers at a specific increment. */ declare function lerp(start: number, stop: number, amt: number): number; /** * Calculates the natural logarithm (the base-e logarithm) of a number. */ declare function log(n: number): number; /** * Calculates the magnitude (or length) of a vector. */ declare function mag(a: number, b: number): number; /** * Re-maps a number from one range to another. */ declare function map(value: number, start1: number, stop1: number, start2: number, stop: number): number; /** * Determines the largest value in a sequence of numbers, and then returns * that value. */ declare function max(n0: number|any[]): number; /** * Determines the smallest value in a sequence of numbers, and then returns * that value. */ declare function min(n0: number|any[]): number; /** * Normalizes a number from another range into a value between 0 and 1. */ declare function norm(value: number, start: number, stop: number): number; /** * Facilitates exponential expressions. */ declare function pow(n: number, e: number): number; /** * Calculates the integer closest to the n parameter. */ declare function round(n: number): number; /** * Squares a number (multiplies a number by itself). */ declare function sq(n: number): number; /** * Calculates the square root of a number. */ declare function sqrt(n: number): number; // src/math/math.js /** * Creates a new p5.Vector (the datatype for storing vectors). */ declare function createVector(x?: number, y?: number, z?: number): void; // src/math/noise.js /** * Returns the Perlin noise value at specified coordinates. */ declare function noise(x: number, y: number, z: number): number; /** * Adjusts the character and level of detail produced by the Perlin noise * function. */ declare function noiseDetail(lod: number, falloff: number): void; /** * Sets the seed value for noise(). */ declare function noiseSeed(seed: number): void; // src/math/random.js /** * Sets the seed value for random(). */ declare function randomSeed(seed: number): void; /** * Return a random number. */ declare function random(min: number, max: number): number; /** * Returns a random number fitting a Gaussian, or * normal, distribution. */ declare function randomGaussian(mean: number, sd: number): number; // src/math/trigonometry.js /** * The inverse of cos(), returns the arc cosine of a value. */ declare function acos(value: number): number; /** * The inverse of sin(), returns the arc sine of a value. */ declare function asin(value: number): number; /** * The inverse of tan(), returns the arc tangent of a value. */ declare function atan(value: number): number; /** * Calculates the angle (in radians) from a specified point to the coordinate * origin as measured from the positive x-axis. */ declare function atan2(y: number, x: number): number; /** * Calculates the cosine of an angle. */ declare function cos(angle: number): number; /** * Calculates the sine of an angle. */ declare function sin(angle: number): number; /** * Calculates the tangent of an angle. */ declare function tan(angle: number): number; /** * Converts a radian measurement to its corresponding value in degrees. */ declare function degrees(radians: number): number; /** * Converts a degree measurement to its corresponding value in radians. */ declare function radians(degrees: number): number; // TODO: Fix angleMode() errors in src/math/trigonometry.js: // // param "mode" has invalid type: Number/Constant // // declare function angleMode(mode: Number/Constant): void; // src/typography/attributes.js // TODO: Fix textAlign() errors in src/typography/attributes.js: // // param "horizAlign" has invalid type: Number/Constant // param "vertAlign" has invalid type: Number/Constant // // declare function textAlign(horizAlign: Number/Constant, vertAlign: Number/Constant): number; /** * Sets/gets the spacing, in pixels, between lines of text. */ declare function textLeading(leading: number): any|number; /** * Sets/gets the current font size. */ declare function textSize(theSize: number): any|number; // TODO: Fix textStyle() errors in src/typography/attributes.js: // // param "theStyle" has invalid type: Number/Constant // // declare function textStyle(theStyle: Number/Constant): any|string; /** * Calculates and returns the width of any character or text string. */ declare function textWidth(theText: string): number; // src/typography/loading_displaying.js /** * Draws text to the screen. */ declare function text(str: string, x: number, y: number, x2: number, y2: number): any; /** * Sets the current font that will be drawn with the text() function. */ declare function textFont(f: any|string): any; // src/utilities/array_functions.js /** * Adds a value to the end of an array. */ declare function append(array: any[], value: any): void; // TODO: Fix arrayCopy() errors in src/utilities/array_functions.js: // // required param "dst" follows an optional param // // declare function arrayCopy(src: any[], srcPosition?: number, dst: any[], dstPosition?: number, length?: number): void; /** * Concatenates two arrays, maps to Array.concat(). */ declare function concat(a: any[], b: any[]): any[]; /** * Reverses the order of an array, maps to Array.reverse() */ declare function reverse(list: any[]): void; /** * Decreases an array by one element and returns the shortened array, * maps to Array.pop(). */ declare function shorten(list: any[]): any[]; /** * Randomizes the order of the elements of an array. */ declare function shuffle(array: any[], bool?: boolean): any[]; /** * Sorts an array of numbers from smallest to largest, or puts an array of * words in alphabetical order. */ declare function sort(list: any[], count?: number): void; /** * Inserts a value or an array of values into an existing array. */ declare function splice(list: any[], value: any, position: number): void; /** * Extracts an array of elements from an existing array. */ declare function subset(list: any[], start: number, count?: number): any[]; // src/utilities/conversion.js /** * Converts a string to its floating point representation. */ declare function float(str: string): number; /** * Converts a boolean, string, or float to its integer representation. */ declare function int(n: string|boolean|number|any[]): number; /** * Converts a boolean, string or number to its string representation. */ declare function str(n: string|boolean|number|any[]): string; /** * Converts a number or string to its boolean representation. */ declare function boolean(n: string|boolean|number|any[]): boolean; /** * Converts a number, string or boolean to its byte representation. */ declare function byte(n: string|boolean|number|any[]): number; /** * Converts a number or string to its corresponding single-character * string representation. */ declare function char(n: string|number|any[]): string; /** * Converts a single-character string to its corresponding integer * representation. */ declare function unchar(n: string|any[]): number; /** * Converts a number to a string in its equivalent hexadecimal notation. */ declare function hex(n: number|any[]): string; /** * Converts a string representation of a hexadecimal number to its equivalent * integer value. */ declare function unhex(n: string|any[]): number; // src/utilities/string_functions.js /** * Combines an array of Strings into one String, each separated by the * character(s) used for the separator parameter. */ declare function join(list: any[], separator: string): string; /** * This function is used to apply a regular expression to a piece of text, * and return matching groups (elements found inside parentheses) as a * String array. */ declare function match(str: string, regexp: string): any[]; /** * This function is used to apply a regular expression to a piece of text, * and return a list of matching groups (elements found inside parentheses) * as a two-dimensional String array. */ declare function matchAll(str: string, regexp: string): any[]; /** * Utility function for formatting numbers into strings. */ declare function nf(num: number|any[], left?: number, right?: number): string|any[]; /** * Utility function for formatting numbers into strings and placing * appropriate commas to mark units of 1000. */ declare function nfc(num: number|any[], right?: number): string|any[]; /** * Utility function for formatting numbers into strings. */ declare function nfp(num: number|any[], left?: number, right?: number): string|any[]; /** * Utility function for formatting numbers into strings. */ declare function nfs(num: number|any[], left?: number, right?: number): string|any[]; /** * The split() function maps to String.split(), it breaks a String into * pieces using a character or string as the delimiter. */ declare function split(value: string, delim: string): any[]; /** * The splitTokens() function splits a String at one or many character * delimiters or "tokens." The delim parameter specifies the character or * characters to be used as a boundary. */ declare function splitTokens(value: string, delim?: string): any[]; /** * Removes whitespace characters from the beginning and end of a String. */ declare function trim(str?: string|any[]): string|any[]; // src/utilities/time_date.js /** * p5.js communicates with the clock on your computer. */ declare function day(): number; /** * p5.js communicates with the clock on your computer. */ declare function hour(): number; /** * p5.js communicates with the clock on your computer. */ declare function minute(): number; /** * Returns the number of milliseconds (thousandths of a second) since * starting the program. */ declare function millis(): number; /** * p5.js communicates with the clock on your computer. */ declare function month(): number; /** * p5.js communicates with the clock on your computer. */ declare function second(): number; /** * p5.js communicates with the clock on your computer. */ declare function year(): number; // Properties from p5.dom // lib/addons/p5.dom.js // TODO: Fix select() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element|Null // // declare function select(name: string, container?: string): Object/p5.Element|Null; /** * Searches the page for elements with the given class or tag name (using the '.' prefix * to specify a class and no prefix for a tag) and returns them as p5.Elements * in an array. */ declare function selectAll(name: string, container?: string): any[]; /** * Removes all elements created by p5, except any canvas / graphics * elements created by createCanvas or createGraphics. */ declare function removeElements(): void; // TODO: Fix createDiv() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createDiv(html: string): Object/p5.Element; // TODO: Fix createP() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createP(html: string): Object/p5.Element; // TODO: Fix createSpan() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createSpan(html: string): Object/p5.Element; // TODO: Fix createImg() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createImg(src: string, alt?: string, successCallback?: () => any): Object/p5.Element; // TODO: Fix createA() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createA(href: string, html: string, target?: string): Object/p5.Element; // TODO: Fix createSlider() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createSlider(min: number, max: number, value?: number): Object/p5.Element; // TODO: Fix createButton() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createButton(label: string, value?: string): Object/p5.Element; // TODO: Fix createCheckbox() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createCheckbox(label?: string, value?: boolean): Object/p5.Element; // TODO: Fix createSelect() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createSelect(multiple?: boolean): Object/p5.Element; // TODO: Fix createRadio() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createRadio(divId?: string): Object/p5.Element; // TODO: Fix createInput() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createInput(value?: number): Object/p5.Element; // TODO: Fix createFileInput() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createFileInput(callback?: () => any, multiple?: string): Object/p5.Element; // TODO: Fix createVideo() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createVideo(src: string|any[], callback?: any): Object/p5.Element; // TODO: Fix createAudio() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createAudio(src: string|any[], callback?: any): Object/p5.Element; // TODO: Fix createCapture() errors in lib/addons/p5.dom.js: // // param "type" has invalid type: String|Constant|Object // return has invalid type: Object/p5.Element // // declare function createCapture(type: string|Constant|any, callback: () => any): Object/p5.Element; // TODO: Fix createElement() errors in lib/addons/p5.dom.js: // // return has invalid type: Object/p5.Element // // declare function createElement(tag: string, content?: string): Object/p5.Element; // Properties from p5.sound // lib/addons/p5.sound.js /** *
Returns the Audio Context for this sketch. */ declare function getAudioContext(): any; /** * Returns a number representing the master amplitude (volume) for sound * in this sketch. */ declare function getMasterVolume(): number; /** *
Scale the output of all sound in this sketch
* Scaled between 0.0 (silence) and 1.0 (full volume). */ declare function masterVolume(volume: number|any, rampTime?: number, timeFromNow?: number): void; // TODO: Property "p5.soundOut", defined in lib/addons/p5.sound.js, is not a valid JS symbol name /** * Returns a number representing the sample rate, in samples per second, * of all sound objects in this audio context. */ declare function sampleRate(): number; /** * Returns the frequency value of a MIDI note value. */ declare function midiToFreq(midiNote: number): number; // TODO: Fix soundFormats() errors in lib/addons/p5.sound.js: // // param "formats" has invalid type: String|Strings // // declare function soundFormats(formats: string|Strings): void; // TODO: Property "{String} failedPath path to the file that failed to load", defined in lib/addons/p5.sound.js, is not a valid JS symbol name