Limpiar el canvas


/ Published in: JavaScript
Save to your folder(s)

Para limpiar o borrar una parte especifica de nuestro canvas podemos usar la función clearRect()


Copy this code and paste it in your HTML
  1. // Creamos nuestro canvas
  2. var canvas = document.getElementById("canvas");
  3. var ctx = canvas.getContext("2d");
  4.  
  5. // Borramos el área que nos interese
  6. ctx.clearRect(x, y, width, height);

URL: http://www.bufa.es/limpiar-canvas/

Report this snippet


Comments


You need to login to view comments.