Skip to content

Commit

Permalink
add random
Browse files Browse the repository at this point in the history
  • Loading branch information
lindelof committed Nov 29, 2019
1 parent 23b14b7 commit abec133
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/particles-bg/ParticlesBg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,22 @@ export default {
return +this.num;
},
getRandom: function() {
if (!this.rand) {
this.rand = new Rand();
this.rand.set(0.25, "color-particles");
this.rand.set(0.2, "ball-particles");
this.rand.set(0.2, "circle-particles");
this.rand.set(0.2, "cobweb-particles");
this.rand.set(0.2, "thick-particles");
this.rand.set(0.2, "lines-particles");
this.rand.set(0.2, "fountain-particles");
this.rand.set(0.2, "polygon-particles");
this.rand.set(0.2, "square-particles");
this.rand.set(0.2, "tadpole-particles");
if (!this.random) {
// Code source from here, thanks author
// https://github.com/a-jie/Proton/blob/gh-pages/source/src/utils/Rand.js
this.random = new Rand();
this.random.set(0.25, "color-particles");
this.random.set(0.2, "ball-particles");
this.random.set(0.2, "circle-particles");
this.random.set(0.2, "cobweb-particles");
this.random.set(0.2, "thick-particles");
this.random.set(0.2, "lines-particles");
this.random.set(0.2, "fountain-particles");
this.random.set(0.2, "polygon-particles");
this.random.set(0.2, "square-particles");
this.random.set(0.2, "tadpole-particles");
}
return this.rand.getResult();
return this.random.getResult();
},
setParticles: function() {
Expand Down
2 changes: 2 additions & 0 deletions src/particles-bg/utils/Rand.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Code source from here, thanks author
// https://github.com/a-jie/Proton/blob/gh-pages/source/src/utils/Rand.js
class Rand {

constructor() {
Expand Down

0 comments on commit abec133

Please sign in to comment.