xxxxxxxxxx
33
let cnv
async function setup() {
cnv = createCanvas(windowWidth, windowHeight);
await loadGoogleFontSet('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wdth,wght@75..100,200..800&display=swap');
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
function draw() {
const t = frameCount / 60 * 1000
background('#E0018D');
noStroke();
fill(`rgba(245,100,100,${map(sin(millis() * 0.0025), -1, 1, 0, 1)})`);
rect(0, 0, width, height);
textAlign(CENTER, CENTER);
noStroke();
fill('white');
textSize(min(width, height) * 0.12);
const numRows = 5;
for (let row = 0; row < numRows; row++) {
const x = width/2;
const y = map(row, 0, numRows-1, height*0.25, height*0.75);
textFont('Bricolage Grotesque', {
fontVariationSettings: `wght ${map(sin(t * 0.005 - row), -1, 1, 200, 800)}`
});
console.log(cnv.drawingContext.font)
text('p5*js 2.0', x, y);
}
}