CSS & 样式
你可以通过 bone 和 container 属性传递 style 或 class 分别定制 bone 和 container 的样式。
在本文档中,Gueleton 使用 Tailwind CSS 的 animate-* 实用类为占位骨架增加动画效果,当然你可以根据自己的需求进行修改。
对于不使用 Tailwind CSS 的项目,文档提供了几种常见的 CSS 动画效果,你可以直接使用这些 CSS 代码,或者根据你的需求进行修改。
Pluse 动画
Section titled “Pluse 动画”.animate-pulse { --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
animation: var(--animate-pulse); /* pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite */}
@keyframes pulse { 50% { opacity: 0.5; }}Wave 动画
Section titled “Wave 动画”.animate-wave { position: relative; overflow: hidden;}
.animate-wave::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 0; display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #fff0, #ffffff80, #fff0); animation: wave 1.5s linear infinite;}@keyframes wave { 0% { transform: translate(-100%); } 100% { transform: translate(100%); }}Bounce 动画
Section titled “Bounce 动画”.animate-bounce { --animate-bounce: bounce 1s infinite;
animation: var(--animate-bounce); /* bounce 1s infinite */}
@keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }}Ping 动画
Section titled “Ping 动画”.animate-ping { --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
animation: var(--animate-ping); /* ping 1s cubic-bezier(0, 0, 0.2, 1) infinite */}
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; }}Spin 动画 🤪
Section titled “Spin 动画 🤪”.animate-spin { --animate-spin: spin 1s linear infinite;
animation: var(--animate-spin); /* spin 1s linear infinite */}
@keyframes spin { to { transform: rotate(360deg); }}