🌐 Detecting your location…
📢 Advertisement — Configure AdSense in Appearance → Customize → AdSense Settings

सीएसएस एनिमेशन गाइड 2026: ट्रांज़िशन, कीफ़्रेम और स्क्रॉल-चालित

⏱️2 min read  ·  413 words

आधुनिक वेब डिज़ाइन के लिए CSS एनिमेशन आवश्यक हो गए हैं। 2026 में, व्यू ट्रांज़िशन एपीआई, स्क्रॉल-संचालित एनिमेशन और एंट्री एनिमेशन के लिए @स्टार्टिंग-स्टाइल अब सभी प्रमुख ब्राउज़रों में समर्थित है, सीएसएस एनिमेशन पहले से कहीं अधिक शक्तिशाली हैं। यह मार्गदर्शिका बुनियादी बदलावों से लेकर उन्नत कीफ़्रेम एनिमेशन और नए 2026 एपीआई तक सब कुछ कवर करती है।

परिवर्तन – सरल अवस्था परिवर्तन

/* 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); }
}

ट्रांज़िशन एपीआई देखें

// 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! */

प्रदर्शन युक्तियाँ

  • केवल कंपोजिटर-अनुकूल गुणों को चेतन करें: transform and opacity
  • एनिमेट करने से बचें: चौड़ाई, ऊँचाई, शीर्ष, बाएँ, मार्जिन, पैडिंग – ये लेआउट का कारण बनते हैं
  • वसीयत-परिवर्तन का संयम से प्रयोग करें: 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;
  }
}

एनिमेशन लाइब्रेरी तुलना

औजार कब उपयोग करें
सीएसएस परिवर्तन सरल होवर प्रभाव, स्थिति परिवर्तन
सीएसएस कीफ़्रेम लूपिंग एनिमेशन, स्पिनर लोड हो रहे हैं
स्क्रॉल-संचालित एपीआई स्क्रॉल, प्रगति पट्टियों पर प्रकट करें
परिवर्तन देखें पृष्ठ/मार्ग परिवर्तन
फ़्रेमर मोशन जटिल प्रतिक्रिया एनिमेशन, इशारे
जीएसएपी जटिल टाइमलाइन एनिमेशन, स्क्रॉलट्रिगर

2026 में सीएसएस एनिमेशन जावास्क्रिप्ट के बिना 80% एनीमेशन जरूरतों को संभाल सकते हैं। होवर स्थिति के लिए सीएसएस ट्रांज़िशन, लूप और प्रवेश द्वार के लिए कीफ़्रेम, प्रकट प्रभावों के लिए स्क्रॉल-संचालित एनिमेशन और सुचारू पृष्ठ ट्रांज़िशन के लिए व्यू ट्रांज़िशन एपीआई का उपयोग करें। फ्रैमर मोशन या जीएसएपी तक तभी पहुंचें जब सीएसएस जटिलता को संभाल नहीं सकता।

✍️ Leave a Comment

Your email address will not be published. Required fields are marked *

🌐 Read in:🇬🇧 English🇩🇪 Deutsch🇧🇷 Português🇸🇦 العربية🇮🇳 हिन्दी🇧🇩 বাংলা