svg悬停动画
代码语言:html
所属分类:悬停
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> ul { margin: 0; padding: 3em; box-sizing: border-box; list-style: none; width: 100%; min-height: 100vh; display: -webkit-box; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; flex-flow: row nowrap; -webkit-box-pack: justify; justify-content: space-between; -webkit-box-align: center; align-items: center; } ul li { margin: 0; padding: 0; box-sizing: border-box; width: calc(33% - 1.5rem); position: relative; } ul li:hover #icon-lighthouse #rays-r path:nth-of-type(1), ul li:hover #icon-lighthouse #rays-r path:nth-of-type(3), ul li:hover #icon-lighthouse #rays-l path:nth-of-type(1), ul li:hover #icon-lighthouse #rays-l path:nth-of-type(3) { stroke-dasharray: 15; /*stroke-dashoffset: 15;*/ -webkit-animation: ray-beam-in-out-sm 0.5s linear forwards 0s, ray-beam-in-sm 0.35s ease-out forwards 0.75s; animation: ray-beam-in-out-sm 0.5s linear forwards 0s, ray-beam-in-sm 0.35s ease-out forwards 0.75s; } ul li:hover #icon-lighthouse #rays-r path:nth-of-type(2), ul li:hover #icon-lighthouse #rays-l path:nth-of-type(2) { stroke-dasharray: 20; /*stroke-dashoffset: 20;*/ -webkit-animation: ray-beam-in-out-lg 0.5s linear forwards 0s, ray-beam-in-lg 0.35s ease-out forwards 0.75s; animation: ray-beam-in-out-lg 0.5s linear forwards 0s, ray-beam-in-lg 0.35s ease-out forwards 0.75s; } @-webkit-keyframes ray-beam-in-out-sm { 0% { stroke-dashoffset: 15; } 100% { stroke-dashoffset: -15; } } @keyframes ray-beam-in-out-sm { 0% { stroke-dashoffset: 15; } 100% { stroke-dashoffset: -15; } } @-webkit-keyframes ray-beam-in-sm { 0% { stroke-dashoffset: 15; } 100% { stroke-dashoffset: 0; } } @keyframes ray-beam-in-sm { 0% { stroke-dashoffset: 15; } 100% { stroke-dashoffset: 0; } } @-webkit-keyframes ray-beam-in-out-lg { 0% { stroke-dashoffset: 20; } 100% { stroke-dashoffset: -20; } } @keyframes ray-beam-in-out-lg { 0% { stroke-dashoffset: 20; } 100% { stroke-dashoffset: -20; } } @-webkit-keyframes ray-beam-in-lg { 0% { stroke-dashoffset: 20; } 100% { stroke-dashoffset: 0; } } @keyframes ray-beam-in-lg { 0% { stroke-dashoffset: 20; } 100% { stroke-dashoffset: 0; } } ul li:hover #icon-target #arrow { -webkit-transform-origin: center center; transform-origin: center center; -webkit-animation: arrow-fire 0.6s ease-in 0s; animation: arrow-fire 0.6s ease-in 0s; } @-webkit-keyframes arrow-fire { 0% { -webkit-transform: translate(60px, -60px); transform: translate(60px, -60px); opacity: 0; } 10% { opacity: 1; } 70% { -webkit-transform: translate(0, 0); transform: translate(0, 0); } 75% { -webkit-transform: rotate(-8deg); transform: rotate(-8deg); } 85% { -webkit-transform: rotate(7deg); transform: rotate(7deg); } 93% { -webkit-transform: rotate(-4deg); transform: rotate(-4deg); } 100% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } } @keyframes arrow-fire { 0% { -webkit-transform: translate(60px, -60px); transform: translate(60px, -60px); opacity: 0; } 10% { opacity: 1; } 70% { -webkit-transform: translate(0, 0); transform: translate(0, 0); } 75% { -webkit-transform: rotate(-8deg); transform: rotate(-8deg); } 85% { -webkit-transform: rotate(7deg); transform: rotate(7deg); } 93% { -webkit-transform: rotate(-4deg); transform: rotate(-4deg); } 100% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } } ul li:hover #icon-hand #star-1 { -webkit-transform-origin: 24px 22px; transform-origin: 24px 22px; -webkit-transform: translateY(30px) rotate(-140deg) scale(0); transform: translateY(30px) rotate(-140deg) scale(0); opacity: 0; -webkit-animation: sparkle 1s cubic-bezier(0.13, 0.32, 0.12, 1) forwards 0s; animation: sparkle 1s cubic-bezier(0.13, 0.32, 0.12, 1) forwards 0s; } ul li:hover #icon-hand #star-2 { -webkit-transform-origin: 58px 35px; transform-origin: 58px 35px; -webkit-transform: translateY(20px) rotate(80deg) scale(0); transform: translateY(20px) rotate(80deg) scale(0); opacity: 0; -webkit-animation: sparkle 1s cubic-bezier(0.13, 0.32, 0.12, 1) forwards 0.2s; animation: sparkle 1s cubic-bezier(0.13, 0.32, 0.12, 1) forwards 0.2s; } ul li:hover #icon-hand #star-4 { -webkit-transform-origin: 49px 11.5px; transform-origin: 49px 11.5px; -webkit-transform: translateY(30px) rotate(-40deg) scale(0); transform: translateY(30px) rotate(-40deg) scale(0); opacity: 0; -webkit-ani.........完整代码请登录后点击上方下载按钮下载查看
网友评论0