Html
    Css
    Js

    
                        
html,body {
	width:100%;
	height:100%;
	overflow:hidden;
	background-color:#fff;
}
body {
	margin:0;
	padding:0;
}
.rain {
	margin-top:10px;
	width:6px;
	height:3px;
	border-radius:0 0 6px 6px;
	background:#999;
	position:absolute;
}
.rain::after {
	content:'';
	position:absolute;
	top:-16px;
	left:50%;
	transform:translateX(-50%);
	width:0;
	height:0;
	border-top:8px solid transparent;
	border-left:3px solid transparent;
	border-right:3px solid transparent;
	border-bottom:8px solid #999;
}
.rainStop {
	position:absolute;
	margin-top:10px;
	width:2px;
	height:6px;
	border-radius:2px;
	transform:rotate(-45deg);
	background:#999;
}
.rainStop::after {
	content:'';
	position:absolute;
	width:2px;
	height:6px;
	border-radius:2px;
	top:6px;
	left:6px;
	background:#999;
	transform:rotate(90deg);
}
.water {
	width:100%;
	height:250px;
	background:#555;
	position:absolute;
	bottom:0;
}

                        
↑上面代码改变,会自动显示代码结果 jQuery调用版本:2.0.0
 立即下载

原生js模仿下雨效果

更新时间:2022-11-22 13:21:28

因最近有初学者朋友想学习js效果,让我帮他实现简单的下雨效果,本效果为纯原生js,效果较为简单,欢迎指点

0