CSS动画
css
常用CSS动画
IntersectionObserver 是一个非常强大且高效的 API,用于检测元素是否进入或离开视口(viewport)。相比于传统的 scroll 事件监听器,它能更高效地处理视口中的元素变化,不会频繁触发,适合用于懒加载图片、触发滚动动画等场景。
文本模糊动画
!!!
text
1<template>
2 <div class="text-blurry"> 白日依山尽,黄河入海流。</div>
3</template>
4<style>
5 .text-blurry {
6 text-align: center;
7 color: transparent;
8 animation: blurAnimation 2s forwards; /* 添加动画 */
9 }
10
11 /* 定义模糊动画 */
12 @keyframes blurAnimation {
13 0% {
14 text-shadow: 0 0 0 rgba(0, 0, 0, 0.5); /* 开始时没有模糊 */
15 }
16 100% {
17 text-shadow: 0 0 5px rgba(0, 0, 0, 0.5),
18 0 0 10px rgba(0, 0, 0, 0.4),
19 0 0 15px rgba(0, 0, 0, 0.3); /* 结束时增加模糊效果 */
20 }
21 }
22</style>!!!