Skip to content

Commit a9040f1

Browse files
committed
update
1 parent 78a0103 commit a9040f1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "particles-bg-vue",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "Vue.js component for particles backgrounds",
55
"author": "creotip@gmail.com",
66
"license": "MIT",

src/particles-bg/ParticlesBg.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default {
5050
color: String,
5151
config: Object,
5252
canvas: Object,
53+
list: Array,
5354
globalCompositeOperation: String
5455
},
5556
data() {
@@ -80,6 +81,11 @@ export default {
8081
return this.random.getResult();
8182
},
8283
84+
getFromList(){
85+
if(!list) return this.getRandom();
86+
return list[Math.floor(Math.random() * list.length)];
87+
},
88+
8389
setParticles: function() {
8490
const type = this.type;
8591
let name = String(type).toLowerCase() || "random";
@@ -89,6 +95,10 @@ export default {
8995
if (this.particles.indexOf("random") === 0) {
9096
this.particles = this.getRandom();
9197
}
98+
99+
if (this.particles.indexOf("list") === 0) {
100+
this.particles = this.getFromList();
101+
}
92102
}
93103
},
94104
created() {

0 commit comments

Comments
 (0)