Javascript noFill

// Define a function called noFill
function noFill(){
    // Set fill to none
    ctx.fillStyle = "none";
    // Clear the canvas
    ctx.clearRect(0, 0, canvas.width, canvas.height);

The noFill function is a useful tool in JavaScript when creating graphics on an HTML canvas. By setting the fillStyle to "none", this function clears the canvas without affecting the current strokeStyle. This function is beneficial for creating shapes and patterns that are not filled in, such as circles or outlines of shapes. Additionally, this function can be used to create a "blank slate" in preparation for a new canvas drawing.

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]