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).

static JComponent gazelle_wavySpacer() {
  ret gazelle_wavySpacer(gazelle_color1(), gazelle_color2());
}

static JComponent gazelle_wavySpacer(Color color1, Color color2) {
  ret jMinWidth(30, swing(-> new JComponent {
    public void paintComponent(Graphics g) {
      cast g to Graphics2D;
      int w = getWidth(), h = getHeight();
  
      var points = graphAsPolygon(x -> 1-sineSigmoid(x), w, h);
      //printVars(+w, +h, points := takeFirst(5, points));
      fillRect(g, 0, 0, w, h, color2);
      fillPrecisePolygon(g, points, color1);
    }
  }));
}

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: 210 / 329
Version history: 9 change(s)
Referenced in: [show references]