(p5, fn)
| 8 | import { RGB, RGBHDR, HSL, HSB, HWB, LAB, LCH, OKLAB, OKLCH } from './creating_reading'; |
| 9 | |
| 10 | function setting(p5, fn){ |
| 11 | /** |
| 12 | * Starts defining a shape that will mask any shapes drawn afterward. |
| 13 | * |
| 14 | * Any shapes drawn between `beginClip()` and |
| 15 | * <a href="#/p5/endClip">endClip()</a> will add to the mask shape. The mask |
| 16 | * will apply to anything drawn after <a href="#/p5/endClip">endClip()</a>. |
| 17 | * |
| 18 | * The parameter, `options`, is optional. If an object with an `invert` |
| 19 | * property is passed, as in `beginClip({ invert: true })`, it will be used to |
| 20 | * set the masking mode. `{ invert: true }` inverts the mask, creating holes |
| 21 | * in shapes that are masked. `invert` is `false` by default. |
| 22 | * |
| 23 | * Masks can be contained between the |
| 24 | * <a href="#/p5/push">push()</a> and <a href="#/p5/pop">pop()</a> functions. |
| 25 | * Doing so allows unmasked shapes to be drawn after masked shapes. |
| 26 | * |
| 27 | * Masks can also be defined in a callback function that's passed to |
| 28 | * <a href="#/p5/clip">clip()</a>. |
| 29 | * |
| 30 | * @method beginClip |
| 31 | * @param {Object} [options] an object containing clip settings. |
| 32 | * @param {Boolean} [options.invert=false] Whether or not to invert the mask. |
| 33 | * |
| 34 | * @example |
| 35 | * function setup() { |
| 36 | * createCanvas(100, 100); |
| 37 | * |
| 38 | * background(200); |
| 39 | * |
| 40 | * // Create a mask. |
| 41 | * beginClip(); |
| 42 | * triangle(15, 37, 30, 13, 43, 37); |
| 43 | * circle(45, 45, 7); |
| 44 | * endClip(); |
| 45 | * |
| 46 | * // Draw a backing shape. |
| 47 | * square(5, 5, 45); |
| 48 | * |
| 49 | * describe('A white triangle and circle on a gray background.'); |
| 50 | * } |
| 51 | * |
| 52 | * @example |
| 53 | * function setup() { |
| 54 | * createCanvas(100, 100); |
| 55 | * |
| 56 | * background(200); |
| 57 | * |
| 58 | * // Create an inverted mask. |
| 59 | * beginClip({ invert: true }); |
| 60 | * triangle(15, 37, 30, 13, 43, 37); |
| 61 | * circle(45, 45, 7); |
| 62 | * endClip(); |
| 63 | * |
| 64 | * // Draw a backing shape. |
| 65 | * square(5, 5, 45); |
| 66 | * |
| 67 | * describe('A white square at the top-left corner of a gray square. The white square has a triangle and a circle cut out of it.'); |
no test coverage detected