(...args)
| 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 |
no test coverage detected