Skip to content

Instantly share code, notes, and snippets.

@arpit
Created September 27, 2011 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arpit/1244268 to your computer and use it in GitHub Desktop.
Save arpit/1244268 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>Hello Canvas</title>
<style>
#can{
background:#dfdfdf;
}
</style>
</head>
<body>
<canvas id="can" height="320" width="300">
</canvas>
<script>
var can = document.getElementById("can");
var ctx = can.getContext("2d");
ctx.fillStyle = "#fff";
function randomXToY(minVal,maxVal){
var randVal = minVal+(Math.random()*(maxVal-minVal));
return randVal
}
for(var i=0; i<60; i++){
ctx.font=randomXToY(14, 40)+"pt Helvetica";
ctx.fillText("Action", randomXToY(10,260), randomXToY(0,280));
//ctx.fillText("Action", randomXToY(80,160), i*40);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment