xxxxxxxxxx
63
let inputText = `Marshall McLuhan, a pivotal figure in the study of media theory, introduced the concept that 'the medium is the message.' This idea, which at first might seem cryptic, emphasizes that the form of a medium embeds itself in the message, creating a symbiotic relationship by which the medium influences how the message is perceived.
McLuhan argued that every medium—whether it is print, television, or the internet—has its own set of characteristics that determine how a message is delivered and thus shapes our interactions and understanding. For example, television is an audiovisual medium that engages viewers differently from print, which is primarily textual and requires a different level of engagement and interpretation.`;
let textPadding = 20;
let backgroundColor = "#36ed95";
let textColor = "#ffffff";
let graphics;
function setup() {
createCanvas(500, 500);
graphics = createGraphics(500, 500); // Create an off-screen graphics buffer
noLoop();
}
function draw() {
graphics.background(backgroundColor);
graphics.fill(textColor);
graphics.textSize(20);
graphics.textAlign(LEFT, TOP);
graphics.text(inputText, textPadding, textPadding, graphics.width - 2 * textPadding, graphics.height - 2 * textPadding);
applyNoiseBlur(graphics, 8); // Apply noise and blur, adjust the '8' to increase/decrease blur intensity
image(graphics, 0, 0); // Draw the off-screen buffer to the main canvas
}
function applyNoiseBlur(pg, blurLevel) {
pg.loadPixels();
for (let x = 0; x < pg.width; x++) {
for (let y = 0; y < pg.height; y++) {
let index = (x + y * pg.width) * 4;
let r = noise(x / 100, y / 100) * blurLevel; // Using Perlin noise for blur variation
let newX = Math.floor(x + r - blurLevel / 2);
let newY = Math.floor(y + r - blurLevel / 2);
let newIndex = (newX + newY * pg.width) * 4;
if (newX > 0 && newX < pg.width && newY > 0 && newY < pg.height) {
pg.pixels[index] = pg.pixels[newIndex];
pg.pixels[index + 1] = pg.pixels[newIndex + 1];
pg.pixels[index + 2] = pg.pixels[newIndex + 2];
pg.pixels[index + 3] = pg.pixels[newIndex + 3];
}
}
}
pg.updatePixels();
}
function setText(newText) {
inputText = newText;
redraw();
}
function updateBackgroundColor(newColor) {
backgroundColor = newColor;
redraw();
}
function updateTextColor(newColor) {
textColor = newColor;
redraw();
}