Updating Canvas content on onmouseover and onmouseout -


i'm working on creating game using html5 , in work i'm update canvas content based on onmouseover , onmouseout . on onmouseover i'm doing

                    cxt.beginpath();                     cxt.moveto(10, 10);                     cxt.lineto(40, 40);                     cxt.moveto(40, 10);                     cxt.lineto(10, 40);                     cxt.stroke();                     cxt.closepath();                     content[canvasnumber - 1] = 'value'; 

now , on onmouseout event want clear content of canvas without overriding current content !!, how can ?!

i think know mean, have little more careful language. say:

without overriding current content !!

but x drew is current content! think meant "without clearing content there before".

of course we'll try our hardest answer questions, please try hard use exact , careful language when asking them. english might not first language, , speak better speak second language, if you're not sure of words, if have same thing in few different ways, more language worth sure understand.

thanks! onto answer now.


if want clear x without overriding content there before, have save content there before.

to save canvas bitmap can use what's called "in-memory canvas" or "offscreen canvas." make these using document.createelement , never adding them dom

here's code example of saving bitmap when mouseover occurs , restoring bitmap when mouseout occurs:

http://jsfiddle.net/simonsarris/urxen/


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -