cancelAnimationFrame does not clean my canvas

0

Inside this canvas

<canvas id="canvas" class="canvas" width="300" height="300"></canvas>

Have this feature

var estado = false;
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext("2d");
function frame(){
  actualizar();
  coliciones();
  dibujar();
  bucle = requestAnimationFrame(frame);

}

function startStop(){
  if (!estado) {
    estado = true;
    frame();
      console.log('game init :'+estado);
  }else {
    estado = false;
    cancelAnimationFrame(bucle);
    console.log('game estatus :'+estado);
  }

but cancelAnimationFrame does not delete or clear my canvas. But if I'm receiving the log's from my console, could someone tell me if I do something wrong?

    
asked by E.Rawrdríguez.Ophanim 30.11.2018 в 21:25
source

0 answers