Skip to content

Commit a340800

Browse files
committed
build: added prettier for checking file formatting style
1 parent 99969ea commit a340800

10 files changed

+1020
-754
lines changed

README.md

+108-103
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ const App = () => {
163163
},
164164
detectRetina: true,
165165
}),
166-
[]
166+
[],
167167
);
168168

169169
if (init) {
@@ -185,116 +185,121 @@ const App = () => {
185185
```tsx
186186
import { useEffect, useMemo, useState } from "react";
187187
import Particles, { initParticlesEngine } from "@tsparticles/react";
188-
import { type Container, type ISourceOptions, MoveDirection, OutMode } from "@tsparticles/engine";
188+
import {
189+
type Container,
190+
type ISourceOptions,
191+
MoveDirection,
192+
OutMode,
193+
} from "@tsparticles/engine";
189194
// import { loadAll } from "@/tsparticles/all"; // if you are going to use `loadAll`, install the "@tsparticles/all" package too.
190195
// import { loadFull } from "tsparticles"; // if you are going to use `loadFull`, install the "tsparticles" package too.
191196
import { loadSlim } from "@tsparticles/slim"; // if you are going to use `loadSlim`, install the "@tsparticles/slim" package too.
192197
// import { loadBasic } from "@tsparticles/basic"; // if you are going to use `loadBasic`, install the "@tsparticles/basic" package too.
193198

194199
const App = () => {
195-
const [ init, setInit ] = useState(false);
196-
197-
// this should be run only once per application lifetime
198-
useEffect(() => {
199-
initParticlesEngine(async (engine) => {
200-
// you can initiate the tsParticles instance (engine) here, adding custom shapes or presets
201-
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
202-
// starting from v2 you can add only the features you need reducing the bundle size
203-
//await loadAll(engine);
204-
//await loadFull(engine);
205-
await loadSlim(engine);
206-
//await loadBasic(engine);
207-
}).then(() => {
208-
setInit(true);
209-
});
210-
}, []);
211-
212-
const particlesLoaded = async (container?: Container): Promise<void> => {
213-
console.log(container);
214-
};
215-
216-
const options: ISourceOptions = useMemo(
217-
() => ({
218-
background: {
219-
color: {
220-
value: "#0d47a1",
221-
},
222-
},
223-
fpsLimit: 120,
224-
interactivity: {
225-
events: {
226-
onClick: {
227-
enable: true,
228-
mode: "push",
229-
},
230-
onHover: {
231-
enable: true,
232-
mode: "repulse",
233-
},
234-
},
235-
modes: {
236-
push: {
237-
quantity: 4,
238-
},
239-
repulse: {
240-
distance: 200,
241-
duration: 0.4,
242-
},
243-
},
244-
},
245-
particles: {
246-
color: {
247-
value: "#ffffff",
248-
},
249-
links: {
250-
color: "#ffffff",
251-
distance: 150,
252-
enable: true,
253-
opacity: 0.5,
254-
width: 1,
255-
},
256-
move: {
257-
direction: MoveDirection.none,
258-
enable: true,
259-
outModes: {
260-
default: OutMode.out,
261-
},
262-
random: false,
263-
speed: 6,
264-
straight: false,
265-
},
266-
number: {
267-
density: {
268-
enable: true,
269-
},
270-
value: 80,
271-
},
272-
opacity: {
273-
value: 0.5,
274-
},
275-
shape: {
276-
type: "circle",
277-
},
278-
size: {
279-
value: { min: 1, max: 5 },
280-
},
281-
},
282-
detectRetina: true,
283-
}),
284-
[]
200+
const [init, setInit] = useState(false);
201+
202+
// this should be run only once per application lifetime
203+
useEffect(() => {
204+
initParticlesEngine(async (engine) => {
205+
// you can initiate the tsParticles instance (engine) here, adding custom shapes or presets
206+
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
207+
// starting from v2 you can add only the features you need reducing the bundle size
208+
//await loadAll(engine);
209+
//await loadFull(engine);
210+
await loadSlim(engine);
211+
//await loadBasic(engine);
212+
}).then(() => {
213+
setInit(true);
214+
});
215+
}, []);
216+
217+
const particlesLoaded = async (container?: Container): Promise<void> => {
218+
console.log(container);
219+
};
220+
221+
const options: ISourceOptions = useMemo(
222+
() => ({
223+
background: {
224+
color: {
225+
value: "#0d47a1",
226+
},
227+
},
228+
fpsLimit: 120,
229+
interactivity: {
230+
events: {
231+
onClick: {
232+
enable: true,
233+
mode: "push",
234+
},
235+
onHover: {
236+
enable: true,
237+
mode: "repulse",
238+
},
239+
},
240+
modes: {
241+
push: {
242+
quantity: 4,
243+
},
244+
repulse: {
245+
distance: 200,
246+
duration: 0.4,
247+
},
248+
},
249+
},
250+
particles: {
251+
color: {
252+
value: "#ffffff",
253+
},
254+
links: {
255+
color: "#ffffff",
256+
distance: 150,
257+
enable: true,
258+
opacity: 0.5,
259+
width: 1,
260+
},
261+
move: {
262+
direction: MoveDirection.none,
263+
enable: true,
264+
outModes: {
265+
default: OutMode.out,
266+
},
267+
random: false,
268+
speed: 6,
269+
straight: false,
270+
},
271+
number: {
272+
density: {
273+
enable: true,
274+
},
275+
value: 80,
276+
},
277+
opacity: {
278+
value: 0.5,
279+
},
280+
shape: {
281+
type: "circle",
282+
},
283+
size: {
284+
value: { min: 1, max: 5 },
285+
},
286+
},
287+
detectRetina: true,
288+
}),
289+
[],
290+
);
291+
292+
if (init) {
293+
return (
294+
<Particles
295+
id="tsparticles"
296+
particlesLoaded={particlesLoaded}
297+
options={options}
298+
/>
285299
);
300+
}
286301

287-
if (init) {
288-
return (
289-
<Particles
290-
id="tsparticles"
291-
particlesLoaded={particlesLoaded}
292-
options={options}
293-
/>
294-
);
295-
}
296-
297-
return <></>;
302+
return <></>;
298303
};
299304
```
300305

0 commit comments

Comments
 (0)