【Tailwind】动画解读:Tailwind CSS Animation Examples

Tailwind CSS Animation Classes

Class CSS Properties 中文翻译
animate-none animation: none; 无动画效果。
animate-spin animation: spin 1s linear infinite; @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } 无限旋转动画,1秒内线性旋转360度。
animate-ping animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } } 无限放大消失动画,1秒内放大至2倍并逐渐消失。
animate-pulse animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } } 无限脉冲动画,2秒内透明度在1和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: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); } } 无限弹跳动画,1秒内元素上下弹跳。

演练场:https://www.tutorialspoint.com/tailwind_css/tailwind_css_animation.htm

Example

html 复制代码
<!DOCTYPE html>
<html>
<head>
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="p-4 text-center">
    <p>( Hover the smile )</p>
    <div class="flex items-center justify-center 
                hover:animate-spin delay-500">
        <div class="w-28 h-28 m-4 rounded-full bg-yellow-400 relative
                    flex justify-center align-center">
            animate-spin
        </div>
    </div>
    <div class="flex items-center justify-center 
                hover:animate-ping delay-500">
        <div class="w-28 h-28 m-4 rounded-full bg-yellow-400 relative
                    flex justify-center align-center">
            animate-ping
        </div>
    </div>
    <div class="flex items-center justify-center 
                hover:animate-pulse delay-500">
        <div class="w-28 h-28 m-4 rounded-full bg-yellow-400 relative
                    flex justify-center align-center">
            animate-pulse
        </div>
    </div>
    <div class="flex items-center justify-center 
                hover:animate-bounce delay-500">
        <div class="w-28 h-28 m-4 rounded-full bg-yellow-400 relative
                    flex justify-center align-center">
            animate-bounce
        </div>
    </div>
    
</body>
</html>
相关推荐
lbh1 天前
当我开始像写代码一样和AI对话,一切都变了
前端·openai·ai编程
We་ct1 天前
LeetCode 918. 环形子数组的最大和:两种解法详解
前端·数据结构·算法·leetcode·typescript·动态规划·取反
wefly20171 天前
m3u8live.cn 在线M3U8播放器,免安装高效验流排错
前端·后端·python·音视频·前端开发工具
C澒1 天前
微前端容器标准化 —— 公共能力篇:通用打印
前端·架构
德育处主任Pro1 天前
前端元素转图片,dom-to-image-more入门教程
前端·javascript·vue.js
木斯佳1 天前
前端八股文面经大全:小红书前端一二面OC(下)·(2026-03-17)·面经深度解析
前端·vue3·proxy·八股·响应式
陈天伟教授1 天前
人工智能应用- 预测新冠病毒传染性:04. 中国:强力措施遏制疫情
前端·人工智能·安全·xss·csrf
zayzy1 天前
前端八股总结
开发语言·前端·javascript
今天减肥吗1 天前
前端面试题
开发语言·前端·javascript
Rabbit_QL1 天前
【前端UI行话】前端 UI 术语速查表
前端·ui·状态模式