Skip to content

Instantly share code, notes, and snippets.

@PullJosh
Created November 5, 2015 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PullJosh/00039f646d6588215c09 to your computer and use it in GitHub Desktop.
Save PullJosh/00039f646d6588215c09 to your computer and use it in GitHub Desktop.
float i = 0;
int verticalLines = 54;
float waveHeight = 100;
float colorChange = 1;
float colorSpeed = 3;
boolean mouse = false;
public void setup() {
smooth();
fullScreen();
strokeWeight(5);
colorMode(HSB, 100);
waveHeight = height / 5;
noCursor();
}
void draw() {
pushMatrix();
translate(0, height / 2);
background(0);
float sinDivider = 30;
for(int n = 0; n < verticalLines; n += 2) {
stroke((i * colorSpeed + n * colorChange) % 100, 100, 100);
float y1 = (sin((i + n * 2) / sinDivider * TWO_PI) + 1) * waveHeight;
line(n * width / verticalLines, y1, (n + 1) * width / verticalLines, y1);
float y2 = (sin(((i + n * 2) / sinDivider + 0.5) * TWO_PI) + 1) * waveHeight * -1;
line((n + 1) * width / verticalLines, y1, (n + 1) * width / verticalLines, y2);
line((n + 1) * width / verticalLines, y2, (n + 2) * width / verticalLines, y2);
y1 = (sin((i + (n + 2) * 2) / sinDivider * TWO_PI) + 1) * waveHeight;
line((n + 2) * width / verticalLines, y2, (n + 2) * width / verticalLines, y1);
}
popMatrix();
i = i + 0.3;
}
void mouseMoved() {
if (mouse) {
exit();
} else {
mouse = true;
}
}
@quat1024
Copy link

quat1024 commented Nov 5, 2015

(Sry at school so I can't comment on scratch)

Tbh i don't know why this happens, it might be a windows or java bug. I tried making a screensaver myself once and it also didn't work properly :L

i'll look into it though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment