tclh123 / commits-graph

Git commits graph widget using HTML5/Canvas.
http://oct.tclh123.com/commits-graph/
226 stars 30 forks source link

Gradient Bezier curves #3

Open maximal opened 9 years ago

maximal commented 9 years ago

It’s better to draw gradients when different branches merge (so the color changes). Otherwise colors are changing roughly.

maximal commented 9 years ago

I tried different variations, like:

var grad = ctx.createLinearGradient(from_x, from_y, to_x, to_y);
grad.addColorStop(0, self.commit.graph.get_color(self.commit.routes[0].branch));
grad.addColorStop(1, self.commit.graph.get_color(self.commit.routes[self.commit.routes.length - 1].branch));
//grad.addColorStop(1, self.commit.graph.get_color(self.branch));

ctx.strokeStyle = grad;

But inside the Route class there’s no information about branches of both sides of the curve (in order to calculate colors). Or my JS skills are just failing me.

tclh123 commented 9 years ago

Thanks for your suggestion. I have no time to develop this recently. You can try it by yourself first.