Libraryless. Click here for Pure Java version (7998L/45K).
svoid g22drawConnectingCurve(Graphics2D g, Pt start, Pt end, int clipAmount default 4) { var controlY = random(0, 40); var control = doublePt(avg(start.x, end.x), controlY); var path = new Path2D.Float; path.moveTo(start.x, start.y); path.quadTo(control.x, control.y, end.x, end.y); var color = oneOf(ll((Color.black), (Color.gray), (Color.red))); var g2 = (Graphics2D) g.create(); g2.setColor(color); if (clipAmount != 0) { Rect clip = rectFromPoints(start.x+clipAmount, 0, end.x-clipAmount, max(end.y, start.y)-clipAmount); print(+clip); g2.clipRect(clip.x, clip.y, clip.w, clip.h); } g2.draw(path); }
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035370 |
| Snippet name: | g22drawConnectingCurve |
| Eternal ID of this version: | #1035370/7 |
| Text MD5: | 809cc675a0eb59cad884ae1b3532aff2 |
| Transpilation MD5: | 42ef829ebba9f99b724cf32759b6bdf2 |
| Author: | stefan |
| Category: | javax / gazelle 22 |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-05-02 21:26:41 |
| Source code size: | 673 bytes / 21 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 432 / 553 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |