Skip to content

Commit 2aebb61

Browse files
committed
update readme
1 parent 999beae commit 2aebb61

File tree

10 files changed

+46
-33
lines changed

10 files changed

+46
-33
lines changed

README.md

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,50 +13,61 @@ This project refers to the source code of the [Proton](https://a-jie.github.io/P
1313
#### A `React` version of `particles-bg` is here [https://github.com/lindelof/particles-bg](https://github.com/lindelof/particles-bg)
1414

1515
### 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)
1919

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)
2121

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)
2323

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)
2525

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)
2727

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)
2929

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)
3131

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)
3333

3434
## Install
3535

3636
```bash
37-
npm install --save particles-bg
37+
npm install --save particles-bg-vue
3838
```
3939

4040
## Usage
4141

42-
```jsx
43-
import React, { Component } from 'react'
42+
### Method 1: Import and use in the component
4443

45-
import ParticlesBg from 'particles-bg'
44+
```vue
45+
<particles-bg type="lines" :bg="true" />
46+
...
4647
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
5353
}
54-
}
54+
};
5555
```
5656

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+
5768
## 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} />
6071
```
6172
#### * type - Is the type of particle animation
6273
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
8192
#### * color - The background color or particle color of the particle scene
8293
Notice: which should be an array under type=`color`
8394

95+
#### * canvas - canvas dom style
96+
```vue
97+
:canvas="canvasObject"
98+
...
99+
```
100+
84101
#### * bg - Set to html background
85102
Is set the following properties
86103
```css
@@ -92,11 +109,14 @@ left: 0
92109

93110
## About Custom
94111

95-
![](https://github.com/lindelof/particles-bg/blob/master/image/08.jpg?raw=true)
112+
![](https://github.com/lindelof/particles-bg-vue/blob/master/images/08.jpg?raw=true)
96113

97114
You can use type="custom" to achieve a higher degree of freedom for the particle background.
98115

99-
```jsx
116+
```vue
117+
<particles-bg type="custom" :config="config" :bg="true"/>
118+
...
119+
100120
let config = {
101121
num: [4, 7],
102122
rps: 0.1,
@@ -118,13 +138,6 @@ You can use type="custom" to achieve a higher degree of freedom for the particle
118138
ctx.closePath();
119139
}
120140
};
121-
122-
return (
123-
<div>
124-
<SignIn />
125-
<ParticlesBg type="custom" config={config} bg={true} />
126-
</div>
127-
)
128141
```
129142

130143
## License

images/01.jpg

76.5 KB
Loading

images/02.jpg

109 KB
Loading

images/03.jpg

66.2 KB
Loading

images/04.jpg

63 KB
Loading

images/05.jpg

52.5 KB
Loading

images/06.jpg

54.1 KB
Loading

images/07.jpg

105 KB
Loading

images/08.jpg

54.7 KB
Loading

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
return {
2020
config:{},
2121
canvasStyle:{
22-
height:"199px"
22+
// height:"199px"
2323
}
2424
};
2525
},

0 commit comments

Comments
 (0)