Famous

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

This article explains the CSS-like custom properties shown in the title, how they work together to control an animation, and practical ways to use them in web interfaces.

What these properties represent

  • -sd-animation: likely a custom shorthand property naming an animation preset (here sd-fadeIn).
  • –sd-duration: a custom property defining how long the animation runs (0ms means instantaneous).
  • –sd-easing: a custom property specifying the timing function (ease-in accelerates at the start).

These look like CSS variables and a custom property convention used by a design system or component library to parameterize animations. They’re not standard CSS properties by themselves, but can be read by CSS or JavaScript to apply animations consistently.

How they work together

  1. A component or stylesheet defines animation presets, e.g. @keyframes sd-fadeIn { from { opacity: 0 } to { opacity: 1 } }.
  2. The component consumes the custom properties: it uses the -sd-animation value to decide which keyframes to apply, –sd-duration for the animation-duration, and –sd-easing for animation-timing-function.
  3. If –sd-duration is 0ms, the animation completes immediately, so sd-fadeIn will not produce a visible transition. ease-in is still applied but has no effect when duration is zero.

Example implementation (CSS + minimal JS)

  • Define keyframes and defaults:
css
:root {–sd-duration: 300ms;  –sd-easing: ease;  -sd-animation: none;}
@keyframes sd-fadeIn {  from { opacity: 0; transform: translateY(6px); }  to   { opacity: 1; transform: translateY(0); }}
.sd-animated {  animation-name: var(-sd-animation);  animation-duration: var(–sd-duration);  animation-timing-function: var(–sd-easing);  animation-fill-mode: both;}
  • Applying via HTML:
html
<div class=“sd-animated” style=”-sd-animation: sd-fadeIn; –sd-duration: 0ms; –sd-easing: ease-in;”>  Content</div>
  • Optional JS to toggle or override while respecting zero-duration:
js
const el = document.querySelector(’.sd-animated’);function playFadeIn(duration = ‘300ms’) {  el.style.setProperty(’–sd-duration’, duration);  el.style.setProperty(’-sd-animation’, ‘sd-fadeIn’);}

Practical notes and tips

  • Zero duration is useful for accessibility or initial render states

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