js实现夜晚月亮下云层上流星雨动画效果代码
代码语言:html
所属分类:动画
代码描述:js实现夜晚月亮下云层上流星雨动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
/* ------------reset------------ */
* {
margin: 0;
padding: 0;
}
html,
body {
width: 100%;
min-width: 1000px;
height: 100%;
min-height: 400px;
overflow: hidden;
}
.container {
position: relative;
width: 100%;
height: 100%;
min-width: 100px;
min-height: 400px;
}
/* ------------画布 ------------ */
/* 遮罩层 */
#mask {
position: absolute;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .8);
z-index: 900;
}
/* 天空背景 */
#sky {
width: 100%;
height: 100%;
background: linear-gradient(rgba(0, 150, 255, 1), rgba(0, 150, 255, .8), rgba(0, 150, 255, .5));
}
/* 月亮 */
#moon {
position: absolute;
top: 50px;
right: 200px;
width: 120px;
height: 120px;
background: rgba(251, 255, 25, 0.938);
border-radius: 50%;
box-shadow: 0 0 20px rgba(251, 255, 25, 0.5);
z-index: 9999;
}
/* 闪烁星星 */
.blink {
position: absolute;
background: rgb(255, 255, 255);
border-radius: 50%;
box-shadow: 0 0 5px rgb(255, 255, 255);
opacity: 0;
z-index: 10000;
animation: blingbling 2s linear infinite;
}
/* 流星 */
.star {
position: absolute;
opacity: 0;
animation: fall 5s linear infinite;
z-index: 10000;
}
.star::after {
content: "";
display: block;
border: solid;
border-width: 2px 0 2px 80px;
/*流星随长度逐渐缩小*/
border-color: transparent transparent transparent rgba(255, 255, 255, 1);
border-radius: 2px 0 0 2px;
transform: rotate(-45deg);
transform-origin: 0 0 0;
box-shadow: 0 0 20px rgba(255, 255, 255, .3);
}
/* 云 */
.cloud {
position: absolute;
width: 100%;
height: 100px;
/* background: #fff; */
animation: float 2s linear infinite;
}
.cloud-1 {
bottom: -100px;
z-index: 1000;
opacity: 1;
animation-delay: 1s;
transform: scale(1.5);
-webkit-transform: scal.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0