[help] automatic clear command on drawing

I have a pencil attached with drawing script, I want after draw something, the picture get cleared automatically like the big pencil on leoburnett.ca website
Please someone suggest me how to write the script. Thankyou all

daynie