Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1. PVector position;
  2. PShape circle;
  3. float x,y;
  4. int count;
  5. int tall;
  6. int count2;
  7. float start;
  8. float stop ;
  9. float vinkel ;
  10. void setup() {
  11.   fullScreen();
  12.   noFill();
  13.   stroke(255,255,255,30);
  14.   strokeWeight(2);
  15.   count = 0;
  16.   background(0);
  17.   tall =10;
  18.   count2= 0;
  19.   start = 0;
  20.   stop = 2*PI;
  21.   vinkel = 0;
  22. }
  23.  
  24.  
  25. void draw() {
  26.   if (count > tall){
  27.     background(0);
  28.     count = 0;
  29.     tall = (int)random(1,100);
  30.     print("hei");
  31.   }
  32.   count = count +1;
  33.   translate(width/2, height/2);
  34.   rotate(vinkel);
  35.   beginShape();
  36.   for (float theta =start; theta <= stop; theta +=0.01){
  37.     float rad =r(theta,
  38.     mouseY/200.0, //a
  39.     mouseX/400.0, //b
  40.     5, //m
  41.     1, //n1
  42.     1, //n2
  43.     2 //n3
  44.     );
  45.     float x = rad*cos(theta)* 50;
  46.     float y = rad*sin(theta)* 50;
  47.     vertex(x,y);
  48.     }
  49.  
  50.   for (float theta =start; theta <= stop; theta +=0.01){
  51.     float rad =r(theta,
  52.     1.2*mouseY/200.0, //a
  53.     1.2*mouseX/400.0, //b
  54.     5, //m
  55.     1, //n1
  56.     1, //n2
  57.     2 //n3
  58.     );
  59.     float x = rad*cos(theta)* 50;
  60.     float y = rad*sin(theta)* 50;
  61.     vertex(x,y);
  62.     }
  63.     for (float theta =start; theta <= stop; theta +=0.01){
  64.     float rad =r(theta,
  65.     1.4*mouseY/200.0, //a
  66.     1.4*mouseX/400.0, //b
  67.     5, //m
  68.     1, //n1
  69.     1, //n2
  70.     2 //n3
  71.     );
  72.     float x = rad*cos(theta)* 50;
  73.     float y = rad*sin(theta)* 50;
  74.     vertex(x,y);
  75.     }
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.   endShape();
  83.   start += 0.1;
  84.   stop += 0.1;
  85.   vinkel +=0.003;
  86.  
  87. }
  88. float r(float theta, float a, float b, float m, float n1, float n2, float n3) {
  89.   return pow(pow(abs(cos(m*theta/4.0)/a),n2)+pow(abs(sin(m*theta/4.0)/b),n3),-1/n1);
  90.  
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement