Jump to content

Template:TextAnimations/styles.css: Difference between revisions

From FC1
Created page with "Base Keyframes: @keyframes wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } } @keyframes hue-cycle { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } } Class logic: .wavy span { display: inline-block; animation-name: wave; animation-duration: 1s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; } .rainbow span { animation-name: hue-cycle; animation..."
 
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Base Keyframes */
/* 1. Base Keyframes */
@keyframes wave {
@keyframes wave {
   0%, 100% { transform: translateY(0); }
   0%, 100% { top: 0; }
   50%      { transform: translateY(-6px); }
   50%      { top: -6px; }
}
}


Line 10: Line 10:
}
}


/* Class logic */
/* 2. Formatting & Container Styles */
.wavy span {
/* 'inline' ensures it stays inside sentences without breaking into a new paragraph */
  display: inline-block;
.text-animation-container {
  animation-name: wave;
   display: inline !important;
  animation-duration: 1s;
   white-space: nowrap;
   animation-iteration-count: infinite;
   animation-timing-function: ease-in-out;
}
}


.rainbow span {
/* The letters MUST be inline-block to allow the 'top' property to animate */
   animation-name: hue-cycle;
.text-animation-container span {
   animation-duration: 3s;
  display: inline-block !important;
   animation-iteration-count: infinite;
}
   animation-timing-function: linear;
 
.force-bold,
.force-bold span {
   font-weight: bold !important;
}
 
.force-italic,
.force-italic span {
  font-style: italic !important;
}
 
/* 3. Standard Animation Styles */
.wavy span {
   display: inline-block !important;
  position: relative !important;
   animation: wave 1s ease-in-out infinite !important;
}
 
.rainbow span {
  display: inline-block !important;
   animation: hue-cycle 3s linear infinite !important;  
}
}


.wavy.rainbow span {
.wavy.rainbow span {
   display: inline-block;
   display: inline-block !important;
   animation-name: wave, hue-cycle;
   position: relative !important;
   animation-duration: 1s, 3s;
   animation: wave 1s ease-in-out infinite, hue-cycle 3s linear infinite !important;
  animation-iteration-count: infinite, infinite;
  animation-timing-function: ease-in-out, linear;
}
}


/* ... keep your existing keyframes and classes from before ... */
/* 4. Override Styles (Reduced Motion / MediaWiki Reset Fix) */
 
@media (prefers-reduced-motion: reduce) {
@media (prefers-reduced-motion: reduce) {
   .wavy span,  
   html body .wavy span,
   .rainbow span,  
   html body .rainbow span,
   .wavy.rainbow span {
   html body .wavy.rainbow span {  
    /* Overriding the potential 'none' or '0s' from global styles */
     animation-iteration-count: infinite !important;
     animation-iteration-count: infinite !important;
     animation-play-state: running !important;
     animation-play-state: running !important;
     animation-duration: inherit; /* Keeps the durations you set above */
     display: inline-block !important;
    position: relative !important;
   }
   }
 
 
   .wavy span {
   html body .wavy span {  
     animation-name: wave !important;
     animation-name: wave !important;  
     display: inline-block !important;
     animation-duration: 1s !important;  
   }
   }
 
   html body .rainbow span {  
   .rainbow span {
     animation-name: hue-cycle !important;
     animation-name: hue-cycle !important;
    animation-duration: 3s !important;  
   }
   }
 
   html body .wavy.rainbow span {  
   .wavy.rainbow span {
     animation-name: wave, hue-cycle !important;  
     animation-name: wave, hue-cycle !important;
     animation-duration: 1s, 3s !important;
     display: inline-block !important;
   }
   }
}
}

Latest revision as of 08:23, 14 March 2026

/* 1. Base Keyframes */
@keyframes wave {
  0%, 100% { top: 0; }
  50%      { top: -6px; }
}

@keyframes hue-cycle {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(360deg); }
}

/* 2. Formatting & Container Styles */
/* 'inline' ensures it stays inside sentences without breaking into a new paragraph */
.text-animation-container {
  display: inline !important;
  white-space: nowrap;
}

/* The letters MUST be inline-block to allow the 'top' property to animate */
.text-animation-container span {
  display: inline-block !important;
}

.force-bold, 
.force-bold span {
  font-weight: bold !important;
}

.force-italic, 
.force-italic span {
  font-style: italic !important;
}

/* 3. Standard Animation Styles */
.wavy span { 
  display: inline-block !important;
  position: relative !important;
  animation: wave 1s ease-in-out infinite !important; 
}

.rainbow span { 
  display: inline-block !important;
  animation: hue-cycle 3s linear infinite !important; 
}

.wavy.rainbow span {
  display: inline-block !important;
  position: relative !important;
  animation: wave 1s ease-in-out infinite, hue-cycle 3s linear infinite !important;
}

/* 4. Override Styles (Reduced Motion / MediaWiki Reset Fix) */
@media (prefers-reduced-motion: reduce) {
  html body .wavy span,
  html body .rainbow span,
  html body .wavy.rainbow span { 
    animation-iteration-count: infinite !important;
    animation-play-state: running !important;
    display: inline-block !important;
    position: relative !important;
  }
  
  html body .wavy span { 
    animation-name: wave !important; 
    animation-duration: 1s !important; 
  }
  html body .rainbow span { 
    animation-name: hue-cycle !important; 
    animation-duration: 3s !important; 
  }
  html body .wavy.rainbow span { 
    animation-name: wave, hue-cycle !important; 
    animation-duration: 1s, 3s !important;
  }
}