svg悬浮背景方块变色显示文字动画效果代码
代码语言:html
所属分类:悬停
代码描述:svg悬浮背景方块变色显示文字动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Abel&display=swap"); @media (min-width: 767px) { * { box-sizing: border-box; } } html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; } .father { background-image: url(//repo.bfw.wiki/bfwrepo/image/5f9ea25a7a863.png); height: 100vh; width: 100%; display: block; position: relative; background-size: cover; border: 5px solid #000; background-color: rgba(#000, 0.3); overflow: hidden; font-family: "Abel", sans-serif; } .father svg a { height: 100%; width: 100%; position: relative; } .father svg .shapem, .svg-section-text { opacity: 0; transition: opacity 0.5s; will-change: opacity; } .father svg .shapem:hover { opacity: 0.5; transition-duration: opacity 0.9s; } .father svg .svg-section:hover .svg-section-text { opacity: 1; transition-duration: opacity 0.9s; } .svg-section-far-left { fill: url(#gradient-far-left); } .svg-section-middle-left { fill: url(#gradient-middle-left); } .svg-section-middle-right { fill: url(#gradient-middle-right); } .svg-section-far-right { fill: url(#gradient-far-right); } .svg-skeleton { opacity: 0.1; fill: #fff; } .svg-section-text { pointer-events: none; } .svg-defs { position: absolute; left: 0; top: 0; opacity: 0; pointer-events: none; } </style> </head> <body translate="no" > <svg class="svg-defs" version="1.1" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="gradient-far-left" gradientTransform="rotate(90)"> <stop offset="0%" stop-color="#bbfff3" /> <stop offset="53%" stop-color="#bbfff3" /> <stop offset="62%" stop-color="#02ffd2" /> <stop offset="100%" stop-color="#02ffd2" /> </linearGradient> <linearGradient id="gradient-middle-left" gradientTransform="rotate(90)"> <stop offset="0%" stop-color="#caf2ff" /> <stop offset="53%" stop-color="#caf2ff" /> <stop offset="62%" stop-color="#540088" /> <stop offset="100%" stop-color="#540088" /> </linearGradient> <linearGradient id="gradient-middle-right" gradientTransform="rotate(90)"> <stop offset="0%" stop-color="#caf2ff" /> <stop offset="53%" stop-color="#caf2ff" /> <stop offset="62%" stop-color="#00c0ff" /> <stop offset="100%" stop-color="#00c0ff" /> </linearGradient> <linearGradient id="gradient-far-right" gradientTransform="rotate(90)"> <stop offset="0%" stop-color="#85BBC0" /> <stop offset="48%" stop-color="#85BBC0" /> <stop offset="58%" stop-color="#a90b05" /> <stop offset="100%" stop-color="#a90b05" /> </linearGradient> </defs> </svg> <div class="father"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1133.86 637.79" height="100%" width="100%" preserveAspectRatio="none"> <g class="svg-section"> <a class="svg-section-link" href="#"> <path class="svg-section-far-right shapem" d="M1133.86-.21H713.23L1126 635.73c.49.76.81 1.55.97 2.36.02.1.1.17.21.17l6.68 2.46V-.21z" /> </a> <g class="svg-section-text"> <text fill="#7F7F7E" x="910" y="130" font-size="20px">DREAMING</text> <text fill="#7F7F7E" x="910" y="150" font-size="12px">DREAM SYSTEM</text> <text fill="#7F7F7E" x="910" y="165" font-size="12px">GLOBAL BLOG</text> </g> </g> <g class="svg-section"> <a class="svg-section-link" href="#"> <path class="svg-section-middle-right shapem" d="M1089.2 622.55H879.5L583.27 166.14l98.76-153.37c5.18-8.07 16.87-8.07 22.09 0l388.55 603.43c1.75 2.72-.21 6.35-3.47 6.35z" /> </a> <g class="svg-section-text.........完整代码请登录后点击上方下载按钮下载查看
网友评论0