Languages
[Edit]
EN

JavaScript - how to clear canvas with specific color?

6 points
Created by:
Root-ssh
178290

In this article, we would like to show how to clear canvas element using specific color in JavaScript.

To clear canvas with specific color it is necessary to use fillRect() function.

Quick solution:

 

Reusable function

Edit

Practical example

Edit

 

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

JavaScript - HTML5 canvas tutorial

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join