hide / show Sprouting Leaves



A refresh will do the trick

Tip: view the console for some intel

v0.3.0 > 0.3.2 changes

  • From now on the determined space an object occupies (roughly, square) is placed in a Set()¹.
  • 4 starting points
  • Counter to show how many attempts for new objects are made
  • At the end of the script there are sprouting leaves added on all unused coordinates

What does the script do?

  1. Start with 8 base coordinates
  2. Calculate the 5 other coordinates, with some randomness to make it more organic. And while calculating:
    • Check if a new coordinate occurs in the not to use coordinates Set()¹
    • If it occurs then skip to a new attempt
  3. Determine a (bit smaller) square of the object and put all coordinates of that square in the Set()¹
  4. Draw the 4 line and 7 circles
  5. Delete the used coordinates couple from the array
  6. Put the 2 new coordinates couples in the array for later use
  7. Pick one unused coordinates couple, and start again from step 2. Repeats 1500 times. And if it's done:
  8. Add sprouting leaves on all unused coordinates

¹ A Set() is used because it only store unique values by default

Other Versions