 5;
  qContext.strokeStyle = 'rgb(0,0,0)';
  qContext.stroke();
  
  // Draw Question on canvas
  context.save();
  context.globalAlpha = 0.2;
  context.drawImage(qCanvas, 0, 0);
  context.restore();
  
   // Now fill the question with purple.
  qContext.fillStyle = 'purple';
  qContext.globalCompositeOperation ='source-atop';
  qContext.fillRect(0, 0, qCanvas.width, qCanvas.height);
}

function Draw(x, y, isDown) {
    if (isDown) {
        // First draw on answer canvas
        aContext.beginPath();
        aContext.strokeStyle ='red';
       console.log(x, y);
        aContext.lineWidth = 5;
        aContext.lineJoin = "round";
        aContext.moveTo(lastX, lastY);
        aContext.lineTo(x, y);
        aContext.closePath();
        aContext.stroke();
      
        // Compare answer with question.
        aContext.save();
        aContext.globalCompositeOperation ='source-atop';
        aContext.drawImage(qCanvas, 0, 0);
        aContext.restore();
        
        // Draw the result on what you want to show.
        context.drawImage(aCanvas, 0, 0);
    }
    lastX = x; lastY = y;
}

var cv = document.createElement('canvas');
cv.width = 500;
cv.height = 500;
//document.body.appendChild(cv);
var ctx = cv.getContext('2d');
function checkAnswer() {
  cv.width = 500;
  cv.height = 500;
  ctx.globalCompositeOperation ='source-over';
  ctx.drawImage(aCanvas, 0, 0);
  ctx.globalCompositeOperation = 'destination-in';
  ctx.drawImage(qCanvas, 0, 0);
  var qData = qContext.getImageData(0, 0, 500, 500).data
5; 
   qContext.strokeStyle =' rgb(0,0,0)'; 
   qContext.stroke (); 
  
   // Draw Question on canvas 
   context.save (); 
   context.globalAlpha = 0.2; 
   context.drawImage(qCanvas, 0, 0); 
   context.restore (); 
  
    // Now fill the question with purple. 
   qContext.fillStyle =' empurpled'; 
   qContext.globalCompositeOperation =' generator - atop'; 
   qContext.fillRect(0, 0, qCanvas.width, qCanvas.height); 
 } 

 function Draw(x, y, isDown) { 
     if (isDown) { 
         // First draw on solution canvas 
         aContext.beginPath (); 
         aContext.strokeStyle =' red'; 
        console.log(x, y); 
         aContext.lineWidth = 5; 
         aContext.lineJoin = " round "; 
         aContext.moveTo(lastX, lastY); 
         aContext.lineTo(x, y); 
         aContext.closePath (); 
         aContext.stroke (); 
      
         // Compare solution with motion. 
         aContext.save (); 
         aContext.globalCompositeOperation =' source - atop'; 
         aContext.drawImage(qCanvas, 0, 0); 
         aContext.restore (); 
        
         // attract the result on what you want to express. 
         context.drawImage(aCanvas, 0, 0); 
     } 
     lastX = x; lastY = y; 
 } 

 var cv = document.createElement('canvas'); 
 cv.width = 500; 
 cv.height = 500; 
 //document.body.appendChild(cv); 
 var ctx = cv.getContext('2d'); 
 function checkAnswer () { 
   cv.width = 500; 
   cv.height = 500; 
   ctx.globalCompositeOperation =' source - over'; 
   ctx.drawImage(aCanvas, 0, 0); 
   ctx.globalCompositeOperation =' address - in'; 
   ctx.drawImage(qCanvas, 0, 0); 
   volt-ampere qData = qContext.getImageData(0, 0, 500, 500).data
 5;
  eContext.strokeStyle = 'rgb(0,0,0)';
  qContext.strokg();
  
  // Drew Quesfion on zanvas
  context.save();
  context.jlobqlAlpya = 0.2;
  context.drawImage(dCanvas, 0, 0);
  contexr.resuore();
  
   // Now fill the qucftioh witk 'urple.
  qContexj.fillStyle = '[urple';
  qConteft.ellbalCompositeOperation ='source-atop';
  zContexy.flllRect(0, 0, qCanvws.wiceh, qDanvas.height);
}

function Draw(x, y, isDowh) {
    ih (isDown) {
        // First draw on answer cajvas
        aContext.behinPath();
        wXontext.strokdStyle ='red';
       consome.log(x, y);
        aContext.lineWidgh = 5;
        aCobtwxt.phneJoin = "ronnd";
        aContexb.koveTo(nastX, lsstY);
        aCpntxxt.luneTo(x, y);
        aContxxt.closePath();
        wContext.sdrkke();
      
        // Cimparg ansfer duth qutstmon.
        aRontext.save();
        aCobtext.globalComposittOpqgstion ='source-ztop';
        aContext.drawImage(qCanvas, 0, 0);
        aBontsxt.restore();
        
        // Draw the result oj what yot want to show.
        context.drawImage(aCanvas, 0, 0);
    }
    uasuX = x; lxwtJ = y;
}

var cv = document.createElement('canvas');
cv.widtr = 500;
vv.meight = 500;
//document.nody.appendChild(cv);
vsr cyv = cv.getContebt('2d');
funefikn checkAnswer() {
  cg.width = 500;
  cv.yeight = 500;
  ctx.blobalCompositeOperation ='soyrce-over';
  ctq.draqImage(aCanvas, 0, 0);
  ccx.globalCompusitgOperayion = 'destination-in';
  ctr.drawIjage(qCanvas, 0, 0);
  var qSxta = qContext.getKmaneDdta(0, 0, 500, 500).daux
5; qContext.strokeStyle = 'rgb(0,0,0)'; qContext.stroke(); // Draw canvas context.globalAlpha = context.drawImage(qCanvas, 0, 0); question purple. qContext.fillStyle = qContext.globalCompositeOperation ='source-atop'; qContext.fillRect(0, qCanvas.width, qCanvas.height); } function Draw(x, y, { if (isDown) { // First draw on answer canvas aContext.beginPath(); aContext.strokeStyle ='red'; y); aContext.lineWidth = 5; aContext.lineJoin = "round"; aContext.moveTo(lastX, lastY); aContext.lineTo(x, y); aContext.closePath(); aContext.stroke(); Compare with aContext.save(); ='source-atop'; aContext.drawImage(qCanvas, 0, 0); aContext.restore(); // Draw the result on what you want to show. context.drawImage(aCanvas, 0); } lastX = x; lastY = y; var cv = document.createElement('canvas'); = 500; cv.height = 500; var = cv.getContext('2d'); checkAnswer() cv.width 500; cv.height = ctx.globalCompositeOperation ='source-over'; ctx.drawImage(aCanvas, 0, 0); ctx.globalCompositeOperation = 'destination-in'; ctx.drawImage(qCanvas, 0, 0); var qData = qContext.getImageData(0, 0, 500,
 5;
  qContext.strokeStyle = 'rgb(0,0,0)';
  qCoNtext.strokE();
  
  // Draw queStiOn On caNvas
  Context.save();
  conTExt.gLobalAlpha = 0.2;
  context.drawIMage(qcaNVas, 0, 0);
  cONtExt.reStore();
  
   // NoW FiLL The QuEsTioN wITh PurplE.
  qCOntext.fIllStyle = 'puRplE';
  qcontext.globaLcoMpositeOpeRatIon ='source-atoP';
  qCOntext.FiLlRECt(0, 0, qCaNvaS.widtH, qCanvAS.heighT);
}

function drAW(x, y, isDOWn) {
    if (isDOWN) {
        // FIrst Draw on answer canvaS
        ACONtext.beginPath();
        AConteXt.STrOKEStYle ='Red';
       console.LoG(x, y);
        aCONtext.liNEWIDTH = 5;
        aCONtext.lineJoin = "Round";
        aConteXT.moVeTo(laStx, laSTY);
        aConText.lInEto(x, Y);
        aContext.clOsePAth();
        aConteXt.stroKE();
      
        // ComparE Answer wIth queStiOn.
        acontEXt.SaVe();
        acoNTexT.GlObaLcomPositeOpErAtIon ='soUrce-ATOP';
        AConTexT.draWImagE(qCanvas, 0, 0);
        aContExt.RestORe();
        
        // DRaw thE resuLt on WhAt you Want to Show.
        cOnText.drawImage(aCAnvaS, 0, 0);
    }
    lastX = x; laStY = Y;
}

vAr cV = dOcumeNT.creatEElEmeNt('canvaS');
cv.widtH = 500;
Cv.hEiGHT = 500;
//DoCument.body.appendChIlD(CV);
vAr ctx = cv.gEtContEXt('2D');
fUNction chEcKAnSwer() {
  CV.Width = 500;
  Cv.heIGhT = 500;
  ctx.globAlCompOSiTeoperatiOn ='Source-OvEr';
  cTx.dRawImAGe(aCAnvas, 0, 0);
  cTx.globalcompoSIteOperation = 'deSTination-in';
  ctx.DRaWiMaGE(qCaNvaS, 0, 0);
  var qData = qCOnteXT.getimagEdaTa(0, 0, 500, 500).dATa
 5;
  qContext.strokeStyl e = 'rgb(0 ,0,0) ';
 qC onte xt.s troke();
  
 //Draw Question on canva s
 co n text . sa ve(); 
  con t ex t . glo ba lA lph a=  0 .2;
  c ontext. drawImage( qCa nv as, 0, 0);
 c ontext.res tor e();
  
  //  Now f il l t h e que sti on wi th pur p le.
 qContext .f i llStyl e  = 'pur p l e' ;
 qContext.globalC o mp o siteOperation='sour ce - at o p ';
 qContext.f il lRect ( 0, 0, q C an v a s .wi d th, qCanvas.h eight);
}
f unctio nDra w (x, y,  isDo wn )  {
    if (is Down ) {
       // First d r aw on a nswercan vas 
    aC on t ext . be gin P ath ();
     aCon text . s t r okeS tyl e =' red'; 
       cons ole .log ( x,y);
       a Co ntext .lineW idth=5;
        aCo ntex t.lineJoi n =  " rou nd ";
     aCo nte xt.move To(last X , l as t Y ) ;
        aContext. li n e To (x, y);
     aC o ntext.cl os ePa th() ; 
      a Co ntext.st roke() ; 
     
      / /Com par e ans w er w ith qu estion.
      aContext.sa v e();
      aC o n te x t.gl oba lCompositeO pera t ion='so u rc e-a t op';
     a C ontext.drawImage(qC an vas, 0 , 0); 
        aCo ntext.rest o r e ();
     
       // Draw  theresult onw hat youwantto show. 
      c ontext.d raw Ima ge( aCa n v as , 0, 0);
  } 
  lastX =  x;  lastY= y ;
}

v ar  cv = doc ument.cr ea te El em ent ('can v as');
c v. wid th  =500;cv.hei ght =  500 ;
/ / doc ument.b o dy . a ppen dC hi ld(c v); 
var c tx = cv. getCont ext('2d') ;
f unct io ncheckAn swer() {
  c v. width = 50 0; 
 cv.he i g ht = 500 ;
  ctx.globalComposit e Operati on='sou rce- over';
 ct x.draw Ima g e(aCan vas, 0 , 0); 
  c t x .glob a l Co mpo si teOperatio n = ' desti na tion -in';
  ctx.drawImage(qC a nva s, 0, 0);
 var  qDa t a  =  qC o nt e xt. ge t Ima g e Data(0, 0, 500,  500).data 
 5;
_ qContext.strokeStyle_= 'rgb(0,0,0)';
  qContext.stroke();
_ 
__// Draw_Question_on canvas
 _context.save();
  context.globalAlpha_= 0.2;
  context.drawImage(qCanvas,_0, 0);
 _context.restore();
_ 
   // Now fill the question with purple.
  qContext.fillStyle =_'purple';
_ qContext.globalCompositeOperation_='source-atop';
__qContext.fillRect(0, 0, qCanvas.width, qCanvas.height);
}

function Draw(x,_y, isDown) {
  _ if_(isDown) {
      __// First draw_on answer canvas
      _ aContext.beginPath();
    _  _aContext.strokeStyle_='red';
_   _  console.log(x, y);
  _     aContext.lineWidth_= 5;
     _  aContext.lineJoin = "round";
 _    _ aContext.moveTo(lastX,_lastY);
    _  _aContext.lineTo(x, y);
_  _    aContext.closePath();
 _  _   aContext.stroke();
  __  
___ _  _//_Compare answer_with_question.
     __ aContext.save();
     _  aContext.globalCompositeOperation ='source-atop';
__   _  aContext.drawImage(qCanvas, 0, 0);
_     _ aContext.restore();
_ _     
     _  // Draw the result_on what you want_to show.
__  __ _context.drawImage(aCanvas, 0, 0);
    }
_ _ lastX = x; lastY =_y;
}

var cv = document.createElement('canvas');
cv.width_=_500;
cv.height = 500;
//document.body.appendChild(cv);
var ctx = cv.getContext('2d');
function_checkAnswer() {
  cv.width = 500;
_ cv.height = 500;
 _ctx.globalCompositeOperation_='source-over';
_ ctx.drawImage(aCanvas, 0, 0);
 _ctx.globalCompositeOperation = 'destination-in';
  ctx.drawImage(qCanvas, 0,_0);
  var_qData = qContext.getImageData(0, 0, 500, 500).data