Palette

ritocoのクリエイティブコーディング記録

【 p5.js 】It tried to become a sphere.

f:id:ritocopalette:20211201154041p:plainf:id:ritocopalette:20211201154044p:plain



code( p5.js )

function setup() {
    createCanvas(500, 500, P2D);
    noLoop();
    noFill();
}
function draw() {
    // background color
    background(random(220, 250), random(220, 250), random(200, 250));

    // motif position
    let dr_steps = width / 10;
    for (let y = 0; y < height; y += dr_steps) {
        for (let x = 0; x < width; x += dr_steps) {
            push();
            translate(x, y);
            pattern001();
            pop();
        }
    }
}
// motif
function pattern001() {
    let a = 0.0;
    let ranA = random(10000);
    let ranB = random(10, 50);
    let inc = TWO_PI / ranA;

    // motif size
    scale(random(0.3, 1.5));

    // motif color,alpha etc...
    for (let i = 0; i < height / 10; i++) {
        let col1 = color(random(120, 220), random(200, 255), random(200, 255));
        stroke(col1);
        arc(width / 20, height / 20, ranB * 2, i + sin(a), i * ranB, HALF_PI);
        strokeWeight(.2);
    }
    a = a + inc;
}




openProcessing

openprocessing.org



License

クリエイティブ・コモンズ・ライセンス