svg+css实现按钮鼠标悬浮植物树叶生长动画效果代码
代码语言:html
所属分类:悬停
代码描述:svg+css实现按钮鼠标悬浮植物树叶生长动画效果代码
代码标签: svg css 按钮 鼠标 悬浮 植物 树叶 生长 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" /> <style> button { position: relative; padding: 13px 35px; background: #f5ddb7; font-size: 17px; font-weight: 900; color: #181818; border: none; border-radius: 8px; box-shadow: 2px 2px 5px #18181869, inset 2px 2px 10px #ffffffb0; transition: all .3s ease-in-out; } .icon-1 { position: absolute; top: 10%; left: 50%; transform: translate(-50%, 0); width: 0px; height: auto; transition: all .5s ease-in-out; z-index: -1; } .icon-2 { position: absolute; top: 10%; left: 50%; transform: translate(-50%, 0); width: 0px; height: auto; transition: all .5s ease-in-out; z-index: -2; } .icon-3 { position: absolute; top: 10%; left: 50%; transform: translate(-50%, 0); width: 0px; height: auto; transition: all .5s ease-in-out; z-index: -2; } .icon-4 { position: absolute; top: 10%; left: 50%; transform: translate(-50%, 0); width: 0px; height: auto; transition: all .5s ease-in-out; z-index: -2; } .icon-5 { position: absolute; top: 10%; left: 50%; transform: translate(-50%, 0); width: 0px; height: auto; transition: all .5s ease-in-out; z-index: -2; } button:hover { padding: 13px 25px; border-radius: 8px 8px 24px 24px; } button:hover .icon-1 { top: -250%; left: 50%; transform: translate(-50%, 0); width: 50px; height: auto; animation: inIcon1 1s ease .45s forwards; } @keyframes inIcon1 { 0% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(0deg); } 25% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(5deg); } 50% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(1deg); } 65% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(3deg); } 100% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(0deg); } } button:hover .icon-2 { position: absolute; top: -200%; left: 90%; transform: translate(-50%, 0); width: 75px; height: auto; animation: inIcon2 1s ease .45s forwards; } @keyframes inIcon2 { 0% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(0deg); } 35% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(10deg); } 50% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(4deg); } 80% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(5deg); } 100% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(0deg); } } button:hover .icon-3 { position: absolute; top: -130%; left: 20%; transform: translate(-50%, 0); width: 60px; height: auto; animation: inIcon3 1s ease .45s forwards; } @keyframes inIcon3 { 0% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(0deg); } 35% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(-2deg); } 100% { transform-origin: 0 100%; transform: translate(-50%, 0) rotate(0deg); } } button:hover .icon-4 { position: absolute; top: -300%; left: 10%; trans.........完整代码请登录后点击上方下载按钮下载查看
网友评论0