xxxxxxxxxx
70
let font;
let pg;
let b;
let content = "perfection";
let blockSize = 200;
let step = 3;
let noiseScale = 0.01;
let noiseLevel = 20;
function preload() {
font = loadFont("/font/LibreBodoni-Bold.ttf");
}
function setup() {
// createCanvas(4960, 7016);
createCanvas(400, 400);
}
function draw() {
background(255);
textFont(font);
textSize(blockSize);
background(255);
noFill();
// for (let y = 0; y < height; y += 15) {
// stroke(0, y / 20);
// text(content, width / 2 - blockSize * step, y);
// }
noFill();
for (let y = 0; y < height; y += 15) {
stroke(0, y / 20);
strokeWeight(3);
let points = font.textToPoints(
content,
width / 2 - blockSize * step,
y,
blockSize,
{
sampleFactor: 0.5,
}
);
for (let p of points) {
let nx = noiseScale * p.x;
let ny = noiseScale * p.y;
let c = noiseLevel * noise(nx, ny);
point(p.x + c, p.y + c);
}
}
noiseScale += 0.001;
stroke(0);
fill(255);
text(content, width / 2 - blockSize * step, height);
}
function mousePressed() {
saveFrames("imperfection", "png", 1, 2);
}
function printFrames(frames) {
for (let frame of frames) {
print(frame);
}
}