svg+css实现播放按钮鼠标悬浮扇形进度延迟动画显示文本效果代码
代码语言:html
所属分类:悬停
代码描述:svg+css实现播放按钮鼠标悬浮扇形进度延迟动画显示文本效果代码
代码标签: svg css 播放 按钮 鼠标 悬浮 扇形 进度 延迟 动画 显示 文本
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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 {
--anchor-name: ; /* unique per instance */
anchor-name: var(--anchor-name);
/* used so the conic only animates the hint on hover-in */
--btn-conic-hint-duration: 0s;
--btn-conic-hint-delay: .5s;
/* 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:
outline-offset 145ms var(--ease-4),
--btn-conic-hint .........完整代码请登录后点击上方下载按钮下载查看
网友评论0