svg悬浮图形变形动画效果代码
代码语言:html
所属分类:悬停
代码描述:svg悬浮图形变形动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html> <head> <style> * { margin: 0; padding: 0; } #wrapper { overflow: hidden; width: 100%; height: 100vh; background: #383838; position: relative; } #svg1 { display: block; width: 100%; height: 100%; transform: scale(.9); position: absolute; bottom: -20px; z-index: 2; } #base { cursor: pointer; } #clip { transform: scale(1) rotate(0deg); transform-origin: 50% 50%; transition: all .8s linear; } #base:hover #clip { transform: scale(7) rotate(70deg); } /* info text with arrow, not important for Effect */ .info { color: #fff; position: absolute; top: 70%; width: 100%; text-align: center; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 5vh; z-index: 1; } .info svg { width: 5vh; } </style> </head> <body> <div id="wrapper" ontouchstart=""> <svg id="svg1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 310.9 343.3"> <!-- when the hover is active, i use svg filter to set background Image for silhouette (change opacity in js for feFlood), otherwise when hover is inactive background is set to solid color --> <filter id="filter" primitiveUnits="objectBoundingBox"> <feImage id="bg" x="-69.00000000000044%" y="0%" height="100%" width="300%" preserveAspectRatio="xMinYMid slice" result="PHOTO" xlink:href="//repo.bfw.wiki/bfwrepo/image/5fb4a415bd3d5.png"></feImage> <feComposite operator="in" in="PHOTO" in2="SourceGraphic" result="mask"></feComposite> .........完整代码请登录后点击上方下载按钮下载查看
网友评论0