Tròn mờ
HTML
<div class="background">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
CSS
@keyframes move {
100% {
transform: translate3d(0, 0, 1px) rotate(360deg);
}
}
.background {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
background: #3e1e68;
overflow: hidden;
}
.background span {
width: 20vmin;
height: 20vmin;
border-radius: 20vmin;
backface-visibility: hidden;
position: absolute;
animation: move;
animation-duration: 45;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.background span:nth-child(0) {
color: #583c87;
top: 67%;
left: 19%;
animation-duration: 41s;
animation-delay: -13s;
transform-origin: -15vw 12vh;
box-shadow: -40vmin 0 5.923003133544631vmin currentColor;
}
.background span:nth-child(1) {
color: #ffacac;
top: 33%;
left: 47%;
animation-duration: 14s;
animation-delay: -41s;
transform-origin: 20vw 12vh;
box-shadow: -40vmin 0 5.183524068119022vmin currentColor;
}
.background span:nth-child(2) {
color: #583c87;
top: 17%;
left: 48%;
animation-duration: 39s;
animation-delay: -49s;
transform-origin: -18vw -8vh;
box-shadow: -40vmin 0 5.604894976930375vmin currentColor;
}
.background span:nth-child(3) {
color: #e45a84;
top: 3%;
left: 53%;
animation-duration: 12s;
animation-delay: -50s;
transform-origin: -7vw 21vh;
box-shadow: 40vmin 0 5.090670665023326vmin currentColor;
}
.background span:nth-child(4) {
color: #e45a84;
top: 20%;
left: 23%;
animation-duration: 34s;
animation-delay: -13s;
transform-origin: -9vw -21vh;
box-shadow: 40vmin 0 5.755125820815682vmin currentColor;
}
.background span:nth-child(5) {
color: #e45a84;
top: 8%;
left: 68%;
animation-duration: 26s;
animation-delay: -25s;
transform-origin: 15vw 1vh;
box-shadow: 40vmin 0 5.460022597795787vmin currentColor;
}
.background span:nth-child(6) {
color: #ffacac;
top: 27%;
left: 86%;
animation-duration: 36s;
animation-delay: -30s;
transform-origin: 3vw -14vh;
box-shadow: 40vmin 0 5.9302648663523545vmin currentColor;
}
.background span:nth-child(7) {
color: #ffacac;
top: 87%;
left: 14%;
animation-duration: 55s;
animation-delay: -29s;
transform-origin: 4vw -1vh;
box-shadow: -40vmin 0 5.837127947123709vmin currentColor;
}
.background span:nth-child(8) {
color: #e45a84;
top: 67%;
left: 95%;
animation-duration: 41s;
animation-delay: -31s;
transform-origin: -17vw -9vh;
box-shadow: 40vmin 0 5.651933768433996vmin currentColor;
}
.background span:nth-child(9) {
color: #e45a84;
top: 62%;
left: 2%;
animation-duration: 43s;
animation-delay: -40s;
transform-origin: -20vw -2vh;
box-shadow: -40vmin 0 5.98898143407259vmin currentColor;
}
.background span:nth-child(10) {
color: #e45a84;
top: 60%;
left: 88%;
animation-duration: 31s;
animation-delay: -28s;
transform-origin: 1vw 19vh;
box-shadow: 40vmin 0 5.685829853284142vmin currentColor;
}
.background span:nth-child(11) {
color: #e45a84;
top: 63%;
left: 68%;
animation-duration: 24s;
animation-delay: -19s;
transform-origin: -17vw -12vh;
box-shadow: -40vmin 0 5.220523752593713vmin currentColor;
}
.background span:nth-child(12) {
color: #583c87;
top: 61%;
left: 95%;
animation-duration: 48s;
animation-delay: -48s;
transform-origin: -16vw 16vh;
box-shadow: 40vmin 0 5.7782361793158925vmin currentColor;
}
.background span:nth-child(13) {
color: #583c87;
top: 98%;
left: 71%;
animation-duration: 44s;
animation-delay: -20s;
transform-origin: -22vw 19vh;
box-shadow: 40vmin 0 5.974989552760053vmin currentColor;
}
.background span:nth-child(14) {
color: #ffacac;
top: 64%;
left: 67%;
animation-duration: 19s;
animation-delay: -4s;
transform-origin: -9vw -23vh;
box-shadow: 40vmin 0 5.594627244812381vmin currentColor;
}
.background span:nth-child(15) {
color: #583c87;
top: 100%;
left: 84%;
animation-duration: 23s;
animation-delay: -10s;
transform-origin: 5vw 9vh;
box-shadow: 40vmin 0 5.934702137468266vmin currentColor;
}
.background span:nth-child(16) {
color: #ffacac;
top: 68%;
left: 25%;
animation-duration: 51s;
animation-delay: -27s;
transform-origin: 5vw 12vh;
box-shadow: -40vmin 0 5.464888612501206vmin currentColor;
}
.background span:nth-child(17) {
color: #583c87;
top: 91%;
left: 83%;
animation-duration: 44s;
animation-delay: -21s;
transform-origin: 6vw 12vh;
box-shadow: 40vmin 0 5.114401367352861vmin currentColor;
}
.background span:nth-child(18) {
color: #e45a84;
top: 93%;
left: 3%;
animation-duration: 46s;
animation-delay: -39s;
transform-origin: -6vw -24vh;
box-shadow: -40vmin 0 5.8417496140967895vmin currentColor;
}
.background span:nth-child(19) {
color: #ffacac;
top: 3%;
left: 80%;
animation-duration: 28s;
animation-delay: -40s;
transform-origin: 15vw -5vh;
box-shadow: 40vmin 0 5.606148624688431vmin currentColor;
}
Tùy chỉnh hiệu ứng này và lấy mã tại đây: Animated CSS Background Generator.
Chúc các bạn thành công!
Bình Luận