Skip to content

Instantly share code, notes, and snippets.

@tagr
Created January 27, 2015 00:59
Show Gist options
  • Save tagr/d5415b121d2872f908a3 to your computer and use it in GitHub Desktop.
Save tagr/d5415b121d2872f908a3 to your computer and use it in GitHub Desktop.
Sulley's Fur
canvas(id='c', width='800', height='600')
var doc = document,
canvas = doc.querySelector('#c'),
cheight = canvas.height,
cwidth = canvas.width,
context = canvas.getContext('2d'),
r = function(seed, step) {
return Math.floor(Math.random()*seed)+step;
},
draw = function(t) {
context.lineWidth = 1;
context.beginPath();
context.moveTo(0,0);
context.strokeStyle = "rgba("+r(52,0)+","+r(160,0)+","+r(140,21)+",0.1)";
context.bezierCurveTo(r(cwidth,0), Math.random()*cwidth, r(cwidth,0), r(cwidth,0), r(cwidth,0), r(cheight,0));
context.quadraticCurveTo(r(cwidth,0),r(cheight,0),r(cwidth,0),r(cheight,0));
context.stroke();
};
(function animation(){
window.requestAnimationFrame(animation);
draw();
})();
body {
background: #000;
}
canvas {
display: block;
}

Sulley's Fur

A random curve drawing using HTML5 Canvas Bezier and quadratic curves. RequestAnimationFrame loops the process.

A Pen by Andy on CodePen.

License.

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