Created
September 1, 2020 09:39
-
-
Save KrabCode/aed498d17dfb4b7aea449f7c017fbc87 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
| void setup() { | |
| size(800, 800, P2D); | |
| } | |
| void draw() { | |
| float t = radians(frameCount); | |
| int detail = 50; | |
| float whiteRadius = 150+150*sin(t); | |
| float redRadius = 350; | |
| background(0); | |
| translate(width/2, height/2); | |
| beginShape(TRIANGLE_STRIP); | |
| noStroke(); | |
| for (int i = 0; i <= detail; i++) { | |
| float a = map(i, 0, detail, 0, TAU); | |
| float x = whiteRadius * cos(a); | |
| float y = whiteRadius * sin(a); | |
| fill(255, 0, 0); | |
| vertex(x, y); | |
| fill(255); | |
| vertex(0, 0); | |
| } | |
| endShape(); | |
| beginShape(TRIANGLE_STRIP); | |
| noStroke(); | |
| for (int i = 0; i <= detail; i++) { | |
| float a = map(i, 0, detail, 0, TAU); | |
| float x0 = redRadius * cos(a); | |
| float x1 = whiteRadius * cos(a); | |
| float y0 = redRadius * sin(a); | |
| float y1 = whiteRadius * sin(a); | |
| fill(255, 0, 0); | |
| vertex(x0, y0); | |
| vertex(x1, y1); | |
| } | |
| endShape(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment