Skip to content

animation

Utilities for animating elements with CSS animations.

Class Effect
animate-spin animation: spin 1s linear infinite; @keyframes spin { to { transform: rotate(360deg); } }
animate-ping animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
animate-pulse animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; @keyframes pulse { 50% { opacity: 0.5; } }
animate-bounce animation: 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); } }
animate-none animation: none;
animate-[<value>] animation: <value>;

Use animate-spin for loading indicators.

animation: Spinanimation: Spin
if ui.div("inline-flex items-center gap-3 rounded-md bg-indigo-500 px-4 py-2 text-sm font-semibold text-white") {
ui.icon(IC.arrow_path, "size-5 animate-spin")
ui.text("Processing…")
}

Use animate-ping to make an element scale and fade like a radar ping.

animation: Pinganimation: Ping
if ui.div("relative flex size-4") {
ui.el("absolute inset-0 animate-ping rounded-full bg-sky-400 opacity-75")
ui.el("relative size-4 rounded-full bg-sky-500")
}

Use animate-pulse for skeleton loaders.

animation: Pulseanimation: Pulse
if ui.div("w-full max-w-sm rounded-md border border-blue-300 p-4 dark:border-blue-500/40") {
if ui.div("flex animate-pulse gap-4") {
ui.el("size-10 rounded-full bg-gray-200 dark:bg-white/10")
if ui.div("flex-1 space-y-4 py-1") {
ui.el("h-2 rounded bg-gray-200 dark:bg-white/10")
if ui.div("grid grid-cols-3 gap-4") {
ui.el("col-span-2 h-2 rounded bg-gray-200 dark:bg-white/10")
ui.el("h-2 rounded bg-gray-200 dark:bg-white/10")
}
ui.el("h-2 rounded bg-gray-200 dark:bg-white/10")
}
}
}
animation: Bounceanimation: Bounce
if ui.div("flex size-10 animate-bounce items-center justify-center rounded-full bg-white shadow-lg ring-1 ring-gray-900/5 dark:bg-gray-800 dark:ring-white/10") {
ui.icon(IC.arrow_right, "size-5 rotate-90 text-violet-500")
}