div+css实现吃豆子loading加载动画效果代码

代码语言:html

所属分类:加载滚动

代码描述:div+css实现吃豆子loading加载动画效果代码

代码标签: div css 吃豆子 loading 加载 动画

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

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

<head>
  <meta charset="UTF-8">

  
  
  
  
<style>

.pacman-loader {
  --dotssize: 0.4em;
  width: 2em;
  aspect-ratio: clamp(2, var(--size, 3), 10);
  background-image: radial-gradient(closest-side circle, var(--dots, #fff) 35%, #fff0 0);
  background-size: var(--dotssize, 0.4em) 100%;
  background-position: var(--dotssize, 0.4em) 50%;
  animation: move var(--time, 0.4s) linear infinite;
  /* the mask helps two purposes: fade in the dots on the right side, and hide them on the left side */
  mask: 
    radial-gradient(farthest-side circle, #fff 99.9%, #fff0) 0 0 / calc(2em / var(--size, 3)) 100% no-repeat,
    linear-gradient(90deg, #0000 calc(1em / var(--size, 3)), #000 0 75%, #0000 95%);
  position: relative;
  /* hide the text using text-indent and hiding overflow */
  overflow: clip;
  text-indent: 2em;
  user-select: none;
  
  &::before, &::after {
    content: "";
    position: absolute;
    left: 0;
    height: 50%;
    aspect-ratio: 2;
    border-radius: 50% / 100% 100% 0 0;
    background: var(--pacman, #fe5);
    transform-origin: 50% 100%;
    transform: rotate(-40deg);
    animation: mouth var(--time, 0.4s) linear infinite alternate;
  }
  
  &::after {
    bottom: 0;
    border-radius: 50% / 0 0 100% 100%;
    transform-origi.........完整代码请登录后点击上方下载按钮下载查看

网友评论0