q5js/q5.js

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

Closed this issue · 0 comments

@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');
    }
}