Tuesday, 26 March 2019

globalCompositeOperation

On many of the demoscreens I have written, in order to achieve the various effects, I use a command called globalCompositeOperation.

We can not only draw new shapes behind existing shapes but we can also use it to mask off certain areas, clear sections from the canvas (not limited to rectangles or simple shapes) and more.

globalCompositeOperation = type

This sets the type of compositing operation to apply when drawing new shapes, where type is a string identifying which of the twelve compositing operations to use.

If you goto the link below, the various types of operation can be tested and seen in use.
http://codef.namwollem.co.uk/TUTORIALS/ctx_globalComposite.html


No comments:

Post a comment