Viele weitere Beispielprojekt für verschiedene Anwendungen

This commit is contained in:
ngb
2022-06-19 22:26:01 +02:00
parent dc6b7ee351
commit a2d883305a
97 changed files with 2535 additions and 61 deletions

View File

@@ -0,0 +1,40 @@
import schule.ngb.zm.Color;
import schule.ngb.zm.Zeichenmaschine;
public class GenColors extends Zeichenmaschine {
public static void main( String[] args ) {
new GenColors();
}
public GenColors() {
super(800, 800, "Nice Colors");
}
@Override
public void setup() {
genPattern();
}
public void genPattern() {
drawing.noStroke();
int SIZE = 40;
for( int i = 0; i < width/SIZE; i++ ) {
for( int j = 0; j < height/SIZE; j++ ) {
Color c = randomNiceColor();
float[] hsl = Color.RGBtoHSL(c.getRGBA(), null);
System.out.printf("%f, %f, %f\n", hsl[0], hsl[1], hsl[2]);
drawing.setFillColor(c);
drawing.square(i*SIZE, j*SIZE, SIZE, NORTHWEST);
}
}
}
@Override
public void mouseClicked() {
genPattern();
redraw();
}
}