写一个html登录页,canvas星光粒子动画特效
时间: 2023-10-11 20:05:59 浏览: 146
Canvas烟花粒子上升特效
好的,我可以为您提供一些代码示例,帮助您创建这样一个登录页。以下是一个基本的HTML结构,其中包含一个登录表单和一个canvas元素用于星光粒子动画特效:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<style>
canvas {
display: block;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
</style>
</head>
<body>
<canvas id="particles"></canvas>
<form action="#">
<label for="username">Username:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Login">
</form>
<script src="https://cdnjs.cloudflare.com/ajax/libs/particlesjs/2.2.3/particles.min.js"></script>
<script>
/* 使用 particles.js 库创建星光粒子动画特效 */
particlesJS("particles", {
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#ffffff"
},
"shape": {
"type": "circle",
"stroke": {
"width": 0,
"color": "#000000"
},
},
"opacity": {
"value": 0.5,
"random": false
},
"size": {
"value": 2,
"random": true
},
"line_linked": {
"enable": true,
"distance": 150,
"color": "#ffffff",
"opacity": 0.4,
"width": 1
},
"move": {
"enable": true,
"speed": 3,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"bounce": false,
},
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": false,
},
"onclick": {
"enable": false
},
"resize": true
},
},
"retina_detect": true
});
</script>
</body>
</html>
```
您可以将此代码复制到您的HTML文件中,并根据需要进行更改和调整。希望这可以帮助您创建所需的登录页。
阅读全文