当然可以!以下是几个实用且效果炫酷的 CSS3 动画示例,每个示例都包括:

  • 🎯 动画效果名称
  • 🔧 HTML + CSS 代码
  • 👀 动画演示说明

你可以直接复制粘贴到本地 HTML 文件中运行查看。


✅ 目录

  1. 渐隐渐现动画(Fade In / Fade Out)
  2. 缩放放大动画(Zoom In)
  3. 左右滑入动画(Slide In)
  4. 旋转动画(Rotate)
  5. 跳动动画(Bounce)
  6. 加载环动画(Loading Spinner)
  7. 闪烁边框动画(Glowing Border)

💡 1. 渐隐渐现动画(Fade In)

<!DOCTYPE html>
<html lang="en">
<head>
<style>
.fade-in {
  opacity: 0;
  animation: fadeIn 2s ease-in forwards;
}
@keyframes fadeIn {
  to { opacity: 1; }
}
</style>
</head>
<body>
  <h2 class="fade-in">🎉 欢迎来到CSS3动画世界!</h2>
</body>
</html>

👀 效果:页面加载后文字逐渐显示。


💡 2. 缩放放大动画(Zoom In)

<style>
.zoom-in {
  transform: scale(0.5);
  animation: zoomIn 0.5s forwards ease-out;
}
@keyframes zoomIn {
  to { transform: scale(1); }
}
</style>

<div class="zoom-in">📦 放大出现的盒子</div>

👀 效果:从小变大进入视野。


💡 3. 左右滑入动画(Slide In)

<style>
.slide-in {
  transform: translateX(-100%);
  animation: slideIn 1s forwards;
}
@keyframes slideIn {
  to { transform: translateX(0); }
}
</style>

<div class="slide-in">➡️ 从左滑入的元素</div>

👀 效果:元素从屏幕左侧滑入。


💡 4. 旋转动画(Rotate)

<style>
.rotate {
  display: inline-block;
  animation: rotate 2s linear infinite;
}
@keyframes rotate {
  to { transform: rotate(360deg); }
}
</style>

<div class="rotate">🔄</div>

👀 效果:元素持续顺时针旋转。


💡 5. 跳动动画(Bounce)

<style>
.bounce {
  display: inline-block;
  animation: bounce 1s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-30px); }
}
</style>

<div class="bounce">🏀 跳跳球</div>

👀 效果:元素上下弹跳。


💡 6. 加载环动画(Loading Spinner)

<style>
.spinner {
  width: 50px;
  height: 50px;
  border: 6px solid #ddd;
  border-top-color: #09f;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
</style>

<div class="spinner"></div>

👀 效果:经典加载动画圆圈。


💡 7. 闪烁边框动画(Glowing Border)

<style>
.glow-box {
  padding: 20px;
  border: 2px solid #00f;
  animation: glow 1s ease-in-out infinite alternate;
}
@keyframes glow {
  from { box-shadow: 0 0 5px #00f; }
  to   { box-shadow: 0 0 20px #0ff; }
}
</style>

<div class="glow-box">✨ 闪烁边框盒子</div>

👀 效果:边框发光闪烁。


🧰 扩展提示

  • 可结合 :hover 实现交互动画,如按钮悬停放大。
  • 使用 animation-delayanimation-iteration-count 控制时序。
  • 配合 JavaScript 添加/移除动画类,可实现更复杂的效果。

🎁 BONUS:多个动画组合演示

<style>
.box {
  width: 100px;
  height: 100px;
  background: #09f;
  border-radius: 10px;
  animation: fadeInZoomSlide 2s ease-in-out forwards;
}
@keyframes fadeInZoomSlide {
  0%   { opacity: 0; transform: scale(0.5) translateX(-100px); }
  100% { opacity: 1; transform: scale(1) translateX(0); }
}
</style>

<div class="box"></div>

👀 效果:同时从左滑入 + 缩放 + 淡入。