Skip to content
The Chat Archive
gpt-4-0314· OpenAI WildChat-4.8M (AI2)

сделай так, чтобы символы переливались при падении разными цветами плавно. не обясняй…

  1. User

    сделай так, чтобы символы переливались при падении разными цветами плавно. не обясняй как. просто выведи полный код программы. сократи код. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); const cols = canvas.width = window.innerWidth; const rows = canvas.height = window.innerHeight; const size = 10; const chars = "abcdefghijklmnopqrstuvwxyz0123456789?!( ):%₽#&*?!;’«»" const charArr = chars.split(""); const matrix = []; for (let i = 0; i < cols / size; i++) { matrix.push([100]); for (let j = 0; j < rows / size; j++) { matrix[i].push(); } }

    function draw() { ctx.fillStyle = "rgba(0, 0.01, 10, 0.05)"; ctx.fillRect(0, 0, cols, rows); ctx.fillStyle = "#0F0"; ctx.font = size + "px arial"; for (let i = 0; i < matrix.length; i++) { for (let j = 0; j < matrix[i].length; j++) { const char = charArr[Math.floor(Math.random() * charArr.length)]; ctx.fillText(char, i * size, matrix[i][j] * size); if (matrix[i][j] * size > rows && Math.random() > 0.975) { matrix[i][j] = 0; } matrix[i][j]++; } } }

    setInterval(draw, 50);

  2. Assistant

    const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); const cols = canvas.width = window.innerWidth; const rows = canvas.height = window.innerHeight; const size = 10; const chars = "abcdefghijklmnopqrstuvwxyz0123456789?!( ):%₽#&*?!;’«»" const charArr = chars.split(""); const matrix = [];

    for (let i = 0; i < cols / size; i++) { matrix[i] = []; for (let j = 0; j < rows / size; j++) { matrix[i][j] = Math.random() * rows / size; } }

    function rgb() { return 'rgb(' + Math.floor(Math.random() * 256) + ',' + Math.floor(Math.random() * 256) + ',' + Math.floor(Math.random() * 256) + ')'; }

    function draw() { ctx.fillStyle = "rgba(0, 0, 10, 0.05)"; ctx.fillRect(0, 0, cols, rows);

    ctx.font = size + "px arial"; for (let i = 0; i < matrix.length; i++) { for (let j = 0; j < matrix[i].length; j++) { const char = charArr[Math.floor(Math.random() * charArr.length)]; ctx.fillStyle = rgb(); ctx.fillText(char, i * size, matrix[i][j] * size); if (matrix[i][j] * size > rows && Math.random() > 0.975) { matrix[i][j] = 0; } matrix[i][j]++; } } }

    setInterval(draw, 50);