QClean and lock / unlock button

Hello, how do I clean the screen (which is drawn) with a button?
Also would like to know how I can do through a button, to lock the painting and through the same button unlock...
I'm sorry for my english

Sample Code

AAnswer to: Clean and lock / unlock button


Hey, that coe just uses another canvas as a texture. To clear the canvas, you could just reset its width, like so:

canvas.width = canvas.width;

and then mark the texture for update:

texture.needsUpdate = true;

edited: ok, width = width does clear it to black, but since it was pale blue originally you don't want that; I have added the fork that does what you really want.


Nice to be visiting your blog once more, it has been months for me. Well this article that ive been waited for therefore long. i want this article to finish my assignment within the faculty, and it has same topic together with your article. Thanks, nice share.
Omaha SEO


I admit, I have not been on this web page in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. professionals. I thank you to help making people more aware of possible issues.

Post a question

You can post JavaScript, HTML, CSS related questions with attached reference to actual codes and get the answers likewise.

Ask a question

  • 1. Click the ‘Post a question’ above

  • 2. Enter question details, reference code, and click ‘Add question’ button

  • 3. Question will be paired with the code on display

Add an answer

  • 1. Choose a question

  • 2. Enter answer details, attach the reference code and click ‘add answer’ button

  • 3. Your answer will accompanied with attached code