Created
January 7, 2020 15:17
-
-
Save lucasdinonolte/e60ff95f53b3b80c4a93c231690067d7 to your computer and use it in GitHub Desktop.
Parametric Equation in Processing emulating 90's screensaver vibes.
This file contains 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
// For exporting the video | |
import com.hamoid.*; | |
static final int NUM_LINES = 20; | |
float t; | |
VideoExport videoExport; | |
void setup() { | |
size(500, 500); | |
pixelDensity(displayDensity()); | |
videoExport = new VideoExport(this, "screensaver.mp4"); | |
videoExport.setFrameRate(30); | |
videoExport.startMovie(); | |
} | |
void draw() { | |
background(20); | |
strokeWeight(1); | |
translate(width/2, height/2); | |
for(float i = 0; i < NUM_LINES; i+=0.1) { | |
stroke(240, 240, 240, (255 / NUM_LINES) * i); | |
line(x1(t+i), y1(t+i), x2(t+i), y2(t+i)); | |
} | |
t+=0.5; | |
videoExport.saveFrame(); | |
} | |
float x1(float t) { | |
return sin(t/10)*100; | |
} | |
float y1(float t) { | |
return cos(t/10)*100; | |
} | |
float x2(float t) { | |
return cos(t/20)*200+sin(t/10)*100; | |
} | |
float y2(float t) { | |
return sin(t/20)*200+cos(t+2/10)*20; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment