|
在GitHub看到了比较不错的粒子效果,就整理了登录界面做背景给大家分享一下。
效果:
css样式:
[CSS] 纯文本查看 复制代码 html,
body {
position:fixed;
top:0px;
left:0px;
height:100%;
width:100%;
background: #141e6e;
background:
radial-gradient(
at center, #0075c3, #000b61
);
}
canvas {
display: block;
vertical-align: bottom;
}
#particles{
width: 100%;
height: 100%;
background-size: cover;
background-position: 50% 50%;
background-repeat: no-repeat;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.loginTitle {
font-size: 40px;
color: #fff;
position: fixed;
top: 32%;
width: 100%;
text-align: center;
}
.login_cont {
position: fixed;
width: 100%;
top: 47%;
text-align: center;
}
.login_cont input {
padding: 10px 15px;
border-radius: 3px;
border: none;
margin-right: 10px;
width: 220px;
}
.login_cont button {
padding: 9px 20px;
border: none;
background: #fff;
border-radius: 3px;
}
.login_cont button:hover {
cursor: pointer;
}
HTML:
[HTML] 纯文本查看 复制代码 <div id="particles">
<canvas class="particles-js-canvas-el" style="width: 100%; height: 100%;"></canvas>
</div>
<div class="loginTitle">苏飞论坛</div>
<div class="login_cont">
<input type="text" placeholder="账号">
<input type="password" placeholder="密码">
<button type="button">登录</button>
</div>
js代码:
[JavaScript] 纯文本查看 复制代码 particlesJS('particles',
{
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#ffffff"
},
"shape": {
"type": "circle",
"stroke": {
"width": 0,
"color": "#000000"
},
"polygon": {
"nb_sides": 5
},
"image": {
"src": "img/github.svg",
"width": 100,
"height": 100
}
},
"opacity": {
"value": 0.5,
"random": false,
"anim": {
"enable": false,
"speed": 1,
"opacity_min": 0.1,
"sync": false
}
},
"size": {
"value": 5,
"random": true,
"anim": {
"enable": false,
"speed": 40,
"size_min": 0.1,
"sync": false
}
},
"line_linked": {
"enable": true,
"distance": 150,
"color": "#ffffff",
"opacity": 0.4,
"width": 1
},
"move": {
"enable": true,
"speed": 6,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": true,
"mode": "repulse"
},
"onclick": {
"enable": true,
"mode": "push"
},
"resize": true
},
"modes": {
"grab": {
"distance": 400,
"line_linked": {
"opacity": 1
}
},
"bubble": {
"distance": 400,
"size": 40,
"duration": 2,
"opacity": 8,
"speed": 3
},
"repulse": {
"distance": 200
},
"push": {
"particles_nb": 4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true,
"config_demo": {
"hide_card": false,
"background_color": "#b61924",
"background_image": "",
"background_position": "50% 50%",
"background_repeat": "no-repeat",
"background_size": "cover"
}
}
);
效果运用了particles.js,可自行在网上下载,也可以在源码里获取,在这就不提供了。如需源码,请点击》》
login.zip
(11.09 KB, 下载次数: 0)
|
|