UNPKG

simple-peer-wrapper

Version:

A wrapper for simple-peer that includes a socket.io signaling server client. To be used in the browser with simple-peer-server.

1,354 lines (1,284 loc) 412 kB
// This file was auto-generated. Please do not edit it. declare class p5 { // Properties from p5 /** * This is the p5 instance constructor. A p5 instance * holds all the properties and methods related to a * p5 sketch. It expects an incoming sketch closure * and it can also take an optional node parameter * for attaching the generated p5 canvas to a node. * The sketch closure takes the newly created p5 * instance as its sole argument and may optionally * set preload(), setup(), and/or draw() properties * on it for running a sketch. * * A p5 sketch can run in "global" or "instance" * mode: "global" - all properties and methods are * attached to the window "instance" - all properties * and methods are bound to this p5 object * * @param sketch a closure that can set optional * preload(), setup(), and/or draw() properties on * the given p5 instance * @param [node] element to attach canvas to, if a * boolean is passed in use it as sync * @param [sync] start synchronously (optional) * @return a p5 instance */ constructor(sketch: Function, node?: HTMLElement|boolean, sync?: boolean) // src/color/creating_reading.js /** * Extracts the alpha value from a color or pixel * array. * * @param color p5.Color object, color components, or * CSS color * @return the alpha value */ alpha(color: p5.Color|number[]|string): number /** * Extracts the blue value from a color or pixel * array. * * @param color p5.Color object, color components, or * CSS color * @return the blue value */ blue(color: p5.Color|number[]|string): number /** * Extracts the HSB brightness value from a color or * pixel array. * * @param color p5.Color object, color components, or * CSS color * @return the brightness value */ brightness(color: p5.Color|number[]|string): number /** * Creates colors for storing in variables of the * color datatype. The parameters are interpreted as * RGB or HSB values depending on the current * colorMode(). The default mode is RGB values from 0 * to 255 and, therefore, the function call * color(255, 204, 0) will return a bright yellow * color. Note that if only one value is provided to * color(), it will be interpreted as a grayscale * value. Add a second value, and it will be used for * alpha transparency. When three values are * specified, they are interpreted as either RGB or * HSB values. Adding a fourth value applies alpha * transparency. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * @param gray number specifying value between white * and black. * @param [alpha] alpha value relative to current * color range (default is 0-255) * @return resulting color */ color(gray: number, alpha?: number): p5.Color /** * Creates colors for storing in variables of the * color datatype. The parameters are interpreted as * RGB or HSB values depending on the current * colorMode(). The default mode is RGB values from 0 * to 255 and, therefore, the function call * color(255, 204, 0) will return a bright yellow * color. Note that if only one value is provided to * color(), it will be interpreted as a grayscale * value. Add a second value, and it will be used for * alpha transparency. When three values are * specified, they are interpreted as either RGB or * HSB values. Adding a fourth value applies alpha * transparency. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * @param v1 red or hue value relative to the current * color range * @param v2 green or saturation value relative to * the current color range * @param v3 blue or brightness value relative to the * current color range * @param [alpha] alpha value relative to current * color range (default is 0-255) */ color(v1: number, v2: number, v3: number, alpha?: number): p5.Color /** * Creates colors for storing in variables of the * color datatype. The parameters are interpreted as * RGB or HSB values depending on the current * colorMode(). The default mode is RGB values from 0 * to 255 and, therefore, the function call * color(255, 204, 0) will return a bright yellow * color. Note that if only one value is provided to * color(), it will be interpreted as a grayscale * value. Add a second value, and it will be used for * alpha transparency. When three values are * specified, they are interpreted as either RGB or * HSB values. Adding a fourth value applies alpha * transparency. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * @param value a color string * @param [alpha] alpha value relative to current * color range (default is 0-255) */ color(value: string, alpha?: number): p5.Color /** * Creates colors for storing in variables of the * color datatype. The parameters are interpreted as * RGB or HSB values depending on the current * colorMode(). The default mode is RGB values from 0 * to 255 and, therefore, the function call * color(255, 204, 0) will return a bright yellow * color. Note that if only one value is provided to * color(), it will be interpreted as a grayscale * value. Add a second value, and it will be used for * alpha transparency. When three values are * specified, they are interpreted as either RGB or * HSB values. Adding a fourth value applies alpha * transparency. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * @param values an array containing the * red,green,blue & and alpha components of the color */ color(values: number[]): p5.Color /** * Creates colors for storing in variables of the * color datatype. The parameters are interpreted as * RGB or HSB values depending on the current * colorMode(). The default mode is RGB values from 0 * to 255 and, therefore, the function call * color(255, 204, 0) will return a bright yellow * color. Note that if only one value is provided to * color(), it will be interpreted as a grayscale * value. Add a second value, and it will be used for * alpha transparency. When three values are * specified, they are interpreted as either RGB or * HSB values. Adding a fourth value applies alpha * transparency. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * */ color(color: p5.Color): p5.Color /** * Extracts the green value from a color or pixel * array. * * @param color p5.Color object, color components, or * CSS color * @return the green value */ green(color: p5.Color|number[]|string): number /** * Extracts the hue value from a color or pixel * array. Hue exists in both HSB and HSL. This * function will return the HSB-normalized hue when * supplied with an HSB color object (or when * supplied with a pixel array while the color mode * is HSB), but will default to the HSL-normalized * hue otherwise. (The values will only be different * if the maximum hue setting for each system is * different.) * * @param color p5.Color object, color components, or * CSS color * @return the hue */ hue(color: p5.Color|number[]|string): number /** * Blends two colors to find a third color somewhere * between them. The amt parameter is the amount to * interpolate between the two values where 0.0 equal * to the first color, 0.1 is very near the first * color, 0.5 is halfway in between, etc. An amount * below 0 will be treated as 0. Likewise, amounts * above 1 will be capped at 1. This is different * from the behavior of lerp(), but necessary because * otherwise numbers outside the range will produce * strange and unexpected colors. The way that * colours are interpolated depends on the current * color mode. * * @param c1 interpolate from this color * @param c2 interpolate to this color * @param amt number between 0 and 1 * @return interpolated color */ lerpColor(c1: p5.Color, c2: p5.Color, amt: number): p5.Color /** * Extracts the HSL lightness value from a color or * pixel array. * * @param color p5.Color object, color components, or * CSS color * @return the lightness */ lightness(color: p5.Color|number[]|string): number /** * Extracts the red value from a color or pixel * array. * * @param color p5.Color object, color components, or * CSS color * @return the red value */ red(color: p5.Color|number[]|string): number /** * Extracts the saturation value from a color or * pixel array. Saturation is scaled differently in * HSB and HSL. This function will return the HSB * saturation when supplied with an HSB color object * (or when supplied with a pixel array while the * color mode is HSB), but will default to the HSL * saturation otherwise. * * @param color p5.Color object, color components, or * CSS color * @return the saturation value */ saturation(color: p5.Color|number[]|string): number // src/color/setting.js /** * The background() function sets the color used for * the background of the p5.js canvas. The default * background is light gray. This function is * typically used within draw() to clear the display * window at the beginning of each frame, but it can * be used inside setup() to set the background on * the first frame of animation or if the background * need only be set once. The color is either * specified in terms of the RGB, HSB, or HSL color * depending on the current colorMode. (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * * A p5.Color object can also be provided to set the * background color. * * * A p5.Image can also be provided to set the * background iamge. * * @param color any value created by the color() * function * @chainable */ background(color: p5.Color): p5 /** * The background() function sets the color used for * the background of the p5.js canvas. The default * background is light gray. This function is * typically used within draw() to clear the display * window at the beginning of each frame, but it can * be used inside setup() to set the background on * the first frame of animation or if the background * need only be set once. The color is either * specified in terms of the RGB, HSB, or HSL color * depending on the current colorMode. (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * * A p5.Color object can also be provided to set the * background color. * * * A p5.Image can also be provided to set the * background iamge. * * @param colorstring color string, possible formats * include: integer rgb() or rgba(), percentage rgb() * or rgba(), 3-digit hex, 6-digit hex * @param [a] opacity of the background relative to * current color range (default is 0-255) * @chainable */ background(colorstring: string, a?: number): p5 /** * The background() function sets the color used for * the background of the p5.js canvas. The default * background is light gray. This function is * typically used within draw() to clear the display * window at the beginning of each frame, but it can * be used inside setup() to set the background on * the first frame of animation or if the background * need only be set once. The color is either * specified in terms of the RGB, HSB, or HSL color * depending on the current colorMode. (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * * A p5.Color object can also be provided to set the * background color. * * * A p5.Image can also be provided to set the * background iamge. * * @param gray specifies a value between white and * black * @param [a] opacity of the background relative to * current color range (default is 0-255) * @chainable */ background(gray: number, a?: number): p5 /** * The background() function sets the color used for * the background of the p5.js canvas. The default * background is light gray. This function is * typically used within draw() to clear the display * window at the beginning of each frame, but it can * be used inside setup() to set the background on * the first frame of animation or if the background * need only be set once. The color is either * specified in terms of the RGB, HSB, or HSL color * depending on the current colorMode. (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * * A p5.Color object can also be provided to set the * background color. * * * A p5.Image can also be provided to set the * background iamge. * * @param v1 red or hue value (depending on the * current color mode) * @param v2 green or saturation value (depending on * the current color mode) * @param v3 blue or brightness value (depending on * the current color mode) * @param [a] opacity of the background relative to * current color range (default is 0-255) * @chainable */ background(v1: number, v2: number, v3: number, a?: number): p5 /** * The background() function sets the color used for * the background of the p5.js canvas. The default * background is light gray. This function is * typically used within draw() to clear the display * window at the beginning of each frame, but it can * be used inside setup() to set the background on * the first frame of animation or if the background * need only be set once. The color is either * specified in terms of the RGB, HSB, or HSL color * depending on the current colorMode. (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * * A p5.Color object can also be provided to set the * background color. * * * A p5.Image can also be provided to set the * background iamge. * * @param values an array containing the * red,green,blue & and alpha components of the color * @chainable */ background(values: number[]): p5 /** * The background() function sets the color used for * the background of the p5.js canvas. The default * background is light gray. This function is * typically used within draw() to clear the display * window at the beginning of each frame, but it can * be used inside setup() to set the background on * the first frame of animation or if the background * need only be set once. The color is either * specified in terms of the RGB, HSB, or HSL color * depending on the current colorMode. (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. * * * If a single string argument is provided, RGB, RGBA * and Hex CSS color strings and all named color * strings are supported. In this case, an alpha * number value as a second argument is not * supported, the RGBA form should be used. * * * A p5.Color object can also be provided to set the * background color. * * * A p5.Image can also be provided to set the * background iamge. * * @param image image created with loadImage() or * createImage(), to set as background (must be same * size as the sketch window) * @param [a] opacity of the background relative to * current color range (default is 0-255) * @chainable */ background(image: p5.Image, a?: number): p5 /** * Clears the pixels within a buffer. This function * only works on p5.Canvas objects created with the * createCanvas() function; it won't work with the * main display window. Unlike the main graphics * context, pixels in additional graphics areas * created with createGraphics() can be entirely or * partially transparent. This function clears * everything to make all of the pixels 100% * transparent. * * @chainable */ clear(): p5 /** * colorMode() changes the way p5.js interprets color * data. By default, the parameters for fill(), * stroke(), background(), and color() are defined by * values between 0 and 255 using the RGB color * model. This is equivalent to setting * colorMode(RGB, 255). Setting colorMode(HSB) lets * you use the HSB system instead. By default, this * is colorMode(HSB, 360, 100, 100, 1). You can also * use HSL. Note: existing color objects remember * the mode that they were created in, so you can * change modes as you like without affecting their * appearance. * * @param mode either RGB, HSB or HSL, corresponding * to Red/Green/Blue and Hue/Saturation/Brightness * (or Lightness) * @param [max] range for all values * @chainable */ colorMode(mode: COLOR_MODE, max?: number): p5 /** * colorMode() changes the way p5.js interprets color * data. By default, the parameters for fill(), * stroke(), background(), and color() are defined by * values between 0 and 255 using the RGB color * model. This is equivalent to setting * colorMode(RGB, 255). Setting colorMode(HSB) lets * you use the HSB system instead. By default, this * is colorMode(HSB, 360, 100, 100, 1). You can also * use HSL. Note: existing color objects remember * the mode that they were created in, so you can * change modes as you like without affecting their * appearance. * * @param mode either RGB, HSB or HSL, corresponding * to Red/Green/Blue and Hue/Saturation/Brightness * (or Lightness) * @param max1 range for the red or hue depending on * the current color mode * @param max2 range for the green or saturation * depending on the current color mode * @param max3 range for the blue or * brightness/lighntess depending on the current * color mode * @param [maxA] range for the alpha * @chainable */ colorMode(mode: any, max1: number, max2: number, max3: number, maxA?: number): p5 /** * Sets the color used to fill shapes. For example, * if you run fill(204, 102, 0), all subsequent * shapes will be filled with orange. This color is * either specified in terms of the RGB or HSB color * depending on the current colorMode(). (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. If a single string argument is * provided, RGB, RGBA and Hex CSS color strings and * all named color strings are supported. In this * case, an alpha number value as a second argument * is not supported, the RGBA form should be used. * * * A p5 Color object can also be provided to set the * fill color. * * @param v1 red or hue value relative to the current * color range * @param v2 green or saturation value relative to * the current color range * @param v3 blue or brightness value relative to the * current color range * @chainable */ fill(v1: number, v2: number, v3: number, alpha?: number): p5 /** * Sets the color used to fill shapes. For example, * if you run fill(204, 102, 0), all subsequent * shapes will be filled with orange. This color is * either specified in terms of the RGB or HSB color * depending on the current colorMode(). (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. If a single string argument is * provided, RGB, RGBA and Hex CSS color strings and * all named color strings are supported. In this * case, an alpha number value as a second argument * is not supported, the RGBA form should be used. * * * A p5 Color object can also be provided to set the * fill color. * * @param value a color string * @chainable */ fill(value: string, alpha?: number): p5 /** * Sets the color used to fill shapes. For example, * if you run fill(204, 102, 0), all subsequent * shapes will be filled with orange. This color is * either specified in terms of the RGB or HSB color * depending on the current colorMode(). (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. If a single string argument is * provided, RGB, RGBA and Hex CSS color strings and * all named color strings are supported. In this * case, an alpha number value as a second argument * is not supported, the RGBA form should be used. * * * A p5 Color object can also be provided to set the * fill color. * * @param values an array containing the * red,green,blue & and alpha components of the color * @chainable */ fill(values: number[]): p5 /** * Sets the color used to fill shapes. For example, * if you run fill(204, 102, 0), all subsequent * shapes will be filled with orange. This color is * either specified in terms of the RGB or HSB color * depending on the current colorMode(). (The default * color space is RGB, with each value in the range * from 0 to 255). The alpha range by default is also * 0 to 255. If a single string argument is * provided, RGB, RGBA and Hex CSS color strings and * all named color strings are supported. In this * case, an alpha number value as a second argument * is not supported, the RGBA form should be used. * * * A p5 Color object can also be provided to set the * fill color. * * @param color the fill color * @chainable */ fill(color: p5.Color): p5 /** * Disables filling geometry. If both noStroke() and * noFill() are called, nothing will be drawn to the * screen. * * @chainable */ noFill(): p5 /** * Disables drawing the stroke (outline). If both * noStroke() and noFill() are called, nothing will * be drawn to the screen. * * @chainable */ noStroke(): p5 /** * Sets the color used to draw lines and borders * around shapes. This color is either specified in * terms of the RGB or HSB color depending on the * current colorMode() (the default color space is * RGB, with each value in the range from 0 to 255). * The alpha range by default is also 0 to 255. If a * single string argument is provided, RGB, RGBA and * Hex CSS color strings and all named color strings * are supported. In this case, an alpha number value * as a second argument is not supported, the RGBA * form should be used. * * * A p5 Color object can also be provided to set the * stroke color. * * @param v1 red or hue value relative to the current * color range * @param v2 green or saturation value relative to * the current color range * @param v3 blue or brightness value relative to the * current color range * @chainable */ stroke(v1: number, v2: number, v3: number, alpha?: number): p5 /** * Sets the color used to draw lines and borders * around shapes. This color is either specified in * terms of the RGB or HSB color depending on the * current colorMode() (the default color space is * RGB, with each value in the range from 0 to 255). * The alpha range by default is also 0 to 255. If a * single string argument is provided, RGB, RGBA and * Hex CSS color strings and all named color strings * are supported. In this case, an alpha number value * as a second argument is not supported, the RGBA * form should be used. * * * A p5 Color object can also be provided to set the * stroke color. * * @param value a color string * @chainable */ stroke(value: string, alpha?: number): p5 /** * Sets the color used to draw lines and borders * around shapes. This color is either specified in * terms of the RGB or HSB color depending on the * current colorMode() (the default color space is * RGB, with each value in the range from 0 to 255). * The alpha range by default is also 0 to 255. If a * single string argument is provided, RGB, RGBA and * Hex CSS color strings and all named color strings * are supported. In this case, an alpha number value * as a second argument is not supported, the RGBA * form should be used. * * * A p5 Color object can also be provided to set the * stroke color. * * @param values an array containing the * red,green,blue & and alpha components of the color * @chainable */ stroke(values: number[]): p5 /** * Sets the color used to draw lines and borders * around shapes. This color is either specified in * terms of the RGB or HSB color depending on the * current colorMode() (the default color space is * RGB, with each value in the range from 0 to 255). * The alpha range by default is also 0 to 255. If a * single string argument is provided, RGB, RGBA and * Hex CSS color strings and all named color strings * are supported. In this case, an alpha number value * as a second argument is not supported, the RGBA * form should be used. * * * A p5 Color object can also be provided to set the * stroke color. * * @param color the stroke color * @chainable */ stroke(color: p5.Color): p5 // src/core/2d_primitives.js /** * Draw an arc to the screen. If called with only x, * y, w, h, start, and stop, the arc will be drawn * and filled as an open pie segment. If a mode * parameter is provided, the arc will be filled like * an open semi-circle (OPEN) , a closed semi-circle * (CHORD), or as a closed pie segment (PIE). The * origin may be changed with the ellipseMode() * function. Note that drawing a full circle (ex: 0 * to TWO_PI) will appear blank because 0 and TWO_PI * are the same position on the unit circle. The best * way to handle this is by using the ellipse() * function instead to create a closed ellipse, and * to use the arc() function only to draw parts of an * ellipse. * * @param x x-coordinate of the arc's ellipse * @param y y-coordinate of the arc's ellipse * @param w width of the arc's ellipse by default * @param h height of the arc's ellipse by default * @param start angle to start the arc, specified in * radians * @param stop angle to stop the arc, specified in * radians * @param [mode] optional parameter to determine the * way of drawing the arc. either CHORD, PIE or OPEN * @chainable */ arc(x: number, y: number, w: number, h: number, start: number, stop: number, mode?: ARC_MODE): p5 /** * Draws an ellipse (oval) to the screen. An ellipse * with equal width and height is a circle. By * default, the first two parameters set the * location, and the third and fourth parameters set * the shape's width and height. If no height is * specified, the value of width is used for both the * width and height. If a negative height or width is * specified, the absolute value is taken. The origin * may be changed with the ellipseMode() function. * * @param x x-coordinate of the ellipse. * @param y y-coordinate of the ellipse. * @param w width of the ellipse. * @param [h] height of the ellipse. * @chainable */ ellipse(x: number, y: number, w: number, h?: number): p5 /** * Draws an ellipse (oval) to the screen. An ellipse * with equal width and height is a circle. By * default, the first two parameters set the * location, and the third and fourth parameters set * the shape's width and height. If no height is * specified, the value of width is used for both the * width and height. If a negative height or width is * specified, the absolute value is taken. The origin * may be changed with the ellipseMode() function. * * @param x x-coordinate of the ellipse. * @param y y-coordinate of the ellipse. * @param w width of the ellipse. * @param h height of the ellipse. * @param detail number of radial sectors to draw */ ellipse(x: number, y: number, w: number, h: number, detail: number): void /** * Draws a line (a direct path between two points) to * the screen. The version of line() with four * parameters draws the line in 2D. To color a line, * use the stroke() function. A line cannot be * filled, therefore the fill() function will not * affect the color of a line. 2D lines are drawn * with a width of one pixel by default, but this can * be changed with the strokeWeight() function. * * @param x1 the x-coordinate of the first point * @param y1 the y-coordinate of the first point * @param x2 the x-coordinate of the second point * @param y2 the y-coordinate of the second point * @chainable */ line(x1: number, y1: number, x2: number, y2: number): p5 /** * Draws a line (a direct path between two points) to * the screen. The version of line() with four * parameters draws the line in 2D. To color a line, * use the stroke() function. A line cannot be * filled, therefore the fill() function will not * affect the color of a line. 2D lines are drawn * with a width of one pixel by default, but this can * be changed with the strokeWeight() function. * * @param x1 the x-coordinate of the first point * @param y1 the y-coordinate of the first point * @param z1 the z-coordinate of the first point * @param x2 the x-coordinate of the second point * @param y2 the y-coordinate of the second point * @param z2 the z-coordinate of the second point * @chainable */ line(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): p5 /** * Draws a point, a coordinate in space at the * dimension of one pixel. The first parameter is the * horizontal value for the point, the second value * is the vertical value for the point. The color of * the point is determined by the current stroke. * * @param x the x-coordinate * @param y the y-coordinate * @param [z] the z-coordinate (for WEBGL mode) * @chainable */ point(x: number, y: number, z?: number): p5 /** * Draw a quad. A quad is a quadrilateral, a four * sided polygon. It is similar to a rectangle, but * the angles between its edges are not constrained * to ninety degrees. The first pair of parameters * (x1,y1) sets the first vertex and the subsequent * pairs should proceed clockwise or * counter-clockwise around the defined shape. * * @param x1 the x-coordinate of the first point * @param y1 the y-coordinate of the first point * @param x2 the x-coordinate of the second point * @param y2 the y-coordinate of the second point * @param x3 the x-coordinate of the third point * @param y3 the y-coordinate of the third point * @param x4 the x-coordinate of the fourth point * @param y4 the y-coordinate of the fourth point * @chainable */ quad(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number): p5 /** * Draw a quad. A quad is a quadrilateral, a four * sided polygon. It is similar to a rectangle, but * the angles between its edges are not constrained * to ninety degrees. The first pair of parameters * (x1,y1) sets the first vertex and the subsequent * pairs should proceed clockwise or * counter-clockwise around the defined shape. * * @param x1 the x-coordinate of the first point * @param y1 the y-coordinate of the first point * @param x2 the x-coordinate of the second point * @param y2 the y-coordinate of the second point * @param x3 the x-coordinate of the third point * @param y3 the y-coordinate of the third point * @param x4 the x-coordinate of the fourth point * @param y4 the y-coordinate of the fourth point * @chainable */ quad(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, x3: number, y3: number, z3: number, x4: number, y4: number, z4: number): p5 /** * Draws a rectangle to the screen. A rectangle is a * four-sided shape with every angle at ninety * degrees. By default, the first two parameters set * the location of the upper-left corner, the third * sets the width, and the fourth sets the height. * The way these parameters are interpreted, however, * may be changed with the rectMode() function. The * fifth, sixth, seventh and eighth parameters, if * specified, determine corner radius for the * top-right, top-left, lower-right and lower-left * corners, respectively. An omitted corner radius * parameter is set to the value of the previously * specified radius value in the parameter list. * * @param x x-coordinate of the rectangle. * @param y y-coordinate of the rectangle. * @param w width of the rectangle. * @param h height of the rectangle. * @param [tl] optional radius of top-left corner. * @param [tr] optional radius of top-right corner. * @param [br] optional radius of bottom-right * corner. * @param [bl] optional radius of bottom-left corner. * @chainable */ rect(x: number, y: number, w: number, h: number, tl?: number, tr?: number, br?: number, bl?: number): p5 /** * Draws a rectangle to the screen. A rectangle is a * four-sided shape with every angle at ninety * degrees. By default, the first two parameters set * the location of the upper-left corner, the third * sets the width, and the fourth sets the height. * The way these parameters are interpreted, however, * may be changed with the rectMode() function. The * fifth, sixth, seventh and eighth parameters, if * specified, determine corner radius for the * top-right, top-left, lower-right and lower-left * corners, respectively. An omitted corner radius * parameter is set to the value of the previously * specified radius value in the parameter list. * * @param x x-coordinate of the rectangle. * @param y y-coordinate of the rectangle. * @param w width of the rectangle. * @param h height of the rectangle. * @param [detailX] number of segments in the * x-direction * @param [detailY] number of segments in the * y-direction * @chainable */ rect(x: number, y: number, w: number, h: number, detailX?: number, detailY?: number): p5 /** * A triangle is a plane created by connecting three * points. The first two arguments specify the first * point, the middle two arguments specify the second * point, and the last two arguments specify the * third point. * * @param x1 x-coordinate of the first point * @param y1 y-coordinate of the first point * @param x2 x-coordinate of the second point * @param y2 y-coordinate of the second point * @param x3 x-coordinate of the third point * @param y3 y-coordinate of the third point * @chainable */ triangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): p5 // src/core/attributes.js /** * Modifies the location from which ellipses are * drawn by changing the way in which parameters * given to ellipse() are interpreted. The default * mode is ellipseMode(CENTER), which interprets the * first two parameters of ellipse() as the shape's * center point, while the third and fourth * parameters are its width and height. * * * ellipseMode(RADIUS) also uses the first two * parameters of ellipse() as the shape's center * point, but uses the third and fourth parameters to * specify half of the shapes's width and height. * * * ellipseMode(CORNER) interprets the first two * parameters of ellipse() as the upper-left corner * of the shape, while the third and fourth * parameters are its width and height. * * * ellipseMode(CORNERS) interprets the first two * parameters of ellipse() as the location of one * corner of the ellipse's bounding box, and the * third and fourth parameters as the location of the * opposite corner. * * * The parameter must be written in ALL CAPS because * Javascript is a case-sensitive language. * * @param mode either CENTER, RADIUS, CORNER, or * CORNERS * @chainable */ ellipseMode(mode: ELLIPSE_MODE): p5 /** * Draws all geometry with jagged (aliased) edges. * Note that smooth() is active by default, so it is * necessary to call noSmooth() to disable smoothing * of geometry, images, and fonts. * * @chainable */ noSmooth(): p5 /** * Modifies the location from which rectangles are * drawn by changing the way in which parameters * given to rect() are interpreted. The default mode * is rectMode(CORNER), which interprets the first * two parameters of rect() as the upper-left corner * of the shape, while the third and fourth * parameters are its width and height. * * * rectMode(CORNERS) interprets the first two * parameters of rect() as the location of one * corner, and the third and fourth parameters as the * location of the opposite corner. * * * rectMode(CENTER) interprets the first two * parameters of rect() as the shape's center point, * while the third and fourth parameters are its * width and height. * * * rectMode(RADIUS) also uses the first two * parameters of rect() as the shape's center point, * but uses the third and fourth parameters to * specify half of the shapes's width and height. * * * The parameter must be written in ALL CAPS because * Javascript is a case-sensitive language. * * @param mode either CORNER, CORNERS, CENTER, or * RADIUS * @chainable */ rectMode(mode: RECT_MODE): p5 /** * Draws all geometry with smooth (anti-aliased) * edges. smooth() will also improve image quality of * resized images. Note that smooth() is active by * default; noSmooth() can be used to disable * smoothing of geometry, images, and fonts. * * @chainable */ smooth(): p5 /** * Sets the style for rendering line endings. These * ends are either squared, extended, or rounded, * each of which specified with the corresponding * parameters: SQUARE, PROJECT, and ROUND. The * default cap is ROUND. * * @param cap either SQUARE, PROJECT, or ROUND * @chainable */ strokeCap(cap: STROKE_CAP): p5 /** * Sets the style of the joints which connect line * segments. These joints are either mitered, * beveled, or rounded and specified with the * corresponding parameters MITER, BEVEL, and ROUND. * The default joint is MITER. * * @param join either MITER, BEVEL, ROUND * @chainable */ strokeJoin(join: STROKE_JOIN): p5 /** * Sets the width of the stroke used for lines, * points, and the border around shapes. All widths * are set in units of pixels. * * @param weight the weight (in pixels) of the stroke * @chainable */ strokeWeight(weight: number): p5 // src/core/constants.js readonly P2D: 'p2d' readonly WEBGL: 'webgl' /** * HALF_PI is a mathematical constant with the value * 1.57079632679489661923. It is half the ratio of * the circumference of a circle to its diameter. It * is useful in combination with the trigonometric * functions sin() and cos(). * */ readonly HALF_PI: number /** * PI is a mathematical constant with the value * 3.14159265358979323846. It is the ratio of the * circumference of a circle to its diameter. It is * useful in combination with the trigonometric * functions sin() and cos(). * */ readonly PI: number /** * QUARTER_PI is a mathematical constant with the * value 0.7853982. It is one quarter the ratio of * the circumference of a circle to its diameter. It * is useful in combination with the trigonometric * functions sin() and cos(). * */ readonly QUARTER_PI: number /** * TAU is an alias for TWO_PI, a mathematical * constant with the value 6.28318530717958647693. It * is twice the ratio of the circumference of a * circle to its diameter. It is useful in * combination with the trigonometric functions sin() * and cos(). * */ readonly TAU: number /** * TWO_PI is a mathematical constant with the value * 6.28318530717958647693. It is twice the ratio of * the circumference of a circle to its diameter. It * is useful in combination with the trigonometric * functions sin() and cos(). * */ readonly TWO_PI: number /** * Constant to be used with angleMode() function, to * set the mode which p5.js interprates and * calculates angles (either DEGREES or RADIANS). * */ readonly DEGREES: 'degrees' /** * Constant to be used with angleMode() function, to * set the mode which p5.js interprates and * calculates angles (either RADIANS or DEGREES). * */ readonly RADIANS: 'radians' readonly CORNER: 'corner' readonly CORNERS: 'corners' readonly RADIUS: 'radius' readonly RIGHT: 'right' readonly LEFT: 'left' readonly CENTER: 'center' readonly TOP: 'top' readonly BOTTOM: 'bottom' readonly BASELINE: 'alphabetic' readonly POINTS: 0x0000 readonly LINES: 0x0001 readonly LINE_STRIP: 0x0003 readonly LINE_LOOP: 0x0002 readonly TRIANGLES: 0x0004 readonly TRIANGLE_FAN: 0x0006 readonly TRIANGLE_STRIP: 0x0005 readonly QUADS: 'quads' readonly QUAD_STRIP: 'quad_strip' readonly CLOSE: 'close' readonly OPEN: 'open' readonly CHORD: 'chord' readonly PIE: 'pie' readonly PROJECT: 'square' readonly SQUARE: 'butt' readonly ROUND: 'round' readonly BEVEL: 'bevel' readonly MITER: 'miter' readonly RGB: 'rgb' readonly HSB: 'hsb' readonly HSL: 'hsl' readonly BLEND: 'source-over' readonly ADD: 'lighter' readonly DARKEST: 'darkest' readonly LIGHTEST: 'lighten' readonly DIFFERENCE: 'difference' readonly EXCLUSION: 'exclusion' readonly MULTIPLY: 'multiply' readonly SCREEN: 'screen' readonly REPLACE: 'copy' readonly OVERLAY: 'overlay' readonly HARD_LIGHT: 'hard-light' readonly SOFT_LIGHT: 'soft-light' readonly DODGE: 'color-dodge' readonly BURN: 'color-burn' readonly THRESHOLD: 'threshold' readonly GRAY: 'gray' readonly OPAQUE: 'opaque' readonly INVERT: 'invert' readonly POSTERIZE: 'posterize' readonly DILATE: 'dilate' readonly ERODE: 'erode' readonly BLUR: 'blur' readonly NORMAL: 'normal' readonly ITALIC: 'italic' readonly BOLD: 'bold' readonly LANDSCAPE: 'landscape' readonly PORTRAIT: 'portrait' // src/core/core.js /** * Called directly before setup(), the preload() * function is used to handle asynchronous loading of * external files. If a preload function is defined, * setup() will wait until any load calls within have * finished. Nothing besides load calls should be * inside preload (loadImage, loadJSON, loadFont, * loadStrings, etc). * * * By default the text "loading..." will be * displayed. To make your own loading page, include * an HTML element with id "p5_loading" in your page. * More information here. * */ preload(): void /** * The setup() function is called once when the * program starts. It's used to define initial * environment properties such as screen size and * background color and to load media such as images * and fonts as the program starts. There can only be * one setup() function for each program and it * shouldn't be called again after its initial * execution. * * * Note: Variables declared within setup() are not * accessible within other functions, including * draw(). * */ setup(): void /** * Called directly after setup(), the draw() function * continuously executes the lines of code contained * inside its block until the program is stopped or * noLoop() is called. Note if noLoop() is called in * setup(), draw() will still be executed once before * stopping. draw() is called automatically and * should never be called explicitly. It should * always be controlled with noLoop(), redraw() and * loop(). After noLoop() stops the code in draw() * from executing, redraw() causes the code inside * draw() to execute once, and loop() will cause the * code inside draw() to resume executing * continuously. * * * The number of times draw() executes in each second * may be controlled with the frameRate() function. * * * There can only be one draw() function for each * sketch,