ngx-4hera-screen-saver
v0.0.3
Published
Screen saver component for Angular.
Downloads
5
Maintainers
Readme
ngx-4hera-screen-saver
About:
Screen saver component for Angular. Screen saver will appear when user is being idle for certain amount of time.
This library uses p5.js
under the hood.
Installation guide:
Install library using npm:
npm install ngx-4hera-screen-saver
Screen savers depend on additional assets, you'll have to modify your angular.json
file to add them:
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "node_modules/ngx-4hera-screen-saver/assets",
"output": "assets/ngx-4hera-screen-saver"
}
]
Usage:
Add Ngx4HeraScreenSaverModule
to imports array in Angular module:
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, Ngx4HeraScreenSaverModule],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
Put ngx-4hera-screen-saver
component in the template (preferably in app.component.html
):
<ngx-4hera-screen-saver></ngx-4hera-screen-saver>
Configuration:
You can pass following optional inputs to the component:
idleAfterMs: time from last user activity after which the screen saver will appear (in miliseconds). Default value: 10000 (10 seconds).
variant: screen saver variant to show. Available variants: "fireworks", "dvd", "stars". Default value: "fireworks".
opacity: screen saver opacity. 0 is transparent, 1 is opaque. Defaults to 1.
zIndex: screen saver z-index CSS value. Defaults to 1.
Example:
<ngx-4hera-screen-saver
[opacity]="0.8"
[zIndex]="2"
[idleAfterMs]="2000"
[variant]="'dvd'"
></ngx-4hera-screen-saver>