一个div+css实现一把竹扇效果代码

代码语言:html

所属分类:布局界面

代码描述:一个div+css实现一把竹扇效果代码

代码标签: 一把 竹扇 效果

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <link rel="apple-touch-icon" type="image/png" href="https://cpwebassets.codepen.io/assets/favicon/apple-touch-icon-5ae1a0698dcc2402e9712f7d01ed509a57814f994c660df9f7a952f3060705ee.png" />
    <meta name="apple-mobile-web-app-title" content="CodePen">

    <link rel="shortcut icon" type="image/x-icon" href="https://cpwebassets.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico" />

    <link rel="mask-icon" type="" href="https://cpwebassets.codepen.io/assets/favicon/logo-pin-8f3771b1072e3c38bd662872f6b673a722f4b3ca2421637d5596661b4e2132cc.svg" color="#111" />


    <title>CodePen - #divtober - Fan</title>




    <style>
        *,
        *::before,
        *::after {
          box-sizing: border-box;
        }
        
        :root {
          --size: 100;
          --unit: calc((var(--size) / 100) * 1vmin);
          --bg: #bec485;
          --fan: #e1b253;
          --shadow: #ba8f3a;
          --crease: #1c1515;
          --hold: #624616;
          --hole: #634514;
          --transparent: rgba(0, 0, 0, 0);
        }
        
        body {
          background-color: var(--bg);
        }
        
        div {
          height: calc(75 * var(--unit));
          width: calc(90 * var(--unit));
        
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
        
          clip-path: polygon(0% 0%, 100% 0%, 100% 50%, 50% 100%, 0% 50%);
        }
        
        div::before {
          content: '';
          display: block;
        
          height: 100%;
          width: 100%;
        
          background: 
        
            /* Left */
            linear-gradient(163deg, var(--fan) 50%, var(--crease) 51% 55%, var(--transparent) 55%) 96.3% 55.4% / 6% 1%,
            linear-gradient(113deg, var(--fan) 50%, var(--crease) 51% 55%, var(--transparent) 54%) 94% 57.3% / 5% 2.7%,
            linear-gradient(var(--hole), var(--hole)) 95.1% 56.9% / 4% 3.5%,
        
            /* Left */
            linear-gradient(157deg, var(--shadow) 50%, var(--crease) 51% 55%, var(--transparent) 55%) 93.3% 40.8% / 6% 1%,
            linear-gradient(105deg, var(--shadow) 50%, var(--crease) 51% 55%, var(--transparent) 54%) 91.5% 42.4% / 5% 2.7%,
            /* Right */
            linear-gradient(96deg, var(--transparent) 50%, var(--crease) 51% 54%, var(--fan) 54%) 94.9% 41.2% / 6% 2%,
            linear-gradient(148deg, var(--transparent) 50%, var(--crease) 51% 54%, var(--fan) 54%) 93% 43% / 5% 1.8%,
            linear-gradient(var(--hole), var(--hole)) 92.1% 41.9% / 4% 3.5%,
        
            /* Left */
            linear-gradient(142deg, var(--fan) 50%, var(--crease) 51% 55%, var(--transparent) 55%) 85.9% 28.8% / 6% 1.5%,
            linear-gradient(98deg, var(--fan) 50%, var(--crease) 51% 55%, var(--transparent) 54%) 84.4% 30.6% / 5% 2.7%,
            /* Right */
            linear-gradient(96deg, var(--transparent) 50%, var(--crease) 51% 54%, var(--shadow) 54%) 86.9% 29.4% / 6% 2%,
            linear-gradient(140deg, var(--transparent) 50%, var(--crease) 51% 54%, var(--shadow) 54%) 85.5% 31.4% / 5% 1.8%,
            linear-gradient(var(--hole), var(--hole)) 85.1% 29.9% / 4% 3.5%,
        
            /* Left */
            linear-gradient(138deg, var(--shadow) 50%, var(--crease) 51% 55%, var(--transparent) 55%) 75.7% 18.5% / 6% 1.5%,
            linear-gradient(87deg, var(--shadow) 50%, var(--crease) 51% 55%, var(--transparent) 54%) 74.8% 20.1% / 5% 2.7%,
            /* Right */
            linear-gradient(90deg, var(--transparent) 50%, var(--crease) 51% 54%, var(--fan) 54%) 76.9% 18.5% / 6% 2%,
            linear-gradient(131deg, var(--transparent) 50%, var(--crease) 51% 54%, var(--fan) 54%) 76% 20.4% / 5% 1.8%,
            linear-gradient(var(--hole), var(--hole)) 76.1% 18.9% / 4% 3.5%,
        
            /* Left */
            linear-gradient(122deg, var(--fan) 50%, var(--crease) 51% 55%, var(--transparent) 55%) 62.7% 15.5% / 6% 1.5%,
            linear-gradient(82deg, var(--fan) 50%, var(--crease) 51% 55%, var(--transparent) 54%) 62.3% 17.1% / 5% 2.7%,
            /* Right */
            linear-gradient(82deg, var(--transparent) 50%, var(--crease) 51% 54%, var(--shadow) 54%) 63.7% 15.5% / 6% 2%,
            linear-gradient(115deg, var(--transparent) 50%, var(--crease) 51% 54%, var(--shadow) 54%) 63.4% 17.4% / 5% 1.7%,
            linear-gradient(var(--hole), var(--hole)) 63.1% 15.9% / 4% 3.5%,
        
            /* MIDDLE */
        
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0