[][src]Function geopattern::cubic_disarray

pub fn cubic_disarray(
    side: f32,
    (width, height): (usize, usize),
    fill: &[(&str, f32)],
    stroke: (&str, f32),
    (translate, rotate): (&[f32], &[f32]),
    background_color: &str
) -> Document

Cubic Disarray

https://generativeartistry.com/tutorials/cubic-disarray/

use geopattern::cubic_disarray;

let c = cubic_disarray(
    60.0,
    (2, 2),
    &(0..4)
        .map(|v| {
            (
                if v & 1 == 0 { "#222" } else { "#ddd" },
                0.02 + (v as f32) / 4.0,
            )
        })
        .collect::<Vec<(&str, f32)>>(),
    ("#ddd", 0.2),
    (
        &(0..4).map(|v| 0.02 + (v as f32) / 4.0).collect::<Vec<f32>>(),
        &(0..4).map(|v| 0.02 + (v as f32 * std::f32::consts::PI) / 4.0).collect::<Vec<f32>>(),
    ),
    "#987987",
);

println!("{}", c);