Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. int n;
  2. float t = 0;
  3. void setup() {
  4.   size(480, 480);
  5.   smooth();
  6.  
  7.   n = 500;
  8. }
  9.  
  10. void draw() {
  11.   noStroke();
  12.   fill(25,25,25);
  13.   float radius = height / 3;
  14.   float angle = 0;
  15.   float angleStep = 0.005;
  16.   float freq = 6;
  17.   float amp = 20;
  18.  
  19.   background(255);
  20.   cerchio(angle, radius, freq, amp, angleStep, t);
  21.   t = t + 0.07;
  22.  
  23. }
  24.  
  25. void cerchio(float angle, float radius, float freq, float amp, float angleStep, float t) {
  26.    
  27.  
  28.   while (angle <= TWO_PI) {
  29.     float dx = (width / 2) + (radius + sin(angle * freq) * (amp * sin(t))) * cos(angle);
  30.     float dy = (height / 2) + (radius + sin(angle * freq) * (amp * sin(t))) * sin(angle);
  31.     ellipse(dx, dy, 2, 2);  
  32.     float dw = (width / 2) + radius * cos(angle);
  33.     float dz = (height / 2) + radius * sin(angle);
  34.     angle += angleStep;
  35.  
  36.     ellipse(dw, dz, 2, 2);    
  37.   }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement