@@ -13,50 +13,61 @@ This project refers to the source code of the [Proton](https://a-jie.github.io/P
13
13
#### A ` React ` version of ` particles-bg ` is here [ https://github.com/lindelof/particles-bg ] ( https://github.com/lindelof/particles-bg )
14
14
15
15
### Online demo
16
- * demo1 [ https://stackblitz.com/edit/react-a6pm3w ] ( https://stackblitz.com/edit/react-a6pm3w?file=index.js )
17
- * demo2 [ https://stackblitz.com/edit/react-bpv9fc ] ( https://stackblitz.com/edit/react-bpv9fc?file=index.js )
18
- * custom [ https://stackblitz.com/edit/react-sop6sx ] ( https://stackblitz.com/edit/react-sop6sx?file=index.js )
16
+ * demo1 [ https://codesandbox.io/s/particles-bg-vue-bg145 ] ( https://codesandbox.io/s/particles-bg-vue-bg145 )
17
+ * demo2 [ https://codesandbox.io/s/particles-bg-vue-qc1b5 ] ( https://codesandbox.io/s/particles-bg-vue-qc1b5 )
18
+ * custom [ https://codesandbox.io/s/particles-bg-vue-2fkvr ] ( https://codesandbox.io/s/particles-bg-vue-2fkvr )
19
19
20
- ![ ] ( https://github.com/lindelof/particles-bg/blob/master/image /01.jpg?raw=true )
20
+ ![ ] ( https://github.com/lindelof/particles-bg-vue /blob/master/images /01.jpg?raw=true )
21
21
22
- ![ ] ( https://github.com/lindelof/particles-bg/blob/master/image /02.jpg?raw=true )
22
+ ![ ] ( https://github.com/lindelof/particles-bg-vue /blob/master/images /02.jpg?raw=true )
23
23
24
- ![ ] ( https://github.com/lindelof/particles-bg/blob/master/image /03.jpg?raw=true )
24
+ ![ ] ( https://github.com/lindelof/particles-bg-vue /blob/master/images /03.jpg?raw=true )
25
25
26
- ![ ] ( https://github.com/lindelof/particles-bg/blob/master/image /04.jpg?raw=true )
26
+ ![ ] ( https://github.com/lindelof/particles-bg-vue /blob/master/images /04.jpg?raw=true )
27
27
28
- ![ ] ( https://github.com/lindelof/particles-bg/blob/master/image /05.jpg?raw=true )
28
+ ![ ] ( https://github.com/lindelof/particles-bg-vue /blob/master/images /05.jpg?raw=true )
29
29
30
- ![ ] ( https://github.com/lindelof/particles-bg/blob/master/image /06.jpg?raw=true )
30
+ ![ ] ( https://github.com/lindelof/particles-bg-vue /blob/master/images /06.jpg?raw=true )
31
31
32
- ![ ] ( https://github.com/lindelof/particles-bg/blob/master/image /07.jpg?raw=true )
32
+ ![ ] ( https://github.com/lindelof/particles-bg-vue /blob/master/images /07.jpg?raw=true )
33
33
34
34
## Install
35
35
36
36
``` bash
37
- npm install --save particles-bg
37
+ npm install --save particles-bg-vue
38
38
```
39
39
40
40
## Usage
41
41
42
- ``` jsx
43
- import React , { Component } from ' react'
42
+ ### Method 1: Import and use in the component
44
43
45
- import ParticlesBg from ' particles-bg'
44
+ ``` vue
45
+ <particles-bg type="lines" :bg="true" />
46
+ ...
46
47
47
- class Example extends Component {
48
- render () {
49
- return (
50
- < div> ... < / div>
51
- < ParticlesBg type= " circle" bg= {true } / >
52
- )
48
+ import { ParticlesBg } from "particles-bg-vue";
49
+ export default {
50
+ name: "App",
51
+ components: {
52
+ ParticlesBg
53
53
}
54
- }
54
+ };
55
55
```
56
56
57
+ ### Method 2: Use it globally
58
+ ``` vue
59
+ import VueParticlesBg from "particles-bg-vue";
60
+
61
+ Vue.use(VueParticlesBg);
62
+
63
+ ....
64
+ <particles-bg type="random" :bg="true" />
65
+ ```
66
+
67
+
57
68
## Parameter Description
58
- ``` jsx
59
- < ParticlesBg color= " #ff0000" num= { 200 } type= " circle" bg= {true } / >
69
+ ``` vue
70
+ <particles-bg color="#ff0000" num=200 type="circle" : bg={true} />
60
71
```
61
72
#### * type - Is the type of particle animation
62
73
Is the type of particle animation, ` random ` is a random selection. You are also free to customize use ` custom ` .
@@ -81,6 +92,12 @@ Is the type of particle animation, `random` is a random selection. You are also
81
92
#### * color - The background color or particle color of the particle scene
82
93
Notice: which should be an array under type=` color `
83
94
95
+ #### * canvas - canvas dom style
96
+ ``` vue
97
+ :canvas="canvasObject"
98
+ ...
99
+ ```
100
+
84
101
#### * bg - Set to html background
85
102
Is set the following properties
86
103
``` css
@@ -92,11 +109,14 @@ left: 0
92
109
93
110
## About Custom
94
111
95
- 
112
+ 
96
113
97
114
You can use type="custom" to achieve a higher degree of freedom for the particle background.
98
115
99
- ```jsx
116
+ ```vue
117
+ <particles-bg type="custom" :config="config" :bg="true"/>
118
+ ...
119
+
100
120
let config = {
101
121
num : [4 , 7 ],
102
122
rps: 0.1 ,
@@ -118,13 +138,6 @@ You can use type="custom" to achieve a higher degree of freedom for the particle
118
138
ctx .closePath ();
119
139
}
120
140
};
121
-
122
- return (
123
- <div >
124
- <SignIn />
125
- <ParticlesBg type="custom" config={config } bg={true } />
126
- </div >
127
- )
128
141
```
129
142
130
143
## License
0 commit comments