Created
May 1, 2021 23:14
-
-
Save silmood/92f0f66a18c0d80b6c7d15d0796003e5 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
| /** | |
| Wave iridescent gradient | |
| */ | |
| int size = 200; | |
| int waveTime = 40; | |
| void setup() { | |
| size(400, 400); | |
| pixelDensity(displayDensity()); | |
| } | |
| void draw() { | |
| background(0); | |
| blendMode(ADD); | |
| pushMatrix(); | |
| translate(width / 2, height / 2 - size / 2); | |
| for (int i = 0; i < size / 4; ++i) { | |
| float offset = i * PI / 180; | |
| float offset2 = (i * PI / 180) + HALF_PI * 0.85; // map(mouseY, 0, height, HALF_PI / 8, TWO_PI); | |
| float offset3 = (i * PI / 180) + map(sin(frameCount * TWO_PI / waveTime / 2), -1, 1, HALF_PI, HALF_PI * 3.5); //map(mouseX, 0, width, HALF_PI / 8, TWO_PI); | |
| float theta = pow(sin(frameCount * TWO_PI / waveTime + offset), 2); | |
| float theta2 = pow(sin(frameCount * TWO_PI / waveTime + offset2), 2); | |
| float theta3 = pow(sin(frameCount * TWO_PI / waveTime + offset3), 2); | |
| float y = i * 4; | |
| strokeWeight(0.75); | |
| stroke(color(255, 20 + (theta * 150))); | |
| line(-size / 2, y, size / 2, y); | |
| stroke(color(255, 0, 0, 20 + (theta2 * 180))); | |
| line(-size / 2, y, size / 2, y); | |
| stroke(color(0, 0, 255, 20 + (theta3 * 200))); | |
| line(-size / 2, y, size / 2, y); | |
| } | |
| popMatrix(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment