css+svg实现简洁图标按钮鼠标悬停圆圈进度反馈动画效果代码
代码语言:html
所属分类:悬停
代码描述:css+svg实现简洁图标按钮鼠标悬停圆圈进度反馈动画效果代码
代码标签: css svg 简洁 图标 按钮 鼠标 悬停 圆圈 进度 反馈 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/open-props.easings.css"> <style> /* @property used because the effect transitions these within a gradient */ @property --btn-conic-hint { syntax: "<percentage>"; inherits: false; initial-value: 0%; /* will transition 0%-100% */ } @property --btn-effect-opacity { syntax: "<percentage>"; inherits: false; initial-value: 0%; /* will transition 0%-5% */ } button { /* used so the conic only animates the hint on hover-in */ --btn-conic-hint-duration: 0s; --btn-conic-hint-delay: 0s; /* adaptive semi-transparent hover highlight */ --highlight-color: light-dark( hsl(0 0% 0% / var(--btn-effect-opacity)), hsl(0 0% 100% / var(--btn-effect-opacity)) ); /* 2 layers: - an opacity fading solid color layer - the conic gradient that does the radar effect */ background: conic-gradient(var(--highlight-color) 0 0), conic-gradient( var(--highlight-color), var(--btn-conic-hint), transparent 0 ); @media (prefers-reduced-motion: no-preference) { /* transitions the @property props */ transition: --btn-conic-hint var(--btn-conic-hint-duration) var(--ease-in-out-4) .5s, --btn-effect-opacity .7s ease-out, /* transition scale on press/:active */ scale 1s var(--ease-spring-4); } &:is(:hover, :focus-visible) { /* animate the conic to completion */ --btn-conic-hint: 100%; /* give the conic completion duration */ --btn-conic-hint-duration: 1s; /* give highlight some opacity */ --btn-effect-opacity: 5%; } @media .........完整代码请登录后点击上方下载按钮下载查看
网友评论0