话不多说上才艺
效果图如下
复制粘贴可直接运行
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="box"></div>
</body>
<script>
var boxHtml = document.querySelector('.box')
var str = 'abcdefghojklmnopqrstuvwxyz'
for (let i = 0; i < 50; i++) {
let Random = Math.random() * (5 - 1) + 1
const dom = document.createElement('div')
let innerText = ''
for (let index = 0; index < Random; index++) {
innerText = innerText.concat(str)
}
dom.innerText = innerText
dom.style.animationDelay = `${Math.random() * 2}s`
dom.style.animationDuration = `${Math.random() * (3 -2) + 2}s`
dom.style.opacity = 0
boxHtml.appendChild(dom)
}
</script>
<style>
.box{
/* display: flex; */
margin: 0 auto;
width: 1000px;
height: 1000px;
transform-origin:center;
transform: rotate(90deg);
}
.box div{
width: 100%;
color: #999;
animation-name: move;
animation-iteration-count:infinite;
animation-direction: normal;
animation-timing-function: linear;
margin: 10px 0;
}
@keyframes move {
0% {
transform: translateX(-100px);
opacity: 0;
}
25%{
transform: translateX(50px);
opacity: 0.2;
}
50%{
transform: translateX(200px);
opacity: 0.5;
}
75%{
transform: translateX(450px);
opacity: 0.2;
}
100%{
transform: translateX(600px);
opacity: 0;
}
}
body {
background: radial-gradient(
circle at 50%,
rgb(255, 255, 255),
rgba(214, 214, 214),
rgb(97, 97, 97)
);
}
</style>
</html>