Crates.io | leaf-spread |
lib.rs | leaf-spread |
version | 0.1.2 |
source | src |
created_at | 2023-02-21 13:01:54.369168 |
updated_at | 2023-03-07 03:44:11.13567 |
description | A crate to iterate indefinitely over well spread points, similar to some leaf arrangement pattern in nature |
homepage | |
repository | https://github.com/Inspirateur/leaf-spread |
max_upload_size | |
id | 790673 |
size | 5,759 |
A Rust crate to iterate indefinitely over well spread points, similar to some leaf arrangement pattern in nature.
Ideal for generating a variable amount of distinct colors.
Grid sample | Poisson Disk | Leaf sample | |
---|---|---|---|
Iterate indefinitely | ❌ | ❌ | ✅ |
Random Looking | ❌ | ✅ | ❌ |
Fast | ✅ | ❌ | ✅ |
use leaf_spread::leaf_sample;
use palette::Hsv;
fn main() {
for [hue, value] in leaf_sample!(0..360, 0.6..1.0).take(10) {
let color = Hsv::new(hue, 0.8, value);
// use the color however
}
}
Golden ratio shenaningans from http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/