Reference beginClip()

beginClip()

Starts defining a shape that will mask any shapes drawn afterward.

Any shapes drawn between beginClip() and endClip() will add to the mask shape. The mask will apply to anything drawn after endClip().

The parameter, options, is optional. If an object with an invert property is passed, as in beginClip({ invert: true }), it will be used to set the masking mode. { invert: true } inverts the mask, creating holes in shapes that are masked. invert is false by default.

Masks can be contained between the push() and pop() functions. Doing so allows unmasked shapes to be drawn after masked shapes.

Masks can also be defined in a callback function that's passed to clip().

Examples

Syntax

beginClip([options])

Parameters

options

an object containing clip settings.

Notice any errors or typos? Please let us know. Please feel free to edit src/color/setting.js and open a pull request!

Related References