Skip to content

Instantly share code, notes, and snippets.

@dbasilioesp
Last active December 17, 2015 23:08
Show Gist options
  • Save dbasilioesp/5686693 to your computer and use it in GitHub Desktop.
Save dbasilioesp/5686693 to your computer and use it in GitHub Desktop.
var P0x = 230;
var P0y = 50;
var P1x = 350;
var P1y = 150;
var px = P0x + t*(P1x - P0x)
var py = P0y + t*(P1y - P0y)
ctx.beginPath(); // inicia o desenho
ctx.rect(px,py , 20,20); // 20 20 é o tamanho do quadrado
ctx.fillStyle = "#FFF"; // cor
ctx.closePath(); // finaliza o desenho
ctx.fill(); // preenche com a cor
if (t < 1)
t += 0.01;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment