//for the menu
int toggle =1;
int width=640;
int height=360;
void setup() {
size(1280, 720);
}
void draw() {
background(255);
noStroke();
fill(0);
float s=5.0;
for (int i=0; i<height; i++) {
for (int j=0; j<width; j++) {
//noise is being used instead of random to get a more natural and harmonic succession
//creation of the art
float x=noise(s*(j+5*frameCount)/width, s*i/height);
float y=noise(s*j/width, s*(i+3*frameCount)/height);
float x1=j + 18*map(x, 0, 1, -0.6, 0.6);
float y1=i + 18*map(y, 0, 1, -0.6, 0.6);
float t= map(cos(0.007*frameCount), -1, 1, 0.01, 0.0005); //0.02, 0.0005
float theta= lerp(noise(t*x1, t*y1 ), noise(4*t*x1, 4*t*y1 ), 0.2);
fill(map( cos(theta*0.04*(1+0.004*frameCount)/t), -1, 1, 0, 255));
rect( j*2, i*2, 2, 2);
}
if(toggle == 1){
fill(150,10);
rect(width+435,400,200,height);
fill(0);
textSize(20);
text(" R = Restart",1120,500);
text(" S = Snapshot",1120,550);
text(" H = Hide menu",1120,600);
text(" U = Show menu",1120,650);
fill(random(255),random(255),random(255));
textSize(40);
text(" Through art, everything is possible",width/2,100);
}
}
}
void keyPressed()
{
if(key==‘R’ || key == ‘r’)
{
keyPressed = true;
background(255);
}