Last active
November 12, 2017 10:20
-
-
Save KrabCode/19af074bb58922b0146d2a176c6869f2 to your computer and use it in GitHub Desktop.
2D Perlin noise colourful rotating line screensaver
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
| import processing.core.PApplet; | |
| public class MainApp extends PApplet{ | |
| public static void main(String[] args) | |
| { | |
| PApplet.main("MainApp", args); | |
| } | |
| public void settings() | |
| { | |
| fullScreen(); | |
| } | |
| public void setup() { | |
| colorMode(HSB, 100); | |
| frameRate(30); | |
| } | |
| public void draw(){ | |
| background(0,0,0); | |
| float mod = 10; | |
| int lineScale = 2; | |
| strokeWeight(1); | |
| strokeCap(PROJECT); | |
| float noiseScale = 0.0094093755f; | |
| float timeScale = 0.00292188f; | |
| // float noiseScale = map(mouseX, 0, width, 0.001f, 0.3f); | |
| // float timeScale = map(mouseY, 0, width, 0.001f, 0.1f); | |
| for (int x = 0; x < width/mod + 1; x++) { | |
| for (int y = 0; y < height/mod + 1; y++) { | |
| float timeNoise = noise((x)*noiseScale, (y)*noiseScale, frameCount*timeScale); | |
| stroke(40+timeNoise*60, 100,100); | |
| pushMatrix(); | |
| translate(x*mod, y*mod); | |
| rotate(radians(timeNoise*360)); | |
| line(-lineScale,-lineScale,lineScale,lineScale); | |
| popMatrix(); | |
| } | |
| } | |
| if(keyPressed || mousePressed){ | |
| exit(); | |
| } | |
| println(noiseScale + " : " + timeScale); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment