Segmentize and randomize.
[php lang=“JavaScript”]$(function() {
var canvas, context, width, height, x, x1, x2, y, z = 600, fl = 350, xres = 5, zres = 5, xcenter, ycenter, scale;
canvas = $("#canvas").get(0);
context = canvas.getContext(“2d”);
width = canvas.width;
height = canvas.height;
xcenter = width / 2;
ycenter = height / 2;
while(z > 0) {
scale = fl / (fl + z);
x1 = xcenter – width / 2 * scale;
x2 = xcenter + width / 2 * scale;
y = ycenter + (200 + Math.random() * 5) * scale;
context.beginPath();
context.moveTo(x1, y);
for(x = x1; x <= x2; x += xres) { y = ycenter + (200 + Math.random() * 5) * scale; context.lineTo(x, y); } context.stroke(); z -= zres; } });[/php] Result.