Fade In On Scroll
Content that fades and rises into place as it enters the viewport.
6 फ्रेमवर्कमध्यम
Text that resolves out of scrambled glyphs into its final string.
<span class="scramble font-mono text-xl font-semibold text-gray-900 dark:text-gray-100" data-text="DECRYPTING SIGNAL">DECRYPTING SIGNAL</span>
<script>
(function () {
var el = document.querySelector('.scramble');
if (!el) return;
var text = el.getAttribute('data-text') || '';
var chars = '!<>-_\\/[]{}-=+*^?#';
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { el.textContent = text; return; }
var revealed = 0, frame = 0;
var id = setInterval(function () {
frame++;
if (frame % 3 === 0) revealed++;
var out = '';
for (var i = 0; i < text.length; i++) {
out += i < revealed || text[i] === ' ' ? text[i] : chars[Math.floor(Math.random() * chars.length)];
}
el.textContent = out;
if (revealed >= text.length) clearInterval(id);
}, 40);
})();
</script>| Prop | टाइप | डिफ़ॉल्ट | विवरण |
|---|---|---|---|
textआवश्यक | string | - | बटन दबाने पर क्लिपबोर्ड में लिखी जाने वाली स्ट्रिंग। |
speedMs | number | 40 | Speed ms |
className | string | '' | रूट एलिमेंट पर मर्ज होने वाली अतिरिक्त क्लासेज़। |
Set `speedMs` for the decode pace. Reduced motion shows the text immediately and the label stays readable to screen readers throughout.