xxxxxxxxxx
52
let textBuffer;
let textDim = 4;
function setup() {
createCanvas(windowWidth, windowHeight);
smooth(4);
background(0);
textAlign(CENTER);
frameRate(1);
textBuffer = createGraphics(width, height);
textBuffer.textAlign(CENTER, CENTER); // Set text alignment for the buffer
}
//reference
// function draw() {
// textDim++;
// frameRate(textDim);
// textSize(textDim);
// fill(random(0, 255));
// for (let i = 0; i < frameRate(); i++) {
// text(int(random(-999999999, 999999999)), random(0, width), random(0, height));
// }
// }
function draw() {
textDim++;
frameRate(textDim);
textSize(textDim);
// Draw text into the text buffer
textBuffer.stroke(random(200, 0));
textBuffer.noFill();
// textBuffer.noFillfill(random(200, 0)); // Text color in the buffer
textBuffer.textSize(textDim);
// Display the text buffer on the main canvas
image(textBuffer, 0, 0);
for (let i = 0; i < frameRate(); i++) {
// Change the text you want to display here
textBuffer.text("October", random(0, width), random(0, height));
}
}
function keyPressed() {
if (key === 's' || key === 'S') {
saveCanvas('buffer 1_', 'png'); // Save the canvas as a svg file with the filename 'blank'
}
}