API Documentation
Basic Usage
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
timeout |
number | 180 | Idle delay in seconds before activation |
effect |
string | "bounce3d" | Effect name: "bounce3d", "matrix", or "ascii-glitch" |
speed |
number | 1 | Animation speed multiplier (0.5 to 3) |
background |
string | - | Background color or image URL |
Properties
| Property | Type | Description |
|---|---|---|
isActive |
boolean (readonly) | Whether the screen saver is currently active |
timeout |
number | Get/set the idle timeout in seconds |
effect |
string | Get/set the current effect name |
speed |
number | Get/set the animation speed multiplier |
background |
string | null | Get/set the background color or image |
Methods
activate()
Programmatically activate the screen saver.
deactivate()
Programmatically deactivate the screen saver.
ScreenSaver.registerEffect(name, effectClass)
Register a custom effect.
Events
screensaver-activate
Fired when the screen saver activates.
screensaver-deactivate
Fired when the screen saver dismisses. Includes duration in milliseconds.
CSS Custom Properties
| Property | Default | Description |
|---|---|---|
--screen-saver-bg |
rgba(0, 0, 0, 0.95) | Overlay background color |
--screen-saver-text-color |
#00ff00 | Primary text color |
--screen-saver-extrude-color |
#003300 | 3D extrusion color (bounce3d) |
--screen-saver-font-family |
'Arial Black', sans-serif | Font family for displayed text |
--screen-saver-font-size |
4rem | Font size for displayed text |
--screen-saver-z-index |
999999 | Z-index of the overlay |
Accessibility
Reduced Motion
The component automatically detects prefers-reduced-motion: reduce and displays static centered text without animation.
ARIA
The overlay has role="dialog" and appropriate aria-label and aria-hidden attributes that update with the component state.
Keyboard Dismissal
The screen saver can be dismissed by pressing any key.
TypeScript
Built-in Effects
bounce3d
Classic DVD-logo style bouncing text with 3D depth effect.
- Extruded shadow via layered text-shadow
- Subtle Y-axis rotation during movement
- Color cycling on edge bounces
- Smooth animation with delta time
matrix
Digital rain effect inspired by The Matrix.
- Canvas-based rendering for performance
- Japanese katakana and ASCII characters
- Semi-transparent overlay for trail effect
- Slot text prominently displayed with glow
ascii-glitch
Cyberpunk-style glitch effect.
- Random character swapping
- Chromatic aberration layers (red/blue shift)
- Flicker effect via opacity changes
- Variable glitch intensity over time