MCPcopy
hub / github.com/processing/p5.js / background

Method background

src/core/p5.Renderer3D.js:734–758  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

732 }
733
734 background(...args) {
735 const a0 = args[0];
736
737 const isImageLike =
738 a0 != null &&
739 typeof a0 === 'object' &&
740 typeof a0.width === 'number' &&
741 typeof a0.height === 'number' &&
742 (a0.canvas != null || a0.elt != null);
743
744 // WEBGL / 3D: support background(image-like)
745 if (isImageLike) {
746 this._pInst.clear();
747 this._pInst.push();
748 this._pInst.resetMatrix();
749 this._pInst.imageMode(constants.CENTER);
750 this._pInst.image(a0, 0, 0, this._pInst.width, this._pInst.height);
751 this._pInst.pop();
752 return;
753 }
754
755 // Default: background(color)
756 const _col = this._pInst.color(...args);
757 this.clear(..._col._getRGBA());
758 }
759
760 //////////////////////////////////////////////
761 // Positioning

Callers 15

sketchFunction · 0.45
sketchFunction · 0.45
sketchFunction · 0.45
sketchFunction · 0.45
sketch.jsFile · 0.45
sketch0Function · 0.45
sketch1Function · 0.45
sketch0Function · 0.45
sketchFunction · 0.45
sketchFunction · 0.45
sketchFunction · 0.45
sketch.jsFile · 0.45

Calls 6

imageMethod · 0.80
_getRGBAMethod · 0.80
clearMethod · 0.45
pushMethod · 0.45
resetMatrixMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected