q5js / q5.js

A sequel to p5.js that's optimized for interactive art!
https://q5js.org
GNU Lesser General Public License v3.0
123 stars 9 forks source link

Fill+stroke doesn't persist between `draw` loops #56

Closed quinton-ashley closed 3 months ago

quinton-ashley commented 4 months ago

@Tezumie reports that

when draw loop restarts setting fill or stroke doesnt persist to next loop, like this for example, the ellipse is always the color from setup even though i set it at end of draw. this is different from behaviour in p5. in p5 the fill or stroke you set will persist through draw loops and not need set again before drawing a shape

let xOff = 0;
let yOff = 0;
let x = 0;
let y = 0;

function setup() {
    width = 500;
    height = 500;
    createCanvas(width, height);
    background('#ffffff');
    fill('#ed1a95');
}
function draw() {
    x = (noise(xOff, 1, 1) * width);
    y = (noise(yOff, 1, 1) * height);
    ellipse(x, y, 100, 100);
    xOff = (xOff + 0.01);
    yOff = (yOff + 0.02);
    if((x > (width / 2))){
        fill('#b19fa9');
    }
    else{
        fill('#000000');
    }
}