爬行的蜗牛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: golang Linux PHP
查看: 37|回复: 0

【炫酷】纯CSS竟然能实现这么漂亮的卡片动画特效!

[复制链接]

94

主题

36

回帖

849

积分

管理员

积分
849
发表于 7 天前 | 显示全部楼层 |阅读模式
动画展示

6401.gif
完整代码

  1. <!DOCTYPE html>
  2. <html lang="en">

  3. <head>
  4.   <meta charset="UTF-8">
  5.   <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.   <title>Document</title>
  8. </head>
  9. <style>
  10.   .parent {
  11.     width: 290px;
  12.     height: 300px;
  13.     perspective: 1000px;
  14.   }

  15.   .card {
  16.     height: 100%;
  17.     border-radius: 50px;
  18.     background: linear-gradient(135deg, rgb(0, 255, 214) 0%, rgb(8, 226, 96) 100%);
  19.     transition: all 0.5s ease-in-out;
  20.     transform-style: preserve-3d;
  21.     box-shadow: rgba(5, 71, 17, 0) 40px 50px 25px -40px, rgba(5, 71, 17, 0.2) 0px 25px 25px -5px;
  22.   }

  23.   .glass {
  24.     transform-style: preserve-3d;
  25.     position: absolute;
  26.     inset: 8px;
  27.     border-radius: 55px;
  28.     border-top-right-radius: 100%;
  29.     background: linear-gradient(0deg, rgba(255, 255, 255, 0.349) 0%, rgba(255, 255, 255, 0.815) 100%);
  30.     transform: translate3d(0px, 0px, 25px);
  31.     border-left: 1px solid white;
  32.     border-bottom: 1px solid white;
  33.     transition: all 0.5s ease-in-out;
  34.   }

  35.   .content {
  36.     padding: 100px 60px 0px 30px;
  37.     transform: translate3d(0, 0, 26px);
  38.   }

  39.   .content .title {
  40.     display: block;
  41.     color: #00894d;
  42.     font-weight: 900;
  43.     font-size: 20px;
  44.   }

  45.   .content .text {
  46.     display: block;
  47.     color: rgba(0, 137, 78, 0.7647058824);
  48.     font-size: 15px;
  49.     margin-top: 20px;
  50.   }

  51.   .bottom {
  52.     padding: 10px 12px;
  53.     transform-style: preserve-3d;
  54.     position: absolute;
  55.     bottom: 20px;
  56.     left: 20px;
  57.     right: 20px;
  58.     display: flex;
  59.     align-items: center;
  60.     justify-content: space-between;
  61.     transform: translate3d(0, 0, 26px);
  62.   }

  63.   .bottom .view-more {
  64.     display: flex;
  65.     align-items: center;
  66.     width: 40%;
  67.     justify-content: flex-end;
  68.     transition: all 0.2s ease-in-out;
  69.   }

  70.   .bottom .view-more:hover {
  71.     transform: translate3d(0, 0, 10px);
  72.   }

  73.   .bottom .view-more .view-more-button {
  74.     background: none;
  75.     border: none;
  76.     color: #00c37b;
  77.     font-weight: bolder;
  78.     font-size: 12px;
  79.   }

  80.   .bottom .view-more .svg {
  81.     fill: none;
  82.     stroke: #00c37b;
  83.     stroke-width: 3px;
  84.     max-height: 15px;
  85.   }

  86.   .bottom .social-buttons-container {
  87.     display: flex;
  88.     gap: 10px;
  89.     transform-style: preserve-3d;
  90.   }

  91.   .bottom .social-buttons-container .social-button {
  92.     width: 30px;
  93.     aspect-ratio: 1;
  94.     padding: 5px;
  95.     background: rgb(255, 255, 255);
  96.     border-radius: 50%;
  97.     border: none;
  98.     display: grid;
  99.     place-content: center;
  100.     box-shadow: rgba(5, 71, 17, 0.5) 0px 7px 5px -5px;
  101.   }

  102.   .bottom .social-buttons-container .social-button:first-child {
  103.     transition: transform 0.2s ease-in-out 0.4s, box-shadow 0.2s ease-in-out 0.4s;
  104.   }

  105.   .bottom .social-buttons-container .social-button:nth-child(2) {
  106.     transition: transform 0.2s ease-in-out 0.6s, box-shadow 0.2s ease-in-out 0.6s;
  107.   }

  108.   .bottom .social-buttons-container .social-button:nth-child(3) {
  109.     transition: transform 0.2s ease-in-out 0.8s, box-shadow 0.2s ease-in-out 0.8s;
  110.   }

  111.   .bottom .social-buttons-container .social-button .svg {
  112.     width: 15px;
  113.     fill: #00894d;
  114.   }

  115.   .bottom .social-buttons-container .social-button:hover {
  116.     background: black;
  117.   }

  118.   .bottom .social-buttons-container .social-button:hover .svg {
  119.     fill: white;
  120.   }

  121.   .bottom .social-buttons-container .social-button:active {
  122.     background: rgb(255, 234, 0);
  123.   }

  124.   .bottom .social-buttons-container .social-button:active .svg {
  125.     fill: black;
  126.   }

  127.   .logo {
  128.     position: absolute;
  129.     right: 0;
  130.     top: 0;
  131.     transform-style: preserve-3d;
  132.   }

  133.   .logo .circle {
  134.     display: block;
  135.     position: absolute;
  136.     aspect-ratio: 1;
  137.     border-radius: 50%;
  138.     top: 0;
  139.     right: 0;
  140.     box-shadow: rgba(100, 100, 111, 0.2) -10px 10px 20px 0px;
  141.     -webkit-backdrop-filter: blur(5px);
  142.     backdrop-filter: blur(5px);
  143.     background: rgba(0, 249, 203, 0.2);
  144.     transition: all 0.5s ease-in-out;
  145.   }

  146.   .logo .circle1 {
  147.     width: 170px;
  148.     transform: translate3d(0, 0, 20px);
  149.     top: 8px;
  150.     right: 8px;
  151.   }

  152.   .logo .circle2 {
  153.     width: 140px;
  154.     transform: translate3d(0, 0, 40px);
  155.     top: 10px;
  156.     right: 10px;
  157.     -webkit-backdrop-filter: blur(1px);
  158.     backdrop-filter: blur(1px);
  159.     transition-delay: 0.4s;
  160.   }

  161.   .logo .circle3 {
  162.     width: 110px;
  163.     transform: translate3d(0, 0, 60px);
  164.     top: 17px;
  165.     right: 17px;
  166.     transition-delay: 0.8s;
  167.   }

  168.   .logo .circle4 {
  169.     width: 80px;
  170.     transform: translate3d(0, 0, 80px);
  171.     top: 23px;
  172.     right: 23px;
  173.     transition-delay: 1.2s;
  174.   }

  175.   .logo .circle5 {
  176.     width: 50px;
  177.     transform: translate3d(0, 0, 100px);
  178.     top: 30px;
  179.     right: 30px;
  180.     display: grid;
  181.     place-content: center;
  182.     transition-delay: 1.6s;
  183.   }

  184.   .logo .circle5 .svg {
  185.     width: 20px;
  186.     fill: white;
  187.   }

  188.   .parent:hover .card {
  189.     transform: rotate3d(1, 1, 0, 30deg);
  190.     box-shadow: rgba(5, 71, 17, 0.3) 30px 50px 25px -40px, rgba(5, 71, 17, 0.1) 0px 25px 30px 0px;
  191.   }

  192.   .parent:hover .card .bottom .social-buttons-container .social-button {
  193.     transform: translate3d(0, 0, 50px);
  194.     box-shadow: rgba(5, 71, 17, 0.2) -5px 20px 10px 0px;
  195.   }

  196.   .parent:hover .card .logo .circle2 {
  197.     transform: translate3d(0, 0, 60px);
  198.   }

  199.   .parent:hover .card .logo .circle3 {
  200.     transform: translate3d(0, 0, 80px);
  201.   }

  202.   .parent:hover .card .logo .circle4 {
  203.     transform: translate3d(0, 0, 100px);
  204.   }

  205.   .parent:hover .card .logo .circle5 {
  206.     transform: translate3d(0, 0, 120px);
  207.   }
  208. </style>

  209. <body>
  210.   <div class="parent">
  211.     <div class="card">
  212.       <div class="logo">
  213.         <span class="circle circle1"></span>
  214.         <span class="circle circle2"></span>
  215.         <span class="circle circle3"></span>
  216.         <span class="circle circle4"></span>
  217.         <span class="circle circle5">
  218.           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29.667 31.69" class="svg">
  219.             <path id="Path_6" data-name="Path 6"
  220.               d="M12.827,1.628A1.561,1.561,0,0,1,14.31,0h2.964a1.561,1.561,0,0,1,1.483,1.628v11.9a9.252,9.252,0,0,1-2.432,6.852q-2.432,2.409-6.963,2.409T2.4,20.452Q0,18.094,0,13.669V1.628A1.561,1.561,0,0,1,1.483,0h2.98A1.561,1.561,0,0,1,5.947,1.628V13.191a5.635,5.635,0,0,0,.85,3.451,3.153,3.153,0,0,0,2.632,1.094,3.032,3.032,0,0,0,2.582-1.076,5.836,5.836,0,0,0,.816-3.486Z"
  221.               transform="translate(0 0)"></path>
  222.             <path id="Path_7" data-name="Path 7"
  223.               d="M75.207,20.857a1.561,1.561,0,0,1-1.483,1.628h-2.98a1.561,1.561,0,0,1-1.483-1.628V1.628A1.561,1.561,0,0,1,70.743,0h2.98a1.561,1.561,0,0,1,1.483,1.628Z"
  224.               transform="translate(-45.91 0)"></path>
  225.             <path id="Path_8" data-name="Path 8"
  226.               d="M0,80.018A1.561,1.561,0,0,1,1.483,78.39h26.7a1.561,1.561,0,0,1,1.483,1.628v2.006a1.561,1.561,0,0,1-1.483,1.628H1.483A1.561,1.561,0,0,1,0,82.025Z"
  227.               transform="translate(0 -51.963)"></path>
  228.           </svg>
  229.         </span>

  230.       </div>
  231.       <div class="glass"></div>
  232.       <div class="content">
  233.         <span class="title">UIVERSE (3D UI)</span>
  234.         <span class="text">Create, share, and use beautiful custom elements made with CSS</span>
  235.       </div>
  236.       <div class="bottom">

  237.         <div class="social-buttons-container">
  238.           <button class="social-button .social-button1">
  239.             <svg viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg" class="svg">
  240.               <path
  241.                 d="M 9.9980469 3 C 6.1390469 3 3 6.1419531 3 10.001953 L 3 20.001953 C 3 23.860953 6.1419531 27 10.001953 27 L 20.001953 27 C 23.860953 27 27 23.858047 27 19.998047 L 27 9.9980469 C 27 6.1390469 23.858047 3 19.998047 3 L 9.9980469 3 z M 22 7 C 22.552 7 23 7.448 23 8 C 23 8.552 22.552 9 22 9 C 21.448 9 21 8.552 21 8 C 21 7.448 21.448 7 22 7 z M 15 9 C 18.309 9 21 11.691 21 15 C 21 18.309 18.309 21 15 21 C 11.691 21 9 18.309 9 15 C 9 11.691 11.691 9 15 9 z M 15 11 A 4 4 0 0 0 11 15 A 4 4 0 0 0 15 19 A 4 4 0 0 0 19 15 A 4 4 0 0 0 15 11 z">
  242.               </path>
  243.             </svg></button>
  244.           <button class="social-button .social-button2">
  245.             <svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" class="svg">
  246.               <path
  247.                 d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z">
  248.               </path>
  249.             </svg>
  250.           </button>
  251.           <button class="social-button .social-button3">
  252.             <svg viewBox="0 0 640 512" xmlns="http://www.w3.org/2000/svg" class="svg">
  253.               <path
  254.                 d="M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z">
  255.               </path>
  256.             </svg>
  257.           </button>
  258.         </div>
  259.         <div class="view-more">
  260.           <button class="view-more-button">View more</button>
  261.           <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-linecap="round"
  262.             stroke-linejoin="round">
  263.             <path d="m6 9 6 6 6-6"></path>
  264.           </svg>
  265.         </div>
  266.       </div>
  267.     </div>
  268.   </div>
  269. </body>

  270. </html>
复制代码


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表