diff --git a/docs/parameterData.json b/docs/parameterData.json
index 7757a85a7f..dfa2e306ff 100644
--- a/docs/parameterData.json
+++ b/docs/parameterData.json
@@ -39,27 +39,6 @@
]
]
},
- "alpha": {
- "overloads": [
- [
- "p5.Color|Number[]|String"
- ]
- ]
- },
- "blue": {
- "overloads": [
- [
- "p5.Color|Number[]|String"
- ]
- ]
- },
- "brightness": {
- "overloads": [
- [
- "p5.Color|Number[]|String"
- ]
- ]
- },
"color": {
"overloads": [
[
@@ -83,37 +62,35 @@
]
]
},
- "green": {
+ "red": {
"overloads": [
[
"p5.Color|Number[]|String"
]
]
},
- "hue": {
+ "green": {
"overloads": [
[
"p5.Color|Number[]|String"
]
]
},
- "lerpColor": {
+ "blue": {
"overloads": [
[
- "p5.Color",
- "p5.Color",
- "Number"
+ "p5.Color|Number[]|String"
]
]
},
- "lightness": {
+ "alpha": {
"overloads": [
[
"p5.Color|Number[]|String"
]
]
},
- "red": {
+ "hue": {
"overloads": [
[
"p5.Color|Number[]|String"
@@ -127,6 +104,37 @@
]
]
},
+ "brightness": {
+ "overloads": [
+ [
+ "p5.Color|Number[]|String"
+ ]
+ ]
+ },
+ "lightness": {
+ "overloads": [
+ [
+ "p5.Color|Number[]|String"
+ ]
+ ]
+ },
+ "lerpColor": {
+ "overloads": [
+ [
+ "p5.Color",
+ "p5.Color",
+ "Number"
+ ]
+ ]
+ },
+ "paletteLerp": {
+ "overloads": [
+ [
+ null,
+ "Number"
+ ]
+ ]
+ },
"beginClip": {
"overloads": [
[
@@ -270,6 +278,13 @@
[]
]
},
+ "blendMode": {
+ "overloads": [
+ [
+ "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|REMOVE|SUBTRACT"
+ ]
+ ]
+ },
"print": {
"overloads": [
[
@@ -349,6 +364,18 @@
[]
]
},
+ "worldToScreen": {
+ "overloads": [
+ [
+ "p5.Vector"
+ ]
+ ]
+ },
+ "sketchVerifier": {
+ "overloads": [
+ []
+ ]
+ },
"setup": {
"overloads": [
[]
@@ -374,7 +401,7 @@
[
"Number?",
"Number?",
- "String?",
+ "P2D|WEBGL?",
"HTMLCanvasElement?"
],
[
@@ -403,7 +430,7 @@
[
"Number",
"Number",
- "String?",
+ "P2D|WEBGL?",
"HTMLCanvasElement?"
],
[
@@ -427,60 +454,32 @@
]
]
},
- "blendMode": {
+ "noLoop": {
"overloads": [
- [
- "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|REMOVE|SUBTRACT"
- ]
+ []
]
},
- "arc": {
+ "loop": {
"overloads": [
- [
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "CHORD|PIE|OPEN?",
- "Integer?"
- ]
+ []
]
},
- "ellipse": {
+ "isLooping": {
"overloads": [
- [
- "Number",
- "Number",
- "Number",
- "Number?"
- ],
- [
- "Number",
- "Number",
- "Number",
- "Number",
- "Integer?"
- ]
+ []
]
},
- "circle": {
+ "redraw": {
"overloads": [
[
- "Number",
- "Number",
- "Number"
+ "Integer?"
]
]
},
- "line": {
+ "applyMatrix": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number"
+ "Array"
],
[
"Number",
@@ -489,36 +488,11 @@
"Number",
"Number",
"Number"
- ]
- ]
- },
- "point": {
- "overloads": [
- [
- "Number",
- "Number",
- "Number?"
],
[
- "p5.Vector"
- ]
- ]
- },
- "quad": {
- "overloads": [
- [
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
"Number",
"Number",
"Number",
- "Integer?",
- "Integer?"
- ],
- [
"Number",
"Number",
"Number",
@@ -531,1430 +505,1427 @@
"Number",
"Number",
"Number",
- "Integer?",
- "Integer?"
+ "Number"
]
]
},
- "rect": {
+ "resetMatrix": {
"overloads": [
- [
- "Number",
- "Number",
- "Number",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
- ],
- [
- "Number",
- "Number",
- "Number",
- "Number",
- "Integer?",
- "Integer?"
- ]
+ []
]
},
- "square": {
+ "rotate": {
"overloads": [
[
"Number",
- "Number",
- "Number",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "p5.Vector|Number[]?"
]
]
},
- "triangle": {
+ "rotateX": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
"Number"
]
]
},
- "ellipseMode": {
+ "rotateY": {
"overloads": [
[
- "CENTER|RADIUS|CORNER|CORNERS"
+ "Number"
]
]
},
- "noSmooth": {
- "overloads": [
- []
- ]
- },
- "rectMode": {
+ "rotateZ": {
"overloads": [
[
- "CENTER|RADIUS|CORNER|CORNERS"
+ "Number"
]
]
},
- "smooth": {
- "overloads": [
- []
- ]
- },
- "strokeCap": {
+ "scale": {
"overloads": [
[
- "ROUND|SQUARE|PROJECT"
+ "Number|p5.Vector|Number[]",
+ "Number?",
+ "Number?"
+ ],
+ [
+ "p5.Vector|Number[]"
]
]
},
- "strokeJoin": {
+ "shearX": {
"overloads": [
[
- "MITER|BEVEL|ROUND"
+ "Number"
]
]
},
- "strokeWeight": {
+ "shearY": {
"overloads": [
[
"Number"
]
]
},
- "bezier": {
+ "translate": {
"overloads": [
[
"Number",
"Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "Number?"
],
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "p5.Vector"
]
]
},
- "bezierDetail": {
+ "push": {
"overloads": [
- [
- "Number"
- ]
+ []
]
},
- "bezierPoint": {
+ "pop": {
+ "overloads": [
+ []
+ ]
+ },
+ "storeItem": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "String",
+ "String|Number|Boolean|Object|Array"
]
]
},
- "bezierTangent": {
+ "getItem": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "String"
]
]
},
- "curve": {
+ "clearStorage": {
+ "overloads": [
+ []
+ ]
+ },
+ "removeItem": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "String"
+ ]
+ ]
+ },
+ "createStringDict": {
+ "overloads": [
+ [
+ "String",
+ "String"
],
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "Object"
]
]
},
- "curveDetail": {
+ "createNumberDict": {
"overloads": [
[
+ "Number",
"Number"
+ ],
+ [
+ "Object"
]
]
},
- "curveTightness": {
+ "select": {
"overloads": [
[
- "Number"
+ "String",
+ "String|p5.Element|HTMLElement?"
]
]
},
- "curvePoint": {
+ "selectAll": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "String",
+ "String|p5.Element|HTMLElement?"
]
]
},
- "curveTangent": {
+ "createElement": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "String",
+ "String?"
]
]
},
- "beginContour": {
+ "removeElements": {
"overloads": [
[]
]
},
- "beginShape": {
+ "addElement": {
+ "overloads": [
+ []
+ ]
+ },
+ "createDiv": {
"overloads": [
[
- "POINTS|LINES|TRIANGLES|TRIANGLE_FAN|TRIANGLE_STRIP|QUADS|QUAD_STRIP|TESS?"
+ "String?"
]
]
},
- "bezierVertex": {
+ "createP": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
- ],
+ "String?"
+ ]
+ ]
+ },
+ "createSpan": {
+ "overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "String?"
]
]
},
- "curveVertex": {
+ "createImg": {
"overloads": [
[
- "Number",
- "Number"
+ "String",
+ "String"
],
+ [
+ "String",
+ "String",
+ "String?",
+ "Function?"
+ ]
+ ]
+ },
+ "createA": {
+ "overloads": [
+ [
+ "String",
+ "String",
+ "String?"
+ ]
+ ]
+ },
+ "createSlider": {
+ "overloads": [
[
"Number",
"Number",
+ "Number?",
"Number?"
]
]
},
- "endContour": {
+ "createButton": {
"overloads": [
- []
+ [
+ "String",
+ "String?"
+ ]
]
},
- "endShape": {
+ "createCheckbox": {
"overloads": [
[
- "CLOSE?",
- "Integer?"
+ "String?",
+ "Boolean?"
]
]
},
- "quadraticVertex": {
+ "createSelect": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number"
+ "Boolean?"
],
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "Object"
]
]
},
- "vertex": {
+ "createRadio": {
"overloads": [
[
- "Number",
- "Number"
+ "Object?"
],
[
- "Number",
- "Number",
- "Number?"
+ "String?"
],
+ []
+ ]
+ },
+ "createColorPicker": {
+ "overloads": [
[
- "Number",
- "Number",
- "Number?",
- "Number?",
- "Number?"
+ "String|p5.Color?"
]
]
},
- "normal": {
+ "createInput": {
"overloads": [
[
- "p5.Vector"
+ "String?",
+ "String?"
],
[
- "Number",
- "Number",
+ "String?"
+ ]
+ ]
+ },
+ "createFileInput": {
+ "overloads": [
+ [
+ "Function",
+ "Boolean?"
+ ]
+ ]
+ },
+ "setMoveThreshold": {
+ "overloads": [
+ [
"Number"
]
]
},
- "noLoop": {
+ "setShakeThreshold": {
"overloads": [
- []
+ [
+ "Number"
+ ]
]
},
- "loop": {
+ "deviceMoved": {
"overloads": [
[]
]
},
- "isLooping": {
+ "deviceTurned": {
"overloads": [
[]
]
},
- "push": {
+ "deviceShaken": {
"overloads": [
[]
]
},
- "pop": {
+ "keyPressed": {
"overloads": [
- []
+ [
+ "KeyboardEvent?"
+ ]
]
},
- "redraw": {
+ "keyReleased": {
"overloads": [
[
- "Integer?"
+ "KeyboardEvent?"
]
]
},
- "applyMatrix": {
+ "keyTyped": {
"overloads": [
[
- "Array"
- ],
+ "KeyboardEvent?"
+ ]
+ ]
+ },
+ "keyIsDown": {
+ "overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
- ],
- [
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
"Number"
]
]
},
- "resetMatrix": {
+ "mouseMoved": {
"overloads": [
- []
+ [
+ "MouseEvent?"
+ ]
]
},
- "rotate": {
+ "mouseDragged": {
"overloads": [
[
- "Number",
- "p5.Vector|Number[]?"
+ "MouseEvent?"
]
]
},
- "rotateX": {
+ "mousePressed": {
"overloads": [
[
- "Number"
+ "MouseEvent?"
]
]
},
- "rotateY": {
+ "mouseReleased": {
"overloads": [
[
- "Number"
+ "MouseEvent?"
]
]
},
- "rotateZ": {
+ "mouseClicked": {
"overloads": [
[
- "Number"
+ "MouseEvent?"
]
]
},
- "scale": {
+ "doubleClicked": {
"overloads": [
[
- "Number|p5.Vector|Number[]",
- "Number?",
- "Number?"
- ],
- [
- "p5.Vector|Number[]"
+ "MouseEvent?"
]
]
},
- "shearX": {
+ "mouseWheel": {
"overloads": [
[
- "Number"
+ "WheelEvent?"
]
]
},
- "shearY": {
+ "requestPointerLock": {
+ "overloads": [
+ []
+ ]
+ },
+ "exitPointerLock": {
+ "overloads": [
+ []
+ ]
+ },
+ "createImage": {
"overloads": [
[
- "Number"
+ "Integer",
+ "Integer"
]
]
},
- "translate": {
+ "saveCanvas": {
"overloads": [
[
- "Number",
- "Number",
- "Number?"
+ "p5.Framebuffer|p5.Element|HTMLCanvasElement",
+ "String?",
+ "String?"
],
[
- "p5.Vector"
+ "String?",
+ "String?"
]
]
},
- "storeItem": {
+ "saveFrames": {
"overloads": [
[
"String",
- "String|Number|Boolean|Object|Array"
+ "String",
+ "Number",
+ "Number",
+ "function(Array)?"
]
]
},
- "getItem": {
+ "loadImage": {
"overloads": [
[
- "String"
+ "String|Request",
+ "function(p5.Image)?",
+ "function(Event)?"
]
]
},
- "clearStorage": {
- "overloads": [
- []
- ]
- },
- "removeItem": {
+ "saveGif": {
"overloads": [
[
- "String"
+ "String",
+ "Number",
+ "Object?"
]
]
},
- "createStringDict": {
+ "image": {
"overloads": [
[
- "String",
- "String"
+ "p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture",
+ "Number",
+ "Number",
+ "Number?",
+ "Number?"
],
[
- "Object"
+ "p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number?",
+ "Number?",
+ "CONTAIN|COVER?",
+ "LEFT|RIGHT|CENTER?",
+ "TOP|BOTTOM|CENTER?"
]
]
},
- "createNumberDict": {
+ "tint": {
"overloads": [
[
"Number",
- "Number"
+ "Number",
+ "Number",
+ "Number?"
],
[
- "Object"
+ "String"
+ ],
+ [
+ "Number",
+ "Number?"
+ ],
+ [
+ "Number[]"
+ ],
+ [
+ "p5.Color"
]
]
},
- "select": {
+ "noTint": {
+ "overloads": [
+ []
+ ]
+ },
+ "imageMode": {
"overloads": [
[
- "String",
- "String|p5.Element|HTMLElement?"
+ "CORNER|CORNERS|CENTER"
]
]
},
- "selectAll": {
+ "blend": {
"overloads": [
[
- "String",
- "String|p5.Element|HTMLElement?"
+ "p5.Image",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL"
+ ],
+ [
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL"
]
]
},
- "removeElements": {
+ "copy": {
"overloads": [
- []
+ [
+ "p5.Image|p5.Element",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer"
+ ],
+ [
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer"
+ ]
]
},
- "changed": {
+ "filter": {
"overloads": [
[
- "Function|Boolean"
+ "THRESHOLD|GRAY|OPAQUE|INVERT|POSTERIZE|BLUR|ERODE|DILATE|BLUR",
+ "Number?",
+ "Boolean?"
+ ],
+ [
+ "p5.Shader"
]
]
},
- "input": {
+ "get": {
"overloads": [
[
- "Function|Boolean"
+ "Number",
+ "Number",
+ "Number",
+ "Number"
+ ],
+ [],
+ [
+ "Number",
+ "Number"
+ ],
+ [
+ "String|Integer"
]
]
},
- "addElement": {
+ "loadPixels": {
"overloads": [
[]
]
},
- "createDiv": {
+ "set": {
"overloads": [
[
- "String?"
+ "Number",
+ "Number",
+ "Number|Number[]|Object"
+ ],
+ [
+ "String|Integer",
+ "String|Number"
]
]
},
- "createP": {
+ "updatePixels": {
"overloads": [
[
- "String?"
- ]
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
+ ],
+ []
]
},
- "createSpan": {
+ "loadJSON": {
"overloads": [
[
- "String?"
+ "String|Request",
+ "Function?",
+ "Function?"
]
]
},
- "createImg": {
+ "loadStrings": {
"overloads": [
[
- "String",
- "String"
- ],
- [
- "String",
- "String",
- "String?",
+ "String|Request",
+ "Function?",
"Function?"
]
]
},
- "createA": {
+ "loadTable": {
"overloads": [
[
- "String",
- "String",
- "String?"
+ "String|Request",
+ "String?",
+ "String?",
+ "Function?",
+ "Function?"
]
]
},
- "createSlider": {
- "overloads": [
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- []
- ]
- },
- "createButton": {
+ "loadXML": {
"overloads": [
[
- "String",
- "String?"
+ "String|Request",
+ "Function?",
+ "Function?"
]
]
},
- "createCheckbox": {
+ "loadBytes": {
"overloads": [
[
- "String?",
- "Boolean?"
+ "String|Request",
+ "Function?",
+ "Function?"
]
]
},
- "createSelect": {
+ "httpGet": {
"overloads": [
[
- "Boolean?"
+ "String|Request",
+ "String?",
+ "Function?",
+ "Function?"
],
[
- "Object"
+ "String|Request",
+ "Function",
+ "Function?"
]
]
},
- "createRadio": {
+ "httpPost": {
"overloads": [
[
- "Object?"
+ "String|Request",
+ "Object|Boolean?",
+ "String?",
+ "Function?",
+ "Function?"
],
[
- "String?"
+ "String|Request",
+ "Object|Boolean",
+ "Function?",
+ "Function?"
],
- []
- ]
- },
- "createColorPicker": {
- "overloads": [
[
- "String|p5.Color?"
+ "String|Request",
+ "Function?",
+ "Function?"
]
]
},
- "createInput": {
+ "httpDo": {
"overloads": [
[
+ "String|Request",
"String?",
- "String?"
+ "String?",
+ "Object?",
+ "Function?",
+ "Function?"
],
[
- "String?"
+ "String|Request",
+ "Function?",
+ "Function?"
]
]
},
- "createFileInput": {
+ "createWriter": {
"overloads": [
[
- "Function",
- "Boolean?"
+ "String",
+ "String?"
]
]
},
- "createMedia": {
- "overloads": [
- []
- ]
- },
- "createVideo": {
+ "write": {
"overloads": [
[
- "String|String[]",
- "Function?"
+ "String|Number|Array"
]
]
},
- "createAudio": {
+ "close": {
"overloads": [
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
[]
]
},
- "createCapture": {
+ "save": {
"overloads": [
[
- "AUDIO|VIDEO|Object?",
- "Object?",
- "Function?"
+ "Object|String?",
+ "String?",
+ "Boolean|String?"
]
]
},
- "createElement": {
+ "saveJSON": {
"overloads": [
[
+ "Array|Object",
"String",
- "String?"
- ]
- ]
- },
- "removeClass": {
- "overloads": [
- [
- "String"
+ "Boolean?"
]
]
},
- "hasClass": {
+ "saveStrings": {
"overloads": [
[
- null
+ "String[]",
+ "String",
+ "String?",
+ "Boolean?"
]
]
},
- "toggleClass": {
+ "saveTable": {
"overloads": [
[
- null
+ "p5.Table",
+ "String",
+ "String?"
]
]
},
- "child": {
+ "abs": {
"overloads": [
- [],
[
- "String|p5.Element?"
+ "Number"
]
]
},
- "center": {
+ "ceil": {
"overloads": [
[
- "String?"
+ "Number"
]
]
},
- "position": {
+ "constrain": {
"overloads": [
- [],
[
- "Number?",
- "Number?",
- "String?"
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "style": {
+ "dist": {
"overloads": [
[
- "String"
+ "Number",
+ "Number",
+ "Number",
+ "Number"
],
[
- "String",
- "String|p5.Color"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "attribute": {
+ "exp": {
"overloads": [
- [],
[
- "String",
- "String"
+ "Number"
]
]
},
- "removeAttribute": {
+ "floor": {
"overloads": [
[
- "String"
+ "Number"
]
]
},
- "value": {
+ "lerp": {
"overloads": [
- [],
[
- "String|Number"
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "show": {
- "overloads": [
- []
- ]
- },
- "hide": {
- "overloads": [
- []
- ]
- },
- "size": {
+ "log": {
"overloads": [
- [],
[
- "Number|AUTO?",
- "Number|AUTO?"
+ "Number"
]
]
},
- "remove": {
- "overloads": [
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- []
- ]
- },
- "drop": {
+ "mag": {
"overloads": [
[
- "Function",
- "Function?"
+ "Number",
+ "Number"
]
]
},
- "draggable": {
+ "map": {
"overloads": [
[
- "p5.Element?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Boolean?"
]
]
},
- "volume": {
+ "max": {
"overloads": [
[
+ "Number",
"Number"
+ ],
+ [
+ "Number[]"
]
]
},
- "setMoveThreshold": {
+ "min": {
"overloads": [
[
+ "Number",
"Number"
+ ],
+ [
+ "Number[]"
]
]
},
- "setShakeThreshold": {
+ "norm": {
"overloads": [
[
+ "Number",
+ "Number",
"Number"
]
]
},
- "deviceMoved": {
+ "pow": {
"overloads": [
- []
+ [
+ "Number",
+ "Number"
+ ]
]
},
- "deviceTurned": {
+ "round": {
"overloads": [
- []
+ [
+ "Number",
+ "Number?"
+ ]
]
},
- "deviceShaken": {
+ "sq": {
"overloads": [
- []
+ [
+ "Number"
+ ]
]
},
- "keyPressed": {
+ "sqrt": {
"overloads": [
[
- "KeyboardEvent?"
+ "Number"
]
]
},
- "keyReleased": {
+ "fract": {
"overloads": [
[
- "KeyboardEvent?"
+ "Number"
]
]
},
- "keyTyped": {
+ "createVector": {
"overloads": [
[
- "KeyboardEvent?"
+ "Number?",
+ "Number?",
+ "Number?"
]
]
},
- "keyIsDown": {
+ "createMatrix": {
+ "overloads": [
+ []
+ ]
+ },
+ "noise": {
+ "overloads": [
+ [
+ "Number",
+ "Number?",
+ "Number?"
+ ]
+ ]
+ },
+ "noiseDetail": {
"overloads": [
[
+ "Number",
"Number"
]
]
},
- "mouseMoved": {
+ "noiseSeed": {
"overloads": [
[
- "MouseEvent?"
+ "Number"
]
]
},
- "mouseDragged": {
+ "randomSeed": {
"overloads": [
[
- "MouseEvent?"
+ "Number"
]
]
},
- "mousePressed": {
+ "random": {
"overloads": [
[
- "MouseEvent?"
+ "Number?",
+ "Number?"
+ ],
+ [
+ "Array"
]
]
},
- "mouseReleased": {
+ "randomGaussian": {
"overloads": [
[
- "MouseEvent?"
+ "Number?",
+ "Number?"
]
]
},
- "mouseClicked": {
+ "acos": {
"overloads": [
[
- "MouseEvent?"
+ "Number"
]
]
},
- "doubleClicked": {
+ "asin": {
"overloads": [
[
- "MouseEvent?"
+ "Number"
]
]
},
- "mouseWheel": {
+ "atan": {
"overloads": [
[
- "WheelEvent?"
+ "Number"
]
]
},
- "requestPointerLock": {
+ "atan2": {
"overloads": [
- []
+ [
+ "Number",
+ "Number"
+ ]
]
},
- "exitPointerLock": {
+ "cos": {
"overloads": [
- []
+ [
+ "Number"
+ ]
]
},
- "touchStarted": {
+ "sin": {
"overloads": [
[
- "TouchEvent?"
+ "Number"
]
]
},
- "touchMoved": {
+ "tan": {
"overloads": [
[
- "TouchEvent?"
+ "Number"
]
]
},
- "touchEnded": {
+ "degrees": {
"overloads": [
[
- "TouchEvent?"
+ "Number"
]
]
},
- "createImage": {
+ "radians": {
"overloads": [
[
- "Integer",
- "Integer"
+ "Number"
]
]
},
- "saveCanvas": {
+ "angleMode": {
"overloads": [
[
- "p5.Framebuffer|p5.Element|HTMLCanvasElement",
- "String?",
- "String?"
+ "RADIANS|DEGREES"
],
+ []
+ ]
+ },
+ "arc": {
+ "overloads": [
[
- "String?",
- "String?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "CHORD|PIE|OPEN?",
+ "Integer?"
]
]
},
- "saveFrames": {
+ "ellipse": {
"overloads": [
[
- "String",
- "String",
"Number",
"Number",
- "Function?"
+ "Number",
+ "Number?"
+ ],
+ [
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Integer?"
]
]
},
- "loadImage": {
+ "circle": {
"overloads": [
[
- "String",
- "Function?",
- "Function?"
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "saveGif": {
+ "line": {
"overloads": [
[
- "String",
"Number",
- "Object?"
+ "Number",
+ "Number",
+ "Number"
+ ],
+ [
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "image": {
+ "point": {
"overloads": [
[
- "p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture",
"Number",
"Number",
- "Number?",
"Number?"
],
[
- "p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture",
+ "p5.Vector"
+ ]
+ ]
+ },
+ "quad": {
+ "overloads": [
+ [
"Number",
"Number",
"Number",
"Number",
"Number",
"Number",
- "Number?",
- "Number?",
- "CONTAIN|COVER?",
- "LEFT|RIGHT|CENTER?",
- "TOP|BOTTOM|CENTER?"
+ "Number",
+ "Number",
+ "Integer?",
+ "Integer?"
+ ],
+ [
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Integer?",
+ "Integer?"
]
]
},
- "tint": {
+ "rect": {
"overloads": [
[
"Number",
"Number",
"Number",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
"Number?"
],
[
- "String"
- ],
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Integer?",
+ "Integer?"
+ ]
+ ]
+ },
+ "square": {
+ "overloads": [
[
"Number",
+ "Number",
+ "Number",
+ "Number?",
+ "Number?",
+ "Number?",
"Number?"
- ],
- [
- "Number[]"
- ],
- [
- "p5.Color"
]
]
},
- "noTint": {
+ "triangle": {
"overloads": [
- []
+ [
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
+ ]
]
},
- "imageMode": {
+ "ellipseMode": {
"overloads": [
[
- "CORNER|CORNERS|CENTER"
+ "CENTER|RADIUS|CORNER|CORNERS"
]
]
},
- "blend": {
+ "noSmooth": {
+ "overloads": [
+ []
+ ]
+ },
+ "rectMode": {
"overloads": [
[
- "p5.Image",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL"
- ],
- [
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL"
+ "CENTER|RADIUS|CORNER|CORNERS"
]
]
},
- "copy": {
+ "smooth": {
+ "overloads": [
+ []
+ ]
+ },
+ "strokeCap": {
"overloads": [
[
- "p5.Image|p5.Element",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer"
- ],
- [
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer"
+ "ROUND|SQUARE|PROJECT"
]
]
},
- "filter": {
+ "strokeJoin": {
"overloads": [
[
- "THRESHOLD|GRAY|OPAQUE|INVERT|POSTERIZE|BLUR|ERODE|DILATE|BLUR",
- "Number?",
- "Boolean?"
- ],
- [
- "THRESHOLD|GRAY|OPAQUE|INVERT|POSTERIZE|BLUR|ERODE|DILATE|BLUR",
- "Number?",
- "Boolean?"
- ],
+ "MITER|BEVEL|ROUND"
+ ]
+ ]
+ },
+ "strokeWeight": {
+ "overloads": [
[
- "p5.Shader"
+ "Number"
]
]
},
- "get": {
+ "bezier": {
"overloads": [
[
+ "Number",
+ "Number",
+ "Number",
+ "Number",
"Number",
"Number",
"Number",
"Number"
],
- [],
[
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
"Number",
"Number"
- ],
- [
- "String|Integer"
]
]
},
- "loadPixels": {
+ "bezierDetail": {
"overloads": [
- [],
- []
+ [
+ "Number"
+ ]
]
},
- "set": {
+ "bezierPoint": {
"overloads": [
[
"Number",
"Number",
- "Number|Number[]|Object"
- ],
- [
- "String|Integer",
- "String|Number"
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "updatePixels": {
- "overloads": [
- [
- "Number?",
- "Number?",
- "Number?",
- "Number?"
- ],
- []
- ]
- },
- "loadJSON": {
+ "bezierTangent": {
"overloads": [
[
- "String",
- "Function?",
- "Function?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "loadStrings": {
+ "curve": {
"overloads": [
[
- "String",
- "Function?",
- "Function?"
- ]
- ]
- },
- "loadTable": {
- "overloads": [
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
+ ],
[
- "String",
- "String?",
- "String?",
- "Function?",
- "Function?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "loadXML": {
+ "curvePoint": {
"overloads": [
[
- "String",
- "Function?",
- "Function?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "loadBytes": {
+ "curveTangent": {
"overloads": [
[
- "String",
- "Function?",
- "Function?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "httpGet": {
+ "vertex": {
"overloads": [
[
- "String",
- "String?",
- "Object|Boolean?",
- "Function?",
- "Function?"
+ "Number",
+ "Number"
],
[
- "String",
- "Object|Boolean",
- "Function?",
- "Function?"
+ "Number",
+ "Number",
+ "Number?"
],
[
- "String",
- "Function",
- "Function?"
+ "Number",
+ "Number",
+ "Number?",
+ "Number?",
+ "Number?"
]
]
},
- "httpPost": {
+ "beginContour": {
"overloads": [
- [
- "String",
- "String?",
- "Object|Boolean?",
- "Function?",
- "Function?"
- ],
- [
- "String",
- "Object|Boolean",
- "Function?",
- "Function?"
- ],
- [
- "String",
- "Function",
- "Function?"
- ]
+ []
]
},
- "httpDo": {
+ "endContour": {
"overloads": [
[
- "String",
- "String?",
- "String?",
- "Object?",
- "Function?",
- "Function?"
- ],
- [
- "String",
- "Object",
- "Function?",
- "Function?"
+ "OPEN|CLOSE?"
]
]
},
- "createWriter": {
+ "beginShape": {
"overloads": [
[
- "String",
- "String?"
+ "POINTS|LINES|TRIANGLES|TRIANGLE_FAN|TRIANGLE_STRIP|QUADS|QUAD_STRIP|PATH?"
]
]
},
- "write": {
- "overloads": [
- [
- "String|Number|Array"
- ]
- ]
- },
- "close": {
- "overloads": [
- []
- ]
- },
- "save": {
- "overloads": [
- [
- "Object|String?",
- "String?",
- "Boolean|String?"
- ]
- ]
- },
- "saveJSON": {
- "overloads": [
- [
- "Array|Object",
- "String",
- "Boolean?"
- ]
- ]
- },
- "saveStrings": {
- "overloads": [
- [
- "String[]",
- "String",
- "String?",
- "Boolean?"
- ]
- ]
- },
- "saveTable": {
- "overloads": [
- [
- "p5.Table",
- "String",
- "String?"
- ]
- ]
- },
- "abs": {
- "overloads": [
- [
- "Number"
- ]
- ]
- },
- "ceil": {
- "overloads": [
- [
- "Number"
- ]
- ]
- },
- "constrain": {
+ "bezierVertex": {
"overloads": [
[
"Number",
"Number",
- "Number"
- ]
- ]
- },
- "dist": {
- "overloads": [
- [
"Number",
"Number",
"Number",
@@ -1966,1348 +1937,1311 @@
"Number",
"Number",
"Number",
+ "Number",
+ "Number",
+ "Number",
"Number"
]
]
},
- "exp": {
+ "curveVertex": {
"overloads": [
[
+ "Number",
"Number"
+ ],
+ [
+ "Number",
+ "Number",
+ "Number?"
]
]
},
- "floor": {
+ "endShape": {
"overloads": [
[
- "Number"
+ "CLOSE?",
+ "Integer?"
]
]
},
- "lerp": {
+ "quadraticVertex": {
"overloads": [
[
+ "Number",
"Number",
"Number",
"Number"
- ]
- ]
- },
- "log": {
- "overloads": [
+ ],
[
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
"Number"
]
]
},
- "mag": {
+ "normal": {
"overloads": [
+ [
+ "p5.Vector"
+ ],
[
+ "Number",
"Number",
"Number"
]
]
},
- "map": {
+ "vertexProperty": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Boolean?"
+ "String",
+ "Number|Number[]"
+ ],
+ [
+ "String",
+ "Number|Number[]",
+ "Number?"
]
]
},
- "max": {
+ "append": {
"overloads": [
[
- "Number",
- "Number"
- ],
- [
- "Number[]"
+ "Array",
+ "Any"
]
]
},
- "min": {
+ "arrayCopy": {
"overloads": [
[
- "Number",
- "Number"
+ "Array",
+ "Integer",
+ "Array",
+ "Integer",
+ "Integer"
],
[
- "Number[]"
+ "Array",
+ "Array",
+ "Integer?"
]
]
},
- "norm": {
+ "concat": {
"overloads": [
[
- "Number",
- "Number",
- "Number"
+ "Array",
+ "Array"
]
]
},
- "pow": {
+ "reverse": {
"overloads": [
[
- "Number",
- "Number"
+ "Array"
]
]
},
- "round": {
+ "shorten": {
"overloads": [
[
- "Number",
- "Number?"
+ "Array"
]
]
},
- "sq": {
+ "shuffle": {
"overloads": [
[
- "Number"
+ "Array",
+ "Boolean?"
]
]
},
- "sqrt": {
+ "sort": {
"overloads": [
[
- "Number"
+ "Array",
+ "Integer?"
]
]
},
- "fract": {
+ "splice": {
"overloads": [
[
- "Number"
+ "Array",
+ "Any",
+ "Integer"
]
]
},
- "createVector": {
+ "subset": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?"
+ "Array",
+ "Integer",
+ "Integer?"
]
]
},
- "noise": {
+ "float": {
"overloads": [
[
- "Number",
- "Number?",
- "Number?"
+ "String"
+ ],
+ [
+ "String[]"
]
]
},
- "noiseDetail": {
+ "int": {
"overloads": [
[
- "Number",
- "Number"
+ "String|Boolean|Number"
+ ],
+ [
+ "Array"
]
]
},
- "noiseSeed": {
+ "str": {
"overloads": [
[
- "Number"
+ "String|Boolean|Number"
]
]
},
- "randomSeed": {
+ "boolean": {
"overloads": [
[
- "Number"
+ "String|Boolean|Number"
+ ],
+ [
+ "Array"
]
]
},
- "random": {
+ "byte": {
"overloads": [
[
- "Number?",
- "Number?"
+ "String|Boolean|Number"
],
[
"Array"
]
]
},
- "randomGaussian": {
+ "char": {
"overloads": [
[
- "Number?",
- "Number?"
+ "String|Number"
+ ],
+ [
+ "Array"
]
]
},
- "acos": {
+ "unchar": {
"overloads": [
[
- "Number"
+ "String"
+ ],
+ [
+ "String[]"
]
]
},
- "asin": {
+ "hex": {
"overloads": [
[
- "Number"
+ "Number",
+ "Number?"
+ ],
+ [
+ "Number[]",
+ "Number?"
]
]
},
- "atan": {
+ "unhex": {
"overloads": [
[
- "Number"
+ "String"
+ ],
+ [
+ "String[]"
]
]
},
- "atan2": {
+ "join": {
"overloads": [
[
- "Number",
- "Number"
+ "Array",
+ "String"
]
]
},
- "cos": {
+ "match": {
"overloads": [
[
- "Number"
+ "String",
+ "String"
]
]
},
- "sin": {
+ "matchAll": {
"overloads": [
[
- "Number"
+ "String",
+ "String"
]
]
},
- "tan": {
+ "nf": {
"overloads": [
[
- "Number"
+ "Number|String",
+ "Integer|String?",
+ "Integer|String?"
+ ],
+ [
+ "Number[]",
+ "Integer|String?",
+ "Integer|String?"
]
]
},
- "degrees": {
+ "nfc": {
"overloads": [
[
- "Number"
+ "Number|String",
+ "Integer|String?"
+ ],
+ [
+ "Number[]",
+ "Integer|String?"
]
]
},
- "radians": {
+ "nfp": {
"overloads": [
[
- "Number"
+ "Number",
+ "Integer?",
+ "Integer?"
+ ],
+ [
+ "Number[]",
+ "Integer?",
+ "Integer?"
]
]
},
- "angleMode": {
+ "nfs": {
"overloads": [
[
- "RADIANS|DEGREES"
+ "Number",
+ "Integer?",
+ "Integer?"
],
- []
+ [
+ "Array",
+ "Integer?",
+ "Integer?"
+ ]
]
},
- "textAlign": {
+ "split": {
"overloads": [
[
- "LEFT|CENTER|RIGHT",
- "TOP|BOTTOM|BASELINE|CENTER?"
- ],
- []
+ "String",
+ "String"
+ ]
]
},
- "textLeading": {
+ "splitTokens": {
"overloads": [
[
- "Number"
- ],
- []
+ "String",
+ "String?"
+ ]
]
},
- "textSize": {
+ "trim": {
"overloads": [
[
- "Number"
+ "String"
],
+ [
+ "String[]"
+ ]
+ ]
+ },
+ "day": {
+ "overloads": [
[]
]
},
- "textStyle": {
+ "hour": {
"overloads": [
- [
- "NORMAL|ITALIC|BOLD|BOLDITALIC"
- ],
[]
]
},
- "textWidth": {
+ "minute": {
"overloads": [
- [
- "String"
- ]
+ []
]
},
- "textAscent": {
+ "millis": {
"overloads": [
[]
]
},
- "textDescent": {
+ "month": {
"overloads": [
[]
]
},
- "textWrap": {
+ "second": {
"overloads": [
- [
- "WORD|CHAR"
- ]
+ []
]
},
- "loadFont": {
+ "year": {
"overloads": [
- [
- "String",
- "Function?",
- "Function?"
- ]
+ []
]
},
- "text": {
+ "strokeMode": {
"overloads": [
[
- "String|Object|Array|Number|Boolean",
- "Number",
- "Number",
- "Number?",
- "Number?"
+ "string"
]
]
},
- "textFont": {
+ "buildGeometry": {
"overloads": [
- [],
[
- "Object|String",
- "Number?"
+ "Function"
]
]
},
- "append": {
+ "freeGeometry": {
"overloads": [
[
- "Array",
- "Any"
+ "p5.Geometry"
]
]
},
- "arrayCopy": {
+ "plane": {
"overloads": [
[
- "Array",
- "Integer",
- "Array",
- "Integer",
- "Integer"
- ],
- [
- "Array",
- "Array",
+ "Number?",
+ "Number?",
+ "Integer?",
"Integer?"
]
]
},
- "concat": {
+ "box": {
"overloads": [
[
- "Array",
- "Array"
+ "Number?",
+ "Number?",
+ "Number?",
+ "Integer?",
+ "Integer?"
]
]
},
- "reverse": {
+ "sphere": {
"overloads": [
[
- "Array"
+ "Number?",
+ "Integer?",
+ "Integer?"
]
]
},
- "shorten": {
+ "cylinder": {
"overloads": [
[
- "Array"
+ "Number?",
+ "Number?",
+ "Integer?",
+ "Integer?",
+ "Boolean?",
+ "Boolean?"
]
]
},
- "shuffle": {
+ "cone": {
"overloads": [
[
- "Array",
+ "Number?",
+ "Number?",
+ "Integer?",
+ "Integer?",
"Boolean?"
]
]
},
- "sort": {
+ "ellipsoid": {
"overloads": [
[
- "Array",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Integer?",
"Integer?"
]
]
},
- "splice": {
+ "torus": {
"overloads": [
[
- "Array",
- "Any",
- "Integer"
+ "Number?",
+ "Number?",
+ "Integer?",
+ "Integer?"
]
]
},
- "subset": {
+ "curveDetail": {
"overloads": [
[
- "Array",
- "Integer",
- "Integer?"
+ "Number"
]
]
},
- "float": {
+ "orbitControl": {
"overloads": [
[
- "String"
- ],
- [
- "String[]"
+ "Number?",
+ "Number?",
+ "Number?",
+ "Object?"
]
]
},
- "int": {
+ "debugMode": {
"overloads": [
+ [],
[
- "String|Boolean|Number"
+ "GRID|AXES"
],
[
- "Array"
+ "GRID|AXES",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
+ ],
+ [
+ "GRID|AXES",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
+ ],
+ [
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
]
]
},
- "str": {
+ "noDebugMode": {
"overloads": [
- [
- "String|Boolean|Number"
- ]
+ []
]
},
- "boolean": {
+ "ambientLight": {
"overloads": [
[
- "String|Boolean|Number"
+ "Number",
+ "Number",
+ "Number",
+ "Number?"
],
[
- "Array"
- ]
- ]
- },
- "byte": {
- "overloads": [
+ "Number",
+ "Number?"
+ ],
[
- "String|Boolean|Number"
+ "String"
],
[
- "Array"
+ "Number[]"
+ ],
+ [
+ "p5.Color"
]
]
},
- "char": {
+ "specularColor": {
"overloads": [
[
- "String|Number"
+ "Number",
+ "Number",
+ "Number"
],
[
- "Array"
- ]
- ]
- },
- "unchar": {
- "overloads": [
+ "Number"
+ ],
[
"String"
],
[
- "String[]"
+ "Number[]"
+ ],
+ [
+ "p5.Color"
]
]
},
- "hex": {
+ "directionalLight": {
"overloads": [
[
"Number",
- "Number?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
],
[
- "Number[]",
- "Number?"
+ "Number",
+ "Number",
+ "Number",
+ "p5.Vector"
+ ],
+ [
+ "p5.Color|Number[]|String",
+ "Number",
+ "Number",
+ "Number"
+ ],
+ [
+ "p5.Color|Number[]|String",
+ "p5.Vector"
]
]
},
- "unhex": {
+ "pointLight": {
"overloads": [
[
- "String"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number"
],
[
- "String[]"
+ "Number",
+ "Number",
+ "Number",
+ "p5.Vector"
+ ],
+ [
+ "p5.Color|Number[]|String",
+ "Number",
+ "Number",
+ "Number"
+ ],
+ [
+ "p5.Color|Number[]|String",
+ "p5.Vector"
]
]
},
- "join": {
+ "imageLight": {
"overloads": [
[
- "Array",
- "String"
+ "p5.image"
]
]
},
- "match": {
+ "panorama": {
"overloads": [
[
- "String",
- "String"
+ "p5.Image"
]
]
},
- "matchAll": {
+ "lights": {
"overloads": [
- [
- "String",
- "String"
- ]
+ []
]
},
- "nf": {
+ "lightFalloff": {
"overloads": [
[
- "Number|String",
- "Integer|String?",
- "Integer|String?"
- ],
- [
- "Number[]",
- "Integer|String?",
- "Integer|String?"
+ "Number",
+ "Number",
+ "Number"
]
]
},
- "nfc": {
+ "spotLight": {
"overloads": [
[
- "Number|String",
- "Integer|String?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number?",
+ "Number?"
],
[
- "Number[]",
- "Integer|String?"
- ]
- ]
- },
- "nfp": {
- "overloads": [
+ "p5.Color|Number[]|String",
+ "p5.Vector",
+ "p5.Vector",
+ "Number?",
+ "Number?"
+ ],
[
"Number",
- "Integer?",
- "Integer?"
+ "Number",
+ "Number",
+ "p5.Vector",
+ "p5.Vector",
+ "Number?",
+ "Number?"
],
[
- "Number[]",
- "Integer?",
- "Integer?"
- ]
- ]
- },
- "nfs": {
- "overloads": [
+ "p5.Color|Number[]|String",
+ "Number",
+ "Number",
+ "Number",
+ "p5.Vector",
+ "Number?",
+ "Number?"
+ ],
[
+ "p5.Color|Number[]|String",
+ "p5.Vector",
"Number",
- "Integer?",
- "Integer?"
+ "Number",
+ "Number",
+ "Number?",
+ "Number?"
],
[
- "Array",
- "Integer?",
- "Integer?"
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "p5.Vector",
+ "Number?",
+ "Number?"
+ ],
+ [
+ "Number",
+ "Number",
+ "Number",
+ "p5.Vector",
+ "Number",
+ "Number",
+ "Number",
+ "Number?",
+ "Number?"
+ ],
+ [
+ "p5.Color|Number[]|String",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number",
+ "Number?",
+ "Number?"
]
]
},
- "split": {
+ "noLights": {
"overloads": [
- [
- "String",
- "String"
- ]
+ []
]
},
- "splitTokens": {
+ "loadModel": {
"overloads": [
[
- "String",
+ "String|Request",
+ "Boolean",
+ "function(p5.Geometry)?",
+ "function(Event)?",
"String?"
- ]
- ]
- },
- "trim": {
- "overloads": [
+ ],
[
- "String"
+ "String|Request",
+ "function(p5.Geometry)?",
+ "function(Event)?",
+ "String?"
],
[
- "String[]"
+ "String|Request",
+ "Object?",
+ "function(p5.Geometry)?",
+ "function(Event)?",
+ "String?",
+ "Boolean?",
+ "Boolean?",
+ "Boolean?"
]
]
},
- "day": {
+ "parseObj": {
"overloads": [
[]
]
},
- "hour": {
+ "parseSTL": {
"overloads": [
[]
]
},
- "minute": {
+ "isBinary": {
"overloads": [
[]
]
},
- "millis": {
+ "matchDataViewAt": {
"overloads": [
[]
]
},
- "month": {
+ "parseBinarySTL": {
"overloads": [
[]
]
},
- "second": {
+ "parseASCIISTL": {
"overloads": [
[]
]
},
- "year": {
+ "model": {
"overloads": [
- []
+ [
+ "p5.Geometry"
+ ]
]
},
- "beginGeometry": {
+ "loadShader": {
"overloads": [
- []
+ [
+ "String|Request",
+ "String|Request",
+ "Function?",
+ "Function?"
+ ]
]
},
- "endGeometry": {
+ "createShader": {
"overloads": [
- []
+ [
+ "String",
+ "String",
+ "Object?"
+ ]
]
},
- "buildGeometry": {
+ "loadFilterShader": {
"overloads": [
[
- "Function"
+ "String",
+ "Function?",
+ "Function?"
]
]
},
- "freeGeometry": {
+ "createFilterShader": {
"overloads": [
[
- "p5.Geometry"
+ "String"
]
]
},
- "plane": {
+ "shader": {
"overloads": [
[
- "Number?",
- "Number?",
- "Integer?",
- "Integer?"
+ "p5.Shader"
]
]
},
- "box": {
+ "strokeShader": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?",
- "Integer?",
- "Integer?"
+ "p5.Shader"
]
]
},
- "sphere": {
+ "imageShader": {
"overloads": [
[
- "Number?",
- "Integer?",
- "Integer?"
+ "p5.Shader"
]
]
},
- "cylinder": {
+ "baseMaterialShader": {
"overloads": [
- [
- "Number?",
- "Number?",
- "Integer?",
- "Integer?",
- "Boolean?",
- "Boolean?"
- ]
+ []
]
},
- "cone": {
+ "baseNormalShader": {
"overloads": [
- [
- "Number?",
- "Number?",
- "Integer?",
- "Integer?",
- "Boolean?"
- ]
+ []
]
},
- "ellipsoid": {
+ "baseColorShader": {
"overloads": [
- [
- "Number?",
- "Number?",
- "Number?",
- "Integer?",
- "Integer?"
- ]
+ []
]
},
- "torus": {
+ "baseStrokeShader": {
+ "overloads": [
+ []
+ ]
+ },
+ "resetShader": {
+ "overloads": [
+ []
+ ]
+ },
+ "texture": {
"overloads": [
[
- "Number?",
- "Number?",
- "Integer?",
- "Integer?"
+ "p5.Image|p5.MediaElement|p5.Graphics|p5.Texture|p5.Framebuffer|p5.FramebufferTexture"
]
]
},
- "orbitControl": {
+ "textureMode": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?",
- "Object?"
+ "IMAGE|NORMAL"
]
]
},
- "debugMode": {
+ "textureWrap": {
"overloads": [
- [],
- [
- "GRID|AXES"
- ],
- [
- "GRID|AXES",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
- ],
- [
- "GRID|AXES",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
- ],
[
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "CLAMP|REPEAT|MIRROR",
+ "CLAMP|REPEAT|MIRROR?"
]
]
},
- "noDebugMode": {
+ "normalMaterial": {
"overloads": [
[]
]
},
- "ambientLight": {
+ "ambientMaterial": {
"overloads": [
[
"Number",
"Number",
- "Number",
- "Number?"
- ],
- [
- "Number",
- "Number?"
- ],
- [
- "String"
+ "Number"
],
[
- "Number[]"
+ "Number"
],
[
- "p5.Color"
+ "p5.Color|Number[]|String"
]
]
},
- "specularColor": {
+ "emissiveMaterial": {
"overloads": [
[
"Number",
"Number",
- "Number"
+ "Number",
+ "Number?"
],
[
"Number"
],
[
- "String"
- ],
- [
- "Number[]"
- ],
- [
- "p5.Color"
+ "p5.Color|Number[]|String"
]
]
},
- "directionalLight": {
+ "specularMaterial": {
"overloads": [
[
"Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number"
+ "Number?"
],
[
"Number",
"Number",
"Number",
- "p5.Vector"
- ],
- [
- "p5.Color|Number[]|String",
- "Number",
- "Number",
- "Number"
+ "Number?"
],
[
- "p5.Color|Number[]|String",
- "p5.Vector"
+ "p5.Color|Number[]|String"
]
]
},
- "pointLight": {
+ "shininess": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
"Number"
- ],
- [
- "Number",
- "Number",
- "Number",
- "p5.Vector"
- ],
+ ]
+ ]
+ },
+ "metalness": {
+ "overloads": [
[
- "p5.Color|Number[]|String",
- "Number",
- "Number",
"Number"
- ],
- [
- "p5.Color|Number[]|String",
- "p5.Vector"
]
]
},
- "imageLight": {
+ "camera": {
"overloads": [
[
- "p5.image"
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
]
]
},
- "panorama": {
+ "perspective": {
"overloads": [
[
- "p5.Image"
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
]
]
},
- "lights": {
+ "linePerspective": {
"overloads": [
+ [
+ "Boolean"
+ ],
[]
]
},
- "lightFalloff": {
+ "ortho": {
"overloads": [
[
- "Number",
- "Number",
- "Number"
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
]
]
},
- "spotLight": {
+ "frustum": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
"Number?",
- "Number?"
- ],
- [
- "p5.Color|Number[]|String",
- "p5.Vector",
- "p5.Vector",
"Number?",
- "Number?"
- ],
- [
- "Number",
- "Number",
- "Number",
- "p5.Vector",
- "p5.Vector",
"Number?",
- "Number?"
- ],
- [
- "p5.Color|Number[]|String",
- "Number",
- "Number",
- "Number",
- "p5.Vector",
"Number?",
- "Number?"
- ],
- [
- "p5.Color|Number[]|String",
- "p5.Vector",
- "Number",
- "Number",
- "Number",
"Number?",
"Number?"
- ],
+ ]
+ ]
+ },
+ "createCamera": {
+ "overloads": [
+ []
+ ]
+ },
+ "setCamera": {
+ "overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "p5.Vector",
- "Number?",
- "Number?"
- ],
- [
- "Number",
- "Number",
- "Number",
- "p5.Vector",
- "Number",
- "Number",
- "Number",
- "Number?",
- "Number?"
- ],
- [
- "p5.Color|Number[]|String",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number",
- "Number?",
- "Number?"
+ "p5.Camera"
]
]
},
- "noLights": {
+ "saveObj": {
"overloads": [
- []
+ [
+ "String?"
+ ]
]
},
- "loadModel": {
+ "saveStl": {
"overloads": [
[
- "String",
- "Boolean",
- "Function?",
- "Function?",
- "String?"
- ],
+ "String?",
+ "Object?"
+ ]
+ ]
+ },
+ "setAttributes": {
+ "overloads": [
[
"String",
- "Function?",
- "Function?",
- "String?"
+ "Boolean"
],
[
- "String",
- "Object?",
- "Function?",
- "Function?",
- "String?",
- "Boolean?",
- "Boolean?",
- "Boolean?"
+ "Object"
]
]
},
- "parseObj": {
+ "update": {
"overloads": [
[]
]
},
- "parseSTL": {
+ "bindTexture": {
"overloads": [
[]
]
},
- "isBinary": {
+ "unbindTexture": {
"overloads": [
[]
]
},
- "matchDataViewAt": {
+ "setInterpolation": {
"overloads": [
- []
+ [
+ "String",
+ "String"
+ ]
]
},
- "parseBinarySTL": {
+ "setWrapMode": {
"overloads": [
- []
+ [
+ "String",
+ "String"
+ ]
]
},
- "parseASCIISTL": {
+ "remove": {
"overloads": [
[]
]
},
- "model": {
+ "loadFont": {
"overloads": [
[
- "p5.Geometry"
+ null
]
]
+ }
+ },
+ "p5.Element": {
+ "remove": {
+ "overloads": [
+ []
+ ]
},
- "loadShader": {
+ "child": {
"overloads": [
+ [],
[
- "String",
- "String",
- "Function?",
- "Function?"
+ "String|p5.Element?"
]
]
},
- "createShader": {
+ "html": {
"overloads": [
+ [],
[
- "String",
- "String"
+ "String?",
+ "Boolean?"
]
]
},
- "createFilterShader": {
+ "addClass": {
"overloads": [
[
"String"
]
]
},
- "shader": {
+ "removeClass": {
"overloads": [
[
- "p5.Shader"
+ "String"
]
]
},
- "resetShader": {
+ "hasClass": {
"overloads": [
- []
+ [
+ null
+ ]
]
},
- "texture": {
+ "toggleClass": {
"overloads": [
[
- "p5.Image|p5.MediaElement|p5.Graphics|p5.Texture|p5.Framebuffer|p5.FramebufferTexture"
+ null
]
]
},
- "textureMode": {
+ "center": {
"overloads": [
[
- "IMAGE|NORMAL"
+ "String?"
]
]
},
- "textureWrap": {
+ "position": {
"overloads": [
+ [],
[
- "CLAMP|REPEAT|MIRROR",
- "CLAMP|REPEAT|MIRROR?"
+ "Number?",
+ "Number?",
+ "String?"
]
]
},
- "normalMaterial": {
+ "show": {
"overloads": [
[]
]
},
- "ambientMaterial": {
+ "hide": {
"overloads": [
+ []
+ ]
+ },
+ "size": {
+ "overloads": [
+ [],
[
- "Number",
- "Number",
- "Number"
- ],
- [
- "Number"
- ],
- [
- "p5.Color|Number[]|String"
+ "Number|AUTO?",
+ "Number|AUTO?"
]
]
},
- "emissiveMaterial": {
+ "style": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number?"
- ],
- [
- "Number"
+ "String"
],
[
- "p5.Color|Number[]|String"
+ "String",
+ "String|p5.Color"
]
]
},
- "specularMaterial": {
+ "attribute": {
"overloads": [
+ [],
[
- "Number",
- "Number?"
- ],
- [
- "Number",
- "Number",
- "Number",
- "Number?"
- ],
- [
- "p5.Color|Number[]|String"
+ "String",
+ "String"
]
]
},
- "shininess": {
+ "removeAttribute": {
"overloads": [
[
- "Number"
+ "String"
]
]
},
- "metalness": {
+ "value": {
"overloads": [
+ [],
[
- "Number"
+ "String|Number"
]
]
},
- "camera": {
+ "changed": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "Function|Boolean"
]
]
},
- "perspective": {
+ "input": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "Function|Boolean"
]
]
},
- "linePerspective": {
+ "drop": {
"overloads": [
[
- "Boolean"
- ],
- []
+ "Function",
+ "Function?"
+ ]
]
},
- "ortho": {
+ "draggable": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "p5.Element?"
]
]
},
- "frustum": {
+ "volume": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "Number"
]
]
},
- "createCamera": {
+ "createMedia": {
"overloads": [
[]
]
},
- "setCamera": {
+ "createVideo": {
"overloads": [
[
- "p5.Camera"
+ "String|String[]",
+ "Function?"
]
]
},
- "saveObj": {
+ "createAudio": {
"overloads": [
[
- "String?"
+ "String|String[]?",
+ "Function?"
]
]
},
- "saveStl": {
+ "createCapture": {
"overloads": [
[
- "String?",
- "Object?"
- ]
- ]
- },
- "setAttributes": {
- "overloads": [
- [
- "String",
- "Boolean"
- ],
- [
- "Object"
- ]
- ]
- },
- "update": {
- "overloads": [
- []
- ]
- },
- "bindTexture": {
- "overloads": [
- []
- ]
- },
- "unbindTexture": {
- "overloads": [
- []
- ]
- },
- "setInterpolation": {
- "overloads": [
- [
- "String",
- "String"
- ]
- ]
- },
- "setWrapMode": {
- "overloads": [
- [
- "String",
- "String"
- ]
- ]
- }
- },
- "p5.Element": {
- "addClass": {
- "overloads": [
- [
- "String"
- ]
- ]
- },
- "html": {
- "overloads": [
- [],
- [
- "String?",
- "Boolean?"
+ "AUDIO|VIDEO|Object?",
+ "Object?",
+ "Function?"
]
]
},
@@ -3464,32 +3398,6 @@
]
}
},
- "p5.Graphics": {
- "reset": {
- "overloads": [
- []
- ]
- },
- "remove": {
- "overloads": [
- []
- ]
- },
- "createFramebuffer": {
- "overloads": [
- [
- "Object?"
- ]
- ]
- }
- },
- "p5.Renderer": {
- "resize": {
- "overloads": [
- []
- ]
- }
- },
"p5.TypedDict": {
"size": {
"overloads": [
@@ -3611,896 +3519,1149 @@
]
}
},
- "p5.MediaElement": {
- "play": {
+ "p5.Table": {
+ "addRow": {
"overloads": [
- []
+ [
+ "p5.TableRow?"
+ ]
]
},
- "stop": {
+ "removeRow": {
"overloads": [
- []
+ [
+ "Integer"
+ ]
]
},
- "pause": {
+ "getRow": {
"overloads": [
- []
+ [
+ "Integer"
+ ]
]
},
- "loop": {
+ "getRows": {
"overloads": [
[]
]
},
- "noLoop": {
+ "findRow": {
"overloads": [
- []
+ [
+ "String",
+ "Integer|String"
+ ]
]
},
- "autoplay": {
+ "findRows": {
"overloads": [
[
- "Boolean?"
+ "String",
+ "Integer|String"
]
]
},
- "volume": {
+ "matchRow": {
"overloads": [
- []
+ [
+ "String|RegExp",
+ "String|Integer"
+ ]
]
},
- "speed": {
+ "matchRows": {
"overloads": [
- [],
[
- "Number"
+ "String",
+ "String|Integer?"
]
]
},
- "time": {
+ "getColumn": {
"overloads": [
- [],
[
- "Number"
+ "String|Number"
]
]
},
- "duration": {
+ "clearRows": {
"overloads": [
[]
]
},
- "onended": {
- "overloads": [
- [
- "Function"
- ]
- ]
- },
- "connect": {
+ "addColumn": {
"overloads": [
[
- "AudioNode|Object"
+ "String?"
]
]
},
- "disconnect": {
- "overloads": [
- []
- ]
- },
- "showControls": {
+ "getColumnCount": {
"overloads": [
[]
]
},
- "hideControls": {
+ "getRowCount": {
"overloads": [
[]
]
},
- "addCue": {
+ "removeTokens": {
"overloads": [
[
- "Number",
- "Function",
- "Object?"
+ "String",
+ "String|Integer?"
]
]
},
- "removeCue": {
+ "trim": {
"overloads": [
[
- "Number"
+ "String|Integer?"
]
]
},
- "clearCues": {
- "overloads": [
- []
- ]
- }
- },
- "p5.Image": {
- "pixelDensity": {
+ "removeColumn": {
"overloads": [
[
- "Number?"
+ "String|Integer"
]
]
},
- "loadPixels": {
- "overloads": [
- []
- ]
- },
- "updatePixels": {
+ "set": {
"overloads": [
[
"Integer",
- "Integer",
- "Integer",
- "Integer"
- ],
- []
+ "String|Integer",
+ "String|Number"
+ ]
]
},
- "get": {
+ "setNum": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number"
- ],
- [],
- [
- "Number",
+ "Integer",
+ "String|Integer",
"Number"
]
]
},
- "set": {
+ "setString": {
"overloads": [
[
- "Number",
- "Number",
- "Number|Number[]|Object"
+ "Integer",
+ "String|Integer",
+ "String"
]
]
},
- "resize": {
+ "get": {
"overloads": [
[
- "Number",
- "Number"
+ "Integer",
+ "String|Integer"
]
]
},
- "copy": {
+ "getNum": {
"overloads": [
[
- "p5.Image|p5.Element",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer"
- ],
- [
- "Integer",
"Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer"
+ "String|Integer"
]
]
},
- "mask": {
+ "getString": {
"overloads": [
[
- "p5.Image"
+ "Integer",
+ "String|Integer"
]
]
},
- "filter": {
+ "getObject": {
"overloads": [
[
- "THRESHOLD|GRAY|OPAQUE|INVERT|POSTERIZE|ERODE|DILATE|BLUR",
- "Number?"
+ "String?"
]
]
},
- "blend": {
+ "getArray": {
+ "overloads": [
+ []
+ ]
+ }
+ },
+ "p5.Graphics": {
+ "reset": {
+ "overloads": [
+ []
+ ]
+ },
+ "remove": {
+ "overloads": [
+ []
+ ]
+ },
+ "createFramebuffer": {
"overloads": [
[
- "p5.Image",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL"
- ],
+ "Object?"
+ ]
+ ]
+ }
+ },
+ "p5.Renderer": {
+ "resize": {
+ "overloads": [
+ []
+ ]
+ },
+ "textBounds": {
+ "overloads": [
[
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "Integer",
- "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL"
+ "string",
+ "number",
+ "number",
+ "number",
+ "number"
]
]
},
- "save": {
+ "fontBounds": {
"overloads": [
[
- "String",
- "String?"
+ "string",
+ "number",
+ "number",
+ "number",
+ "number"
]
]
},
- "reset": {
+ "textWidth": {
"overloads": [
- []
+ [
+ "string"
+ ]
]
},
- "getCurrentFrame": {
+ "fontWidth": {
"overloads": [
- []
+ [
+ "string"
+ ]
]
},
- "setFrame": {
+ "textAscent": {
"overloads": [
[
- "Number"
+ null
]
]
},
- "numFrames": {
+ "fontAscent": {
"overloads": [
[]
]
},
- "play": {
+ "textDescent": {
"overloads": [
- []
+ [
+ null
+ ]
]
},
- "pause": {
+ "fontDescent": {
"overloads": [
[]
]
},
- "delay": {
+ "textFont": {
"overloads": [
[
- "Number",
- "Number?"
+ "p5.Font|string",
+ "number",
+ "object"
+ ]
+ ]
+ },
+ "textSize": {
+ "overloads": [
+ [
+ null
]
]
+ },
+ "textProperty": {
+ "overloads": [
+ []
+ ]
+ },
+ "textProperties": {
+ "overloads": [
+ []
+ ]
}
},
- "p5.XML": {
- "getParent": {
+ "p5.MediaElement": {
+ "play": {
"overloads": [
[]
]
},
- "getName": {
+ "stop": {
"overloads": [
[]
]
},
- "setName": {
+ "pause": {
"overloads": [
- [
- "String"
- ]
+ []
]
},
- "hasChildren": {
+ "loop": {
"overloads": [
[]
]
},
- "listChildren": {
+ "noLoop": {
"overloads": [
[]
]
},
- "getChildren": {
+ "autoplay": {
"overloads": [
[
- "String?"
+ "Boolean?"
]
]
},
- "getChild": {
+ "volume": {
"overloads": [
- [
- "String|Integer"
- ]
+ []
]
},
- "addChild": {
+ "speed": {
"overloads": [
+ [],
[
- "p5.XML"
+ "Number"
]
]
},
- "removeChild": {
+ "time": {
"overloads": [
+ [],
[
- "String|Integer"
+ "Number"
]
]
},
- "getAttributeCount": {
+ "duration": {
"overloads": [
[]
]
},
- "listAttributes": {
+ "onended": {
"overloads": [
- []
+ [
+ "Function"
+ ]
]
},
- "hasAttribute": {
+ "connect": {
"overloads": [
[
- "String"
+ "AudioNode|Object"
]
]
},
- "getNum": {
+ "disconnect": {
"overloads": [
- [
- "String",
- "Number?"
- ]
+ []
]
},
- "getString": {
+ "showControls": {
"overloads": [
- [
- "String",
- "Number?"
- ]
+ []
]
},
- "setAttribute": {
+ "hideControls": {
+ "overloads": [
+ []
+ ]
+ },
+ "addCue": {
"overloads": [
[
- "String",
- "Number|String|Boolean"
+ "Number",
+ "Function",
+ "Object?"
]
]
},
- "getContent": {
+ "removeCue": {
"overloads": [
[
- "String?"
+ "Number"
]
]
},
- "serialize": {
+ "clearCues": {
"overloads": [
[]
]
}
},
- "p5.Vector": {
- "toString": {
- "overloads": [
- []
- ]
- },
- "set": {
+ "p5.Image": {
+ "pixelDensity": {
"overloads": [
[
- "Number?",
- "Number?",
"Number?"
- ],
- [
- "p5.Vector|Number[]"
]
]
},
- "copy": {
+ "loadPixels": {
"overloads": [
- [],
- [
- "p5.Vector"
- ]
+ []
]
},
- "add": {
+ "updatePixels": {
"overloads": [
[
- "Number",
- "Number?",
- "Number?"
- ],
- [
- "p5.Vector|Number[]"
- ],
- [
- "p5.Vector",
- "p5.Vector",
- "p5.Vector?"
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer"
]
]
},
- "rem": {
+ "get": {
"overloads": [
[
+ "Number",
"Number",
"Number",
"Number"
],
+ [],
[
- "p5.Vector|Number[]"
- ],
- [
- "p5.Vector",
- "p5.Vector"
- ],
- [
- "p5.Vector",
- "p5.Vector"
+ "Number",
+ "Number"
]
]
},
- "sub": {
+ "set": {
"overloads": [
[
"Number",
- "Number?",
- "Number?"
- ],
- [
- "p5.Vector|Number[]"
- ],
- [
- "p5.Vector",
- "p5.Vector",
- "p5.Vector?"
+ "Number",
+ "Number|Number[]|Object"
]
]
},
- "mult": {
+ "resize": {
"overloads": [
[
+ "Number",
"Number"
- ],
+ ]
+ ]
+ },
+ "copy": {
+ "overloads": [
[
- "Number",
- "Number",
- "Number?"
- ],
- [
- "Number[]"
- ],
- [
- "p5.Vector"
- ],
- [],
- [
- "Number",
- "Number",
- "Number?"
- ],
- [
- "p5.Vector",
- "Number",
- "p5.Vector?"
- ],
- [
- "p5.Vector",
- "p5.Vector",
- "p5.Vector?"
+ "p5.Image|p5.Element",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer"
],
[
- "p5.Vector",
- "Number[]",
- "p5.Vector?"
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer"
]
]
},
- "div": {
+ "mask": {
"overloads": [
[
- "Number"
- ],
- [
- "Number",
- "Number",
- "Number?"
- ],
- [
- "Number[]"
- ],
- [
- "p5.Vector"
- ],
- [],
+ "p5.Image"
+ ]
+ ]
+ },
+ "filter": {
+ "overloads": [
[
- "Number",
- "Number",
+ "THRESHOLD|GRAY|OPAQUE|INVERT|POSTERIZE|ERODE|DILATE|BLUR",
"Number?"
- ],
- [
- "p5.Vector",
- "Number",
- "p5.Vector?"
- ],
+ ]
+ ]
+ },
+ "blend": {
+ "overloads": [
[
- "p5.Vector",
- "p5.Vector",
- "p5.Vector?"
+ "p5.Image",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL"
],
[
- "p5.Vector",
- "Number[]",
- "p5.Vector?"
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "Integer",
+ "BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL"
]
]
},
- "mag": {
+ "save": {
"overloads": [
- [],
- [],
[
- "p5.Vector"
+ "String",
+ "String?"
]
]
},
- "magSq": {
+ "reset": {
+ "overloads": [
+ []
+ ]
+ },
+ "getCurrentFrame": {
+ "overloads": [
+ []
+ ]
+ },
+ "setFrame": {
"overloads": [
- [],
- [],
[
- "p5.Vector"
+ "Number"
]
]
},
- "dot": {
+ "numFrames": {
+ "overloads": [
+ []
+ ]
+ },
+ "play": {
+ "overloads": [
+ []
+ ]
+ },
+ "pause": {
+ "overloads": [
+ []
+ ]
+ },
+ "delay": {
"overloads": [
[
"Number",
- "Number?",
"Number?"
- ],
- [
- "p5.Vector"
- ],
- [],
- [
- "p5.Vector",
- "p5.Vector"
]
]
+ }
+ },
+ "p5.XML": {
+ "getParent": {
+ "overloads": [
+ []
+ ]
},
- "cross": {
+ "getName": {
"overloads": [
- [
- "p5.Vector"
- ],
- [],
- [
- "p5.Vector",
- "p5.Vector"
- ]
+ []
]
},
- "dist": {
+ "setName": {
"overloads": [
[
- "p5.Vector"
- ],
- [],
- [
- "p5.Vector",
- "p5.Vector"
+ "String"
]
]
},
- "normalize": {
+ "hasChildren": {
"overloads": [
- [],
- [],
- [
- "p5.Vector",
- "p5.Vector?"
- ]
+ []
]
},
- "limit": {
+ "listChildren": {
+ "overloads": [
+ []
+ ]
+ },
+ "getChildren": {
"overloads": [
[
- "Number"
- ],
- [],
- [
- "p5.Vector",
- "Number",
- "p5.Vector?"
+ "String?"
]
]
},
- "setMag": {
+ "getChild": {
"overloads": [
[
- "Number"
- ],
- [],
- [
- "p5.Vector",
- "Number",
- "p5.Vector?"
+ "String|Integer"
]
]
},
- "heading": {
+ "addChild": {
"overloads": [
- [],
- [],
[
- "p5.Vector"
+ "p5.XML"
]
]
},
- "setHeading": {
+ "removeChild": {
"overloads": [
[
- "Number"
+ "String|Integer"
]
]
},
- "rotate": {
+ "getAttributeCount": {
+ "overloads": [
+ []
+ ]
+ },
+ "listAttributes": {
+ "overloads": [
+ []
+ ]
+ },
+ "hasAttribute": {
"overloads": [
[
- "Number"
- ],
- [],
- [
- "p5.Vector",
- "Number",
- "p5.Vector?"
+ "String"
]
]
},
- "angleBetween": {
+ "getNum": {
"overloads": [
[
- "p5.Vector"
- ],
- [],
- [
- "p5.Vector",
- "p5.Vector"
+ "String",
+ "Number?"
]
]
},
- "lerp": {
+ "getString": {
"overloads": [
[
- "Number",
- "Number",
- "Number",
- "Number"
- ],
+ "String",
+ "Number?"
+ ]
+ ]
+ },
+ "setAttribute": {
+ "overloads": [
[
- "p5.Vector",
- "Number"
- ],
- [],
+ "String",
+ "Number|String|Boolean"
+ ]
+ ]
+ },
+ "getContent": {
+ "overloads": [
[
- "p5.Vector",
- "p5.Vector",
- "Number",
- "p5.Vector?"
+ "String?"
]
]
},
- "slerp": {
+ "serialize": {
+ "overloads": [
+ []
+ ]
+ }
+ },
+ "p5.Vector": {
+ "getValue": {
"overloads": [
[
- "p5.Vector",
- "Number"
- ],
- [],
+ "number"
+ ]
+ ]
+ },
+ "setValue": {
+ "overloads": [
[
- "p5.Vector",
- "p5.Vector",
- "Number",
- "p5.Vector?"
+ "number",
+ "number"
]
]
},
- "reflect": {
+ "set": {
"overloads": [
[
- "p5.Vector"
+ "Number?",
+ "Number?",
+ "Number?"
],
- [],
[
- "p5.Vector",
- "p5.Vector",
- "p5.Vector?"
+ "p5.Vector|Number[]"
]
]
},
- "array": {
+ "copy": {
"overloads": [
- [],
[],
[
"p5.Vector"
]
]
},
- "equals": {
+ "add": {
"overloads": [
[
- "Number?",
+ "Number",
"Number?",
"Number?"
],
[
- "p5.Vector|Array"
+ "p5.Vector|Number[]"
],
- [],
[
- "p5.Vector|Array",
- "p5.Vector|Array"
+ "p5.Vector",
+ "p5.Vector",
+ "p5.Vector?"
]
]
},
- "fromAngle": {
+ "rem": {
"overloads": [
[
"Number",
- "Number?"
+ "Number",
+ "Number"
+ ],
+ [
+ "p5.Vector|Number[]"
+ ],
+ [
+ "p5.Vector",
+ "p5.Vector"
]
]
},
- "fromAngles": {
+ "sub": {
"overloads": [
[
"Number",
- "Number",
+ "Number?",
"Number?"
+ ],
+ [
+ "p5.Vector|Number[]"
+ ],
+ [
+ "p5.Vector",
+ "p5.Vector",
+ "p5.Vector?"
]
]
},
- "random2D": {
- "overloads": [
- []
- ]
- },
- "random3D": {
- "overloads": [
- []
- ]
- }
- },
- "p5.Font": {
- "textBounds": {
+ "mult": {
"overloads": [
[
- "String",
+ "Number"
+ ],
+ [
"Number",
"Number",
"Number?"
+ ],
+ [
+ "Number[]"
+ ],
+ [
+ "p5.Vector"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "Number",
+ "p5.Vector?"
+ ],
+ [
+ "p5.Vector",
+ "p5.Vector",
+ "p5.Vector?"
+ ],
+ [
+ "p5.Vector",
+ "Number[]",
+ "p5.Vector?"
]
]
},
- "textToPoints": {
+ "div": {
"overloads": [
[
- "String",
+ "Number"
+ ],
+ [
"Number",
"Number",
- "Number?",
- "Object?"
+ "Number?"
+ ],
+ [
+ "Number[]"
+ ],
+ [
+ "p5.Vector"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "Number",
+ "p5.Vector?"
+ ],
+ [
+ "p5.Vector",
+ "p5.Vector",
+ "p5.Vector?"
+ ],
+ [
+ "p5.Vector",
+ "Number[]",
+ "p5.Vector?"
]
]
- }
- },
- "p5.Camera": {
- "perspective": {
+ },
+ "mag": {
"overloads": [
+ [],
[
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "p5.Vector"
]
]
},
- "ortho": {
+ "magSq": {
"overloads": [
+ [],
[
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "p5.Vector"
]
]
},
- "frustum": {
+ "dot": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?",
- "Number?",
+ "Number",
"Number?",
"Number?"
+ ],
+ [
+ "p5.Vector"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "p5.Vector"
]
]
},
- "pan": {
+ "cross": {
"overloads": [
[
- "Number"
+ "p5.Vector"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "p5.Vector"
]
]
},
- "tilt": {
+ "dist": {
"overloads": [
[
- "Number"
+ "p5.Vector"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "p5.Vector"
]
]
},
- "lookAt": {
+ "normalize": {
"overloads": [
+ [],
[
- "Number",
- "Number",
- "Number"
+ "p5.Vector",
+ "p5.Vector?"
]
]
},
- "camera": {
+ "limit": {
"overloads": [
[
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?",
- "Number?"
+ "Number"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "Number",
+ "p5.Vector?"
]
]
},
- "move": {
+ "setMag": {
"overloads": [
[
- "Number",
- "Number",
+ "Number"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "Number",
+ "p5.Vector?"
+ ]
+ ]
+ },
+ "heading": {
+ "overloads": [
+ [],
+ [
+ "p5.Vector"
+ ]
+ ]
+ },
+ "setHeading": {
+ "overloads": [
+ [
+ "Number"
+ ]
+ ]
+ },
+ "rotate": {
+ "overloads": [
+ [
+ "Number"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "Number",
+ "p5.Vector?"
+ ]
+ ]
+ },
+ "angleBetween": {
+ "overloads": [
+ [
+ "p5.Vector"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "p5.Vector"
+ ]
+ ]
+ },
+ "lerp": {
+ "overloads": [
+ [
+ "Number",
+ "Number",
+ "Number",
+ "Number"
+ ],
+ [
+ "p5.Vector",
+ "Number"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "p5.Vector",
+ "Number",
+ "p5.Vector?"
+ ]
+ ]
+ },
+ "slerp": {
+ "overloads": [
+ [
+ "p5.Vector",
+ "Number"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "p5.Vector",
+ "Number",
+ "p5.Vector?"
+ ]
+ ]
+ },
+ "reflect": {
+ "overloads": [
+ [
+ "p5.Vector"
+ ],
+ [],
+ [
+ "p5.Vector",
+ "p5.Vector",
+ "p5.Vector?"
+ ]
+ ]
+ },
+ "array": {
+ "overloads": [
+ [],
+ [
+ "p5.Vector"
+ ]
+ ]
+ },
+ "equals": {
+ "overloads": [
+ [
+ "Number?",
+ "Number?",
+ "Number?"
+ ],
+ [
+ "p5.Vector|Array"
+ ],
+ [],
+ [
+ "p5.Vector|Array",
+ "p5.Vector|Array"
+ ]
+ ]
+ },
+ "fromAngle": {
+ "overloads": [
+ [
+ "Number",
+ "Number?"
+ ]
+ ]
+ },
+ "fromAngles": {
+ "overloads": [
+ [
+ "Number",
+ "Number",
+ "Number?"
+ ]
+ ]
+ },
+ "random2D": {
+ "overloads": [
+ []
+ ]
+ },
+ "random3D": {
+ "overloads": [
+ []
+ ]
+ }
+ },
+ "p5.Camera": {
+ "perspective": {
+ "overloads": [
+ [
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
+ ]
+ ]
+ },
+ "ortho": {
+ "overloads": [
+ [
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
+ ]
+ ]
+ },
+ "frustum": {
+ "overloads": [
+ [
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
+ ]
+ ]
+ },
+ "pan": {
+ "overloads": [
+ [
+ "Number"
+ ]
+ ]
+ },
+ "tilt": {
+ "overloads": [
+ [
+ "Number"
+ ]
+ ]
+ },
+ "lookAt": {
+ "overloads": [
+ [
+ "Number",
+ "Number",
+ "Number"
+ ]
+ ]
+ },
+ "camera": {
+ "overloads": [
+ [
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?",
+ "Number?"
+ ]
+ ]
+ },
+ "move": {
+ "overloads": [
+ [
+ "Number",
+ "Number",
"Number"
]
]
@@ -4638,6 +4799,23 @@
}
},
"p5.Shader": {
+ "version": {
+ "overloads": [
+ []
+ ]
+ },
+ "inspectHooks": {
+ "overloads": [
+ []
+ ]
+ },
+ "modify": {
+ "overloads": [
+ [
+ "Object?"
+ ]
+ ]
+ },
"copyToContext": {
"overloads": [
[
@@ -4653,1167 +4831,5 @@
]
]
}
- },
- "p5.Table": {
- "addRow": {
- "overloads": [
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ],
- [
- "p5.TableRow?"
- ]
- ]
- },
- "removeRow": {
- "overloads": [
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ]
- ]
- },
- "getRow": {
- "overloads": [
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ],
- [
- "Integer"
- ]
- ]
- },
- "getRows": {
- "overloads": [
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- []
- ]
- },
- "findRow": {
- "overloads": [
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ]
- ]
- },
- "findRows": {
- "overloads": [
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ],
- [
- "String",
- "Integer|String"
- ]
- ]
- },
- "matchRow": {
- "overloads": [
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ],
- [
- "String|RegExp",
- "String|Integer"
- ]
- ]
- },
- "matchRows": {
- "overloads": [
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ]
- ]
- },
- "getColumn": {
- "overloads": [
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ],
- [
- "String|Number"
- ]
- ]
- },
- "clearRows": {
- "overloads": [
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- []
- ]
- },
- "addColumn": {
- "overloads": [
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ]
- ]
- },
- "getColumnCount": {
- "overloads": [
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- []
- ]
- },
- "getRowCount": {
- "overloads": [
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- []
- ]
- },
- "removeTokens": {
- "overloads": [
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ],
- [
- "String",
- "String|Integer?"
- ]
- ]
- },
- "trim": {
- "overloads": [
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ],
- [
- "String|Integer?"
- ]
- ]
- },
- "removeColumn": {
- "overloads": [
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ],
- [
- "String|Integer"
- ]
- ]
- },
- "set": {
- "overloads": [
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ],
- [
- "Integer",
- "String|Integer",
- "String|Number"
- ]
- ]
- },
- "setNum": {
- "overloads": [
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ],
- [
- "Integer",
- "String|Integer",
- "Number"
- ]
- ]
- },
- "setString": {
- "overloads": [
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ],
- [
- "Integer",
- "String|Integer",
- "String"
- ]
- ]
- },
- "get": {
- "overloads": [
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ]
- ]
- },
- "getNum": {
- "overloads": [
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ]
- ]
- },
- "getString": {
- "overloads": [
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ],
- [
- "Integer",
- "String|Integer"
- ]
- ]
- },
- "getObject": {
- "overloads": [
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ],
- [
- "String?"
- ]
- ]
- },
- "getArray": {
- "overloads": [
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- [],
- []
- ]
- }
}
}
\ No newline at end of file
diff --git a/src/color/creating_reading.js b/src/color/creating_reading.js
index 9396c0f0a9..f848ba3a25 100644
--- a/src/color/creating_reading.js
+++ b/src/color/creating_reading.js
@@ -1527,6 +1527,61 @@ function creatingReading(p5, fn){
// p5._validateParameters('lerpColor', arguments);
return c1.lerp(c2, amt, this._renderer.states.colorMode);
};
+
+ /**
+ * Blends multiple colors to find a color between them.
+ *
+ * The `amt` parameter specifies the amount to interpolate between the color
+ * stops which are colors at each `amt` value "location" with `amt` values
+ * that are between 2 color stops interpolating between them based on its relative
+ * distance to both.
+ *
+ * The way that colors are interpolated depends on the current
+ * colorMode().
+ *
+ * @method paletteLerp
+ * @param {[p5.Color|String|Number|Number[], Number][]} colors_stops color stops to interpolate from
+ * @param {Number} amt number to use to interpolate relative to color stops
+ * @return {p5.Color} interpolated color.
+ *
+ * @example
+ *
+ *
+ * function setup() {
+ * createCanvas(400, 400);
+ * }
+ *
+ * function draw() {
+ * // The background goes from white to red to green to blue fill
+ * background(paletteLerp([
+ * ['white', 0],
+ * ['red', 0.05],
+ * ['green', 0.25],
+ * ['blue', 1]
+ * ], millis() / 10000 % 1));
+ * }
+ *
+ *
+ */
+ fn.paletteLerp = function(color_stops, amt) {
+ const first_color_stop = color_stops[0];
+ if (amt < first_color_stop[1])
+ return this.color(first_color_stop[0]);
+
+ for (let i = 1; i < color_stops.length; i++) {
+ const color_stop = color_stops[i];
+ if (amt < color_stop[1]) {
+ const prev_color_stop = color_stops[i - 1];
+ return this.lerpColor(
+ this.color(prev_color_stop[0]),
+ this.color(color_stop[0]),
+ (amt - prev_color_stop[1]) / (color_stop[1] - prev_color_stop[1])
+ );
+ }
+ }
+
+ return this.color(color_stops[color_stops.length - 1][0]);
+ };
}
export default creatingReading;
diff --git a/src/core/constants.js b/src/core/constants.js
index 36d1533c27..f5f8e89eab 100644
--- a/src/core/constants.js
+++ b/src/core/constants.js
@@ -1359,7 +1359,7 @@ export const FLOAT = 'float';
export const HALF_FLOAT = 'half-float';
/**
- * The `splineEnds` mode where splines curve through
+ * The `splineProperty('ends')` mode where splines curve through
* their first and last points.
* @typedef {unique symbol} INCLUDE
* @property {INCLUDE} INCLUDE
@@ -1368,7 +1368,7 @@ export const HALF_FLOAT = 'half-float';
export const INCLUDE = Symbol('include');
/**
- * The `splineEnds` mode where the first and last points in a spline
+ * The `splineProperty('ends')` mode where the first and last points in a spline
* affect the direction of the curve, but are not rendered.
* @typedef {unique symbol} EXCLUDE
* @property {EXCLUDE} EXCLUDE
@@ -1377,7 +1377,7 @@ export const INCLUDE = Symbol('include');
export const EXCLUDE = Symbol('exclude');
/**
- * The `splineEnds` mode where the spline loops back to its first point.
+ * The `splineProperty('ends')` mode where the spline loops back to its first point.
* Only used internally.
* @typedef {unique symbol} JOIN
* @property {JOIN} JOIN
diff --git a/src/core/friendly_errors/param_validator.js b/src/core/friendly_errors/param_validator.js
index 973f950cd0..7768c90f85 100644
--- a/src/core/friendly_errors/param_validator.js
+++ b/src/core/friendly_errors/param_validator.js
@@ -19,10 +19,13 @@ function validateParams(p5, fn, lifecycles) {
// const p5Constructors = {};
// NOTE: This is a tempt fix for unit test but is not correct
// Attaced constructors are `undefined`
- const p5Constructors = Object.keys(dataDoc).reduce((acc, val) => {
- if (val !== 'p5') {
- const className = val.substring(3);
- acc[className] = p5[className];
+ const p5Constructors = Object.keys(p5).reduce((acc, val) => {
+ if (
+ val.match(/^[A-Z]/) && // Starts with a capital
+ !val.match(/^[A-Z][A-Z0-9]*$/) && // Is not an all caps constant
+ p5[val] instanceof Function // Is a function
+ ) {
+ acc[val] = p5[val];
}
return acc;
}, {});
@@ -125,18 +128,6 @@ function validateParams(p5, fn, lifecycles) {
* @returns {z.ZodSchema} Zod schema
*/
fn.generateZodSchemasForFunc = function (func) {
- // A special case for `p5.Color.paletteLerp`, which has an unusual and
- // complicated function signature not shared by any other function in p5.
- if (func === 'p5.Color.paletteLerp') {
- return z.tuple([
- z.array(z.tuple([
- z.instanceof(p5.Color),
- z.number()
- ])),
- z.number()
- ]);
- }
-
const { funcName, funcClass } = extractFuncNameAndClass(func);
let funcInfo = dataDoc[funcClass][funcName];
@@ -149,18 +140,27 @@ function validateParams(p5, fn, lifecycles) {
// Returns a schema for a single type, i.e. z.boolean() for `boolean`.
const generateTypeSchema = type => {
+ if (!type) return z.any();
+
const isArray = type.endsWith('[]');
const baseType = isArray ? type.slice(0, -2) : type;
let typeSchema;
- // Type only contains uppercase letters and underscores -> type is a
- // constant. Note that because we're ultimately interested in the value of
+ // Check for constants. Note that because we're ultimately interested in the value of
// the constant, mapping constants to their values via `constantsMap` is
// necessary.
- if (/^[A-Z_]+$/.test(baseType)) {
+ if (baseType in constantsMap) {
typeSchema = z.literal(constantsMap[baseType]);
}
+ // Some more constants are attached directly to p5.prototype, e.g. by addons:
+ else if (baseType.match(/^[A-Z][A-Z0-9]*$/) && baseType in fn) {
+ typeSchema = z.literal(fn[baseType]);
+ }
+ // Function types
+ else if (baseType.startsWith('function')) {
+ typeSchema = z.function();
+ }
// All p5 objects start with `p5` in the documentation, i.e. `p5.Camera`.
else if (baseType.startsWith('p5')) {
const className = baseType.substring(baseType.indexOf('.') + 1);
@@ -169,6 +169,19 @@ function validateParams(p5, fn, lifecycles) {
// For primitive types and web API objects.
else if (schemaMap[baseType]) {
typeSchema = schemaMap[baseType];
+ }
+ // Tuple types
+ else if (baseType.startsWith('[') && baseType.endsWith(']')) {
+ typeSchema = z.tuple(
+ baseType
+ .slice(1, -1)
+ .split(/, */g)
+ .map(entry => generateTypeSchema(entry))
+ );
+ }
+ // JavaScript classes, e.g. Request
+ else if (baseType.match(/^[A-Z]/) && baseType in window) {
+ typeSchema = z.instanceof(window[baseType]);
} else {
throw new Error(`Unsupported type '${type}' in parameter validation. Please report this issue.`);
}
@@ -179,8 +192,8 @@ function validateParams(p5, fn, lifecycles) {
// Generate a schema for a single parameter. In the case where a parameter can
// be of multiple types, `generateTypeSchema` is called for each type.
const generateParamSchema = param => {
- const isOptional = param.endsWith('?');
- param = param.replace(/\?$/, '');
+ const isOptional = param?.endsWith('?');
+ param = param?.replace(/\?$/, '');
let schema;
@@ -193,7 +206,7 @@ function validateParams(p5, fn, lifecycles) {
// our constants sometimes have numeric or non-primitive values.
// 2) In some cases, the type can be constants or strings, making z.enum()
// insufficient for the use case.
- if (param.includes('|')) {
+ if (param?.includes('|')) {
const types = param.split('|');
schema = z.union(types
.map(t => generateTypeSchema(t))
@@ -218,11 +231,11 @@ function validateParams(p5, fn, lifecycles) {
// combinations that are valid for all numbers of parameters.
const generateOverloadCombinations = params => {
// No optional parameters, return the original parameter list right away.
- if (!params.some(p => p.endsWith('?'))) {
+ if (!params.some(p => p?.endsWith('?'))) {
return [params];
}
- const requiredParamsCount = params.filter(p => !p.endsWith('?')).length;
+ const requiredParamsCount = params.filter(p => p === null || !p.endsWith('?')).length;
const result = [];
for (let i = requiredParamsCount; i <= params.length; i++) {
@@ -332,7 +345,7 @@ function validateParams(p5, fn, lifecycles) {
/**
* Prints a friendly error message after parameter validation, if validation
* has failed.
- *
+ *
* @method _friendlyParamError
* @private
* @param {z.ZodError} zodErrorObj - The Zod error object containing validation errors.
@@ -423,7 +436,7 @@ function validateParams(p5, fn, lifecycles) {
// Generates a link to the documentation based on the given function name.
// TODO: Check if the link is reachable before appending it to the error
- // message.
+ // message.
const generateDocumentationLink = (func) => {
const { funcName, funcClass } = extractFuncNameAndClass(func);
const p5BaseUrl = 'https://p5js.org/reference';
diff --git a/src/core/friendly_errors/sketch_verifier.js b/src/core/friendly_errors/sketch_verifier.js
index f90eb4f204..0752150f1e 100644
--- a/src/core/friendly_errors/sketch_verifier.js
+++ b/src/core/friendly_errors/sketch_verifier.js
@@ -1,19 +1,49 @@
-import * as acorn from 'acorn';
-import * as walk from 'acorn-walk';
+import { parse } from 'acorn';
+import { simple as walk } from 'acorn-walk';
+import * as constants from '../constants';
+
+// List of functions to ignore as they either are meant to be re-defined or
+// generate false positive outputs.
+const ignoreFunction = [
+ 'setup',
+ 'draw',
+ 'preload',
+ 'deviceMoved',
+ 'deviceTurned',
+ 'deviceShaken',
+ 'doubleClicked',
+ 'mousePressed',
+ 'mouseReleased',
+ 'mouseMoved',
+ 'mouseDragged',
+ 'mouseClicked',
+ 'mouseWheel',
+ 'touchStarted',
+ 'touchMoved',
+ 'touchEnded',
+ 'keyPressed',
+ 'keyReleased',
+ 'keyTyped',
+ 'windowResized',
+ // 'name',
+ // 'parent',
+ // 'toString',
+ // 'print',
+ // 'stop',
+ // 'onended'
+];
+
+export const verifierUtils = {
-/**
- * @for p5
- * @requires core
- */
-function sketchVerifier(p5, fn) {
/**
* Fetches the contents of a script element in the user's sketch.
- *
+ *
+ * @private
* @method fetchScript
* @param {HTMLScriptElement} script
* @returns {Promise}
- */
- fn.fetchScript = async function (script) {
+ */
+ fetchScript: async function (script) {
if (script.src) {
try {
const contents = await fetch(script.src).then((res) => res.text());
@@ -26,37 +56,20 @@ function sketchVerifier(p5, fn) {
} else {
return script.textContent;
}
- }
-
- /**
- * Extracts the user's code from the script fetched. Note that this method
- * assumes that the user's code is always the last script element in the
- * sketch.
- *
- * @method getUserCode
- * @returns {Promise} The user's code as a string.
- */
- fn.getUserCode = async function () {
- // TODO: think of a more robust way to get the user's code. Refer to
- // https://github.com/processing/p5.js/pull/7293.
- const scripts = document.querySelectorAll('script');
- const userCodeScript = scripts[scripts.length - 1];
- const userCode = await fn.fetchScript(userCodeScript);
-
- return userCode;
- }
+ },
/**
* Extracts the user-defined variables and functions from the user code with
* the help of Espree parser.
- *
+ *
+ * @private
* @method extractUserDefinedVariablesAndFuncs
* @param {string} code - The code to extract variables and functions from.
* @returns {Object} An object containing the user's defined variables and functions.
* @returns {Array<{name: string, line: number}>} [userDefinitions.variables] Array of user-defined variable names and their line numbers.
* @returns {Array<{name: string, line: number}>} [userDefinitions.functions] Array of user-defined function names and their line numbers.
*/
- fn.extractUserDefinedVariablesAndFuncs = function (code) {
+ extractUserDefinedVariablesAndFuncs: function (code) {
const userDefinitions = {
variables: [],
functions: []
@@ -66,13 +79,13 @@ function sketchVerifier(p5, fn) {
const lineOffset = -1;
try {
- const ast = acorn.parse(code, {
+ const ast = parse(code, {
ecmaVersion: 2021,
sourceType: 'module',
locations: true // This helps us get the line number.
});
- walk.simple(ast, {
+ walk(ast, {
VariableDeclarator(node) {
if (node.id.type === 'Identifier') {
const category = node.init && ['ArrowFunctionExpression', 'FunctionExpression'].includes(node.init.type)
@@ -109,18 +122,116 @@ function sketchVerifier(p5, fn) {
}
return userDefinitions;
- }
+ },
- fn.run = async function () {
- const userCode = await fn.getUserCode();
- const userDefinedVariablesAndFuncs = fn.extractUserDefinedVariablesAndFuncs(userCode);
+ /**
+ * Checks user-defined variables and functions for conflicts with p5.js
+ * constants and global functions.
+ *
+ * This function performs two main checks:
+ * 1. Verifies if any user definition conflicts with p5.js constants.
+ * 2. Checks if any user definition conflicts with global functions from
+ * p5.js renderer classes.
+ *
+ * If a conflict is found, it reports a friendly error message and halts
+ * further checking.
+ *
+ * @private
+ * @param {Object} userDefinitions - An object containing user-defined variables and functions.
+ * @param {Array<{name: string, line: number}>} userDefinitions.variables - Array of user-defined variable names and their line numbers.
+ * @param {Array<{name: string, line: number}>} userDefinitions.functions - Array of user-defined function names and their line numbers.
+ * @returns {boolean} - Returns true if a conflict is found, false otherwise.
+ */
+ checkForConstsAndFuncs: function (userDefinitions, p5) {
+ const allDefinitions = [
+ ...userDefinitions.variables,
+ ...userDefinitions.functions
+ ];
- return userDefinedVariablesAndFuncs;
+ // Helper function that generates a friendly error message that contains
+ // the type of redefinition (constant or function), the name of the
+ // redefinition, the line number in user's code, and a link to its
+ // reference on the p5.js website.
+ function generateFriendlyError(errorType, name, line) {
+ const url = `https://p5js.org/reference/p5/${name}`;
+ const message = `${errorType} "${name}" on line ${line} is being redeclared and conflicts with a p5.js ${errorType.toLowerCase()}. p5.js reference: ${url}`;
+ return message;
+ }
+
+ // Checks for constant redefinitions.
+ for (let { name, line } of allDefinitions) {
+ const libDefinition = constants[name];
+ if (libDefinition !== undefined) {
+ const message = generateFriendlyError('Constant', name, line);
+ console.log(message);
+ return true;
+ }
+ }
+
+ // The new rules for attaching anything to global are (if true for both of
+ // the following):
+ // - It is a member of p5.prototype
+ // - Its name does not start with `_`
+ const globalFunctions = new Set(
+ Object.getOwnPropertyNames(p5.prototype)
+ .filter(key => !key.startsWith('_') && key !== 'constructor')
+ );
+
+ for (let { name, line } of allDefinitions) {
+ if (!ignoreFunction.includes(name) && globalFunctions.has(name)) {
+ const message = generateFriendlyError('Function', name, line);
+ console.log(message);
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ /**
+ * Extracts the user's code from the script fetched. Note that this method
+ * assumes that the user's code is always the last script element in the
+ * sketch.
+ *
+ * @private
+ * @method getUserCode
+ * @returns {Promise} The user's code as a string.
+ */
+ getUserCode: async function () {
+ // TODO: think of a more robust way to get the user's code. Refer to
+ // https://github.com/processing/p5.js/pull/7293.
+ const scripts = document.querySelectorAll('script');
+ const userCodeScript = scripts[scripts.length - 1];
+ const userCode = await verifierUtils.fetchScript(userCodeScript);
+
+ return userCode;
+ },
+
+ /**
+ * @private
+ */
+ runFES: async function (p5) {
+ const userCode = await verifierUtils.getUserCode();
+ const userDefinedVariablesAndFuncs = verifierUtils.extractUserDefinedVariablesAndFuncs(userCode);
+
+ verifierUtils.checkForConstsAndFuncs(userDefinedVariablesAndFuncs, p5);
}
+};
+
+/**
+ * @for p5
+ * @requires core
+ */
+function sketchVerifier(p5, _fn, lifecycles) {
+ lifecycles.presetup = async function() {
+ if (!p5.disableFriendlyErrors) {
+ verifierUtils.runFES(p5);
+ }
+ };
}
export default sketchVerifier;
if (typeof p5 !== 'undefined') {
sketchVerifier(p5, p5.prototype);
-}
\ No newline at end of file
+}
diff --git a/src/core/main.js b/src/core/main.js
index 125aedb835..9b65ef009b 100644
--- a/src/core/main.js
+++ b/src/core/main.js
@@ -182,6 +182,10 @@ class p5 {
}
}
+ get pixels(){
+ return this._renderer.pixels;
+ }
+
static registerAddon(addon) {
const lifecycles = {};
addon(p5, p5.prototype, lifecycles);
diff --git a/src/core/p5.Renderer.js b/src/core/p5.Renderer.js
index bcc69ed086..e5ba194d63 100644
--- a/src/core/p5.Renderer.js
+++ b/src/core/p5.Renderer.js
@@ -10,6 +10,18 @@ import { Image } from '../image/p5.Image';
import { Vector } from '../math/p5.Vector';
import { Shape } from '../shape/custom_shapes';
+class ClonableObject {
+ constructor(obj = {}) {
+ for (const key in obj) {
+ this[key] = obj[key];
+ }
+ }
+
+ clone() {
+ return new ClonableObject(this);
+ }
+};
+
class Renderer {
static states = {
strokeColor: null,
@@ -30,7 +42,7 @@ class Renderer {
textAlign: constants.LEFT,
textBaseline: constants.BASELINE,
bezierOrder: 3,
- splineEnds: constants.INCLUDE,
+ splineProperties: new ClonableObject({ ends: constants.INCLUDE, tightness: 0 }),
textWrap: constants.WORD,
// added v2.0
@@ -77,7 +89,6 @@ class Renderer {
this._clipping = false;
this._clipInvert = false;
- this._curveTightness = 0;
this._currentShape = undefined; // Lazily generate current shape
}
@@ -150,11 +161,11 @@ class Renderer {
this.currentShape.bezierVertex(position, textureCoordinates);
}
- splineEnds(mode) {
- if (mode === undefined) {
- return this.states.splineEnds;
+ splineProperty(key, value) {
+ if (value === undefined) {
+ return this.states.splineProperties[key];
} else {
- this.states.splineEnds = mode;
+ this.states.splineProperties[key] = value;
}
this.updateShapeProperties();
}
@@ -305,7 +316,8 @@ class Renderer {
updateShapeProperties() {
this.currentShape.bezierOrder(this.states.bezierOrder);
- this.currentShape.splineEnds(this.states.splineEnds);
+ this.currentShape.splineProperty('ends', this.states.splineProperties.ends);
+ this.currentShape.splineProperty('tightness', this.states.splineProperties.tightness);
}
updateShapeVertexProperties() {
diff --git a/src/core/rendering.js b/src/core/rendering.js
index 810ce3bc32..52669d3d10 100644
--- a/src/core/rendering.js
+++ b/src/core/rendering.js
@@ -123,7 +123,7 @@ function rendering(p5, fn){
* @param {HTMLCanvasElement} [canvas]
* @return {p5.Renderer}
*/
- p5.prototype.createCanvas = function (w, h, renderer, ...args) {
+ fn.createCanvas = function (w, h, renderer, ...args) {
// p5._validateParameters('createCanvas', arguments);
//optional: renderer, otherwise defaults to p2d
@@ -239,7 +239,7 @@ function rendering(p5, fn){
*
*
*/
- p5.prototype.resizeCanvas = function (w, h, noRedraw) {
+ fn.resizeCanvas = function (w, h, noRedraw) {
// p5._validateParameters('resizeCanvas', arguments);
if (this._renderer) {
// Make sure width and height are updated before the renderer resizes so
@@ -274,7 +274,7 @@ function rendering(p5, fn){
*
*
*/
- p5.prototype.noCanvas = function () {
+ fn.noCanvas = function () {
if (this.canvas) {
this.canvas.parentNode.removeChild(this.canvas);
}
@@ -392,7 +392,7 @@ function rendering(p5, fn){
* @param {HTMLCanvasElement} [canvas]
* @return {p5.Graphics}
*/
- p5.prototype.createGraphics = function (w, h, ...args) {
+ fn.createGraphics = function (w, h, ...args) {
/**
* args[0] is expected to be renderer
* args[1] is expected to be canvas
@@ -541,7 +541,7 @@ function rendering(p5, fn){
*
*
*/
- p5.prototype.createFramebuffer = function (options) {
+ fn.createFramebuffer = function (options) {
return new Framebuffer(this._renderer, options);
};
@@ -625,7 +625,7 @@ function rendering(p5, fn){
*
*
*/
- p5.prototype.clearDepth = function (depth) {
+ fn.clearDepth = function (depth) {
this._assert3d('clearDepth');
this._renderer.clearDepth(depth);
};
diff --git a/src/events/keyboard.js b/src/events/keyboard.js
index b3396ae996..58f19095c1 100644
--- a/src/events/keyboard.js
+++ b/src/events/keyboard.js
@@ -105,8 +105,8 @@ function keyboard(p5, fn){
*
*
*/
- fn.isKeyPressed = false;
- fn.keyIsPressed = false; // khan
+
+ fn.keyIsPressed = false;
fn.code = null;
/**
@@ -454,7 +454,6 @@ function keyboard(p5, fn){
if (this._downKeys[e.code]) {
return;
}
- this.isKeyPressed = true;
this.keyIsPressed = true;
this.keyCode = e.which;
this.key = e.key;
@@ -629,8 +628,8 @@ function keyboard(p5, fn){
delete this._downKeyCodes[e.code];
delete this._downKeys[e.key];
- if (Object.keys(this._downKeys).length === 0) {
- this.isKeyPressed = false;
+
+ if (!this._areDownKeys()) {
this.keyIsPressed = false;
this.key = '';
this.code = null;
diff --git a/src/shape/curves.js b/src/shape/curves.js
index 93a19c1d38..370011152e 100644
--- a/src/shape/curves.js
+++ b/src/shape/curves.js
@@ -765,61 +765,6 @@ function curves(p5, fn){
return this;
};
- /**
- * Adjusts the way curve() and
- * splineVertex() draw.
- *
- * Spline curves are like cables that are attached to a set of points.
- * `curveTightness()` adjusts how tightly the cable is attached to the points.
- *
- * The parameter, `tightness`, determines how the curve fits to the vertex
- * points. By default, `tightness` is set to 0. Setting tightness to 1,
- * as in `curveTightness(1)`, connects the curve's points using straight
- * lines. Values in the range from –5 to 5 deform curves while leaving them
- * recognizable.
- *
- * @method curveTightness
- * @param {Number} amount amount of tightness.
- * @chainable
- *
- * @example
- *
- *
- * // Move the mouse left and right to see the curve change.
- *
- * function setup() {
- * createCanvas(100, 100);
- *
- * describe('A black curve forms a sideways U shape. The curve deforms as the user moves the mouse from left to right');
- * }
- *
- * function draw() {
- * background(200);
- *
- * // Set the curve's tightness using the mouse.
- * let t = map(mouseX, 0, 100, -5, 5, true);
- * curveTightness(t);
- *
- * // Draw the curve.
- * noFill();
- * beginShape();
- * splineVertex(10, 26);
- * splineVertex(10, 26);
- * splineVertex(83, 24);
- * splineVertex(83, 61);
- * splineVertex(25, 65);
- * splineVertex(25, 65);
- * endShape();
- * }
- *
- *
- */
- fn.curveTightness = function(t) {
- // p5._validateParameters('curveTightness', arguments);
- this._renderer._curveTightness = t;
- return this;
- };
-
/**
* Calculates coordinates along a spline curve using interpolation.
*
@@ -934,7 +879,7 @@ function curves(p5, fn){
*/
fn.curvePoint = function(a, b, c, d, t) {
// p5._validateParameters('curvePoint', arguments);
- const s = this._renderer._curveTightness,
+ const s = this._renderer.states.splineProperties.tightness,
t3 = t * t * t,
t2 = t * t,
f1 = (s - 1) / 2 * t3 + (1 - s) * t2 + (s - 1) / 2 * t,
@@ -1051,7 +996,7 @@ function curves(p5, fn){
fn.curveTangent = function(a, b, c, d, t) {
// p5._validateParameters('curveTangent', arguments);
- const s = this._renderer._curveTightness,
+ const s = this._renderer.states.splineProperties.tightness,
tt3 = t * t * 3,
t2 = t * 2,
f1 = (s - 1) / 2 * tt3 + (1 - s) * t2 + (s - 1) / 2,
diff --git a/src/shape/custom_shapes.js b/src/shape/custom_shapes.js
index 84724486c4..cb53761d19 100644
--- a/src/shape/custom_shapes.js
+++ b/src/shape/custom_shapes.js
@@ -280,8 +280,10 @@ to interpolated endpoints (a breaking change)
*/
class SplineSegment extends Segment {
#vertexCapacity = Infinity;
- _splineEnds = constants.INCLUDE;
- _splineTightness = 0;
+ _splineProperties = {
+ ends: constants.INCLUDE,
+ tightness: 0
+ };
get vertexCapacity() {
return this.#vertexCapacity;
@@ -296,7 +298,7 @@ class SplineSegment extends Segment {
}
get canOverrideAnchor() {
- return this._splineEnds === constants.EXCLUDE;
+ return this._splineProperties.ends === constants.EXCLUDE;
}
// assuming for now that the first interpolated vertex is always
@@ -304,7 +306,7 @@ class SplineSegment extends Segment {
// if this spline segment doesn't follow another segment,
// the first vertex is in an anchor
get _firstInterpolatedVertex() {
- if (this._splineEnds === constants.EXCLUDE) {
+ if (this._splineProperties.ends === constants.EXCLUDE) {
return this._comesAfterSegment ?
this.vertices[1] :
this.vertices[0];
@@ -328,10 +330,10 @@ class SplineSegment extends Segment {
// doesn't line up with end of last segment
addToShape(shape) {
const added = super.addToShape(shape);
- this._splineEnds = shape._splineEnds;
- this._splineTightness = shape._splineTightness;
+ this._splineProperties.ends = shape._splineProperties.ends;
+ this._splineProperties.tightness = shape._splineProperties.tightness;
- if (this._splineEnds !== constants.EXCLUDE) return added;
+ if (this._splineProperties.ends !== constants.EXCLUDE) return added;
let verticesPushed = !this._belongsToShape;
let lastPrimitive = shape.at(-1, -1);
@@ -367,9 +369,9 @@ class SplineSegment extends Segment {
// override method on base class
getEndVertex() {
- if (this._splineEnds === constants.INCLUDE) {
+ if (this._splineProperties.ends === constants.INCLUDE) {
return super.getEndVertex();
- } else if (this._splineEnds === constants.EXCLUDE) {
+ } else if (this._splineProperties.ends === constants.EXCLUDE) {
return this.vertices.at(-2);
} else {
return this.getStartVertex();
@@ -389,11 +391,11 @@ class SplineSegment extends Segment {
}
const prevVertex = this.getStartVertex();
- if (this._splineEnds === constants.INCLUDE) {
+ if (this._splineProperties.ends === constants.INCLUDE) {
points.unshift(prevVertex);
points.push(this.vertices.at(-1));
- } else if (this._splineEnds === constants.JOIN) {
- points.unshift(this.vertices.at(-1), prevVertex);
+ } else if (this._splineProperties.ends === constants.JOIN) {
+ points.unshift(this.vertices.at(-1));
points.push(prevVertex, this.vertices.at(0));
}
@@ -410,7 +412,7 @@ class SplineSegment extends Segment {
}
close() {
- this._splineEnds = constants.JOIN;
+ this._splineProperties.ends = constants.JOIN;
}
}
@@ -581,10 +583,12 @@ class Shape {
#initialVertexProperties;
#primitiveShapeCreators;
#bezierOrder = 3;
- _splineTightness = 0;
kind = null;
contours = [];
- _splineEnds = constants.INCLUDE;
+ _splineProperties = {
+ tightness: 0,
+ ends: constants.INCLUDE
+ };
userVertexProperties = null;
constructor(
@@ -828,12 +832,8 @@ class Shape {
this.#bezierOrder = order;
}
- splineEnds(mode) {
- this._splineEnds = mode;
- }
-
- splineTightness(tightness) {
- this._splineTightness = tightness;
+ splineProperty(key, value) {
+ this._splineProperties[key] = value;
}
/*
@@ -1076,7 +1076,7 @@ class PrimitiveToPath2DConverter extends PrimitiveVisitor {
const shape = splineSegment._shape;
if (
- splineSegment._splineEnds === constants.EXCLUDE &&
+ splineSegment._splineProperties.ends === constants.EXCLUDE &&
!splineSegment._comesAfterSegment
) {
let startVertex = splineSegment._firstInterpolatedVertex;
@@ -1088,7 +1088,7 @@ class PrimitiveToPath2DConverter extends PrimitiveVisitor {
);
let bezierArrays = shape.catmullRomToBezier(
arrayVertices,
- splineSegment._splineTightness
+ splineSegment._splineProperties.tightness
).map(arr => arr.map(vertArr => shape.arrayToVertex(vertArr)));
for (const array of bezierArrays) {
const points = array.flatMap(vert => [vert.position.x, vert.position.y]);
@@ -1217,7 +1217,7 @@ class PrimitiveToVerticesConverter extends PrimitiveVisitor {
);
let bezierArrays = shape.catmullRomToBezier(
arrayVertices,
- splineSegment._splineTightness
+ splineSegment._splineProperties.tightness
);
let startVertex = shape.vertexToArray(splineSegment._firstInterpolatedVertex);
for (const array of bezierArrays) {
@@ -1596,10 +1596,11 @@ function customShapes(p5, fn) {
/**
* TODO: documentation
- * @param {SHOW|HIDE} mode
+ * @param {String} key
+ * @param value
*/
- fn.splineEnds = function(mode) {
- return this._renderer.splineEnds(mode);
+ fn.splineProperty = function(key, value) {
+ return this._renderer.splineProperty(key, value);
};
/**
@@ -1967,6 +1968,7 @@ function customShapes(p5, fn) {
* counter-clockwise order.
*
* @method endContour
+ * @param {OPEN|CLOSE} [mode=OPEN]
*
* @example
*
diff --git a/src/type/text2d.js b/src/type/text2d.js
index 5283aec65f..4c97b4af6d 100644
--- a/src/type/text2d.js
+++ b/src/type/text2d.js
@@ -518,12 +518,16 @@ function text2d(p5, fn) {
// adjust the bounding boxes based on horiz. text alignment
if (lines.length > 1) {
- boxes.forEach(bb => bb.x += this._xAlignOffset(textAlign, width));
+ // Call the 2D mode version: the WebGL mode version does additional
+ // alignment adjustments to account for how WebGL renders text.
+ boxes.forEach(bb => bb.x += p5.Renderer2D.prototype._xAlignOffset.call(this, textAlign, width));
}
// adjust the bounding boxes based on vert. text alignment
if (typeof height !== 'undefined') {
- this._yAlignOffset(boxes, height);
+ // Call the 2D mode version: the WebGL mode version does additional
+ // alignment adjustments to account for how WebGL renders text.
+ p5.Renderer2D.prototype._yAlignOffset.call(this, boxes, height);
}
// get the bounds for the text block
@@ -1224,11 +1228,11 @@ function text2d(p5, fn) {
case fn.LEFT:
adjustedX = x;
break;
- case fn._CTX_MIDDLE:
- adjustedX = x + (adjustedW - widths[i]) / 2;
+ case fn.CENTER:
+ adjustedX = x + (adjustedW - widths[i]) / 2 - adjustedW / 2 + (width || 0) / 2;
break;
case fn.RIGHT:
- adjustedX = x + adjustedW - widths[i];
+ adjustedX = x + adjustedW - widths[i] - adjustedW + (width || 0);
break;
case fn.END:
throw new Error('textBounds: END not yet supported for textAlign');
@@ -1255,10 +1259,10 @@ function text2d(p5, fn) {
case fn.BASELINE:
break;
case fn._CTX_MIDDLE:
- yOff = -totalHeight / 2 + textSize;
+ yOff = -totalHeight / 2 + textSize + (height || 0) / 2;
break;
case fn.BOTTOM:
- yOff = -(totalHeight - textSize);
+ yOff = -(totalHeight - textSize) + (height || 0);
break;
default:
console.warn(`${textBaseline} is not supported in WebGL mode.`); // FES?
diff --git a/src/webgl/loading.js b/src/webgl/loading.js
index 3ada682900..8c7019ccfb 100755
--- a/src/webgl/loading.js
+++ b/src/webgl/loading.js
@@ -441,6 +441,7 @@ function loading(p5, fn){
if (flipV) {
model.flipV();
}
+ model._makeTriangleEdges();
if (successCallback) {
return successCallback(model);
@@ -464,6 +465,7 @@ function loading(p5, fn){
if (flipV) {
model.flipV();
}
+ model._makeTriangleEdges();
if (successCallback) {
return successCallback(model);
@@ -1087,19 +1089,7 @@ function loading(p5, fn){
fn.model = function (model, count = 1) {
this._assert3d('model');
// p5._validateParameters('model', arguments);
- if (model.vertices.length > 0) {
- if (!this._renderer.geometryInHash(model.gid)) {
-
- if (model.edges.length === 0) {
- model._makeTriangleEdges();
- }
-
- model._edgesToVertices();
- this._renderer._getOrMakeCachedBuffers(model);
- }
-
- this._renderer._drawGeometry(model, { count });
- }
+ this._renderer.model(model, count);
};
}
diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js
index b6b90984af..d890e8d830 100644
--- a/src/webgl/p5.RendererGL.js
+++ b/src/webgl/p5.RendererGL.js
@@ -46,6 +46,7 @@ import filterInvertFrag from "./shaders/filters/invert.frag";
import filterThresholdFrag from "./shaders/filters/threshold.frag";
import filterShaderVert from "./shaders/filters/default.vert";
import { PrimitiveToVerticesConverter } from "../shape/custom_shapes";
+import { Color } from "../color/p5.Color";
const STROKE_CAP_ENUM = {};
const STROKE_JOIN_ENUM = {};
@@ -407,8 +408,6 @@ class RendererGL extends Renderer {
this.filterLayerTemp = undefined;
this.defaultFilterShaders = {};
- this._curveTightness = 6;
-
this.fontInfos = {};
this._curShader = undefined;
@@ -440,8 +439,8 @@ class RendererGL extends Renderer {
);
}
this.geometryBuilder = new GeometryBuilder(this);
- this.geometryBuilder.prevFillColor = [...this.states.curFillColor];
- this.states.curFillColor = [-1, -1, -1, -1];
+ this.geometryBuilder.prevFillColor = this.states.fillColor;
+ this.fill(new Color([-1, -1, -1, -1]));
}
/**
@@ -460,7 +459,7 @@ class RendererGL extends Renderer {
);
}
const geometry = this.geometryBuilder.finish();
- this.states.curFillColor = this.geometryBuilder.prevFillColor;
+ this.fill(this.geometryBuilder.prevFillColor);
this.geometryBuilder = undefined;
return geometry;
}
@@ -586,6 +585,21 @@ class RendererGL extends Renderer {
this.updateShapeVertexProperties();
}
+ model(model, count = 1) {
+ if (model.vertices.length > 0) {
+ if (this.geometryBuilder) {
+ this.geometryBuilder.addRetained(model);
+ } else {
+ if (!this.geometryInHash(model.gid)) {
+ model._edgesToVertices();
+ this._getOrMakeCachedBuffers(model);
+ }
+
+ this._drawGeometry(model, { count });
+ }
+ }
+ }
+
//////////////////////////////////////////////
// Rendering
//////////////////////////////////////////////
@@ -2409,34 +2423,6 @@ class RendererGL extends Renderer {
_vToNArray(arr) {
return arr.flatMap((item) => [item.x, item.y, item.z]);
}
-
- // function to calculate BezierVertex Coefficients
- _bezierCoefficients(t) {
- const t2 = t * t;
- const t3 = t2 * t;
- const mt = 1 - t;
- const mt2 = mt * mt;
- const mt3 = mt2 * mt;
- return [mt3, 3 * mt2 * t, 3 * mt * t2, t3];
- }
-
- // function to calculate QuadraticVertex Coefficients
- _quadraticCoefficients(t) {
- const t2 = t * t;
- const mt = 1 - t;
- const mt2 = mt * mt;
- return [mt2, 2 * mt * t, t2];
- }
-
- // function to convert Bezier coordinates to Catmull Rom Splines
- _bezierToCatmull(w) {
- const p1 = w[1];
- const p2 = w[1] + (w[2] - w[0]) / this._curveTightness;
- const p3 = w[2] - (w[3] - w[1]) / this._curveTightness;
- const p4 = w[2];
- const p = [p1, p2, p3, p4];
- return p;
- }
}
function rendererGL(p5, fn) {
diff --git a/src/webgl/shaders/phong.frag b/src/webgl/shaders/phong.frag
index 74c5206d95..d4d2205b80 100644
--- a/src/webgl/shaders/phong.frag
+++ b/src/webgl/shaders/phong.frag
@@ -49,7 +49,7 @@ void main(void) {
inputs.color = isTexture
? TEXTURE(uSampler, vTexCoord) * uTint/255.
: vColor;
- if (isTexture) {
+ if (isTexture && inputs.color.a > 0.0) {
// Textures come in with premultiplied alpha. Temporarily unpremultiply it
// so hooks users don't have to think about premultiplied alpha.
inputs.color.rgb /= inputs.color.a;
diff --git a/src/webgl/text.js b/src/webgl/text.js
index 0f75bcb42d..241f18b509 100644
--- a/src/webgl/text.js
+++ b/src/webgl/text.js
@@ -665,7 +665,7 @@ function text(p5, fn){
console.log(
'WEBGL: only Opentype (.otf) and Truetype (.ttf) fonts are supported'
);
- return p;
+ return;
}
this.push(); // fix to #803
diff --git a/test/unit/core/curves.js b/test/unit/core/curves.js
index d389e0fb9d..4840e273b1 100644
--- a/test/unit/core/curves.js
+++ b/test/unit/core/curves.js
@@ -4,7 +4,11 @@ import curves from '../../../src/shape/curves';
suite('Curves', function() {
beforeAll(function() {
mockP5Prototype._renderer = {
- _curveTightness: 0
+ states: {
+ splineProperties: {
+ tightness: 0
+ }
+ }
};
curves(mockP5, mockP5Prototype);
});
diff --git a/test/unit/core/param_errors.js b/test/unit/core/param_errors.js
index 49128258c3..5bce63c7b7 100644
--- a/test/unit/core/param_errors.js
+++ b/test/unit/core/param_errors.js
@@ -218,7 +218,7 @@ suite('Validate Params', function () {
[new mockP5.Color(), 0.8],
[new mockP5.Color(), 0.5]
];
- const result = mockP5Prototype.validate('p5.Color.paletteLerp', [colorStops, 0.5]);
+ const result = mockP5Prototype.validate('p5.paletteLerp', [colorStops, 0.5]);
assert.isTrue(result.success);
})
})
diff --git a/test/unit/core/sketch_overrides.js b/test/unit/core/sketch_overrides.js
index cf16edbff7..7a8f398fde 100644
--- a/test/unit/core/sketch_overrides.js
+++ b/test/unit/core/sketch_overrides.js
@@ -1,16 +1,21 @@
-import sketchVerifier from '../../../src/core/friendly_errors/sketch_verifier.js';
+import {
+ verifierUtils
+} from '../../../src/core/friendly_errors/sketch_verifier.js';
-suite('Validate Params', function () {
+suite('Sketch Verifier', function () {
const mockP5 = {
- _validateParameters: vi.fn()
+ _validateParameters: vi.fn(),
+ Color: function () { },
+ Vector: function () { },
+ prototype: {
+ rect: function () { },
+ ellipse: function () { },
+ }
};
- const mockP5Prototype = {};
- beforeAll(function () {
- sketchVerifier(mockP5, mockP5Prototype);
- });
-
- afterAll(function () {
+ afterEach(() => {
+ vi.restoreAllMocks()
+ vi.unstubAllGlobals();
});
suite('fetchScript()', function () {
@@ -26,17 +31,15 @@ suite('Validate Params', function () {
vi.stubGlobal('fetch', mockFetch);
const mockScript = { src: url };
- const result = await mockP5Prototype.fetchScript(mockScript);
+ const result = await verifierUtils.fetchScript(mockScript);
expect(mockFetch).toHaveBeenCalledWith(url);
expect(result).toBe(code);
-
- vi.unstubAllGlobals();
});
test('Fetches code when there is no src attribute', async function () {
const mockScript = { textContent: code };
- const result = await mockP5Prototype.fetchScript(mockScript);
+ const result = await verifierUtils.fetchScript(mockScript);
expect(result).toBe(code);
});
@@ -46,17 +49,21 @@ suite('Validate Params', function () {
const userCode = "let c = p5.Color(20, 20, 20);";
test('fetches the last script element', async function () {
- document.body.innerHTML = `
+ const fakeDocument = document.createElement('div');
+ fakeDocument.innerHTML = `
`;
+ vi.spyOn(document, 'querySelectorAll')
+ .mockImplementation((...args) => fakeDocument.querySelectorAll(...args));
- mockP5Prototype.fetchScript = vi.fn(() => Promise.resolve(userCode));
+ vi.spyOn(verifierUtils, 'fetchScript')
+ .mockImplementation(() => Promise.resolve(userCode));
- const result = await mockP5Prototype.getUserCode();
+ const result = await verifierUtils.getUserCode();
- expect(mockP5Prototype.fetchScript).toHaveBeenCalledTimes(1);
+ expect(verifierUtils.fetchScript).toHaveBeenCalledTimes(1);
expect(result).toBe(userCode);
});
});
@@ -73,7 +80,7 @@ suite('Validate Params', function () {
const baz = (x) => x * 2;
`;
- const result = mockP5Prototype.extractUserDefinedVariablesAndFuncs(code);
+ const result = verifierUtils.extractUserDefinedVariablesAndFuncs(code);
const expectedResult = {
"functions": [
{
@@ -140,7 +147,7 @@ suite('Validate Params', function () {
for (let i = 0; i < 5; i++) {}
`;
- const result = mockP5Prototype.extractUserDefinedVariablesAndFuncs(code);
+ const result = verifierUtils.extractUserDefinedVariablesAndFuncs(code);
const expectedResult = {
"functions": [],
"variables": [
@@ -170,51 +177,87 @@ suite('Validate Params', function () {
const invalidCode = 'let x = ;';
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => { });
- const result = mockP5Prototype.extractUserDefinedVariablesAndFuncs(invalidCode);
+ const result = verifierUtils.extractUserDefinedVariablesAndFuncs(invalidCode);
expect(consoleSpy).toHaveBeenCalled();
expect(result).toEqual({ variables: [], functions: [] });
-
consoleSpy.mockRestore();
});
});
- suite('run()', function () {
- test('Returns extracted variables and functions', async function () {
- const mockScript = `
- let x = 5;
- const y = 10;
- function foo() {}
- const bar = () => {};
- `;
- mockP5Prototype.getUserCode = vi.fn(() => Promise.resolve(mockScript));
+ suite('checkForConstsAndFuncs()', function () {
+ // Set up for this suite of tests
+ let consoleSpy;
- const result = await mockP5Prototype.run();
- const expectedResult = {
- "functions": [
- {
- "line": 3,
- "name": "foo",
- },
- {
- "line": 4,
- "name": "bar",
- },
- ],
- "variables": [
- {
- "line": 1,
- "name": "x",
- },
- {
- "line": 2,
- "name": "y",
- },
- ],
+ class MockP5 {
+ setup() {}
+ draw() {}
+ rect() {}
+ }
+
+ beforeEach(function () {
+ consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
+ });
+
+ afterEach(function () {
+ consoleSpy.mockRestore();
+ });
+
+ test('Detects conflict with p5.js constant', function () {
+ const userDefinitions = {
+ variables: [{ name: 'PI', line: 1 }],
+ functions: []
};
+ const result = verifierUtils.checkForConstsAndFuncs(userDefinitions, MockP5);
- expect(mockP5Prototype.getUserCode).toHaveBeenCalledTimes(1);
- expect(result).toEqual(expectedResult);
+ expect(result).toBe(true);
+ expect(consoleSpy).toHaveBeenCalledWith(
+ expect.stringContaining(
+ 'Constant "PI" on line 1 is being redeclared and conflicts with a p5.js constant'
+ )
+ );
+ });
+
+ test('Detects conflict with p5.js global function', function () {
+ const userDefinitions = {
+ variables: [],
+ functions: [{ name: 'rect', line: 2 }]
+ };
+ const result = verifierUtils.checkForConstsAndFuncs(userDefinitions, MockP5);
+
+ expect(result).toBe(true);
+ expect(consoleSpy).toHaveBeenCalledWith(
+ expect.stringContaining(
+ 'Function "rect" on line 2 is being redeclared and conflicts with a p5.js function'
+ )
+ );
+ });
+
+ test('Allows redefinition of whitelisted functions', function () {
+ const userDefinitions = {
+ variables: [],
+ functions: [
+ { name: 'setup', line: 1 },
+ { name: 'draw', line: 2 },
+ { name: 'preload', line: 3 }
+ ]
+ };
+
+ const result = verifierUtils.checkForConstsAndFuncs(userDefinitions, MockP5);
+
+ expect(result).toBe(false);
+ expect(consoleSpy).not.toHaveBeenCalled();
+ });
+
+ test('Returns false when no conflicts are found', function () {
+ const userDefinitions = {
+ variables: [{ name: 'img', line: 1 }],
+ functions: [{ name: 'cut', line: 2 }]
+ };
+
+ const result = verifierUtils.checkForConstsAndFuncs(userDefinitions, MockP5);
+
+ expect(result).toBe(false);
});
});
-});
\ No newline at end of file
+});
diff --git a/test/unit/events/keyboard.js b/test/unit/events/keyboard.js
index c1c80bd186..dc31f62336 100644
--- a/test/unit/events/keyboard.js
+++ b/test/unit/events/keyboard.js
@@ -39,22 +39,6 @@ suite('Keyboard Events', function() {
});
});
- suite('p5.prototype.isKeyPressed', function() {
- test('isKeyPressed should be a boolean', function() {
- assert.isBoolean(myp5.isKeyPressed);
- });
-
- test('isKeyPressed should be true on key press', function() {
- window.dispatchEvent(new KeyboardEvent('keydown'));
- assert.strictEqual(myp5.isKeyPressed, true);
- });
-
- test('isKeyPressed should be false on key up', function() {
- window.dispatchEvent(new KeyboardEvent('keyup'));
- assert.strictEqual(myp5.isKeyPressed, false);
- });
- });
-
suite('p5.prototype.key', function() {
test('key should be a string', async function() {
window.dispatchEvent(new KeyboardEvent('keydown', { key: 's' }));
diff --git a/test/unit/visual/cases/shapes.js b/test/unit/visual/cases/shapes.js
index 61f8c0d3d9..83ec314049 100644
--- a/test/unit/visual/cases/shapes.js
+++ b/test/unit/visual/cases/shapes.js
@@ -128,7 +128,7 @@ visualSuite('Shape drawing', function() {
visualTest('Drawing with curves with hidden ends', function(p5, screenshot) {
setup(p5);
p5.beginShape();
- p5.splineEnds(p5.EXCLUDE);
+ p5.splineProperty('ends', p5.EXCLUDE);
p5.splineVertex(10, 10);
p5.splineVertex(15, 40);
p5.splineVertex(40, 35);
@@ -150,9 +150,19 @@ visualSuite('Shape drawing', function() {
screenshot();
});
+ visualTest('Drawing simple closed curves', function(p5, screenshot) {
+ setup(p5);
+ p5.beginShape();
+ p5.splineVertex(10, 10);
+ p5.splineVertex(15, 40);
+ p5.splineVertex(40, 35);
+ p5.endShape(p5.CLOSE);
+ screenshot();
+ });
+
visualTest('Drawing with curves with tightness', function(p5, screenshot) {
setup(p5);
- p5.curveTightness(0.5);
+ p5.splineProperty('tightness', -1);
p5.beginShape();
p5.splineVertex(10, 10);
p5.splineVertex(15, 40);
@@ -166,7 +176,7 @@ visualSuite('Shape drawing', function() {
visualTest('Drawing closed curve loops', function(p5, screenshot) {
setup(p5);
p5.beginShape();
- p5.splineEnds(p5.EXCLUDE);
+ p5.splineProperty('ends', p5.EXCLUDE);
p5.splineVertex(10, 10);
p5.splineVertex(15, 40);
p5.splineVertex(40, 35);
diff --git a/test/unit/visual/cases/typography.js b/test/unit/visual/cases/typography.js
index 3bf1332344..63cd0f9452 100644
--- a/test/unit/visual/cases/typography.js
+++ b/test/unit/visual/cases/typography.js
@@ -128,235 +128,265 @@ visualSuite("Typography", function () {
});
visualSuite("textAlign", function () {
- visualTest("all alignments with single word", function (p5, screenshot) {
- const alignments = [
- { alignX: p5.LEFT, alignY: p5.TOP },
- { alignX: p5.CENTER, alignY: p5.TOP },
- { alignX: p5.RIGHT, alignY: p5.TOP },
- { alignX: p5.LEFT, alignY: p5.CENTER },
- { alignX: p5.CENTER, alignY: p5.CENTER },
- { alignX: p5.RIGHT, alignY: p5.CENTER },
- { alignX: p5.LEFT, alignY: p5.BOTTOM },
- { alignX: p5.CENTER, alignY: p5.BOTTOM },
- { alignX: p5.RIGHT, alignY: p5.BOTTOM },
- ];
-
- p5.createCanvas(300, 300);
- p5.textSize(60);
- alignments.forEach((alignment) => {
- p5.background(255);
- p5.textAlign(alignment.alignX, alignment.alignY);
- p5.text("Single Line", p5.width / 2, p5.height / 2);
- const bb = p5.textBounds("Single Line", p5.width / 2, p5.height / 2);
- p5.push();
- p5.noFill();
- p5.stroke("red");
- p5.rect(bb.x, bb.y, bb.w, bb.h);
- p5.pop();
- screenshot();
- })
- });
-
- visualTest("all alignments with single line", function (p5, screenshot) {
- const alignments = [
- { alignX: p5.LEFT, alignY: p5.TOP },
- { alignX: p5.CENTER, alignY: p5.TOP },
- { alignX: p5.RIGHT, alignY: p5.TOP },
- { alignX: p5.LEFT, alignY: p5.CENTER },
- { alignX: p5.CENTER, alignY: p5.CENTER },
- { alignX: p5.RIGHT, alignY: p5.CENTER },
- { alignX: p5.LEFT, alignY: p5.BOTTOM },
- { alignX: p5.CENTER, alignY: p5.BOTTOM },
- { alignX: p5.RIGHT, alignY: p5.BOTTOM },
- ];
-
- p5.createCanvas(300, 300);
- p5.textSize(45);
- alignments.forEach((alignment) => {
- p5.background(255);
- p5.textAlign(alignment.alignX, alignment.alignY);
- p5.text("Single Line", p5.width / 2, p5.height / 2);
- const bb = p5.textBounds("Single Line", p5.width / 2, p5.height / 2);
- p5.push();
- p5.noFill();
- p5.stroke("red");
- p5.rect(bb.x, bb.y, bb.w, bb.h);
- p5.pop();
- screenshot();
- });
- });
-
- visualTest("all alignments with multi-lines and wrap word",
- function (p5, screenshot) {
- const alignments = [
- { alignX: p5.LEFT, alignY: p5.TOP },
- { alignX: p5.CENTER, alignY: p5.TOP },
- { alignX: p5.RIGHT, alignY: p5.TOP },
- { alignX: p5.LEFT, alignY: p5.CENTER },
- { alignX: p5.CENTER, alignY: p5.CENTER },
- { alignX: p5.RIGHT, alignY: p5.CENTER },
- { alignX: p5.LEFT, alignY: p5.BOTTOM },
- { alignX: p5.CENTER, alignY: p5.BOTTOM },
- { alignX: p5.RIGHT, alignY: p5.BOTTOM },
- ];
-
- p5.createCanvas(150, 100);
- p5.textSize(20);
- p5.textWrap(p5.WORD);
-
- let xPos = 20;
- let yPos = 20;
- const boxWidth = 100;
- const boxHeight = 60;
-
- alignments.forEach((alignment, i) => {
- p5.background(255);
- p5.push();
- p5.textAlign(alignment.alignX, alignment.alignY);
-
- p5.noFill();
- p5.strokeWeight(2);
- p5.stroke(200);
- p5.rect(xPos, yPos, boxWidth, boxHeight);
-
- p5.fill(0);
- p5.noStroke();
- p5.text(
- "A really long text that should wrap automatically as it reaches the end of the box",
- xPos,
- yPos,
- boxWidth,
- boxHeight
- );
- const bb = p5.textBounds(
- "A really long text that should wrap automatically as it reaches the end of the box",
- xPos,
- yPos,
- boxWidth,
- boxHeight
+ for (const mode of ['2d', 'webgl']) {
+ visualSuite(`${mode} mode`, () => {
+ visualTest("all alignments with single word", async function (p5, screenshot) {
+ const alignments = [
+ { alignX: p5.LEFT, alignY: p5.TOP },
+ { alignX: p5.CENTER, alignY: p5.TOP },
+ { alignX: p5.RIGHT, alignY: p5.TOP },
+ { alignX: p5.LEFT, alignY: p5.CENTER },
+ { alignX: p5.CENTER, alignY: p5.CENTER },
+ { alignX: p5.RIGHT, alignY: p5.CENTER },
+ { alignX: p5.LEFT, alignY: p5.BOTTOM },
+ { alignX: p5.CENTER, alignY: p5.BOTTOM },
+ { alignX: p5.RIGHT, alignY: p5.BOTTOM },
+ ];
+
+ p5.createCanvas(300, 300, mode === 'webgl' ? p5.WEBGL : undefined);
+ if (mode === 'webgl') p5.translate(-p5.width/2, -p5.height/2);
+ p5.textSize(60);
+ const font = await p5.loadFont(
+ '/unit/assets/Inconsolata-Bold.ttf'
);
- p5.noFill();
- p5.stroke("red");
- p5.rect(bb.x, bb.y, bb.w, bb.h);
- p5.pop();
-
- screenshot();
+ p5.textFont(font);
+ alignments.forEach((alignment) => {
+ p5.background(255);
+ p5.textAlign(alignment.alignX, alignment.alignY);
+ p5.text("Single Line", p5.width / 2, p5.height / 2);
+ const bb = p5.textBounds("Single Line", p5.width / 2, p5.height / 2);
+ p5.push();
+ p5.noFill();
+ p5.stroke("red");
+ p5.rect(bb.x, bb.y, bb.w, bb.h);
+ p5.pop();
+ screenshot();
+ })
});
- }
- );
-
- visualTest(
- "all alignments with multi-lines and wrap char",
- function (p5, screenshot) {
- const alignments = [
- { alignX: p5.LEFT, alignY: p5.TOP },
- { alignX: p5.CENTER, alignY: p5.TOP },
- { alignX: p5.RIGHT, alignY: p5.TOP },
- { alignX: p5.LEFT, alignY: p5.CENTER },
- { alignX: p5.CENTER, alignY: p5.CENTER },
- { alignX: p5.RIGHT, alignY: p5.CENTER },
- { alignX: p5.LEFT, alignY: p5.BOTTOM },
- { alignX: p5.CENTER, alignY: p5.BOTTOM },
- { alignX: p5.RIGHT, alignY: p5.BOTTOM },
- ];
-
- p5.createCanvas(150, 100);
- p5.textSize(20);
- p5.textWrap(p5.CHAR);
-
- let xPos = 20;
- let yPos = 20;
- const boxWidth = 100;
- const boxHeight = 60;
-
- alignments.forEach((alignment, i) => {
- p5.background(255);
- p5.push();
- p5.textAlign(alignment.alignX, alignment.alignY);
-
- p5.noFill();
- p5.strokeWeight(2);
- p5.stroke(200);
- p5.rect(xPos, yPos, boxWidth, boxHeight);
-
- p5.fill(0);
- p5.noStroke();
- p5.text(
- "A really long text that should wrap automatically as it reaches the end of the box",
- xPos,
- yPos,
- boxWidth,
- boxHeight
- );
- const bb = p5.textBounds(
- "A really long text that should wrap automatically as it reaches the end of the box",
- xPos,
- yPos,
- boxWidth,
- boxHeight
- );
- p5.noFill();
- p5.stroke("red");
- p5.rect(bb.x, bb.y, bb.w, bb.h);
- p5.pop();
- screenshot();
- });
- }
- );
-
- visualTest(
- "all alignments with multi-line manual text",
- function (p5, screenshot) {
- const alignments = [
- { alignX: p5.LEFT, alignY: p5.TOP },
- { alignX: p5.CENTER, alignY: p5.TOP },
- { alignX: p5.RIGHT, alignY: p5.TOP },
- { alignX: p5.LEFT, alignY: p5.CENTER },
- { alignX: p5.CENTER, alignY: p5.CENTER },
- { alignX: p5.RIGHT, alignY: p5.CENTER },
- { alignX: p5.LEFT, alignY: p5.BOTTOM },
- { alignX: p5.CENTER, alignY: p5.BOTTOM },
- { alignX: p5.RIGHT, alignY: p5.BOTTOM },
- ];
-
- p5.createCanvas(150, 100);
- p5.textSize(20);
-
- let xPos = 20;
- let yPos = 20;
- const boxWidth = 100;
- const boxHeight = 60;
-
- alignments.forEach((alignment, i) => {
- p5.background(255);
- p5.push();
- p5.textAlign(alignment.alignX, alignment.alignY);
-
- p5.noFill();
- p5.stroke(200);
- p5.strokeWeight(2);
- p5.rect(xPos, yPos, boxWidth, boxHeight);
-
- p5.fill(0);
- p5.noStroke();
- p5.text("Line 1\nLine 2\nLine 3", xPos, yPos, boxWidth, boxHeight);
- const bb = p5.textBounds(
- "Line 1\nLine 2\nLine 3",
- xPos,
- yPos,
- boxWidth,
- boxHeight
+ visualTest("all alignments with single line", async function (p5, screenshot) {
+ const alignments = [
+ { alignX: p5.LEFT, alignY: p5.TOP },
+ { alignX: p5.CENTER, alignY: p5.TOP },
+ { alignX: p5.RIGHT, alignY: p5.TOP },
+ { alignX: p5.LEFT, alignY: p5.CENTER },
+ { alignX: p5.CENTER, alignY: p5.CENTER },
+ { alignX: p5.RIGHT, alignY: p5.CENTER },
+ { alignX: p5.LEFT, alignY: p5.BOTTOM },
+ { alignX: p5.CENTER, alignY: p5.BOTTOM },
+ { alignX: p5.RIGHT, alignY: p5.BOTTOM },
+ ];
+
+ p5.createCanvas(300, 300, mode === 'webgl' ? p5.WEBGL : undefined);
+ if (mode === 'webgl') p5.translate(-p5.width/2, -p5.height/2);
+ p5.textSize(45);
+ const font = await p5.loadFont(
+ '/unit/assets/Inconsolata-Bold.ttf'
);
- p5.noFill();
- p5.stroke("red");
- p5.rect(bb.x, bb.y, bb.w, bb.h);
- p5.pop();
-
- screenshot();
+ p5.textFont(font);
+ alignments.forEach((alignment) => {
+ p5.background(255);
+ p5.textAlign(alignment.alignX, alignment.alignY);
+ p5.text("Single Line", p5.width / 2, p5.height / 2);
+ const bb = p5.textBounds("Single Line", p5.width / 2, p5.height / 2);
+ p5.push();
+ p5.noFill();
+ p5.stroke("red");
+ p5.rect(bb.x, bb.y, bb.w, bb.h);
+ p5.pop();
+ screenshot();
+ });
});
- }
- );
+
+ visualTest("all alignments with multi-lines and wrap word",
+ async function (p5, screenshot) {
+ const alignments = [
+ { alignX: p5.LEFT, alignY: p5.TOP },
+ { alignX: p5.CENTER, alignY: p5.TOP },
+ { alignX: p5.RIGHT, alignY: p5.TOP },
+ { alignX: p5.LEFT, alignY: p5.CENTER },
+ { alignX: p5.CENTER, alignY: p5.CENTER },
+ { alignX: p5.RIGHT, alignY: p5.CENTER },
+ { alignX: p5.LEFT, alignY: p5.BOTTOM },
+ { alignX: p5.CENTER, alignY: p5.BOTTOM },
+ { alignX: p5.RIGHT, alignY: p5.BOTTOM },
+ ];
+
+ p5.createCanvas(150, 100, mode === 'webgl' ? p5.WEBGL : undefined);
+ if (mode === 'webgl') p5.translate(-p5.width/2, -p5.height/2);
+ p5.textSize(20);
+ p5.textWrap(p5.WORD);
+ const font = await p5.loadFont(
+ '/unit/assets/Inconsolata-Bold.ttf'
+ );
+ p5.textFont(font);
+
+ let xPos = 20;
+ let yPos = 20;
+ const boxWidth = 100;
+ const boxHeight = 60;
+
+ alignments.forEach((alignment, i) => {
+ p5.background(255);
+ p5.push();
+ p5.textAlign(alignment.alignX, alignment.alignY);
+
+ p5.noFill();
+ p5.strokeWeight(2);
+ p5.stroke(200);
+ p5.rect(xPos, yPos, boxWidth, boxHeight);
+
+ p5.fill(0);
+ p5.noStroke();
+ p5.text(
+ "A really long text that should wrap automatically as it reaches the end of the box",
+ xPos,
+ yPos,
+ boxWidth,
+ boxHeight
+ );
+ const bb = p5.textBounds(
+ "A really long text that should wrap automatically as it reaches the end of the box",
+ xPos,
+ yPos,
+ boxWidth,
+ boxHeight
+ );
+ p5.noFill();
+ p5.stroke("red");
+ p5.rect(bb.x, bb.y, bb.w, bb.h);
+ p5.pop();
+
+ screenshot();
+ });
+ }
+ );
+
+ visualTest(
+ "all alignments with multi-lines and wrap char",
+ async function (p5, screenshot) {
+ const alignments = [
+ { alignX: p5.LEFT, alignY: p5.TOP },
+ { alignX: p5.CENTER, alignY: p5.TOP },
+ { alignX: p5.RIGHT, alignY: p5.TOP },
+ { alignX: p5.LEFT, alignY: p5.CENTER },
+ { alignX: p5.CENTER, alignY: p5.CENTER },
+ { alignX: p5.RIGHT, alignY: p5.CENTER },
+ { alignX: p5.LEFT, alignY: p5.BOTTOM },
+ { alignX: p5.CENTER, alignY: p5.BOTTOM },
+ { alignX: p5.RIGHT, alignY: p5.BOTTOM },
+ ];
+
+ p5.createCanvas(150, 100, mode === 'webgl' ? p5.WEBGL : undefined);
+ if (mode === 'webgl') p5.translate(-p5.width/2, -p5.height/2);
+ p5.textSize(20);
+ p5.textWrap(p5.CHAR);
+ const font = await p5.loadFont(
+ '/unit/assets/Inconsolata-Bold.ttf'
+ );
+ p5.textFont(font);
+
+ let xPos = 20;
+ let yPos = 20;
+ const boxWidth = 100;
+ const boxHeight = 60;
+
+ alignments.forEach((alignment, i) => {
+ p5.background(255);
+ p5.push();
+ p5.textAlign(alignment.alignX, alignment.alignY);
+
+ p5.noFill();
+ p5.strokeWeight(2);
+ p5.stroke(200);
+ p5.rect(xPos, yPos, boxWidth, boxHeight);
+
+ p5.fill(0);
+ p5.noStroke();
+ p5.text(
+ "A really long text that should wrap automatically as it reaches the end of the box",
+ xPos,
+ yPos,
+ boxWidth,
+ boxHeight
+ );
+ const bb = p5.textBounds(
+ "A really long text that should wrap automatically as it reaches the end of the box",
+ xPos,
+ yPos,
+ boxWidth,
+ boxHeight
+ );
+ p5.noFill();
+ p5.stroke("red");
+ p5.rect(bb.x, bb.y, bb.w, bb.h);
+ p5.pop();
+
+ screenshot();
+ });
+ }
+ );
+
+ visualTest(
+ "all alignments with multi-line manual text",
+ async function (p5, screenshot) {
+ const alignments = [
+ { alignX: p5.LEFT, alignY: p5.TOP },
+ { alignX: p5.CENTER, alignY: p5.TOP },
+ { alignX: p5.RIGHT, alignY: p5.TOP },
+ { alignX: p5.LEFT, alignY: p5.CENTER },
+ { alignX: p5.CENTER, alignY: p5.CENTER },
+ { alignX: p5.RIGHT, alignY: p5.CENTER },
+ { alignX: p5.LEFT, alignY: p5.BOTTOM },
+ { alignX: p5.CENTER, alignY: p5.BOTTOM },
+ { alignX: p5.RIGHT, alignY: p5.BOTTOM },
+ ];
+
+ p5.createCanvas(150, 100, mode === 'webgl' ? p5.WEBGL : undefined);
+ if (mode === 'webgl') p5.translate(-p5.width/2, -p5.height/2);
+ p5.textSize(20);
+
+ const font = await p5.loadFont(
+ '/unit/assets/Inconsolata-Bold.ttf'
+ );
+ p5.textFont(font);
+
+ let xPos = 20;
+ let yPos = 20;
+ const boxWidth = 100;
+ const boxHeight = 60;
+
+ alignments.forEach((alignment, i) => {
+ p5.background(255);
+ p5.push();
+ p5.textAlign(alignment.alignX, alignment.alignY);
+
+ p5.noFill();
+ p5.stroke(200);
+ p5.strokeWeight(2);
+ p5.rect(xPos, yPos, boxWidth, boxHeight);
+
+ p5.fill(0);
+ p5.noStroke();
+ p5.text("Line 1\nLine 2\nLine 3", xPos, yPos, boxWidth, boxHeight);
+ const bb = p5.textBounds(
+ "Line 1\nLine 2\nLine 3",
+ xPos,
+ yPos,
+ boxWidth,
+ boxHeight
+ );
+ p5.noFill();
+ p5.stroke("red");
+ p5.rect(bb.x, bb.y, bb.w, bb.h);
+ p5.pop();
+
+ screenshot();
+ });
+ }
+ );
+ });
+ }
});
visualSuite("textStyle", function () {
@@ -543,4 +573,4 @@ visualSuite("Typography", function () {
screenshot();
});
});
-});
+}, { shiftThreshold: 3 });
diff --git a/test/unit/visual/cases/webgl.js b/test/unit/visual/cases/webgl.js
index 14d354d500..bf112aab2a 100644
--- a/test/unit/visual/cases/webgl.js
+++ b/test/unit/visual/cases/webgl.js
@@ -562,4 +562,48 @@ visualSuite('WebGL', function() {
screenshot();
});
});
+
+ visualSuite('buildGeometry()', () => {
+ visualTest('can draw models', (p5, screenshot) => {
+ p5.createCanvas(50, 50, p5.WEBGL);
+
+ const sphere = p5.buildGeometry(() => {
+ p5.scale(0.25);
+ p5.sphere();
+ });
+
+ const geom = p5.buildGeometry(() => {
+ p5.model(sphere);
+ });
+
+ p5.background(255);
+ p5.lights();
+ p5.model(geom);
+ screenshot();
+ });
+
+ visualTest('only fills set in buildGeometry are kept', (p5, screenshot) => {
+ p5.createCanvas(50, 50, p5.WEBGL);
+
+ const geom = p5.buildGeometry(() => {
+ p5.push();
+ p5.translate(-p5.width*0.2, 0);
+ p5.scale(0.15);
+ p5.sphere();
+ p5.pop();
+
+ p5.push();
+ p5.fill('red');
+ p5.translate(p5.width*0.2, 0);
+ p5.scale(0.15);
+ p5.sphere();
+ p5.pop();
+ });
+
+ p5.fill('blue');
+ p5.noStroke();
+ p5.model(geom);
+ screenshot();
+ });
+ });
});
diff --git a/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing closed curves/000.png b/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing closed curves/000.png
index 9260c77d47..80536c3fec 100644
Binary files a/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing closed curves/000.png and b/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing closed curves/000.png differ
diff --git a/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing simple closed curves/000.png b/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing simple closed curves/000.png
new file mode 100644
index 0000000000..feca4096f6
Binary files /dev/null and b/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing simple closed curves/000.png differ
diff --git a/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing simple closed curves/metadata.json b/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing simple closed curves/metadata.json
new file mode 100644
index 0000000000..2d4bfe30da
--- /dev/null
+++ b/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing simple closed curves/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 1
+}
\ No newline at end of file
diff --git a/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing with curves with tightness/000.png b/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing with curves with tightness/000.png
index 593867d9c8..36ee10117a 100644
Binary files a/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing with curves with tightness/000.png and b/test/unit/visual/screenshots/Shape drawing/2D mode/Drawing with curves with tightness/000.png differ
diff --git a/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing closed curves/000.png b/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing closed curves/000.png
index 3a361da3d2..3342850bbc 100644
Binary files a/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing closed curves/000.png and b/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing closed curves/000.png differ
diff --git a/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing simple closed curves/000.png b/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing simple closed curves/000.png
new file mode 100644
index 0000000000..fb77dde4ed
Binary files /dev/null and b/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing simple closed curves/000.png differ
diff --git a/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing simple closed curves/metadata.json b/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing simple closed curves/metadata.json
new file mode 100644
index 0000000000..2d4bfe30da
--- /dev/null
+++ b/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing simple closed curves/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 1
+}
\ No newline at end of file
diff --git a/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing with curves with tightness/000.png b/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing with curves with tightness/000.png
index 8d123f745f..e9b6d00541 100644
Binary files a/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing with curves with tightness/000.png and b/test/unit/visual/screenshots/Shape drawing/WebGL mode/Drawing with curves with tightness/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/000.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/000.png
new file mode 100644
index 0000000000..65fe692c5f
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/001.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/001.png
new file mode 100644
index 0000000000..cd50d79636
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/002.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/002.png
new file mode 100644
index 0000000000..5cc24cf1e8
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/003.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/003.png
new file mode 100644
index 0000000000..46668250ed
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/004.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/004.png
new file mode 100644
index 0000000000..47dc26976f
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/005.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/005.png
new file mode 100644
index 0000000000..c6bc09365c
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/006.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/006.png
new file mode 100644
index 0000000000..0b478046d5
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/007.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/007.png
new file mode 100644
index 0000000000..8166bd360e
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/008.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/008.png
new file mode 100644
index 0000000000..0084c70136
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/metadata.json
similarity index 100%
rename from test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/metadata.json
rename to test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-line manual text/metadata.json
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/000.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/000.png
new file mode 100644
index 0000000000..8c532567f2
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/001.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/001.png
new file mode 100644
index 0000000000..8c532567f2
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/002.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/002.png
new file mode 100644
index 0000000000..8c532567f2
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/003.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/003.png
new file mode 100644
index 0000000000..aa31ca421c
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/004.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/004.png
new file mode 100644
index 0000000000..aa31ca421c
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/005.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/005.png
new file mode 100644
index 0000000000..aa31ca421c
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/006.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/006.png
new file mode 100644
index 0000000000..24c31bf9f0
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/007.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/007.png
new file mode 100644
index 0000000000..24c31bf9f0
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/008.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/008.png
new file mode 100644
index 0000000000..24c31bf9f0
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/metadata.json
similarity index 100%
rename from test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/metadata.json
rename to test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap char/metadata.json
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/000.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/000.png
new file mode 100644
index 0000000000..625cff297e
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/001.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/001.png
new file mode 100644
index 0000000000..0c8e6cc5f4
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/002.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/002.png
new file mode 100644
index 0000000000..107b414cf1
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/003.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/003.png
new file mode 100644
index 0000000000..66b399acab
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/004.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/004.png
new file mode 100644
index 0000000000..b7c16ef103
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/005.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/005.png
new file mode 100644
index 0000000000..13d890b939
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/006.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/006.png
new file mode 100644
index 0000000000..998744baee
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/007.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/007.png
new file mode 100644
index 0000000000..88b1067dae
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/008.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/008.png
new file mode 100644
index 0000000000..e8ec79f527
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/metadata.json
similarity index 100%
rename from test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/metadata.json
rename to test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with multi-lines and wrap word/metadata.json
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/000.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/000.png
new file mode 100644
index 0000000000..12ef9095ea
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/001.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/001.png
new file mode 100644
index 0000000000..b15fc433da
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/002.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/002.png
new file mode 100644
index 0000000000..167a0e0b89
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/003.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/003.png
new file mode 100644
index 0000000000..0a6d247b8f
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/004.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/004.png
new file mode 100644
index 0000000000..2cede116be
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/005.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/005.png
new file mode 100644
index 0000000000..5b8e47a3fb
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/006.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/006.png
new file mode 100644
index 0000000000..b073f4f280
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/007.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/007.png
new file mode 100644
index 0000000000..31ff320e6d
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/008.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/008.png
new file mode 100644
index 0000000000..a28d50a1a7
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/metadata.json
similarity index 100%
rename from test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/metadata.json
rename to test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single line/metadata.json
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/000.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/000.png
new file mode 100644
index 0000000000..17cd52e212
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/001.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/001.png
new file mode 100644
index 0000000000..73543ad5ca
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/002.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/002.png
new file mode 100644
index 0000000000..950fed450f
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/003.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/003.png
new file mode 100644
index 0000000000..0a0cf124ca
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/004.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/004.png
new file mode 100644
index 0000000000..291357ab16
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/005.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/005.png
new file mode 100644
index 0000000000..1550ac57ec
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/006.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/006.png
new file mode 100644
index 0000000000..be4b764ade
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/007.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/007.png
new file mode 100644
index 0000000000..146c39bbd9
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/008.png b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/008.png
new file mode 100644
index 0000000000..537831c815
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/metadata.json
similarity index 100%
rename from test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/metadata.json
rename to test/unit/visual/screenshots/Typography/textAlign/2d mode/all alignments with single word/metadata.json
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/000.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/000.png
deleted file mode 100644
index 405ffd2249..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/000.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/001.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/001.png
deleted file mode 100644
index 4b26841128..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/001.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/002.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/002.png
deleted file mode 100644
index 8e906c72f4..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/002.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/003.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/003.png
deleted file mode 100644
index 9bc8ab64d6..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/003.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/004.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/004.png
deleted file mode 100644
index 0236f7df2a..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/004.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/005.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/005.png
deleted file mode 100644
index 9ee9f49dc4..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/005.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/006.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/006.png
deleted file mode 100644
index 0ef34ba8ec..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/006.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/007.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/007.png
deleted file mode 100644
index 7e95f34fe4..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/007.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/008.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/008.png
deleted file mode 100644
index 6daa6ae1c6..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-line manual text/008.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/000.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/000.png
deleted file mode 100644
index 20ab4c025a..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/000.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/001.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/001.png
deleted file mode 100644
index 76ba8db037..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/001.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/002.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/002.png
deleted file mode 100644
index 40eda0c1f7..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/002.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/003.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/003.png
deleted file mode 100644
index eda083ec24..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/003.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/004.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/004.png
deleted file mode 100644
index f251dc928f..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/004.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/005.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/005.png
deleted file mode 100644
index faefb039b6..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/005.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/006.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/006.png
deleted file mode 100644
index 7837c2c495..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/006.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/007.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/007.png
deleted file mode 100644
index 0ba619dc0a..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/007.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/008.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/008.png
deleted file mode 100644
index 1b1861fa7e..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap char/008.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/000.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/000.png
deleted file mode 100644
index d8a0da4b85..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/000.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/001.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/001.png
deleted file mode 100644
index 1c540c99dc..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/001.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/002.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/002.png
deleted file mode 100644
index 92e32adce1..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/002.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/003.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/003.png
deleted file mode 100644
index e9bdde8ff1..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/003.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/004.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/004.png
deleted file mode 100644
index fcf4642cd1..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/004.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/005.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/005.png
deleted file mode 100644
index 484c4b634e..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/005.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/006.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/006.png
deleted file mode 100644
index 6804067da3..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/006.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/007.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/007.png
deleted file mode 100644
index 56dec541d8..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/007.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/008.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/008.png
deleted file mode 100644
index 5ab23c9c77..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with multi-lines and wrap word/008.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/000.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/000.png
deleted file mode 100644
index 0879a4c9b6..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/000.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/001.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/001.png
deleted file mode 100644
index 1ebfd9099d..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/001.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/002.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/002.png
deleted file mode 100644
index 3c54c775a6..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/002.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/003.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/003.png
deleted file mode 100644
index e9a560412e..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/003.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/004.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/004.png
deleted file mode 100644
index 63415e8e91..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/004.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/005.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/005.png
deleted file mode 100644
index de2df43fd0..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/005.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/006.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/006.png
deleted file mode 100644
index ff0525cf0b..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/006.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/007.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/007.png
deleted file mode 100644
index 67d7f637f0..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/007.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/008.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/008.png
deleted file mode 100644
index f039042b66..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single line/008.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/000.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/000.png
deleted file mode 100644
index 78d8d75e8f..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/000.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/001.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/001.png
deleted file mode 100644
index a897b53e4c..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/001.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/002.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/002.png
deleted file mode 100644
index 0a04e5faaa..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/002.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/003.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/003.png
deleted file mode 100644
index 4267318db5..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/003.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/004.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/004.png
deleted file mode 100644
index ec17f3e0ec..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/004.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/005.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/005.png
deleted file mode 100644
index cafd2ae4f6..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/005.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/006.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/006.png
deleted file mode 100644
index 5b6f270828..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/006.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/007.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/007.png
deleted file mode 100644
index 9b5098b9fe..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/007.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/008.png b/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/008.png
deleted file mode 100644
index b2a0aca247..0000000000
Binary files a/test/unit/visual/screenshots/Typography/textAlign/all alignments with single word/008.png and /dev/null differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/000.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/000.png
new file mode 100644
index 0000000000..339f1bd5d0
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/001.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/001.png
new file mode 100644
index 0000000000..90698c7f28
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/002.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/002.png
new file mode 100644
index 0000000000..a5a9490fe8
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/003.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/003.png
new file mode 100644
index 0000000000..1a9a110c48
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/004.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/004.png
new file mode 100644
index 0000000000..493cc85c51
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/005.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/005.png
new file mode 100644
index 0000000000..1524a41e81
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/006.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/006.png
new file mode 100644
index 0000000000..8e34453dbb
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/007.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/007.png
new file mode 100644
index 0000000000..b75b92977d
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/008.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/008.png
new file mode 100644
index 0000000000..12020de4a6
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/metadata.json
new file mode 100644
index 0000000000..5147b8612d
--- /dev/null
+++ b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-line manual text/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 9
+}
\ No newline at end of file
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/000.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/000.png
new file mode 100644
index 0000000000..a85c0d7e3f
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/001.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/001.png
new file mode 100644
index 0000000000..a85c0d7e3f
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/002.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/002.png
new file mode 100644
index 0000000000..a85c0d7e3f
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/003.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/003.png
new file mode 100644
index 0000000000..d3986bad49
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/004.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/004.png
new file mode 100644
index 0000000000..d3986bad49
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/005.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/005.png
new file mode 100644
index 0000000000..d3986bad49
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/006.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/006.png
new file mode 100644
index 0000000000..75490d5dad
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/007.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/007.png
new file mode 100644
index 0000000000..75490d5dad
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/008.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/008.png
new file mode 100644
index 0000000000..75490d5dad
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/metadata.json
new file mode 100644
index 0000000000..5147b8612d
--- /dev/null
+++ b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap char/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 9
+}
\ No newline at end of file
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/000.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/000.png
new file mode 100644
index 0000000000..f571f42148
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/001.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/001.png
new file mode 100644
index 0000000000..462e6e8df6
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/002.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/002.png
new file mode 100644
index 0000000000..496c73d326
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/003.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/003.png
new file mode 100644
index 0000000000..2b72b85b6c
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/004.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/004.png
new file mode 100644
index 0000000000..174c540232
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/005.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/005.png
new file mode 100644
index 0000000000..3f4b37651c
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/006.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/006.png
new file mode 100644
index 0000000000..e2fe3738a2
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/007.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/007.png
new file mode 100644
index 0000000000..465d86afba
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/008.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/008.png
new file mode 100644
index 0000000000..e7987b1e45
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/metadata.json
new file mode 100644
index 0000000000..5147b8612d
--- /dev/null
+++ b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with multi-lines and wrap word/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 9
+}
\ No newline at end of file
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/000.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/000.png
new file mode 100644
index 0000000000..5f67b23cd0
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/001.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/001.png
new file mode 100644
index 0000000000..2d80d846ad
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/002.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/002.png
new file mode 100644
index 0000000000..9ee769a72c
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/003.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/003.png
new file mode 100644
index 0000000000..4929fd0907
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/004.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/004.png
new file mode 100644
index 0000000000..99f991da03
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/005.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/005.png
new file mode 100644
index 0000000000..c50b267675
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/006.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/006.png
new file mode 100644
index 0000000000..f2ea8e27ca
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/007.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/007.png
new file mode 100644
index 0000000000..846a1bf51a
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/008.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/008.png
new file mode 100644
index 0000000000..5cc2a7fea3
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/metadata.json
new file mode 100644
index 0000000000..5147b8612d
--- /dev/null
+++ b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single line/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 9
+}
\ No newline at end of file
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/000.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/000.png
new file mode 100644
index 0000000000..23f2678a80
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/000.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/001.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/001.png
new file mode 100644
index 0000000000..4931c86268
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/001.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/002.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/002.png
new file mode 100644
index 0000000000..b321783592
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/002.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/003.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/003.png
new file mode 100644
index 0000000000..f4be694605
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/003.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/004.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/004.png
new file mode 100644
index 0000000000..0e5b6b0a03
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/004.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/005.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/005.png
new file mode 100644
index 0000000000..4638c4b353
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/005.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/006.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/006.png
new file mode 100644
index 0000000000..52c39dadb4
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/006.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/007.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/007.png
new file mode 100644
index 0000000000..0bf414478d
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/007.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/008.png b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/008.png
new file mode 100644
index 0000000000..aba3082227
Binary files /dev/null and b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/008.png differ
diff --git a/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/metadata.json b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/metadata.json
new file mode 100644
index 0000000000..5147b8612d
--- /dev/null
+++ b/test/unit/visual/screenshots/Typography/textAlign/webgl mode/all alignments with single word/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 9
+}
\ No newline at end of file
diff --git a/test/unit/visual/screenshots/WebGL/buildGeometry()/can draw models/000.png b/test/unit/visual/screenshots/WebGL/buildGeometry()/can draw models/000.png
new file mode 100644
index 0000000000..777ade92ce
Binary files /dev/null and b/test/unit/visual/screenshots/WebGL/buildGeometry()/can draw models/000.png differ
diff --git a/test/unit/visual/screenshots/WebGL/buildGeometry()/can draw models/metadata.json b/test/unit/visual/screenshots/WebGL/buildGeometry()/can draw models/metadata.json
new file mode 100644
index 0000000000..2d4bfe30da
--- /dev/null
+++ b/test/unit/visual/screenshots/WebGL/buildGeometry()/can draw models/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 1
+}
\ No newline at end of file
diff --git a/test/unit/visual/screenshots/WebGL/buildGeometry()/only fills set in buildGeometry are kept/000.png b/test/unit/visual/screenshots/WebGL/buildGeometry()/only fills set in buildGeometry are kept/000.png
new file mode 100644
index 0000000000..24ac984988
Binary files /dev/null and b/test/unit/visual/screenshots/WebGL/buildGeometry()/only fills set in buildGeometry are kept/000.png differ
diff --git a/test/unit/visual/screenshots/WebGL/buildGeometry()/only fills set in buildGeometry are kept/metadata.json b/test/unit/visual/screenshots/WebGL/buildGeometry()/only fills set in buildGeometry are kept/metadata.json
new file mode 100644
index 0000000000..2d4bfe30da
--- /dev/null
+++ b/test/unit/visual/screenshots/WebGL/buildGeometry()/only fills set in buildGeometry are kept/metadata.json
@@ -0,0 +1,3 @@
+{
+ "numScreenshots": 1
+}
\ No newline at end of file
diff --git a/test/unit/visual/visualTest.js b/test/unit/visual/visualTest.js
index 4e77574c6c..068e8c7247 100644
--- a/test/unit/visual/visualTest.js
+++ b/test/unit/visual/visualTest.js
@@ -8,11 +8,6 @@ const { readFile, writeFile } = server.commands
// based on antialiasing.
const COLOR_THRESHOLD = 25;
-// By how many pixels can the snapshot shift? This is
-// often useful to accommodate different text rendering
-// across environments.
-const SHIFT_THRESHOLD = 3;
-
// The max side length to shrink test images down to before
// comparing, for performance.
const MAX_SIDE = 50;
@@ -39,6 +34,11 @@ function escapeName(name) {
let namePrefix = '';
+// By how many pixels can the snapshot shift? This is
+// often useful to accommodate different text rendering
+// across environments.
+let shiftThreshold = 2;
+
/**
* A helper to define a category of visual tests.
*
@@ -51,7 +51,7 @@ let namePrefix = '';
export function visualSuite(
name,
callback,
- { focus = false, skip = false } = {}
+ { focus = false, skip = false, shiftThreshold: newShiftThreshold } = {}
) {
let suiteFn = describe;
if (focus) {
@@ -61,11 +61,16 @@ export function visualSuite(
suiteFn = suiteFn.skip;
}
suiteFn(name, () => {
+ let lastShiftThreshold
let lastPrefix;
let lastDeviceRatio = window.devicePixelRatio;
beforeAll(() => {
lastPrefix = namePrefix;
namePrefix += escapeName(name) + '/';
+ lastShiftThreshold = shiftThreshold;
+ if (newShiftThreshold !== undefined) {
+ shiftThreshold = newShiftThreshold
+ }
// Force everything to be 1x
window.devicePixelRatio = 1;
@@ -76,6 +81,7 @@ export function visualSuite(
afterAll(() => {
namePrefix = lastPrefix;
window.devicePixelRatio = lastDeviceRatio;
+ shiftThreshold = lastShiftThreshold;
});
});
}
@@ -109,7 +115,7 @@ export async function checkMatch(actual, expected, p5) {
cnv.image(actual, 0, 0);
cnv.blendMode(DIFFERENCE);
cnv.image(expectedWithBg, 0, 0);
- for (let i = 0; i < SHIFT_THRESHOLD; i++) {
+ for (let i = 0; i < shiftThreshold; i++) {
cnv.filter(ERODE, false);
}
const diff = cnv.get();
diff --git a/utils/convert.js b/utils/convert.js
index d3b5722bc4..a92049298a 100644
--- a/utils/convert.js
+++ b/utils/convert.js
@@ -69,8 +69,7 @@ function typeObject(node) {
const { type: typeName } = typeObject(node.expression);
if (
typeName === 'Array' &&
- node.applications.length === 1 &&
- node.applications[0].type === 'NameExpression'
+ node.applications.length === 1
) {
return {
type: `${typeObject(node.applications[0]).type}[]`
@@ -78,10 +77,18 @@ function typeObject(node) {
}
const args = node.applications.map(n => typeObject(n).type);
return {
- type: `${typeName}<${args.join(', ')}>`
+ type: `${typeName}<${args.join(', ')}>`
};
} else if (node.type === 'UndefinedLiteral') {
return { type: 'undefined' };
+ } else if (node.type === 'FunctionType') {
+ let signature = `function(${node.params.map(p => typeObject(p).type).join(', ')})`;
+ if (node.result) {
+ signature += `: ${typeObject(node.result).type}`;
+ }
+ return { type: signature };
+ } else if (node.type === 'ArrayType') {
+ return { type: `[${node.elements.map(e => typeObject(e).type).join(', ')}]` };
} else {
// TODO
// - handle record types
@@ -192,7 +199,11 @@ function getModuleInfo(entry) {
const entryForTagValue = entryForTag && entryForTag.description;
const file = entry.context.file;
let { module, submodule, for: forEntry } = fileModuleInfo[file] || {};
- forEntry = entry.memberof || entryForTagValue || forEntry;
+ let memberof = entry.memberof;
+ if (memberof && memberof !== 'p5' && !memberof.startsWith('p5.')) {
+ memberof = 'p5.' + memberof;
+ }
+ forEntry = memberof || entryForTagValue || forEntry;
return { module, submodule, forEntry };
}
@@ -335,7 +346,10 @@ for (const entry of allData) {
const { module, submodule, forEntry } = getModuleInfo(entry);
const propTag = entry.tags.find(tag => tag.title === 'property');
const forTag = entry.tags.find(tag => tag.title === 'for');
- const memberof = entry.memberof;
+ let memberof = entry.memberof;
+ if (memberof && memberof !== 'p5' && !memberof.startsWith('p5.')) {
+ memberof = 'p5.' + memberof;
+ }
if (!propTag || (!forEntry && !forTag && !memberof)) continue;
const forName = memberof || (forTag && forTag.description) || forEntry;
@@ -379,14 +393,19 @@ for (const entry of allData) {
if (entry.kind === 'function' && entry.properties.length === 0) {
const { module, submodule, forEntry } = getModuleInfo(entry);
+ let memberof = entry.memberof;
+ if (memberof && memberof !== 'p5' && !memberof.startsWith('p5.')) {
+ memberof = 'p5.' + memberof;
+ }
+
// Ignore functions that aren't methods
if (entry.tags.some(tag => tag.title === 'function')) continue;
// If a previous version of this same method exists, then this is probably
// an overload on that method
- const prevItem = (classMethods[entry.memberof] || {})[entry.name] || {};
+ const prevItem = (classMethods[memberof] || {})[entry.name] || {};
- const className = entry.memberof || prevItem.class || forEntry;
+ const className = memberof || prevItem.class || forEntry;
// Ignore methods of private classes
if (!converted.classes[className]) continue;
@@ -442,8 +461,8 @@ for (const entry of allData) {
submodule
};
- classMethods[entry.memberof] = classMethods[entry.memberof] || {};
- classMethods[entry.memberof][entry.name] = item;
+ classMethods[memberof] = classMethods[memberof] || {};
+ classMethods[memberof][entry.name] = item;
}
}
for (const className in classMethods) {