Animations Showcase Project
Explore advanced CSS animations, micro-interactions, and visual effects. Create engaging, performant animations without JavaScript.
🎬 Loading Animations
/* Spinning Loader */
.loader {
width: 50px;
height: 50px;
border: 5px solid #f3f3f3;
border-top: 5px solid #667eea;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Pulsing Loader */
.loader-pulse {
width: 50px;
height: 50px;
background: #667eea;
border-radius: 50%;
animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.2);
opacity: 0.7;
}
}
/* Dots Loader */
.loader-dots {
display: flex;
gap: 8px;
}
.loader-dots span {
width: 12px;
height: 12px;
background: #667eea;
border-radius: 50%;
animation: bounce 1.4s ease-in-out infinite;
}
.loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.loader-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
0%, 80%, 100% {
transform: scale(0);
}
40% {
transform: scale(1);
}
}
/* Skeleton Loading */
.skeleton {
background: linear-gradient(
90deg,
#f0f0f0 25%,
#e0e0e0 50%,
#f0f0f0 75%
);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
border-radius: 4px;
}
@keyframes shimmer {
to {
background-position: -200% 0;
}
}
.skeleton-card {
padding: 1rem;
background: white;
border-radius: 8px;
}
.skeleton-avatar {
width: 60px;
height: 60px;
border-radius: 50%;
}
.skeleton-line {
height: 16px;
margin: 8px 0;
}
.skeleton-line:nth-child(1) { width: 80%; }
.skeleton-line:nth-child(2) { width: 60%; }
.skeleton-line:nth-child(3) { width: 90%; }
🎯 Button Animations
/* Ripple Effect */
.btn-ripple {
position: relative;
overflow: hidden;
background: #667eea;
color: white;
padding: 1rem 2rem;
border: none;
border-radius: 8px;
cursor: pointer;
}
.btn-ripple::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.5);
transform: translate(-50%, -50%);
transition: width 0.6s, height 0.6s;
}
.btn-ripple:active::after {
width: 300px;
height: 300px;
}
/* Slide Fill */
.btn-slide {
position: relative;
background: transparent;
color: #667eea;
border: 2px solid #667eea;
padding: 1rem 2rem;
border-radius: 8px;
cursor: pointer;
overflow: hidden;
z-index: 1;
transition: color 0.3s;
}
.btn-slide::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: #667eea;
transition: width 0.3s;
z-index: -1;
}
.btn-slide:hover {
color: white;
}
.btn-slide:hover::before {
width: 100%;
}
/* Gradient Shift */
.btn-gradient {
background: linear-gradient(
45deg,
#667eea,
#764ba2,
#667eea
);
background-size: 200% 100%;
color: white;
padding: 1rem 2rem;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-position 0.5s;
}
.btn-gradient:hover {
background-position: 100% 0;
}
/* Bounce */
.btn-bounce {
background: #667eea;
color: white;
padding: 1rem 2rem;
border: none;
border-radius: 8px;
cursor: pointer;
transition: transform 0.3s;
}
.btn-bounce:active {
animation: buttonBounce 0.3s ease-in-out;
}
@keyframes buttonBounce {
0%, 100% { transform: scale(1); }
50% { transform: scale(0.95); }
}
/* Glow */
.btn-glow {
background: #667eea;
color: white;
padding: 1rem 2rem;
border: none;
border-radius: 8px;
cursor: pointer;
box-shadow: 0 0 10px rgba(102, 126, 234, 0);
transition: box-shadow 0.3s;
}
.btn-glow:hover {
box-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
}
/* Loading State */
.btn-loading {
background: #667eea;
color: white;
padding: 1rem 2rem;
border: none;
border-radius: 8px;
cursor: pointer;
position: relative;
}
.btn-loading.loading {
color: transparent;
pointer-events: none;
}
.btn-loading.loading::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 20px;
height: 20px;
margin: -10px 0 0 -10px;
border: 3px solid rgba(255, 255, 255, 0.3);
border-top-color: white;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
🎨 Card Animations
/* Hover Lift */
.card-lift {
background: white;
border-radius: 16px;
padding: 2rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.card-lift:hover {
transform: translateY(-10px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}
/* 3D Flip */
.card-flip-container {
perspective: 1000px;
width: 300px;
height: 400px;
}
.card-flip {
width: 100%;
height: 100%;
position: relative;
transform-style: preserve-3d;
transition: transform 0.6s;
}
.card-flip-container:hover .card-flip {
transform: rotateY(180deg);
}
.card-flip-front,
.card-flip-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
border-radius: 16px;
padding: 2rem;
background: white;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.card-flip-back {
transform: rotateY(180deg);
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
/* Shimmer Effect */
.card-shimmer {
background: white;
border-radius: 16px;
padding: 2rem;
position: relative;
overflow: hidden;
}
.card-shimmer::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.5),
transparent
);
transition: left 0.5s;
}
.card-shimmer:hover::before {
left: 100%;
}
/* Expand on Hover */
.card-expand {
background: white;
border-radius: 16px;
padding: 1.5rem;
max-height: 200px;
overflow: hidden;
transition: max-height 0.3s ease;
}
.card-expand:hover {
max-height: 400px;
}
.card-expand__extra {
opacity: 0;
transform: translateY(20px);
transition: all 0.3s ease;
}
.card-expand:hover .card-expand__extra {
opacity: 1;
transform: translateY(0);
}
/* Parallax Hover */
.card-parallax {
background: white;
border-radius: 16px;
padding: 2rem;
transform-style: preserve-3d;
transition: transform 0.1s;
}
/* JavaScript for mouse tracking */
.card-parallax img {
transform: translateZ(50px);
}
.card-parallax h3 {
transform: translateZ(30px);
}
.card-parallax p {
transform: translateZ(20px);
}
🌊 Text Animations
/* Typing Effect */
.typing {
border-right: 2px solid #667eea;
white-space: nowrap;
overflow: hidden;
animation:
typing 3.5s steps(40, end),
blink 0.75s step-end infinite;
}
@keyframes typing {
from { width: 0; }
to { width: 100%; }
}
@keyframes blink {
50% { border-color: transparent; }
}
/* Gradient Text */
.text-gradient {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
font-size: 3rem;
font-weight: 800;
}
/* Animated Gradient */
.text-animated-gradient {
background: linear-gradient(
90deg,
#667eea,
#764ba2,
#f093fb,
#4facfe,
#667eea
);
background-size: 300% 100%;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
animation: gradientShift 3s ease infinite;
}
@keyframes gradientShift {
0%, 100% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
}
/* Glitch Effect */
.text-glitch {
position: relative;
font-size: 3rem;
font-weight: 800;
}
.text-glitch::before,
.text-glitch::after {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.text-glitch::before {
left: 2px;
text-shadow: -2px 0 #ff00c1;
animation: glitch1 2s infinite;
}
.text-glitch::after {
left: -2px;
text-shadow: -2px 0 #00fff9;
animation: glitch2 2s infinite;
}
@keyframes glitch1 {
0%, 100% { clip: rect(0, 900px, 0, 0); }
20% { clip: rect(10px, 900px, 30px, 0); }
40% { clip: rect(50px, 900px, 70px, 0); }
60% { clip: rect(30px, 900px, 50px, 0); }
80% { clip: rect(70px, 900px, 90px, 0); }
}
@keyframes glitch2 {
0%, 100% { clip: rect(0, 900px, 0, 0); }
20% { clip: rect(5px, 900px, 25px, 0); }
40% { clip: rect(45px, 900px, 65px, 0); }
60% { clip: rect(25px, 900px, 45px, 0); }
80% { clip: rect(65px, 900px, 85px, 0); }
}
/* Neon Glow */
.text-neon {
color: #fff;
font-size: 3rem;
font-weight: 800;
text-shadow:
0 0 10px #667eea,
0 0 20px #667eea,
0 0 30px #667eea,
0 0 40px #764ba2,
0 0 70px #764ba2,
0 0 80px #764ba2;
animation: neonFlicker 1.5s infinite alternate;
}
@keyframes neonFlicker {
0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
text-shadow:
0 0 10px #667eea,
0 0 20px #667eea,
0 0 30px #667eea,
0 0 40px #764ba2,
0 0 70px #764ba2,
0 0 80px #764ba2;
}
20%, 24%, 55% {
text-shadow: none;
}
}
/* Wave Animation */
.text-wave {
display: inline-block;
}
.text-wave span {
display: inline-block;
animation: wave 1.5s ease-in-out infinite;
}
.text-wave span:nth-child(1) { animation-delay: 0s; }
.text-wave span:nth-child(2) { animation-delay: 0.1s; }
.text-wave span:nth-child(3) { animation-delay: 0.2s; }
.text-wave span:nth-child(4) { animation-delay: 0.3s; }
.text-wave span:nth-child(5) { animation-delay: 0.4s; }
@keyframes wave {
0%, 40%, 100% {
transform: translateY(0);
}
20% {
transform: translateY(-20px);
}
}
🎪 Entrance Animations
/* Fade In */
.fade-in {
animation: fadeIn 0.6s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* Slide In from Bottom */
.slide-in-bottom {
animation: slideInBottom 0.6s ease-out;
}
@keyframes slideInBottom {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Scale In */
.scale-in {
animation: scaleIn 0.5s ease-out;
}
@keyframes scaleIn {
from {
opacity: 0;
transform: scale(0.8);
}
to {
opacity: 1;
transform: scale(1);
}
}
/* Rotate In */
.rotate-in {
animation: rotateIn 0.6s ease-out;
}
@keyframes rotateIn {
from {
opacity: 0;
transform: rotate(-180deg) scale(0.5);
}
to {
opacity: 1;
transform: rotate(0) scale(1);
}
}
/* Bounce In */
.bounce-in {
animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes bounceIn {
0% {
opacity: 0;
transform: scale(0.3);
}
50% {
opacity: 1;
transform: scale(1.05);
}
70% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
/* Flip In X */
.flip-in-x {
animation: flipInX 0.6s ease-out;
}
@keyframes flipInX {
from {
opacity: 0;
transform: perspective(400px) rotateX(90deg);
}
to {
opacity: 1;
transform: perspective(400px) rotateX(0);
}
}
/* Stagger Animation (with delays) */
.stagger-item {
animation: fadeInBottom 0.6s ease-out backwards;
}
.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
@keyframes fadeInBottom {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
🎭 Interactive Animations
/* Floating */
.floating {
animation: floating 3s ease-in-out infinite;
}
@keyframes floating {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-20px);
}
}
/* Rotating */
.rotating {
animation: rotate 10s linear infinite;
}
@keyframes rotate {
to {
transform: rotate(360deg);
}
}
/* Pulsing */
.pulsing {
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
}
/* Shaking */
.shake {
animation: shake 0.5s ease-in-out;
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
20%, 40%, 60%, 80% { transform: translateX(10px); }
}
/* Wiggle */
.wiggle {
animation: wiggle 1s ease-in-out infinite;
}
@keyframes wiggle {
0%, 100% { transform: rotate(0deg); }
25% { transform: rotate(-5deg); }
75% { transform: rotate(5deg); }
}
/* Heartbeat */
.heartbeat {
animation: heartbeat 1.5s ease-in-out infinite;
}
@keyframes heartbeat {
0%, 100% {
transform: scale(1);
}
10% {
transform: scale(1.1);
}
20% {
transform: scale(1);
}
30% {
transform: scale(1.1);
}
40% {
transform: scale(1);
}
}
/* Tada */
.tada {
animation: tada 1s ease-in-out;
}
@keyframes tada {
0% { transform: scale(1) rotate(0deg); }
10%, 20% { transform: scale(0.9) rotate(-3deg); }
30%, 50%, 70%, 90% { transform: scale(1.1) rotate(3deg); }
40%, 60%, 80% { transform: scale(1.1) rotate(-3deg); }
100% { transform: scale(1) rotate(0deg); }
}
/* Rubber Band */
.rubber-band {
animation: rubberBand 1s ease-in-out;
}
@keyframes rubberBand {
0% { transform: scale(1); }
30% { transform: scaleX(1.25) scaleY(0.75); }
40% { transform: scaleX(0.75) scaleY(1.25); }
50% { transform: scaleX(1.15) scaleY(0.85); }
65% { transform: scaleX(0.95) scaleY(1.05); }
75% { transform: scaleX(1.05) scaleY(0.95); }
100% { transform: scale(1); }
}
🎨 Background Animations
/* Gradient Animation */
.animated-gradient {
background: linear-gradient(
-45deg,
#667eea,
#764ba2,
#f093fb,
#4facfe
);
background-size: 400% 400%;
animation: gradientAnimation 15s ease infinite;
}
@keyframes gradientAnimation {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
/* Particles */
.particles {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: -1;
}
.particle {
position: absolute;
background: white;
border-radius: 50%;
opacity: 0.5;
animation: float 10s infinite;
}
.particle:nth-child(1) {
width: 5px;
height: 5px;
left: 10%;
animation-delay: 0s;
}
.particle:nth-child(2) {
width: 8px;
height: 8px;
left: 30%;
animation-delay: 2s;
}
.particle:nth-child(3) {
width: 6px;
height: 6px;
left: 50%;
animation-delay: 4s;
}
@keyframes float {
0% {
transform: translateY(100vh) scale(0);
opacity: 0;
}
10% {
opacity: 0.5;
}
90% {
opacity: 0.5;
}
100% {
transform: translateY(-100px) scale(1);
opacity: 0;
}
}
/* Wave Background */
.wave-background {
position: relative;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
overflow: hidden;
}
.wave {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100px;
background: url("data:image/svg+xml,...");
background-size: 1000px 100px;
animation: wave 10s linear infinite;
}
@keyframes wave {
0% {
background-position-x: 0;
}
100% {
background-position-x: 1000px;
}
}
🎯 Performance Tips
/* 1. Use transform and opacity for smooth animations */
/* Good - GPU accelerated */
.element {
transition: transform 0.3s, opacity 0.3s;
}
.element:hover {
transform: translateY(-10px);
opacity: 0.9;
}
/* Avoid - triggers layout recalculation */
.element {
transition: top 0.3s, margin 0.3s;
}
/* 2. Use will-change for complex animations */
.animated-element {
will-change: transform, opacity;
}
/* Remove after animation */
.animated-element.done {
will-change: auto;
}
/* 3. Reduce animation complexity on mobile */
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* 4. Use requestAnimationFrame for JS animations */
/* JavaScript */
function animate() {
element.style.transform = `translateX(${x}px)`;
requestAnimationFrame(animate);
}
/* 5. Debounce scroll animations */
let ticking = false;
window.addEventListener('scroll', () => {
if (!ticking) {
window.requestAnimationFrame(() => {
doAnimation();
ticking = false;
});
ticking = true;
}
});
/* 6. Use transform3d for better performance */
/* Forces GPU acceleration */
.element {
transform: translate3d(0, 0, 0);
}
/* 7. Limit the number of animated elements */
/* Animate container, not all children */
/* 8. Use CSS containment */
.animated-container {
contain: layout style paint;
}
🎯 Key Takeaways
- Performance: Use transform and opacity for smooth animations
- Loading states: Spinners, skeletons, progress indicators
- Micro-interactions: Button effects, hover states, transitions
- Entrance animations: Fade, slide, scale, rotate, bounce
- Text effects: Typing, gradients, glitch, neon glow
- will-change: Hint browser about upcoming changes
- Accessibility: Respect prefers-reduced-motion
- GPU acceleration: translate3d, transform3d for better performance