xxxxxxxxxx
32
let myfont;
let fontSize = 160;
let hiArray;
function preload() {
myfont = loadFont("GraphikMedium.otf");
}
function setup() {
createCanvas(600, 400);
textFont(myfont); // use myfont as default font
textSize(fontSize);
hiArray = myfont.textToPoints("hello", 100, height / 2, fontSize, {
sampleFactor: 0.2,
});
}
function draw() {
background(220);
// text("hi", 100, height / 2);
beginShape();
for (let i = 0; i < hiArray.length; i++) {
// noStroke();
fill(hiArray[i].x, mouseX, mouseY);
rect(hiArray[i].x, hiArray[i].y, 5, -mouseY);
//line(hiArray[i].x, hiArray[i].y, mouseX, mouseY);
}
}