菜单悬浮弹出动画效果
代码语言:html
所属分类:菜单导航
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> .wrapper { --background: #62ABFF; --icon-color: #414856; --shape-color-01: #B8CBEE; --shape-color-02: #7691E8; --shape-color-03: #FDD053; --width: 90px; --height: 90px; --border-radius: var(--height); width: var(--width); height: var(--height); position: relative; border-radius: var(--border-radius); display: -webkit-box; display: flex; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; } .wrapper .btn { background: var(--background); width: var(--width); height: var(--height); position: relative; z-index: 3; border-radius: var(--border-radius); box-shadow: 0 10px 30px rgba(65, 72, 86, 0.05); display: -webkit-box; display: flex; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; -webkit-animation: plus-animation-reverse .5s ease-out forwards; animation: plus-animation-reverse .5s ease-out forwards; } .wrapper .btn::before, .wrapper .btn::after { content: ""; display: block; position: absolute; border-radius: 4px; background: #fff; } .wrapper .btn::before { width: 4px; height: 28px; } .wrapper .btn::after { width: 28px; height: 4px; } .wrapper .tooltip { width: 90px; height: 75px; border-radius: 70px; position: absolute; background: #fff; z-index: 2; padding: 0 15px; box-shadow: 0 10px 30px rgba(65, 72, 86, 0.05); opacity: 0; top: 0; display: -webkit-box; display: flex; justify-content: space-around; -webkit-box-align: center; align-items: center; -webkit-transition: opacity .15s ease-in, top .15s ease-in, width .15s ease-in; transition: opacity .15s ease-in, top .15s ease-in, width .15s ease-in; } .wrapper .tooltip > svg { width: 100%; height: 26px; display: -webkit-box; display: flex; justify-content: space-around; -webkit-box-align: center; align-items: center; cursor: pointer; } .wrapper .tooltip > svg .icon { fill: none; stroke: var(--icon-color); stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; opacity: .4; -webkit-transition: opacity .3s ease; transition: opacity .3s ease; } .wrapper .tooltip > svg:hover .icon { opacity: 1; } .wrapper .tooltip::after { content: ""; width: 20px; height: 20px; background: #fff; border-radius: 3px; position: absolute; left: 50%; margin-left: -10px; bottom: -8px; -webkit-transform: rotate(45deg); transform: rotate(45deg); z-index: 0; } .wrapper > svg { width: 300px; height: 300px; position: absolute; z-index: 1; -webkit-transform: scale(0); transform: scale(0); } .wrapper > svg .shape { fill: none; stroke: none; stroke-width: 3px; stroke-linecap: round; stroke-linejoin: round; -webkit-transform-origin: 50% 20%; transform-origin: 50% 20%; } .wrapper input { height: 100%; width: 100%; border-radius: var(--border-radius); cursor: pointer; position: absolute; z-index: 5; opacity: 0; } .wrapper input:checked ~ svg { -webkit-animation: pang-animation 1.2s ease-out forwards; animation: pang-animation 1.2s ease-out forwards; } .wrapper input:checked ~ svg .shape:nth-of-type(1) { -webkit-transform: translate(-10px, 30%) rotate(40deg); transform: translate(-10px, 30%) rotate(40deg); } .wrapper input:checked ~ svg .shape:nth-of-type(2) { -webkit-transform: translate(-23px, 30%) rotate(80deg); transform: translate(-23px, 30%) rotate(80deg); } .wrapper input:checked ~ svg .shape:nth-of-type(3) { -webkit-transform: translate(10px, 30%) rotate(120deg); transform: translate(10px, 30%) rotate(120deg); } .wrapper input:checked ~ svg .shape:nth-of-type(4) { -webkit-transform: translate(6px, 30%) rotate(160deg); transform: translate(6px, 30%) rotate(160deg); } .wrapper input:checked ~ svg .shape:nth-of-type(5) { -webkit-transform: translate(11px, 30%) rotate(200deg); transform: translate(11px, 30%) rotate(200deg); } .wrapper input:checked ~ svg .shape:nth-of-type(6) { -webkit-transform: translate(21px, 30%) rotate(240deg); transform: translate(21px, 30%) rotate(240deg); } .wrapper input:checked ~ svg .shape:nth-of-type(7) { -webkit-transform: translate(22px, 30%) rotate(280deg); transform: translate(22px, 30%) rotate(280deg); } .wrapper input:checked ~ svg .shape:nth-of-type(8) { -webkit-transform: translate(-11px, 30%) rotate(320deg); transform: translate(-11px, 30%) rotate(320deg); } .wrapper input:checked ~ svg .shape:nth-of-type(9) { -webkit-transform: translate(-21px, 30%) rotate(360deg); transform: translate(-21px, 30%) rotate(360deg); } .wrapper input:checked ~ .btn { -webkit-animation: plus-animation .5s ease-out forwards; animation: plus-animation .5s ease-out forwards; } .wrapper input:checked ~ .tooltip { width: 190px; height: 70px; -webkit-animation: stretch-animation 1s ease-out forwards .15s; animation: stretch-animation 1s ease-out forwards .15s; top: -90px; opacity: 1; } @-webkit-keyframes pang-animation { 0% { -webkit-transform: scale(0); transform: scale(0); opacity: 0; } 40% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; } 100% { -webkit-transform: scale(1.1); transform: scale(1.1); opacity: 0; } } @keyframes pang-animation { 0% { -webkit-transform: scale(0); transform: scale(0); opacity: 0; } 40% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; } 100% { -webkit-transform: scale(1.1); transform: scale(1.1); opacity: 0; } } @-webkit-keyframes plus-animation { 0% { -webkit-transform: rotate(0) scale(1); transform: rotate(0) scale(1); } 20% { -webkit-transform: rotate(60deg) scale(0.93); transform: rotate(60deg) scale(0.93); } 55% { -webkit-transform: rotate(35deg) scale(0.97); transform: rotate(35deg) scale(0.97); } 80% { -webkit-transform: rotate(48deg) scale(0.94); transform: rotate(48deg) scale(0.94); } 100% { -webkit-transform: rotate(45deg) scale(0.95); transform: rotate(45deg) scale(0.95); } } @keyframes plus-animation { 0% { -webkit-transform: rotate(0) scale(1); transform: rotate(0) scale(1); } 20% { -webkit-transform: rotate(60deg) scale(0.93); transform: rotate(60deg) scale(0.93); } 55% { -webkit-transform: rotate(35deg) scale(0.97); transform: rotate(35deg) scale(0.97); } 80% { -webkit-transform: rotate(48deg) scale(0.94); transform: rotate(48deg) scale(0.94); } 100% { -webkit-transform: rotate(45deg) scale(0.95); transform: rotate(45deg) scale(0.95); } } @-webkit-keyframes plus-animation-reverse { 0% { -webkit-transform: rotate(45deg) scale(0.95); transform: rotate(45deg) scale(0.95); } 20% { -webkit-transform: rotate(-15deg); transform: rotate(-15deg); } 55% { -webkit-transform: rotate(10deg); transform: rotate(10deg); } 80% { -webkit-transform: rotate(-3deg); transform: rotate(-3deg); } 100% { -webkit-transform: rotate(0) scale(1); transform: rotate(0) scale(1); } } @keyframes plus-animation-reverse { 0% { -webkit-transform: rotate(45deg) scale(0.95); transform: rotate(45deg) scale(0.95); } 20% { -webkit-transform: rotate(-15deg); transform: rotate(-15deg); } 55% { -we.........完整代码请登录后点击上方下载按钮下载查看
网友评论0