I wrote a function whose purpose is to re-draw a square line block (which cover whole page) every time when the window size is changed.
The problem is that
bgCtx.clearRect(0, 0, bgCtx.width, bgCtx.height);
didn't work for me: As my Chrome browser size changed, the previous red lines does not clear as I thought.
reproduced screenshot: http://i.imgur.com/6aePMLm.png
I tried browse other answered questions, some of their cases are missing bgCtx.beginPath();
but I did include it, and bgCtx.width = bgCtx.width;
doesn't work, either, am I missing something or anything wrong?
Any suggestion would be appreciated :)
You're creating a new canvas element on every draw()
. Fiddle
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.