Created
November 5, 2015 13:43
-
-
Save PullJosh/00039f646d6588215c09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(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