gsap+Draggable3实现可配置鼠标悬浮文字浮现动画效果代码
代码语言:html
所属分类:悬停
代码描述:gsap+Draggable3实现可配置鼠标悬浮文字浮现动画效果代码
代码标签: gsap Draggable 配置 鼠标 悬浮 文字 浮现 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url('//repo.bfw.wiki/bfwrepo/css/normalize.min.css') layer(normalize);
@layer normalize, base, demo;
@layer demo {
:root {
--bg: light-dark(white, black);
--bd-top: light-dark(hsl(0 0% 90%), hsl(0 0% 50%));
--bd-bottom: light-dark(hsl(0 0% 40% / 0.5), black);
--color: light-dark(hsl(0 0% 10%), hsl(0 0% 90%));
--tip: light-dark(
color-mix(in hsl, var(--bg), canvasText 5%),
color-mix(in hsl, var(--bg), canvasText 25%)
);
--tip-height: 2rem;
--ease-in: linear(
0 0%,
0.0039 6.25%,
0.0156 12.5%,
0.0352 18.75%,
0.0625 25%,
0.0977 31.25%,
0.1407 37.5%,
0.1914 43.74%,
0.2499 49.99%,
0.3164 56.25%,
0.3906 62.5%,
0.5625 75%,
0.7656 87.5%,
1 100%
);
--ease: ease;
}
.nav li {
width: 40px;
height: 40px;
border-radius: 50%;
display: grid;
place-items: center;
position: relative;
&::after {
content: '';
position: absolute;
inset: -1px 0;
}
}
.nav {
opacity: 0;
height: 42px;
color: var(--color);
box-shadow: 0 4px 8px 0 hsl(0 0% 0% / 0.2);
position: fixed;
bottom: 3rem;
left: 50%;
translate: 0% 0;
margin-left: calc(var(--width) * -0.5px);
border-radius: 100px;
background: linear-gradient(var(--bg), var(--bg)) padding-box,
linear-gradient(var(--bd-top), var(--bd-bottom)) border-box;
border: 1px solid #0000;
transition: opacity 0s var(--transition);
}
nav button {
color: canvasText;
position: absolute;
left: 0;
top: 0;
translate: -100% -50%;
opacity: 0.25;
transition: opacity calc(var(--speed) * 1s);
&:is(:hover, :active) {
opacity: 1;
}
}
.nav:has(ul:is(:hover, :focus-within)) button {
opacity: 0;
}
.nav :where(a, button) {
width: 32px;
aspect-ratio: 1;
border-radi.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0