Closed mattes3 closed 5 years ago
The randomness
option has the type () => number | () => number[]
. The behavior is:
spread
is not a number, randomness
is ignored.spread
is a number and randomness
is a function that returns a number, then meshes will be placed on each face if Math.random() < spread
. This results in a uniformly random distribution of meshes.spread
is a number and randomness
is a function that returns an array of numbers, then meshes will be placed on each face if returnedArray[facePosition] < spread
. This is useful to produce more organic-looking arrangements of meshes.If the third approach is desired, ScatterHelper
is useful for producing the relevant array.
Hi,
as promised, I've begun to port this library to Typescript. I ran into a problem with scatter.js.
The function ScatterMeshes() has an option called
randomness
. I cannot find out the correct type for this option.The doc for this option says:
So,
randomness
is supposed to be a function that returns an array of numbers. How canMath.random
be a valid value for this option, sinceMath.random
returns only one number, not an array of numbers?Can you shed some light on this, please?