Palette

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

【 p5.js 】Painting like an oil painting.

code01( p5.js )

f:id:ritocopalette:20211212204244p:plainf:id:ritocopalette:20211212204248p:plain


function setup() {
    createCanvas(canva = 300,canva,WEBGL);
    frameRate(1);
    w = 800;
    n = 900;
    noLoop();
}

function draw() {
    background(255);
    noStroke();

// light
    r = random;
    v = createVector;
    myAl = ambientLight;
    myPl = pointLight;
    myDl = directionalLight;
  
//customize ( Material )
    myVal = random(4,20);//4-25
    myVal2 = random(-5,5);//4-25

// drawing
    for (i = -n; i < n; i++) {
        push();
        rotateX(r(n));
        rotateY(r(n));
        rotateZ(r(n));
      
//customize ( RGB Light Color )
        myPl(225, 250, 222, v(1000));
        myPl(202, 13, 125, v(100));
        myDl(22, 250, 50, 0,myVal2,0);

//motif
        torus(n, canva/10, r(w) > int(myVal)  ? int(myVal) : n);
        pop();
    }
}



code02( p5.js )

f:id:ritocopalette:20211205223924p:plainf:id:ritocopalette:20211205223911p:plain


function setup() {
    createCanvas(wh = 500,wh,WEBGL);
    frameRate(1);
    w = 800;
    n = 900;
    noLoop();
}

function draw() {
    background(255);
    noStroke();

// light
    r = random;
    v = createVector;
    al = ambientLight;
    pl = pointLight;
    dl = directionalLight;

// drawing
    for (i = -n; i < n; i++) {
        push();
        rotateX(r(n));
        rotateY(r(n));

        // pl(r(w), r(w), r(w), v(w));
        // pl(r(w), r(w), r(w), v(w));
        // dl(r(w), r(w), r(w), v(w));

        pl(225, 220, r(222), v(1000));
        pl(2220, 13, 25, v(12));
        dl(22, 20, (w/2), v(220));

//motif
        torus(n, wh/10, r(w) > 1 ? 5 : n);
        pop();
    }
}




openProcessing

openprocessing.org



License

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

memo / comment

油彩画のような不思議な質感の絵ができました。
遠目で見た方がそれっぽい感じはあります。
code01はcustomizeの中を、いろんな値にしてみて見るといいものができるかもしれません。

最初にcode02が完成し、数日後に扱いやすくなるようにcode01のように書き直しました。
code02も質感が面白いので残します。