Libraryless. Click here for Pure Java version (5548L/30K).
1 | // TODO: does maxSteps 1 do anything? |
2 | static RGB varyColor(RGB rgb, int maxSteps default 25) { |
3 | float max = maxSteps/255f; |
4 | int s = random(3); |
5 | if (s == 0) |
6 | return new RGB(vary0to1(rgb.r, max), rgb.g, rgb.b); |
7 | else if (s == 1) |
8 | return new RGB(rgb.r, vary0to1(rgb.g, max), rgb.b); |
9 | else |
10 | return new RGB(rgb.r, rgb.g, vary0to1(rgb.b, max)); |
11 | } |
12 | |
13 | static Color varyColor(Color color, int maxSteps default 25) { |
14 | ret toColor(varyColor(RGB(color), maxSteps); |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006086 |
Snippet name: | varyColor |
Eternal ID of this version: | #1006086/4 |
Text MD5: | 0136d0682533075ac20caef9633f66f2 |
Transpilation MD5: | 7f27f9c0b2f9797270ca456996755d8f |
Author: | stefan |
Category: | javax / genetic optimization |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-13 05:27:54 |
Source code size: | 481 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 587 / 679 |
Version history: | 3 change(s) |
Referenced in: | [show references] |