css+svg实现圆点loading加载动画效果代码

代码语言:html

所属分类:加载滚动

代码描述:css+svg实现圆点loading加载动画效果代码

代码标签: loading 加载 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
<style>
* {
  border: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #e3e4e8;
  --fg: #17181c;
  --primary: #255ff4;
  --secondary: #f4af25;
  font-size: calc(24px + (36 - 24) * (100vw - 320px) / (1280 - 320));
}

body {
  background: var(--bg);
  color: var(--fg);
  display: grid;
  font: 1em/1.5 sans-serif;
  height: 100vh;
  place-items: center;
}

.pl {
  width: 7em;
  height: 2em;
}
.pl, .pl__inner, .pl__oval-group {
  overflow: hidden;
}
.pl, .pl__inner {
  border-radius: 1em;
}
.pl__inner {
  display: flex;
  width: 100%;
  height: 100%;
}
.pl__oval {
  animation: inAndOut 2s linear infinite;
  background-color: var(--primary);
  border-radius: 50%;
  width: 1em;
  height: 1.5em;
  transform: scale(0);
}
.pl__oval-group {
  filter: url("#goo");
  -webkit-filter: url("#goo");
  height: 4.5em;
  transform: translateY(1em) translateY(-50%);
}
.pl__oval-group:nth-child(2n) .pl__oval {
  background-color: var(--secondary);
}
.pl__oval-group:nth-child(7n + 2) .pl__oval {
  animation-delay: 0.1s;
}
.pl__oval-group:nth-child(7n + 3) .pl__oval {
  animation-delay: 0.2s;
}
.pl__oval-group:nth-child(7n + 4) .pl__oval {
  animation-delay: 0.3s;
}
.pl__oval-group:nth-child(7n + 5) .pl__oval {
  animation-delay: 0.4s;
}
.pl__oval-group:nth-child(7n + 6) .pl__oval {
  animation-delay: 0.5s;
}
.pl__oval-group:nth-child(7n + 7) .pl__oval {
  animation-delay: 0.6s;
}

.svg-filter {
  position: absolute;
  transform: translate(-100%, -100%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181c;
    --fg: #e3e4e8;
  }
}
@keyframes inAndOut {
  from, 75%, to {
    transform: scale(0);
  }
  37.5% {
    transform: scale(1.3);
  }
}
</style>



</head>

<body translate="no" >
  <div class="pl">
	<div class="pl__inner">
		<div class="pl__oval-group">
			<div class=".........完整代码请登录后点击上方下载按钮下载查看

网友评论0