> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.yCQYjhFMiQz/rev.1159
 * 
 * authors: 
 *   Markell

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



float a = 1.419, b = -2.28415, c = 2.427543, d = -2.177196, e = 0.7, f = -1.1;
float x,y,xn,yn,u,v;
float mx, my;
int passes = 16, N=512;
float k = N*.2;

void setup() {
  size(512,512);
  background(0);
}
  
void draw() {
    stroke(255,50);
  if(mousePressed) {
    background(0);
    plot(10000);
  }
}

void mouseReleased(){
    stroke(255,25);
  for(int i = 0; i < passes; i++){
    plot(10000);
  }
}

void plot(int iterations){
  mx = map(mouseX,0,width,-4,4);
  my = map(mouseY,0,height,-4,4);
  for(int i =0; i < iterations; i++) {
    xn = sin(mx*y) - cos(my*x);
    yn = sin(c*x) - cos(d*y);
    x = xn; y = yn;
    u = (int)((x+2.5) *k);
    v = (int)((y+2.5) *k);
    point(u,v);
  }
}