css+div布局绘制光芒四射的可爱太阳代码

代码语言:html

所属分类:布局界面

代码描述:css+div布局绘制光芒四射的可爱太阳代码

代码标签: css div 布局 绘制 光芒 四射 可爱 太阳 代码

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

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

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

  
  
  
<style>
@property --modif {
  syntax: '<number>';
  inherits: false;
  initial-value: 1;
}

@property --transY {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}

figure {
  font-size: 1vmin;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50em;
  aspect-ratio: 1;
  overflow: hidden;
  
  figcaption {
    transform: translate(0, -2em);
  }
  
  .center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25em;
    transform: translate(-50%, -50%);
    aspect-ratio: 1;
    background: #fc0;
    border-radius: 50% 48% 47% 52%;
    animation: 
      rotate 5s infinite,
      shake 4.7s infinite;
    
    .cheek {
      --pos: 30%;
      width: 11%;
      aspect-ratio: 1.5;
      border-radius: 50%;
      background: #f003;
      position: absolute;
      transform: translate(-50%, -50%);
      top: 67%;
      left: var(--pos);
      
      & + & {
        left: calc(100% - var(--pos));
      }
    }
    
    .eye {
      --pos: 35%;
      width: 11%;
      aspect-ratio: 1;
      border-radius: 50%;
      background: #000;
      position: absolute;
      transform: translate(-50%, -50%);
      top: 60%;
      left: var(--pos);
      
      &::before {
        content: "";
        position: absolute;
        top: 30%;
        left: 35%;
        width: 30%;
        aspect-ratio: 1;
        border-radius: 50%;
        transform: translate(-50%, -50%);
        background: #fff;
        animation: growShrink 3s linear infinite;
      }
      
      &::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 15%;
        width: 20%;
        aspect-ratio: 1;
        border-radius: 50%;
        transform: translate(-50%, -50%);
        background: #fff;
        animation: growShrink 3s -1.5s linear infinite;
      }
      
      & + & {
        left: calc(100% - var(--pos));
      }
    }
    
    .mouth {
      --size: 0.7em;
      width: 7%;
      aspect-ratio: 1;
      border: var(--size) solid #0000;
      border-left-color: #000;
      border-bottom-color: #000;
      border-radius: 50%;
      top: 63%;
      left: 50%;
      position: absolute;
      transform: translate(-50%, -50%) rotate(-45deg);
    }
  }
  
  .ray {
    --angle: 0deg;
    --modif: 1;
    --transY: -13.5em;
    --anim: ;
    --extraanim: ;
    width: 3%;
    height: 10%;
    background: #fb2;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform-origin: 50% 100%;
    transform: translate(-50%, -100%) rotate(var(--angle)) translateY(var(--transY)) scaleY(var(--modif));
    position: absolute;
    animation: 
      var(--extraanim)
      var(--anim);
    
    &:nth-child(odd) { --anim: growRays 2s infinite linear; }
    &:nth-child(even) { --anim: growRays 2s -1s infinite linear; }
    &:nth-child(3n) { animation-delay: -1.3s; }
    &:nth-child(7n) { animation-delay: -0.7s; }
    &:nth-child(4n) { --extraanim: moveRay 1.6s infinite linear,; }
    &:nth-child(5n) { --extraanim: moveRay 2.3s -1.1s infinite linear,; }
  }
}

@keyframes growRays {
  0%, 100% { --modif: 1; }
  50% { --modif: 1.6; }
}

@keyframes shake {
  0%, 100% { border-radius: 50% 48% 47% 52%; }
  20% { border-radius: 53% 50% 49% 47%; }
  40% { border-radius: 51% 47% 52% 50%; }
  60% { border-radius: 48% 51% 50% 51%; }
  80% { border-radius: 47% 50% 51% 48%; }
}

@keyframes rotate {
  0%,100% { transform: translate(-50%, -50%) rotate(0deg) }
  33% { transform: translate(-50%, -50%) rotate(2deg); }
  66% { transform: translate(-50%, -50%) rotate(-2deg); }
}

@keyframes growShrink {
  0%, 100% { scale: 1.1 1.1; }
  50% { scale: 0.9 0.9; }
}

@keyframes moveRay {
  0%, 100% { --transY: -13.5em; }
  33% { --transY: -13.25em; }
  66% { --transY: -13.75em; }
}




body {
  background: #69f2
}



/***/

#youtube {
  z-index: 2;
  display: block;
  width: 100px;
  height: 70px;
  posi.........完整代码请登录后点击上方下载按钮下载查看

网友评论0