Guest User

Untitled

a guest
May 24th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. import toxi.math.noise.*;
  2.  
  3. import toxi.math.waves.*;
  4. import toxi.geom.*;
  5. import toxi.math.*;
  6. import toxi.math.conversion.*;
  7. import toxi.geom.util.*;
  8. import toxi.util.datatypes.*;
  9. import toxi.color.*;
  10. import toxi.color.theory.*;
  11. private static final int NUM_NODES = 3;
  12.  
  13. void setup() {
  14. size(1200, 1800);
  15. smooth();
  16. }
  17.  
  18. void draw() {
  19. //beginRecord(PDF, "frame-####.pdf");
  20. background(0);
  21. noFill();
  22. ColorList cl = ColorRange.WARM.getColors(TColor.RED, 100, 0.05f) .sortByCriteria(AccessCriteria.HUE, false);
  23.  
  24. for (int i = 0; i < 12; i++) {
  25. int[] nodeX = new int[NUM_NODES];
  26. int[] nodeY = new int[NUM_NODES];
  27.  
  28. int lastX = (int) random(-300, width + 300);
  29. for (int j = 0; j < nodeX.length; j++) {
  30. lastX = nodeX[j] = lastX + (int) random(-500, 500);
  31. }
  32.  
  33. int max_node_height = height / (NUM_NODES + 2);
  34. for (int j = 1; j <= NUM_NODES; j++) {
  35. int position = (int) (random(0, max_node_height) + (j * max_node_height));
  36. nodeY[j - 1] = position;
  37. }
  38. for (int k = 0; k < 500; k += random(3, 8)) {
  39. stroke(cl.get((int) (k % (int) cl.size())).toARGB());
  40. beginShape();
  41. curveVertex(k + nodeX[0] + random(-10, 10), 0);
  42. curveVertex(k + nodeX[0] + random(-10, 10), 0);
  43. for (int j = 0; j < NUM_NODES; j++) {
  44. curveVertex(k + nodeX[j], nodeY[j]);
  45. }
  46. curveVertex(k + nodeX[NUM_NODES - 1] + random(-150, 150), height);
  47. curveVertex(k + nodeX[NUM_NODES - 1] + random(-150, 150), height);
  48. endShape();
  49. }
  50. }
  51.  
  52. for (int i = 0; i < 20; i++) {
  53. pushMatrix();
  54. translate(random(0, width), random(0, height));
  55. scale(random(0, 1));
  56. beginShape();
  57. fill(0, 0, 0);
  58. noStroke();
  59. vertex(55, 20);
  60. vertex(75, 40);
  61. bezierVertex(75, 37, 70, 25, 50, 25);
  62. bezierVertex(20, 25, 20, 62.5f, 20, 62.5f);
  63. bezierVertex(20, 80, 40, 102, 75, 120);
  64. bezierVertex(110, 102, 130, 80, 130, 62.5f);
  65. bezierVertex(130, 62.5f, 130, 25, 100, 25);
  66. bezierVertex(85, 25, 75, 37, 75, 40);
  67. endShape();
  68. popMatrix();
  69. }
  70. //endRecord();
  71. }
Add Comment
Please, Sign In to add comment