Different thickness along the line.
in
Share your Work
•
1 year ago
Hello, today I got an idea which could look cool if I use lines with different thickness along them.
Here's a function I wrote, it serves me well, but it's not perfect so feel free to edit it or suggest your own sollution to this problem.
It requires starting point, ending point and starting and ending radius'.
Here's a result of a sketch in which I used this function (I also used a little bit of Adobe's After Effects):
Here's a function I wrote, it serves me well, but it's not perfect so feel free to edit it or suggest your own sollution to this problem.
It requires starting point, ending point and starting and ending radius'.
- void funk(float x1, float y1, float x2, float y2, float r1, float r2) {
- float x11, y11, x12, y12, x21, y21, x22, y22, k;
- k = (y2 - y1)/(x2 - x1);
- k = -1/k;
- k = atan(k);
- x11 = x1 + r1*cos(k);
- y11 = y1 + r1*sin(k);
- x12 = x1 - r1*cos(k);
- y12 = y1 - r1*sin(k);
- x21 = x2 - r2*cos(k);
- y21 = y2 - r2*sin(k);
- x22 = x2 + r2*cos(k);
- y22 = y2 + r2*sin(k);
- ellipse(x1, y1, r1*2, r1*2);
- ellipse(x2, y2, r2*2, r2*2);
- beginShape();
- vertex(x11, y11);
- vertex(x12, y12);
- vertex(x21, y21);
- vertex(x22, y22);
- endShape();
- }
Here's a result of a sketch in which I used this function (I also used a little bit of Adobe's After Effects):