Skip to content

Instantly share code, notes, and snippets.

Created November 3, 2015 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/0c719611e6a97926af90 to your computer and use it in GitHub Desktop.
Save anonymous/0c719611e6a97926af90 to your computer and use it in GitHub Desktop.
Party
<canvas width="400" height="400"></canvas>
var canvas = document.querySelector("canvas");
var ctx = canvas.getContext("2d");
ctx.font = "900 80px sans-serif";
ctx.lineWidth=2;
var str = "FTW";
var strwidth = ctx.measureText(str).width;
var width=canvas.width;
var c=0;
var color=0;
var img;
(function a() {
img=ctx.getImageData(0,0,width,width);
ctx.putImageData(img,0,10);
ctx.save();
ctx.translate((width/2),width/2);
ctx.rotate(Math.PI*(c++/200));
ctx.fillStyle='hsla('+(color=color+4%360)+', 100%, 50%, 1)';
ctx.fillText("FTW",-(strwidth/2),20);
ctx.strokeText("FTW",-(strwidth/2),20);
ctx.restore();
requestAnimationFrame(a);
})();
html,body,canvas {
padding:0px;
margin:0px;
overflow:hidden;
height:100%;
}
body {
background: #ffffff);
}
canvas {
display:block;
margin:auto;
width:100vmin;
height:100vmin;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment