最新下载
24小时阅读排行榜
- 1 合约交易中的“限价单”和“市价单”有什么区别?哪种能避免不必要的损失?
- 2 如何删除mysql数据表
- 3 mysql命令行乱码如何解决
- 4 mysql怎么查询数据表是否在数据库中
- 5 合约交易中,如何区分“震荡行情”和“趋势行情”?用错策略的风险有多大?
- 6 怎么查看mysql的初始密码
- 7 以太坊能涨到多高,以下是2026年至2030年以太坊价格预测
- 8 比特币突破新高:2027年达到20万美元的潜在因素
- 9 什么是加密货币的“白皮书”?如何阅读和分析项目白皮书?
- 10 合约交易的“已实现盈亏”和“未实现盈亏”是什么?它们如何影响我的账户余额?
- 11 以太坊怎么买?哪个平台安全?
- 12 什么是交易滑点(Slippage)?避免在链上交易中多花钱的技巧
- 13 狗狗币价值评估:马斯克效应下是否适合配置资产
- 14 mongodb条件查询不等于
- 15 狗狗币起源故事:从 meme 到主流的5个关键里程碑
最新教程
-
- Node.js 教程
- 8656 2025-08-28
-
- CSS3 教程
- 1158804 2025-08-27
-
- Rust 教程
- 13859 2025-08-27
-
- Vue 教程
- 16099 2025-08-22
-
- PostgreSQL 教程
- 12471 2025-08-21
-
- Git 教程
- 5544 2025-08-21
html5 canvas线条下落动画特效是一款跟下雨有点相似的线条下落动画效果。
(function(){
var c = document.getElementById("c"),
ctx = c.getContext("2d");
c.width = innerWidth;
c.height = innerHeight;
var lines = [],
maxSpeed = 5,
spacing = 5,
xSpacing = 0,
n = innerWidth / spacing,
colors = ["#3B8686", "#79BD9A", "#A8DBA8", "#0B486B"],
i;
for (i = 0; i < n; i++){
xSpacing += spacing;
lines.push({
x: xSpacing,
y: Math.round(Math.random()*c.height),
width: 2,
height: Math.round(Math.random()*(innerHeight/10)),
speed: Math.random()*maxSpeed + 1,
color: colors[Math.floor(Math.random() * colors.length)]
});
}
function draw(){
var i;
ctx.clearRect(0,0,c.width,c.height);
for (i = 0; i < n; i++){
ctx.fillStyle = lines[i].color;
ctx.fillRect(lines[i].x, lines[i].y, lines[i].width, lines[i].height);
lines[i].y += lines[i].speed;
if (lines[i].y > c.height)
lines[i].y = 0 - lines[i].height;
}
requestAnimationFrame(draw);
}
draw();
}());

