Code P_1_2_3_02

Grundlegende Prinzipien –  P.1 Farbe –  P.1.2 Farbpaletten –  P.1.2.3 Farbpaletten aus Regeln –  P_1_2_3_02

Pages


  • 194 - 195

  • 196 - 197

Comments

  • 2019-11-25 @ 3:07 am   |  Comment by fang

    Can you explain this part? I really can't understand...Thank you!

     

     

     

     

    int counter = 0; // row count and row height int rowCount = (int)random(5,40); float rowHeight = (float)height/(float)rowCount; for(int i=0; i<rowCount; i++) { // seperate each line in parts // how many fragments int partCount = i+1; float[] parts = new float[0]; for(int ii=0; ii<partCount; ii++) { // sub fragments or not? if (random(1.0) < 0.075) { // take care of big values int fragments = (int)random(2,20); partCount = partCount + fragments; for(int iii=0; iii<fragments; iii++) { parts = append(parts, random(2)); } } else { parts = append(parts, random(2,20)); } } // add all subparts float sumPartsTotal = 0; for(int ii=0; ii<partCount; ii++) sumPartsTotal += parts[ii]; // draw rects float sumPartsNow = 0; for(int ii=0; ii<parts.length; ii++) { // get component color values int index = counter % colorCount; fill(hueValues[index],saturationValues[index],brightnessValues[index]); sumPartsNow += parts[ii]; rect(map(sumPartsNow, 0,sumPartsTotal, 0,width),rowHeight*i, map(parts[ii], 0,sumPartsTotal, 0,width)*-1,rowHeight); counter++; } }

Leave a Comment

   (required)

  

Please enable JavaScript to post a comment.

(.zip, max. 1MB)  

Proof that you are human!
Please paste the snippet below in an empty Processing sketch!
What number does the Processing console show?

randomSeed(27390);
println(int(random(100000)));

  (required)