Skip to content

Instantly share code, notes, and snippets.

@paraboul
Created August 23, 2012 00:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paraboul/3430747 to your computer and use it in GitHub Desktop.
Save paraboul/3430747 to your computer and use it in GitHub Desktop.
random cover
<html>
<head></head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
var canvas = document.getElementById("canvas").getContext('2d');
canvas.shadowColor="#000";
canvas.shadowBlur = 10;
canvas.beginPath();
for (var i = 0; i < 3000; i++) {
canvas.lineTo(Math.random() * 800, Math.random() * 600);
if (i%3 == 0) {
canvas.transform(0.995, 0, 0, 0.995, 2, 2);
canvas.closePath();
var val = ~~(0.5+Math.random()*255);
canvas.fillStyle = "rgb("+val+", "+val+", "+val+")";
canvas.fill();
canvas.beginPath();
}
}
</script>
</body>
</html>
@paraboul
Copy link
Author

@ptejada
Copy link

ptejada commented Aug 24, 2012

Cool, code looks simple yet complex.

@matael
Copy link

matael commented Jan 5, 2013

Pretty clean ! nice job !

@lyrixx
Copy link

lyrixx commented Jan 5, 2013

Huge :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment