font = loadFont('GrandHotel-Regular.ttf');
createCanvas(windowWidth, windowHeight);
gradientCnv = createGraphics(width, height);
textCnv = createGraphics(width, height);
function frankify(canvas, textString) {
bounds = font.textBounds(textString, 0, 0, height / 4);
textX = width/2 - bounds.w/2;
textY = height/2 - bounds.h/2;
letterPoint = {x: textX, y: textY};
for (let i = 0; i < textString.length; i++) {
let letter = textString.charAt(i);
letterBounds = font.textBounds(letter, 0, 0, height / 4);
points = font.textToPoints(letter, letterPoint.x, letterPoint.y, height / 4, {
letterPoint.x = letterPoint.x + letterBounds.w;
letterPoint = {x: textX, y: textY};
for (let i = 0; i < textString.length; i++) {
letter = textString.charAt(i);
letterBounds = font.textBounds(letter, 0, 0, height / 4);
points = font.textToPoints(letter, letterPoint.x, letterPoint.y, height / 4, {
canvas.textSize(height / 4);
canvas.text(letter, letterPoint.x, letterPoint.y);
letterPoint.x = letterPoint.x + letterBounds.w;
let shift = frankify(textCnv, "Lisa Frank");
gradient = prepGradient();
function prepGradient() {
let gradientCnv = createGraphics(width, height);
let gradient = gradientCnv.drawingContext.createLinearGradient(textX, textY - bounds.h, textX + bounds.w, textY);
gradient.addColorStop(0, color("#ff08d6"));
gradient.addColorStop(0.15, color("#ffa408"));
gradient.addColorStop(0.33, color("#fbff00"));
gradient.addColorStop(0.48, color("#41f01a"));
gradient.addColorStop(0.75, color("#1ac1f0"));
gradient.addColorStop(0.95, color("#a51af0"));
gradientCnv.drawingContext.fillStyle = gradient
gradientCnv.rect(0, 0, width, height);
function drawText(context) {
for (let i = 0; i < points.length; i++) {