新着
アニメーションFade In On Scroll
Content that fades and rises into place as it enters the viewport.
#scroll#reveal#fade
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.