Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Created November 3, 2014 18:50
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 mhkeller/fe0b80f6e1ac11facaaf to your computer and use it in GitHub Desktop.
Save mhkeller/fe0b80f6e1ac11facaaf to your computer and use it in GitHub Desktop.
function qBPath(sx, sy, tx, ty) {
var curve = ((tx-sx) * 0.05),
path = "";
path += "Q " + (sx) + "," + (sy+curve) + " " + ((sx+tx)/2) +","+ ((sy+ty)/2);
path += "Q " + (tx) + "," + (ty-curve) + " " + tx + "," + ty;
return path;
}
path += 'M ' + source_left_offset + ',0'
path += qBPath(source_left_offset, 0, target_x - padding, baseline_y)
path += 'L ' + target_x + padding + ','+baseline_y;
path += qBPath(target_x + padding, baseline_y, source_right_offset, 0)
path += 'Z';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment