【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>
相关推荐
yuhaiqiang36 分钟前
从这两件事就能看出 vibecoding 距离专业作品差距有多大?AI 能抹平技术,但抹不平品味 !
前端·后端·程序员
一次旅行42 分钟前
DeepSeek‑V4‑Flash‑Vision‑Exp 小白入门实战|3种传图方式、完整可跑代码、避坑排障
java·前端·人工智能
其实防守也摸鱼1 小时前
Codex破局:前端组件秒级生成的技术文章大纲
开发语言·前端·人工智能·学习·安全·web安全
奥莱维1 小时前
KNX酒店方案_KNX专用线与高端酒店技术逻辑
java·服务器·前端·数据库
qq_452396231 小时前
第二篇:《前端架构的“道”与“术”:架构设计原则与决策框架》
前端·架构
用户921080262862 小时前
AI 消息列表虚拟滚动:这是业务问题,还是组件能力边界?
前端
前端snow2 小时前
ai agent---mcp知识汇总
前端
计算机魔术师2 小时前
AI 写了一半代码,谁来背锅?Anthropic 的安全重构笔记
前端
明月_清风3 小时前
vLLM 深度实战:2026 年生产级 LLM 推理引擎完全指南
前端·后端·ai编程
风月说与山鬼3 小时前
七、uni-app页面与组件生命周期
前端·uni-app