css实现简单点击旋转播放按钮效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现简单点击旋转播放按钮效果代码

代码标签: 点击 旋转 播放 按钮 效果

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        *, *::before, *::after {
          padding: 0;
          margin: 0 auto;
          box-sizing: border-box;
        }
        
        body {
          background-color: #000;
          color: #fff;
          min-height: 100vh;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
        }
        
        input[type=checkbox] {
          -webkit-appearance: none;
             -moz-appearance: none;
                  appearance: none;
          position: fixed;
          top: -100%;
          left: -100%;
        }
        input[type=checkbox]:checked + .playButton {
          --ry: 90deg;
          --clr: maroon;
        }
        
        .playButton {
          position: relative;
          width: 160px;
          height: 80px;
          border-radius: 10%/20%;
          background-color: var(--clr, red);
          perspective: 320px;
          cursor: pointer;
          margin: 1em auto;
          transition: background-color 0.5s;
        }
        
        .icon {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: rotateY(var(--ry, 0deg));
          transform-style: preserve-3d;
          transition: transform 0.5s;
        }
        .icon.pause > div {
          position: absolute;
          background-color: #fff;
        }
        .icon.pause > div:nth-child(1) {
          top: -15px;
          left: -9px;
          width: 30px;
          height: 30px;
          -webkit-clip-path: polygon(0 0, 100% 50%, 0 100%);
                  clip-path: polygon(0 0, 100% 50%, 0 100%);
          transform: translateZ(-5px);
          background-image: linear-gradient(334deg, #0005 12px, #0000 19px), linear-gradient(206deg, #0005 12px, #0000 19px), linear-gradient(90deg, #0005, #0000 7px);
        }
        .icon.pause > div:nth-child(3) {
          top: -15px;
          left: -9px;
          width: 10px;
          height: 30px;
          transform-origin: left;
          transform: translateZ(-15px) rotateY(-90deg);
          box-shadow: 0 0 5px #0005 inset;
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0