Created
May 11, 2016 14:48
-
-
Save fiskurgit/5ecfebdb6158c4451f2682ee71b3f30e 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
| int step = 0; | |
| int segmentCount = 70; | |
| int startStep = 0;//offset the start position, not necessary but more interesting while drawing. | |
| float pointDiameter = 0.25; | |
| float plotRadius = 5; | |
| float radiusIncrement = 6; | |
| void setup(){ | |
| size(500, 500); | |
| background(255); | |
| noStroke(); | |
| } | |
| void draw(){ | |
| step++; | |
| float theta = (step + startStep) * TWO_PI / segmentCount; | |
| float x = width/2 + cos(theta) * plotRadius; | |
| float y = height/2 + sin(theta) * plotRadius; | |
| float colorComponentA = map(x, 0, width, 100, 255); | |
| float colorComponentB = map(y, 0, width, 200, 255); | |
| fill(colorComponentA, (colorComponentA + colorComponentB)/2, colorComponentB); | |
| ellipse(x, y, pointDiameter, pointDiameter); | |
| if(step == segmentCount){ | |
| step = 0; | |
| startStep++; | |
| plotRadius += radiusIncrement; | |
| segmentCount += 2; | |
| //Control how the the plot points grow: | |
| if(pointDiameter < 6 && plotRadius > 25){ | |
| pointDiameter+=0.25; | |
| } | |
| } | |
| if(plotRadius >= width/2 - width/10){ | |
| noLoop(); | |
| println("fin"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment