This project was generated with Angular CLI version 9.1.0.
git clone https://github.com/agbq/Particles-Demo-App.git
cd Particles-Demo-App
npm i
npm i -g @angular/cli
ng serve
- Open browser to http://localhost:4200/
Run ng test
to execute the unit tests via Karma.
This app was built using the particles.js library.
As of 4/6/20, no typings exist for particles.js library and no fully functional Angular directives could be identified. Instead, the particles.js library was added to the angular.json 'scripts' property and the following lines were added in app.component.ts:
declare let particlesJS: any;
This is the start function for particles.js. The parameters are the div ID for particles.js and a configuration object.
declare let pJSDom: any;
This is an array in particles.js that contains pJS objects. For optimal performance, the component destroys the existing pJS object before loading a new one. Because the destroypJS() function sets pJSDom to null, the component also resets pJSDom to an empty array, ready for a new pJS object.
A demo of particles.js can be used to quickly create and download new configurations.
Configuration example
Configuration options
- Create a new configuration using the demo above or by duplicating and modifying an existing configuration.
- Add it to the particles-config.ts file, exporting it as a constant.
- Import it in the app.component.ts file and add it as a property of the component.
- Add it to the mat-button-toggle-group in the app.component.html file following the pattern of the existing configurations.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.