svg+css实现一个炫酷视觉差异vip贵宾卡会员卡点击翻转效果代码
代码语言:html
所属分类:视觉差异
代码描述:svg+css实现一个炫酷视觉差异vip贵宾卡会员卡点击翻转效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css?family=Rubik:300,400,500,700&display=swap"); body { margin: 0; font-family: "Rubik", sans-serif; display: flex; width:100vw; align-content: center; background: #f2f2f2; height: 100vh; } #inner{ width:375px; height:200px; position:relative; background: linear-gradient(-45deg, #303030, #191919); padding: 20px; overflow: hidden; box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.2); border-radius: 12px; transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); transform: perspective(600px) rotateY(0deg); } #card { margin: auto; width: 415px; height: 240px; transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); transform: perspective(600px) rotateX(0deg); position: relative; z-index: 20; } #inner:before{ content:""; width:400px; height:400px; background:rgba(0,0,0,0.6); position:absolute; border-radius:100%; top:92px; left:70px; z-index:-30; transform: perspective(600px) translatez(30px); } #inner:after{ content:""; width:400px; height:400px; background:rgba(0,0,0,0.6); position:absolute; border-radius:100%; top:-260px; left:-160px; z-index:-30; transform: perspective(600px) translatez(30px); } .benefit{ width:100%; height :100%; /* background:#fff; */ display:none; position:relative; align-content:center; justify-content:center; align-items:center; flex-wrap:nowarp; } .btn{ border-radius:50%; box-shadow: 0 2px 15px rgba(0,0,0,.65); height:60px; width:60px; display:flex; align-content:center; background:#222; margin:auto 30px; position:relative; overflow:hidden; } .btn svg{ margin:auto; } .btn:hover{ -webkit-animation-duration: 0.75s; animation-duration: 0.75s; -webkit-animation-name: pop; animation-name:pop; } #top { width: 50%; /* height:120px; */ font-size: 32px; font-weight: 700; color: #f9cbab; } #mid { margin-top: 50px; font-weight: 300; color: #f9cbab; } #bot { font-size: 80px; color: #f9cbab; font-weight: 500; } .intext{ display:flex; width:200px; justify-content:space-between; /* flex-wrap:none; position:flex; */ } .first{ width:120px; margin-right:10px; transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .second{ width:80px; transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .rightbtn { width: 110px; text-align: right; padding: 10px; float: right; height:20px; position: absolute; right: 0px; border-bottom-left-radius: 30px; border-top-left-radius: 30px; background-color: rgba(255, 255, 255, 0.2); top: 20px; z-index: 999; overflow-x:hidden; transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .rightbtn span { /* width: 100%; */ color: #fff; z-index: 999; transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .rightbtn:hover { background-color: #f9cbab; transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .rightbtn:hover span { color: #000; transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .des { font-size: 12px; font-weight: 300; color: #777; } #glaze:after { content: ""; width: 700px; height: 70px; background: rgba(255, 255, 255, 0.06); position: absolute; top: 0; transform: rotateZ(-45deg); left: 60px; } #glaze { transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* overflow:hidden; */ /* width:calc( 100% ; */ height: 100%; position: absolute; top: 0; z-index:9; left: 200px; } #glaze:before { content: ""; width: 700px; height: 10px; background: rgba(255, 255, 255, 0.06); position: absolute; top: 0; left: 20px; transform: rotateZ(-45deg); } [type="checkbox"] { display: none; } [type="checkbox"]:checked + #card #glaze{ transform:perspective(600px) rotateY(160deg); transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);} [type="checkbox"]:checked + #card #inner{ transform:rotateY(180deg); transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);} [type="checkbox"]:checked + #card .content {display:none} [type="checkbox"]:checked + #card .benefit { display:flex;transform:perspective(600px) rotateY(160deg); transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);} [type="checkbox"]:checked + #card .rightbtn {text-align: left; right: 0px; width: 60px; /* right:auto; */ } [type="checkbox"]:checked + #card .intext{ display:block; transform:rotateY(180deg) translatex(25px); transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);} } @keyframes pop{ /* from, 20%, 40%, 60%, 80%, to { -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } */ 0% { opacity: 1; /* -webkit-transform: scale3d(0.3, 0.3, 0.3); */ transform: scale3d(0.3, 0.3, 0.3); } 20% { /* -webkit-transform: scale3d(1.1, 1.1, 1.1); */ transform: scale3d(1.1, 1.1, 1.1); } 40% { /* -webkit-transform: scale3d(0.9, 0.9, 0.9); */ transform: scale3d(0.9, 0.9, 0.9); } 60% { /* opacity: 1; */ /* -webkit-transform: scale3d(1.03, 1.03, 1.03); */ transform: scale3d(1.03, 1.03, 1.03); } 80% { /* -webkit-transform: scale3d(0.97, 0.97, 0.97); */ transform: scale3d(0.97, 0.97, 0.97); } 100% { opacity: 1; /* -webkit-transform: scale3d(1, 1, 1); */ transform: scale3d(1, 1, 1); } } </style> </head> <body> <input type="checkbox" id="switch"> <div id="card"> <div id="inner"> <label for="switch" class="rightbtn"><div class="intext"><span class="first">My Benefits ></span> <span class="second"> < back</span></div></label> <div class="content"> <div id="top">VIP CARD</div> <div class="des">exp at 20/07</div> <div id="mid">coupons left</div> <div id="bot">5</div> </div> <div class="benefit"> <div class="btn one"> <?xml version="1.0" encoding="UTF-8"?> <svg width="60%" height="60%" viewBox="0 0 40 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <circle id="path-1" cx="38.6195122" cy="38.6195122" r="38.6195122"></circle> </defs> <g id="0106" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="1000分未开" transform="translate(-617.000000, -827.000000)"> <g id="编组-55" transform="translate(18.000000, 497.000000)"> <g id="Group-3" transform="translate(41.000000, 127.000000)"></g> </g> <g id="券icon" transform="translate(598.000000, 806.000000)"> <g> <mask id="mask-2" fill="whi.........完整代码请登录后点击上方下载按钮下载查看
网友评论0