当前位置:网站首页>Canvas random bubbling background
Canvas random bubbling background
2022-06-13 00:42:00 【KatyLight】

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
@font-face {
}
body{
padding: 0;
margin: 0;
background-color: black;
color: white;
}
.window{
position: fixed;
left: 0;
width: 100vw;
height:100vh;
top: 0;
z-index: 12;
}
.window>div{
width: fit-content;
height: fit-content;
position: absolute;
top:0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
input{
display: block;
background-color: rgba(0,0,0,0.5);
color: white;
border: 1px solid white;
font-size: 20px;
margin-left: 10px;
padding-inline-start: 30px;
line-height: 40px;
vertical-align: middle;
height: 40px;
width: 600px;
transition: all .5s ease-in ;
}
input:focus{
outline: none;
box-shadow: 0 0 7px 4px white, inset 0 0 5px 2px white;
transition: all .2s ease-in ;
}
input:focus+span{
text-shadow: 0 0 7px white;
font-weight: bolder;
transition: all .2s ease-in ;
}
input+span{
transition: all .2s ease-in ;
}
.search{
position: relative;
}
.search>span{
position: absolute;
top: 8px;
left: 17px;
z-index: 20;
}
</style>
</head>
<script>
var c,ctx;
window.onload=()=>{
c=document.getElementById('c')
c.width=window.screen.width;
c.height=window.screen.height;
ctx=c.getContext('2d');
ctx.strokeStyle="#FFFFFF88";
ctx.fillStyle="#FFFFFF88";
ctx.lineWidth=3;
for(let i=0;i<32;i++){
addCircles();
}
setInterval(()=>{
draw()
},1);
}
var circles=[
]
function addCircles(){
circles.push({
p:{
x:Math.floor(c.width*Math.random()),
y:Math.floor(c.height*Math.random())
},
r:1,
e:Math.floor(50+Math.random()*100)
})
}
function draw(){
ctx.clearRect(0,0,c.width,c.height)
for(let i=0;i<circles.length;i++){
ctx.beginPath();
ctx.arc(circles[i].p.x,circles[i].p.y,circles[i].r,0,Math.PI*2);
ctx.stroke();
ctx.closePath();
circles[i].r++;
if(circles[i].r>circles[i].e){
circles.splice(i,1);
addCircles();
}
}
}
</script>
<body>
<canvas id="c"></canvas>
<div class="window">
<div class="search">
<input type="search" placeholder=" Enter search content "/>
<span>◯</span>
</div>
</div>
</body>
</html>
边栏推荐
- Three kinds of thinking make me reborn
- [buglist] serial port programming does not read data
- Leetcode weekly -- April to May
- TypeError: wave. ensureState is not a function
- Arduino controls tb6600 driver +42 stepper motor
- Why is there always a space (63 or 2048 sectors) in front of the first partition when partitioning a disk
- Hard (magnetic) disk (I)
- Assembly language learning
- 6.824 Lab 1: MapReduce
- ucore lab2
猜你喜欢

Antdpro - protable realizes the linkage effect of two selection boxes

DNS attack surface analysis

Summary of openstack installation problems

1. Google grpc framework source code analysis Hello World

Some basic design knowledge

Daily buckle exercise - conclusion

Kotlin 协程,job的生命周期

深度学习每周期的步数多少合适?

A simple deadlock example

Development notes of Mongoose
随机推荐
How to determine whether T is a value type in a generic type or a reference class- How to determine whether T is a value type or reference class in generic?
RCC clock configuration of stm32f401
Why is there always a space (63 or 2048 sectors) in front of the first partition when partitioning a disk
市值破万亿,连续三个月销量破10万,比亚迪会成为最强国产品牌?
为什么磁盘分区的时候,第一个分区前面总有一段空间(63或者2048个扇区)
Masa auth - overall design from the user's perspective
Leetcode weekly -- April to May
After so long use, CSDN has finally opened a blog
Triangle wave and triangle wave convolution
Delphi2009 connecting Oracle11g
Andersen Global通过在芬兰和丹麦的合作协议拓展北欧地区业务版图
Mongodb array operation
[error] invalid use of incomplete type uses an undefined type
Stm32f4 development of DMA transmission to GPIO port
[LeetCode]20. Valid parentheses thirty-six
Kotlin 协程,job的生命周期
Browser cache execution process
Make the tasks in the scheduled task XXL job flexible
Lambda expression
kotlin 协程withContext切换线程