CSS অ্যানিমেশন আধুনিক ওয়েব ডিজাইনের জন্য অপরিহার্য হয়ে উঠেছে। 2026 সালে, ভিউ ট্রানজিশন এপিআই, স্ক্রোল-চালিত অ্যানিমেশন, এবং এন্ট্রি অ্যানিমেশনের জন্য @স্টার্টিং-স্টাইল এখন সমস্ত প্রধান ব্রাউজারে সমর্থিত, CSS অ্যানিমেশন আগের চেয়ে আরও শক্তিশালী। এই নির্দেশিকাটি মৌলিক রূপান্তর থেকে শুরু করে উন্নত কীফ্রেম অ্যানিমেশন এবং নতুন 2026 API- পর্যন্ত সবকিছুই কভার করে।
📋 Table of Contents
ট্রানজিশন — সাধারণ অবস্থার পরিবর্তন
/* transition: property duration timing-function delay */
.button {
background: #0066CC;
transform: translateY(0);
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
transition: background 200ms ease,
transform 150ms ease,
box-shadow 200ms ease;
}
.button:hover {
background: #0052A3;
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(0,102,204,0.3);
}
.button:active {
transform: translateY(0);
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* Timing functions */
/* ease (default), linear, ease-in, ease-out, ease-in-out */
/* cubic-bezier(x1, y1, x2, y2) — custom curve */
.smooth { transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1); } /* ease-out-expo */
.bounce { transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1); } /* bounce */
কীফ্রেম অ্যানিমেশন
/* Define the animation */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* Apply animations */
.hero-title {
animation: fadeInUp 600ms ease-out both; /* both = apply forwards and backwards fill */
}
.loading-icon {
animation: spin 1s linear infinite;
}
.highlight {
animation: pulse 2s ease-in-out infinite;
}
/* Stagger children animations */
.card-list .card {
animation: fadeInUp 400ms ease-out both;
}
.card-list .card:nth-child(1) { animation-delay: 0ms; }
.card-list .card:nth-child(2) { animation-delay: 100ms; }
.card-list .card:nth-child(3) { animation-delay: 200ms; }
.card-list .card:nth-child(4) { animation-delay: 300ms; }
@স্টার্টিং-স্টাইল — এন্ট্রি অ্যানিমেশন (2024+)
/* Animate elements entering the DOM */
dialog, [popover] {
opacity: 1;
transform: scale(1);
transition: opacity 200ms ease, transform 200ms ease,
display 200ms ease allow-discrete; /* allow display changes */
/* @starting-style defines state BEFORE element appears */
@starting-style {
opacity: 0;
transform: scale(0.95);
}
}
/* Exit animation via overlay::before-close (coming soon) */
/* Currently handle with JS class toggling */
স্ক্রোল-চালিত অ্যানিমেশন (2024+)
/* Animate based on scroll position — NO JavaScript needed! */
@keyframes reveal {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
.reveal-on-scroll {
animation: reveal linear both;
animation-timeline: view(); /* tied to element's position in viewport */
animation-range: entry 0% entry 30%; /* animate when 0-30% of element enters */
}
/* Progress bar tied to page scroll */
.reading-progress {
position: fixed;
top: 0;
left: 0;
height: 3px;
background: #0066CC;
transform-origin: left;
animation: scaleX linear;
animation-timeline: scroll(root); /* tied to document scroll */
}
@keyframes scaleX {
from { transform: scaleX(0); }
to { transform: scaleX(1); }
}
ট্রানজিশন API দেখুন
// Animate between page states or route changes
async function navigateTo(url) {
// Start transition
const transition = document.startViewTransition(async () => {
// Update the DOM here
const content = await fetchPage(url);
document.body.innerHTML = content;
});
// Wait for transition complete
await transition.finished;
}
// In Next.js / React — use experimental viewTransition
import { unstable_viewTransition as viewTransition } from 'react';
function handleNavigation() {
viewTransition(() => {
router.push('/new-page');
});
}
/* CSS controls the animation */
::view-transition-old(root) {
animation: slide-out 300ms ease-out;
}
::view-transition-new(root) {
animation: slide-in 300ms ease-out;
}
@keyframes slide-out {
to { transform: translateX(-100%); opacity: 0; }
}
@keyframes slide-in {
from { transform: translateX(100%); opacity: 0; }
}
/* Per-element transitions */
.hero-image {
view-transition-name: hero; /* matched between pages */
}
/* Browser automatically morphs .hero-image between pages! */
কর্মক্ষমতা টিপস
- শুধুমাত্র কম্পোজিটর-বান্ধব বৈশিষ্ট্য অ্যানিমেট করুন:
transformandopacity - অ্যানিমেটিং এড়িয়ে চলুন: প্রস্থ, উচ্চতা, শীর্ষ, বাম, মার্জিন, প্যাডিং – এইগুলি লেআউটের কারণ
- সংক্ষিপ্তভাবে ইচ্ছা-পরিবর্তন ব্যবহার করুন:
will-change: transformGPU স্তরে প্রচার করে - সম্মান হ্রাস গতি:
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
অ্যানিমেশন লাইব্রেরি তুলনা
| টুল | কখন ব্যবহার করুন |
|---|---|
| CSS রূপান্তর | সরল হোভার প্রভাব, রাষ্ট্র পরিবর্তন |
| CSS কীফ্রেম | লুপিং অ্যানিমেশন, স্পিনার লোড হচ্ছে |
| স্ক্রোল-চালিত API | স্ক্রোল, অগ্রগতি বারে প্রকাশ করুন |
| ট্রানজিশন দেখুন | পৃষ্ঠা/রুট পরিবর্তন |
| ফ্রেমার মোশন | জটিল প্রতিক্রিয়া অ্যানিমেশন, অঙ্গভঙ্গি |
| জিএসএপি | জটিল টাইমলাইন অ্যানিমেশন, ScrollTrigger |
2026 সালে CSS অ্যানিমেশনগুলি জাভাস্ক্রিপ্ট ছাড়াই অ্যানিমেশনের 80% চাহিদা মেটাতে পারে। হোভার স্টেটের জন্য CSS ট্রানজিশন, লুপ এবং এন্ট্রান্সের জন্য কীফ্রেম, রিভিল ইফেক্টের জন্য স্ক্রোল-চালিত অ্যানিমেশন এবং মসৃণ পেজ ট্রানজিশনের জন্য ভিউ ট্রানজিশন API ব্যবহার করুন। Framer Motion বা GSAP-এর জন্য তখনই পৌঁছান যখন CSS জটিলতা সামলাতে পারে না।
🔗 Share this article
✍️ Leave a Comment