[mw_shl_code=css、真]<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title>マートリックス</title> <style> 本文 { マージン:0; パッド数:0; 背景色:#000; オーバーフロー:隠し; カラー:#e6922a; } </style> </head> <body> <canvas id="canvas"></canvas>
<スクリプトタイプ="text/javascript"> var canvas = document.getElementById("canvas"), context = canvas.getContext("2d");
var fontSize = 12, listText = "abcdefghijklmnopqrstuvwxyz ".split(""), 列、行、 listColumn = [];
関数 draw() { 描画背景 context.fillStyle = "rgba(0, 0, 0, 0.05)"; context.fillRect(0, 0, canvas.width, canvas.height); context.save();
ロゴを描く context.shadowColor = "#074425"; context.shadowBlur = parseInt(Math.random() * 40 + 1); context.font = "太字36px Arial"; context.fillStyle = "#eefbf5"; context.fillText("ITSVSE.COM", (canvas.width / 2 - context.measureText("ITSVSE.COM").width / 2), canvas.height - 200); context.fillText("Wusoft Forum", (canvas.width / 2 - context.measureText("Wusoft Forum").width / 2), canvas.height - 165); context.font = "16px Microsoft Yahei"; context.fillText(「The Matrix: The Matrix Revolution」、(canvas.width / 2 - context.measureText("The Matrix: The Matrix Revolution").width / 2), canvas.height - 100);
描画コード context.restore(); context.font = "normal " + fontSize + "px Arial"; context.fillStyle = "#12ee46"; (var i = 0; 私は<列; i++) { もし(Math.random() > 0.5) { var str = listText[parseInt(Math.random() * listText.length)]; context.fillText(str, i * fontSize, listColumn* fontSize); リストコラム+= 1; もし(listColumn>= 行) { リストコラム= 0; } } } }
関数 resize() { canvas.width = window.innerWidth - 3; canvas.height = window.innerHeight - 3;
column = canvas.width / fontSize, 行 = canvas.height / fontSize;
(var i = 0; 私は<列; i++) { リストコラム= 1; } }
window.addEventListener("resize", resize);
canvas.addEventListener("mousedown", function () { clearInterval(タイマー); タイマー = setInterval(draw, 20); });
canvas.addEventListener("mouseup", function () { clearInterval(タイマー); タイマー = setInterval(draw, 40); });
resize(); var timer = setInterval(draw, 40);
</script> </body> [/</html>mw_shl_code]
|