css代码

.img {
        position: relative;
        background: url("")
          no-repeat;
        background-size: 100%;
        width: 200px;
        height: 200px;
        border-radius: 50%;
        cursor: pointer;
      }
      .img::before,
      .img::after {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        bottom: 0;
        border-radius: 50%;
      }
      .img::before {
        background: rgba(0, 0, 0, 0.5);
      }
      .img::after {
        background: inherit;
        clip-path: circle(0% at 50% 50%);
        transition: all 1s;
      }
      .img:hover::after {
        clip-path: circle(50% at 50% 50%);
      }

 

js代码

    <div class="img"></div>

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐