Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1033484 // gazelle_wavySpacer

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (10165L/57K).

1  
static JComponent gazelle_wavySpacer() {
2  
  ret gazelle_wavySpacer(gazelle_color1(), gazelle_color2());
3  
}
4  
5  
static JComponent gazelle_wavySpacer(Color color1, Color color2) {
6  
  ret jMinWidth(30, swing(-> new JComponent {
7  
    public void paintComponent(Graphics g) {
8  
      cast g to Graphics2D;
9  
      int w = getWidth(), h = getHeight();
10  
  
11  
      var points = graphAsPolygon(x -> 1-sineSigmoid(x), w, h);
12  
      //printVars(+w, +h, points := takeFirst(5, points));
13  
      fillRect(g, 0, 0, w, h, color2);
14  
      fillPrecisePolygon(g, points, color1);
15  
    }
16  
  }));
17  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033484
Snippet name: gazelle_wavySpacer
Eternal ID of this version: #1033484/10
Text MD5: 655749477bc4e30e1454dd64594f07a0
Transpilation MD5: e776101c8ab1ddba67967927bdd00b34
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-27 03:01:27
Source code size: 575 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 211 / 330
Version history: 9 change(s)
Referenced in: [show references]