-
-
Save josues/86ea845d5db1ab52b52a1e3a00540138 to your computer and use it in GitHub Desktop.
Processing to P5 ?
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
| function setup() { | |
| createCanvas(500, 500); | |
| smooth(); | |
| } | |
| function draw() { | |
| background(255); | |
| noStroke(); | |
| fill(0); | |
| ellipseMode(CENTER); | |
| translate(width/2, height/2); | |
| randomSeed(99); // Immer die gleiche Zufallsfolge | |
| var numberOfDots = 4000; | |
| var radius = 180; | |
| for (var j = 0; j < numberOfDots; j++) { | |
| var randomangle = random(0, TWO_PI); // Zufaelliger Winkel von 0 - 360 Grad | |
| var randomradius = radius * sqrt(random(0, 1)); // Homogene Verteilung | |
| var x = -sin(randomangle) * randomradius; | |
| var y = cos(randomangle) * randomradius; | |
| ellipse(x, y, 5, 5); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should work. See the image.

BTW it's good to add a link to the original work. Like --> https://www.openprocessing.org/sketch/62168 Random Distribution In Circle – Homogeneous by FELD