I can’t produce content from that title as written because it appears to be incomplete or contains raw HTML/animation attributes that make the intent unclear. I’ll assume you want an article about embedding or using animated HTML spans (e.g., ). Here’s a concise, complete article on that topic.
Using data-sd-animate on span elements — practical guide
What it is
Many front-end libraries and custom scripts use data- attributes (like data-sd-animate) to store animation configuration on elements such as . These attributes let JavaScript read animation settings from the DOM and apply effects (fade, slide, typewriter, etc.) without hard-coding options in scripts.
When to use it
- You want per-element animation settings editable in HTML.
- Designers or content editors should control animation without touching JS.
- You need declarative animation configuration for small to medium sites.
Example HTML
<p>Hello, <span data-sd-animate=“type:loop;duration:1200;delay:200”>world</span>!</p>
Basic JavaScript pattern
document.querySelectorAll(’[data-sd-animate]’).forEach(el => { const config = el.getAttribute(‘data-sd-animate’); // parse “key:value;key:value” pairs into an object const options = Object.fromEntries(config.split(’;’).filter(Boolean).map(pair => { const [k,v] = pair.split(’:’); return [k.trim(), v.trim()]; })); // apply a simple animation based on options const duration = parseInt(options.duration || 800, 10); el.style.transition = opacity ${</span><span class="text-[var(--sdm-c,inherit)] dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]" style="--sdm-c: #1F2328; --shiki-dark: #E6EDF3;">duration</span><span class="text-[var(--sdm-c,inherit)] dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]" style="--sdm-c: #0A3069; --shiki-dark: #A5D6FF;">}ms ease; el.style.opacity = 0; setTimeout(() => { el.style.opacity = 1; }, parseInt(options.delay || 0, 10));});
Accessibility considerations
- Avoid animations that cause motion sickness; provide a prefers-reduced-motion fallback.
- Ensure animated text remains readable while animating.
- Do not rely solely on animation for conveying information.
Performance tips
- Prefer CSS transitions/animations for simple fades/moves; offload to compositor-friendly properties (transform, opacity).
- Throttle or stagger animations to reduce layout thrashing.
- Clean up event listeners and timers after animations finish.
Advanced ideas
- Use JSON in data attributes for complex configs: data-sd-animate=‘{“type”:“slide”,“easing”:“ease-out”}’
- Integrate with IntersectionObserver to trigger animations only when in view.
- Combine with Web Animations API for finer control and playback.
If you meant a different title or a specific animation library (e.g., ScrollReveal, GSAP, or a custom “sd-animate” system), tell me which and I’ll tailor the article.
Leave a Reply