首页 > 其他分享 >css_扩散动效

css_扩散动效

时间:2023-10-10 23:15:45浏览次数:42  
标签:opacity index 100% 50% transform 动效 position 扩散 css

  • html
<div id="modelContainer" class="init">
  <div class="mask"></div>
  <div class="model_content">
    <div class="attention_container">
      <div class="dot">
        <div class="iconfont icon-question"></div>
      </div>
      <div class="wave"></div>
    </div>
    <div class="hint">活动已结束</div>
    <div class="btn_close">关闭</div>
  </div>
</div>
  • css
& > #modelContainer {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  overflow: hidden;
  &.hidden {
    animation: hidden 0.25s ease forwards;
  }
  &.show {
    animation: show 0.25s ease forwards;
  }
  &.init {
    opacity: 0;
    z-index: -10;
  }
  & > .mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000;
    opacity: 0.6;
  }
  & > .model_content {
    width: 90%;
    background-color: #fff;
    position: absolute;
    z-index: 101;
    border-radius: 10px;
    text-align: center;
    &.hidden {
      animation: contentHidden 0.25s ease forwards;
    }
    &.show {
      animation: contentShow 0.25s ease forwards;
    }
    @keyframes contentHidden {
      0% {
        transform: translateY(0);
      }
      100% {
        transform: translateY(-150px);
      }
    }
    @keyframes contentShow {
      0% {
        transform: translateY(-150px);
      }
      100% {
        transform: translateY(0);
      }
    }

    & > .attention_container {
      width: 100%;
      height: 150px;
      position: relative;
      & > .dot {
        width: 50px;
        height: 50px;
        background-color: rgb(255, 234, 96);
        border-radius: 50%;
        position: absolute;
        top: calc(50% - 25px);
        left: calc(50% - 25px);
        animation: dotMove 1.5s linear alternate infinite;
        & > .iconfont {
          font-size: 30px;
          color: #fff;
          font-weight: 700;
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
        }
      }
      & > .wave {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        position: absolute;
        top: calc(50% - 25px);
        left: calc(50% - 25px);
        box-shadow: 0 0 10px 0 rgb(255, 234, 96) inset;
        animation: waveMove 1s linear infinite;
      }
      @keyframes dotMove {
        0% {
          transform: scale(1);
        }
        100% {
          transform: scale(1.2);
        }
      }
      @keyframes waveMove {
        0% {
          transform: scale(1);
          box-shadow: 0 0 10px 0 rgb(255, 234, 96) inset;
          opacity: 1;
        }
        100% {
          transform: scale(1.8);
          box-shadow: 0 0 40px 0 rgb(255, 234, 96) inset;
          opacity: 0;
        }
      }
    }
    & > .hint {
      color: #666;
    }
    & > .btn_close {
      margin-top: 20px;
      position: relative;
      height: 50px;
      line-height: 50px;
      text-align: center;
      color: #999;
      font-size: 18px;
      &::after {
        content: '';
        display: block;
        width: 100%;
        height: 1px;
        background-color: #999;
        transform: scaleY(0.5);
        position: absolute;
        top: 0;
        left: 0;
      }
    }
  }

  @keyframes hidden {
    0% {
      opacity: 1;
      z-index: 100;
    }
    100% {
      opacity: 0;
      z-index: -10;
    }
  }
  @keyframes show {
    0% {
      opacity: 0;
      z-index: -10;
    }
    100% {
      opacity: 1;
      z-index: 100;
    }
  }
}
  • 效果

标签:opacity,index,100%,50%,transform,动效,position,扩散,css
From: https://www.cnblogs.com/isAyi/p/17755966.html

相关文章

  • css样式对单行和多行文本的隐藏
    在我们日常的网页中,尤其是新闻类的网页会遇到许多类似于这样的样式多行甚至单行的文本隐藏+上省略号标题。解决这一办法,需要利用css的样式进行改变如下代码的演示:单行文本隐藏:多行文本隐藏:主要知识点:1、单行文本隐藏省略:文本不能换行、超出部分隐藏、超出部分省略2、......
  • 每日一题:通过css变量来控制主题
    1、定义不同主题颜色:root{--theme-color:blue;--font-size:18px;;}html[theme="dark"]{--theme-color:#000;2、通过切换html自定义属性来控制主题<!DOCTYPEhtml><htmllang="en"><head><met......
  • css技巧
    https://segmentfault.com/a/1190000044084906?utm_source=sf-similar-article......
  • CSS 将div撑满body
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>测试</title><style>html,body{height:100%;margin:0;overflow:hidden;}.con......
  • Spring Boot 访问静态资源css/js
    一、前言我们用SpringBoot搭建Web应用时(如搭建一个博客),经常需要在Html中访问一些静态资源,比如:css样式;js脚本;favicon.ico图标等;而在SpringBoot中如果没有做任何配置,是无法直接访问静态资源的,通常会报404错误二、SpringBoot访问静态资源的默认目录Spring......
  • CSS弹性盒子
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title>Document</title>......
  • CSS盒子模型
    对html进行封装:包括外边距、边框、内边距和实际内容<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title......
  • 自定义滚动条 css
    /*自定义滚动条css*/.customScrollbar::-webkit-scrollbar{width:10px;height:10px;}.customScrollbar::-webkit-scrollbar-thumb{border-radius:8px;background-color:#47515b;}.customScrollbar::-webkit-scrollbar-thumb:hover{background-color:#5D626C;}.customScr......
  • css自定义滚动条
    .container{width:200px;height:150px;overflow:auto;/*自动显示滚动条/-ms-overflow-style:scrollbar;/在IE上显示自定义滚动条*/}/*自定义滚动条的样式*/.container::-webkit-scrollbar{width:10px;height:10px;}.container::-webkit-scrollbar-trac......
  • 在线直播源码,CSS磨砂玻璃效果和渐变主题色文字
    在线直播源码,CSS磨砂玻璃效果和渐变主题色文字HTML <divclass="card"> <h2class="gradient"> </h2> <div>  <p>.welcome{</p>  <pclass="indent">"CSDN:lqj_本人"</p>  <pclass="......