Advertisement
xeromino

p5js

Oct 4th, 2016
205
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var t2=0;
  2.  
  3. function x1(t) {
  4.   return sin(t / 20);
  5. }
  6.  
  7. function y1(t) {
  8.   return cos(t / 10);
  9. }
  10.  
  11. function x2(t) {
  12.   return sin(t / 10) * 200;
  13. }
  14.  
  15. function y2(t) {
  16.   return cos(t / 20) * 200;
  17. }
  18.  
  19. var NUM_LINES = 600;
  20. var NUM_LINES2 = 200;
  21.  
  22. function setup() {
  23.   background(20);
  24.   createCanvas(900, 600);
  25. }
  26.  
  27. function draw() {
  28.   background(20);
  29.   strokeWeight(1.5);
  30.   stroke(250, 75);
  31.  
  32.   translate(width / 2, height / 2);
  33.  
  34.   for (var i = 0; i < NUM_LINES; i += 8) {
  35.     line(x1(t2 - 1 * 80 + 90), y1(t2 * i * 40), x2(t2 - i), y2(t2 - i * 30));
  36.   }
  37.  
  38.   t2 += 0.01;
  39. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement