// Copyright (c) 2025 catsona - All Rights Reserved var canvas = document.getElementById("paws"); var width = document.body.clientWidth; var height = document.body.clientHeight; var pawsize = Math.min(width, height) / 10.0; canvas.width = width; canvas.height = height; var context = canvas.getContext("2d"); context.fillStyle = '#141414'; context.fillRect(0, 0, canvas.width, canvas.height); function randf(min, max) { return Math.random() * (max - min) + min; } // Walker properties var step = pawsize * 1.5; var max_angle = 0.25; var frames_per_appear = 2; // Walker state var x = randf(0, width); var y = randf(0, height); var a = (Math.random() * 2.0 - 1.0) * Math.PI; var frame = 0; // Draw new paw each update setInterval( function() { // Verify dimensions var local_width = document.body.clientWidth; var local_height = document.body.clientHeight; if (local_width != width || local_height != height) { // Reinit width = local_width; height = local_height; pawsize = Math.min(width, height) * 0.1; step = pawsize * 1.5; context.fillStyle = '#141414'; context.fillRect(0, 0, canvas.width, canvas.height); x = randf(0, width); y = randf(0, height); a = (Math.random() * 2.0 - 1.0) * max_angle; } // Debug red dots //context.beginPath(); //context.arc(x, y, 5, 0, 2 * Math.PI); //context.fillStyle = "red"; //context.fill(); // Fade out context.globalAlpha = 0.51; context.fillStyle = "#141414"; context.fillRect(0, 0, canvas.width, canvas.height); // Draw and make a step context.globalAlpha = 1.0; context.save(); context.translate(x, y); context.rotate(a + Math.PI * 0.5); context.font = pawsize + 'px serif'; context.textAlign = "center"; context.fillText("🐾", 0, 0); context.restore(); if (frame >= frames_per_appear) { // Perform single step x += step * Math.cos(a); y += step * Math.sin(a); a += (Math.random() * 2.0 - 1.0) * max_angle * Math.PI; // Border check if (x < 0) x = width; if (y < 0) y = height; if (x > width) x = 0; if (y > height) y = 0; frame = 0; } ++frame; }, 400, );