xxxxxxxxxx
143
let font1;
let startTime;
let alphaValue = 255; // Initial alpha value (fully opaque)
let fadeSpeed = 1; // Adjust the fading speed
function preload() {
font1 = loadFont('Kenia-Regular.ttf')
font2 = loadFont('Inter.ttf')
}
function setup() {
createCanvas(windowWidth, windowHeight);
textAlign(CENTER, CENTER); // Center text alignment
blendMode(EXCLUSION);
background(0); // Set the background color to blue
startTime = millis(); // Initialize the start time
}
let frameCountCustom = 0;
let frameCountCustom1 = 0;
let textX = 0;
function draw() {
// Calculate the elapsed time
let elapsedTime = millis() - startTime;
// Set a duration (in milliseconds) after which the text should start fading
let fadeStartTime = 5000; // Adjust this value based on your preference (5000 milliseconds = 5 seconds)
// Check if the elapsed time is less than the fade start time
if (elapsedTime < fadeStartTime) {
// Your existing drawing code goes here
// Example text drawing
textFont(font2);
fill(255);
textSize(35);
textFont(font1);
} else {
// If the time has exceeded the fade start time, start fading out the text
alphaValue = max(0, alphaValue - fadeSpeed);
}
// Set the alpha value for the text
fill(255, alphaValue);
frameCountCustom += 0.01;
textFont(font2);
fill(255);
let txt = "wavy";
let numberOfLines = 2;
let lineSpacing = 2;
push();
// fill("rgb(255, 90, 255)");
translate(width / 2 , height/2); // Center the canvas
for (let j = 0; j < numberOfLines; j++) {
let x0 = cos((frameCountCustom + j * 5) * 5 / 5 * 10) * 10 * 20;
// let y0 = lineSpacing * j * 10; // Adjust this value to move text further to the top
let y0 = tan((frameCountCustom1 + j * 1) * 5) * 3 * 120;
push();
translate(x0, y0);
let letterLocX = 0;
let letterLocY = 0;
for (let i = 0; i < txt.length; i++) {
let whichLetter = txt.charAt(i);
let movementX = sin((frameCountCustom + i / 100) * 0.5);
let movementY = tan((frameCountCustom + i * 2)) * 20;
let txtSize = 100;
let x1 = letterLocY / movementX;
let y1 = letterLocX / movementY;
textSize(txtSize);
text(whichLetter, x1, y1);
letterLocX += textWidth(whichLetter);
}
pop();
}
for (let j = 0; j < numberOfLines; j++) {
let x01 = sin((frameCountCustom + j + 10)) * 2 * 20;
// let y0 = lineSpacing * j; // Adjust this value to move text further to the top
let y01 = sin((frameCountCustom1 + j * 20 * 2) * 10)
}
pop();
}
function keyPressed() {
if (key === 'f' || key === 'F') {
enterFullscreen();
}
}
function enterFullscreen() {
let fs = fullscreen();
if (!fs) {
fullscreen(true);
}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
updateBackground(); // Update the background color when resizing the window
}