Text Scramble Effect - Online Decoding Animation
Animate text that looks like it's being decoded or scrambled before settling on the final word. Copy the JS snippet.
UD5 Toolkit
Experience a textarea that grows with your content. No more scrollbars — just seamless expansion. Compare with a standard fixed textarea in real time.
function autoResizeTextarea(textarea) {
textarea.style.height = 'auto';
textarea.style.height = textarea.scrollHeight + 'px';
}
// Attach to your textarea
const ta = document.getElementById('myTextarea');
ta.addEventListener('input', () => autoResizeTextarea(ta));
// Also trigger on window resize
window.addEventListener('resize', () => autoResizeTextarea(ta));
// With max-height support
function autoResizeWithMax(textarea, maxHeight) {
textarea.style.height = 'auto';
const newHeight = Math.min(textarea.scrollHeight, maxHeight);
textarea.style.height = newHeight + 'px';
textarea.style.overflowY = textarea.scrollHeight > maxHeight ? 'auto' : 'hidden';
}
Also check out the modern CSS approach: field-sizing: content; (Chrome 123+)
scrollHeight property, which returns the full height of an element's content (including overflow). The process is: ① Reset height to auto (allows the browser to calculate the natural height), ② Read scrollHeight to get the actual content height, ③ Set the element's height to that value. This is triggered on input events. For max-height support, simply clamp the value and toggle overflow-y between hidden and auto.
field-sizing: content; enables native auto-resize behavior for textareas. Simply apply textarea { field-sizing: content; } in your stylesheet. However, browser support is limited — it works in Chrome 123+ and Edge 123+, but Firefox and Safari do not yet support it (as of 2025). For production use with broad compatibility, the JavaScript scrollHeight method remains the recommended approach. You can use @supports (field-sizing: content) for progressive enhancement.
newHeight = Math.min(scrollHeight, maxHeight). When the content exceeds maxHeight, switch overflow-y to auto so a native scrollbar appears. This gives users the best of both worlds — automatic growth for reasonable amounts of text, with a safety net for extremely long content. Try adjusting the Max Height slider in the configuration panel above to see this in action.
scrollHeight method works consistently across iOS Safari, Android Chrome, and all modern mobile browsers. One tip: listen for orientationchange and resize events to recalculate height when the viewport changes (e.g., when the virtual keyboard appears). Also consider using debounce on resize events for smoother performance.
ref and attach the onInput handler. You can create a custom hook like useAutoResize(ref, maxHeight) for reusability.@input with a template ref ($refs) or create a custom directive v-auto-resize.@HostListener('input') or (input) event binding with ElementRef.autosize (npm) which handles edge cases, or wrap the native scrollHeight logic in a framework-idiomatic way. The core principle remains the same across all frameworks.
scrollHeight read and height write are fast DOM operations. However, if you're also performing heavy operations on each keystroke (like real-time Markdown preview, auto-save to server, or complex validation), consider debouncing those additional operations while keeping the resize itself synchronous for smooth visual feedback. Avoid forcing layout thrashing — the standard pattern (reset height → read scrollHeight → set height) is already optimized to minimize reflows.
Animate text that looks like it's being decoded or scrambled before settling on the final word. Copy the JS snippet.
Drop a PDF and extract any embedded JavaScript or form actions. Check for malicious code. Privacy‑friendly analysis.
Configure how your PWA launches: focus existing or create new. Test with the launch_handler manifest field.
Build a horizontal scroll‑snap container with configurable snap‑type and alignment. Perfect for image galleries.
Compare all CSS easing presets side by side on a bouncing ball. See which curve fits your UI animation.
Query the permission state of camera, microphone, geolocation, and more. See the response and learn the API.
Process audio faster than real‑time with OfflineAudioContext. Apply filters and export the result. Dev tool.
Drop files onto a zone and see a preview with name, size, and type. Copy the JavaScript pattern for your site.
Create promises that resolve or reject after a delay. See state changes and chain .then/.catch. Debug async code.
Demonstrate how to add custom headers and POST‑like functionality to EventSource using a polyfill. Code and example.
Scroll a container and see how sticky elements behave. Adjust top, bottom, and scroll margins. Copy the code.
See how scroll‑padding and scroll‑margin affect the position of elements when using anchor links or scroll‑snap. Visual.
Write JavaScript using element.animate() and see the result in a live preview. Compare with CSS keyframes. Debugger included.
Test the experimental Translation API to translate text between languages directly in the browser, without cloud calls. Check support and copy the JavaScript starter.
Apply a convolution filter (blur, sharpen) using a Web Worker. See the UI stay responsive while processing. Learn multithreading in the browser.
Toggle scrollbar‑gutter: stable to reserve space for the scrollbar and avoid content jumps. Visual demo with two columns.
Acquire and release locks across tabs. Prevent race conditions in IndexedDB or localStorage. Visual queue and lock state.
Input any JavaScript object and see if structuredClone can deep‑copy it. Compare with JSON.parse/stringify. Learn transferables.
Register a periodic background sync to fetch fresh data even when the tab is closed. Understand the API and limits.
Test the Fullscreen API: request fullscreen on a colored div, detect changes, and copy the JavaScript boilerplate.
Choose Babel presets (env, React, TypeScript) and plugins. Get a clean babel.config.json to transpile your code. Local tool.
See the View Transitions API in action. Cross‑fade and morph between two states. Copy the JavaScript starter code.
Press any key to see the complete KeyboardEvent properties: key, code, keyCode, modifiers. Indispensable for game & shortcut developers.
Write JavaScript code and see the output or console.log results immediately. Safe iframe sandbox. For quick experiments.
Paste any JavaScript snippet and get a ready‑to‑drag bookmarklet link. Minify and encode automatically. Pure client.
Paste any JavaScript expression and see its evaluated type and value. Understand JS coercion and type quirks. Educational.
Find safe mixing ratios for the classic elephant toothpaste demonstration. Volume adjustments for different container sizes.
Type any condition and see the result of the ternary operator. Understand truthy/falsy values. Quick learning tool.
Press any key to see the corresponding JavaScript event key, code, and keyCode. An essential debugging tool for front-end developers handling keyboard input.
Minify JavaScript and CSS code to reduce file size for production. Remove whitespace and comments instantly. Run locally, your code stays private.