clear()

Description

Clear the canvas from all drawn objects, with the ability to keep the background. Shorthand method for the clear() method in the draw module.

Arguments

keepBackground : Boolean

True if the background should be kept, and false if everything should be cleared.

Return Value

Core. Returns the core instance itself.

Examples

Example 1

First we create an instance of the core object. Then we create two rectangles and add them to the canvas. Finally we add event listeners that will clear the canvas when clicked. Left button keeps the background and the right button clears everything. Reload the output to try again.