Oscilloscope
Animated CRT oscilloscope trace with phosphor persistence effect
Size
Material
<div class="oscilloscope">
<div class="oscilloscope-line"></div>
<canvas width="200" height="80" id="oscCanvas"></canvas>
</div> .oscilloscope {
width: 200px; height: 80px; background: var(--bg-inset);
border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
box-shadow: inset 0 1px 4px rgba(0,0,0,0.5); position: relative; overflow: hidden;
}
.oscilloscope-line {
position: absolute; top: 50%; left: 0; right: 0; height: 1px;
background: rgba(102,255,102,0.15);
}
.oscilloscope canvas { display: block; width: 100%; height: 100%; } API
| Class | Type | Description |
|---|---|---|
.oscilloscope | Base | Primary component class |
.md | Size | Medium (default) variant |
Design Notes
Physical Analog
Reference devices: Tektronix analog oscilloscopes, audio test equipment, synthesizer waveform monitors. Mechanism: Cathode ray tube (CRT) display. Electron beam deflected by input signal (vertical) while swept horizontally at constant rate. Beam strikes P31 phosphor screen which glows briefly, creating trailing afterglow effect.
Geometry
| Property | Value |
|---|---|
| Container | 200x80px |
| Center line | 1px at 50% height (zero-voltage reference) |
| Canvas | Full container size |
CSS Recipe
Container
.oscilloscope {
width: 200px; height: 80px; background: var(--bg-inset);
border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
box-shadow: inset 0 1px 4px rgba(0,0,0,0.5); position: relative; overflow: hidden;
}
Zero Reference Line
.oscilloscope-line {
position: absolute; top: 50%; left: 0; right: 0; height: 1px;
background: rgba(102,255,102,0.15);
}
Canvas
.oscilloscope canvas { display: block; width: 100%; height: 100%; }
HTML Structure
<div class="oscilloscope">
<div class="oscilloscope-line"></div>
<canvas width="200" height="80" id="oscCanvas"></canvas>
</div>
Size Variants
No explicit size variants.
Material Variants
Single material: Phosphor screen (CRT display).
Theme Behavior
- Container adapts via tokens
- Phosphor green color is fixed
- Center line green tint is fixed
Constraints
- Background fade (
rgba(14,12,10,0.3)fill each frame) simulates phosphor decay -- previous trace fades gradually. - Trace color MUST be green (
rgba(102,255,102,0.8)) matching P31 phosphor. - Canvas
shadowBlurof 4px green simulates phosphor glow/bloom. - Center reference line is ALWAYS faintly visible (zero-voltage reference), even with no signal.
- Animation uses
requestAnimationFrameloop. - Waveform:
sin(x*0.06 + t)+ harmonics with time offset.
Accessibility
- Use
role="img"witharia-labelon the canvas - Provide text description of the waveform if informational
- Consider
prefers-reduced-motionto pause animation - Requires JS for canvas animation
♿
Accessibility
- Element
- Use semantic HTML with appropriate ARIA roles
- Keyboard
- Follow WAI-ARIA patterns for this control type
- Focus
-
Visible focus indicator required. Use native browser focus ring or custom
:focus-visiblestyles.