Advertisement
xeromino

modSin

Mar 8th, 2017
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. float y;
  2. float a, f;
  3.  
  4. void setup() {
  5.   size(1080, 720);
  6.   background(34);
  7.   a = random(2,10);
  8.   f = random(0.05);
  9. }
  10.  
  11. void draw() {
  12.   //background(34);
  13.   stroke(238, 10);
  14.   float amplitude = a; //10;
  15.   float frequency = f; //0.01;
  16.   beginShape();
  17.   noFill();
  18.   for (int x=0; x<width; x+=2) {
  19.     y = sin(x*frequency);
  20.     float t = 0.000001*(-millis()*130);
  21.     t = -frameCount/500.0;
  22.     y += sin(x*frequency*2.1 + t)*4.5;
  23.     y += sin(x*frequency*1.72 + t*1.121)*4.0;
  24.     y += sin(x*frequency*2.221 + t*0.437)*5.0;
  25.     y += sin(x*frequency*3.1122+ t*4.269)*2.5;
  26.     y *= amplitude;
  27.     vertex(x, height/2+y);
  28.   }
  29.   endShape();
  30. }
  31.  
  32. void keyPressed() {
  33.   save(random(9999)+".png");
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement