java - Make shades with different color in Julia set . -
as in title , want add 2-3 colors shades julia set . dont have idea how . know how add 1 color , , . must add 2-3.
import java.awt.color; import java.awt.graphics; import java.util.random; import javax.swing.japplet; public class complextester extends japplet { color c; public void init() { resize(600, 600); } public color setc1() { c = new color(250, 250, 0); return c; } public void paint(graphics g) { random generator = new random(); complex c = new complex(-0.123, 0.745); complex b = new complex(); (int k = 0; k < 600; k++) (int j = 0; j < 600; j++) { complex = new complex((k / 200.0) - 1.5, (600 - j) / 200.0 - 1.5); int = 0; b = a; { b = b.kwadrat().dodaj(c); i++; if (b.moduĊ2().getx() > 2) break; } while (i < 30); if (i == 30) { g.setcolor(setc2()); g.drawoval(k, j, 1, 1); } } } }
setcolor() method add 1 color . methor add few colors ?
you can create fixed palette of colors using enum
, shown here , here. in case, might want create gamut of colors using gethsbcolor()
, shown here in list<color>
. related example using queue<color>
may found here. once have such collection, chose color index based on number of iterations required.
Comments
Post a Comment