效果如下

代码如下

<!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>

最新文章

  1. 基于Hexo和Github搭建博客
  2. VS2013无法加载JSON格式
  3. android BluetoothLE 多个 setCharacteristicNotification writeCharacteristic 失效
  4. Linux系统下设置Tomcat自启动
  5. 7. Reverse Words in a String
  6. HDU 5773 最长上升子序列
  7. .NET动态加载用户控件并传值的方法
  8. thymeleaf比较符号问题
  9. linux-kernel/CodingStyle
  10. Sql server 数据库中,纯SQL语句查询、执行 单引号问题。
  11. JAVA工程师面试总结
  12. kubernetes系列08—service资源详解
  13. php 关于经纬度距离计算方法
  14. 向后台提交数据:cookie,secure_cookie,
  15. MD5+Salt值
  16. Vue事件总线(eventBus)$on()会多次触发解决办法
  17. Android 开发 VectorDrawable 矢量图 (二)了解矢量图属性与绘制
  18. My thoughts after NOIP 2018(1)
  19. MySQL复制框架
  20. golang bug Unknown load command 0x32 (50)

热门文章

  1. ysoserial commonscollections3 分析
  2. MySQL的下载、安装、配置
  3. 【lwip】09-IPv4协议&amp;超全源码实现分析
  4. 论文笔记 - An Explanation of In-context Learning as Implicit Bayesian Inference
  5. 小巧快速的ZooKeeper可视化管理+实时监控工具
  6. 【OpenStack云平台】网络控制节点 HA 集群配置
  7. 云原生之旅 - 13)基于 Github Action 的自动化流水线
  8. 递归与Stream流转换
  9. &lt;一&gt;继承的基本意义
  10. label studio 结合 MMDetection 实现数据集自动标记、模型迭代训练的闭环