Something went wrong. Try again.
silly personal website
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118<!DOCTYPE html><html> <head> <meta charset="utf-8"> <style> * { margin: 0; padding: 0; } html, body { overflow: hidden; } canvas { display: block; image-rendering: pixelated; } </style> </head> <body> <canvas id="c" width="88" height="31"></canvas> <script> const canvas = document.getElementById("c"), ctx = canvas.getContext("2d");
const BUTTON_W = 88, BUTTON_H = 31; const pixelBuffer = new Uint8ClampedArray(BUTTON_W * BUTTON_H * 4);
let time = 0;
const bayer = [0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5].map((v) => v / 16); function dither(brightness, x, y) { const threshold = bayer[(y & 3) * 4 + (x & 3)]; return brightness > threshold ? 255 : 0; }
function wave(x, y, time) { const normX = x / BUTTON_W; const normY = y / BUTTON_H;
const depth = normY; const depth2 = depth * depth;
const frequency = 7 + 18 * depth2; const scrollSpeed = time * (0.5 + depth2 * 1.4);
const w1 = Math.sin(normX * frequency + scrollSpeed + Math.sin(normX * 3.1 - time * 0.4) * 1.5); const w2 = Math.sin( normX * frequency * 0.6 - scrollSpeed * 1.2 + Math.cos(normX * 5.7 + time * 0.5) * 1.0, ); const w3 = Math.sin(normX * frequency * 1.4 + scrollSpeed * 0.8 + normY * 5 - time); const w4 = Math.cos( normX * frequency * 0.35 - scrollSpeed * 0.6 + Math.sin(normY * 8 + time * 0.7) * 0.8, );
const weightedBrightness = w1 * 0.35 + w2 * 0.3 + w3 * 0.2 + w4 * 0.15; const foamCrest = Math.max(0, weightedBrightness - 0.45) * 4 * depth; const contrastScaled = weightedBrightness * (0.25 + depth2 * 0.75) + 0.4;
return Math.max(0, Math.min(1, contrastScaled + foamCrest)); }
const glyphs = { k: ["1000", "1001", "1010", "1100", "1010", "1001"], y: ["0000", "1001", "1001", "0111", "0001", "0110"], u: ["0000", "1001", "1001", "1001", "1001", "0111"], ".": ["0", "0", "0", "0", "0", "1"], r: ["0000", "1011", "1100", "1000", "1000", "1000"], e: ["0000", "0110", "1001", "1111", "1000", "0110"], };
const charWidths = { k: 4, y: 4, u: 4, ".": 1, r: 4, e: 4 }; const labelChars = ["k", "y", "u", ".", "r", "e"];
const TAG_W = 30, TAG_H = 11; const TAG_X = BUTTON_W - TAG_W; const TAG_Y = BUTTON_H - TAG_H; const TEXT_X = TAG_X + 2; const TEXT_Y = TAG_Y + 2;
function drawTag() { ctx.fillStyle = "#000"; ctx.fillRect(TAG_X, TAG_Y, TAG_W, TAG_H);
ctx.fillStyle = "#fff"; let cursorX = TEXT_X; labelChars.forEach((char) => { glyphs[char].forEach((row, rowIndex) => { [...row].forEach((bit, bitIndex) => { if (bit === "1") ctx.fillRect(cursorX + bitIndex, TEXT_Y + rowIndex, 1, 1); }); }); cursorX += charWidths[char] + 1; }); }
function drawFrame() { time += 0.038; for (let y = 0; y < BUTTON_H; y++) { for (let x = 0; x < BUTTON_W; x++) { const brightness = dither(wave(x, y, time), x, y); const bufferIndex = (y * BUTTON_W + x) * 4; pixelBuffer[bufferIndex] = brightness; pixelBuffer[bufferIndex + 1] = brightness; pixelBuffer[bufferIndex + 2] = brightness; pixelBuffer[bufferIndex + 3] = 255; } }
ctx.putImageData(new ImageData(pixelBuffer, BUTTON_W, BUTTON_H), 0, 0); drawTag();
requestAnimationFrame(drawFrame); }
drawFrame(); </script> </body></html>