Creator

”-sd-animation: sd-fadeIn; –sd-duration: 0ms; –sd-easing: ease-in;”

This article explains the CSS-like custom properties shown in the title, what they do, and how to use them to create subtle fade-in animations in modern web components.

What these properties mean

  • -sd-animation: sd-fadeIn; a custom property that names the animation to apply. Here it indicates a predefined “sd-fadeIn” animation (presumably defined elsewhere).
  • –sd-duration: 0ms; sets the animation duration. At 0ms the animation is instantaneous (no visible transition).
  • –sd-easing: ease-in; sets the timing function controlling acceleration; “ease-in” starts slowly and speeds up.

Typical use cases

  • Design systems or web components that let authors configure animations via CSS custom properties.
  • Feature flags where an animation can be disabled by setting duration to 0ms.
  • Providing theme-level defaults while allowing per-component overrides.

Example: defining and using sd-fadeIn

Assume a component library recognizes the custom properties and a CSS animation is provided:

css
:root {–sd-duration: 300ms;  –sd-easing: ease;  -sd-animation: sd-fadeIn;}
/* Define the keyframes for sd-fadeIn /@keyframes sd-fadeIn {  from { opacity: 0; transform: translateY(6px); }  to   { opacity: 1; transform: translateY(0); }}
/ Utility that applies the animation when the custom property names it */.sd-animated {  animation-name: var(-sd-animation);  animation-duration: var(–sd-duration);  animation-timing-function: var(–sd-easing);  animation-fill-mode: both;}

HTML:

html
<div class=“sd-animated” style=”–sd-duration: 250ms; –sd-easing: cubic-bezier(.2,.9,.2,1); -sd-animation: sd-fadeIn;”>  Hello — I will fade in</div>

Disabling animations

To immediately disable the animation without altering the component code, set duration to 0ms (as in the title). The browser will render the final state instantly, which is useful for:

  • Accessibility preferences (reduce motion)
  • Test environments
  • Performance-sensitive contexts

Accessibility and best practices

  • Respect user preferences: check prefers-reduced-motion and set –sd-duration: 0ms accordingly.
  • Provide sensible defaults (200–400ms) for small UI transitions.
  • Avoid chaining many simultaneous animations; prefer compositing-friendly properties (opacity, transform).

Example honoring reduced motion:

css
@media (prefers-reduced-motion: reduce) {  :root { –sd-duration: 0ms; }}

Summary

The snippet ”-sd-animation: sd-fadeIn; –sd-duration: 0ms; –sd-easing: ease-in;” is a compact way to configure a fade-in animation while disabling its duration. It’s useful in component-based systems for flexible, themeable animations and for honoring runtime or accessibility preferences.

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