炫酷科技感黑客感瀑布流html代码
2024-10-21 06:21:51
效果如下
代码如下
<!DOCTYPE html><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>炫酷科技感黑客感瀑布流html代码</title>
<style>
* {
margin: 0;
padding: 0;
}
body {
background: black;
}
canvas {
display: block;
}
</style>
</head>
<body>
<canvas id="waterfall"></canvas>
<script>
var waterfall = document.getElementById("waterfall");
var ctx = waterfall.getContext("2d");
waterfall.height = window.innerHeight;
waterfall.width = window.innerWidth;
var chinese = "瀑布流瀑布流瀑布流";
chinese = chinese.split("");
var font_size = 10;
var columns = waterfall.width / font_size;
var drops = [];
for (var x = 0; x < columns; x++) drops[x] = 1;
function draw() {
ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
ctx.fillRect(0, 0, waterfall.width, waterfall.height);
ctx.fillStyle = "#0F0";
ctx.font = font_size + "px arial";
for (var i = 0; i < drops.length; i++) {
var text = chinese[Math.floor(Math.random() * chinese.length)];
ctx.fillText(text, i * font_size, drops[i] * font_size);
if (drops[i] * font_size > waterfall.height && Math.random() > 0.975)
drops[i] = 0;
drops[i]++;
}
}
setInterval(draw, 50);
</script>
</body>
</html>
最新文章
- 基于Hexo和Github搭建博客
- VS2013无法加载JSON格式
- android BluetoothLE 多个 setCharacteristicNotification writeCharacteristic 失效
- Linux系统下设置Tomcat自启动
- 7. Reverse Words in a String
- HDU 5773 最长上升子序列
- .NET动态加载用户控件并传值的方法
- thymeleaf比较符号问题
- linux-kernel/CodingStyle
- Sql server 数据库中,纯SQL语句查询、执行 单引号问题。
- JAVA工程师面试总结
- kubernetes系列08—service资源详解
- php 关于经纬度距离计算方法
- 向后台提交数据:cookie,secure_cookie,
- MD5+Salt值
- Vue事件总线(eventBus)$on()会多次触发解决办法
- Android 开发 VectorDrawable 矢量图 (二)了解矢量图属性与绘制
- My thoughts after NOIP 2018(1)
- MySQL复制框架
- golang bug Unknown load command 0x32 (50)
热门文章
- ysoserial commonscollections3 分析
- MySQL的下载、安装、配置
- 【lwip】09-IPv4协议&;超全源码实现分析
- 论文笔记 - An Explanation of In-context Learning as Implicit Bayesian Inference
- 小巧快速的ZooKeeper可视化管理+实时监控工具
- 【OpenStack云平台】网络控制节点 HA 集群配置
- 云原生之旅 - 13)基于 Github Action 的自动化流水线
- 递归与Stream流转换
- <;一>;继承的基本意义
- label studio 结合 MMDetection 实现数据集自动标记、模型迭代训练的闭环