moeyua / astro-theme-typography

Rediscover the beauty of typography.
https://astro-theme-typography.vercel.app
MIT License
262 stars 87 forks source link

feat: 添加链接在 hover 时的渐变动画 #144

Closed mslxl closed 1 week ago

mslxl commented 1 week ago

加了 0.3 秒的 ease 效果,感觉能让视觉效果好些。突然的变化感觉就像灯泡突然亮了一样,和右边的标题 hover 动画不太搭配

Before After
recording recording
vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
astro-theme-typography ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 22, 2024 1:37pm
moeyua commented 1 week ago

这里我最开始也加了一点动效,但是 underline 的颜色会在移开指针后立刻更改颜色,现在还没想到合适的处理方式🤔

mslxl commented 1 week ago

用 pseudo class 去模拟 underline 怎么样? 这样就可以给 pseudo class 塞点动画。

:where(a):not(.not-underline-hover) {
  --at-apply: 'underline-hover';

  position: relative;
  text-decoration: none; /*temporarily modify*/
  transition: color .3s ease 0s, background-color .3s ease 0s;
}

:where(a):not(.not-underline-hover)::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 2px;

  background-color: var(--uno-colors-foreground);
}

image

视觉效果上感觉看不出来和 underline 的区别

不过像这种 underline 的动画我不太会设计,感觉加上动效也挺奇怪的

moeyua commented 1 week ago

我研究了一下发现可以解决这个问题,已经提交了新的 PR #151,这边就先关闭啦~