Home Web Front-end JS Tutorial JS Library Particles.js Chinese Development Manual

JS Library Particles.js Chinese Development Manual

Sep 15, 2017 am 09:18 AM
javascript manual

Because I need to make products, a good UI interface is also very important. I found that the special effect of this kind of scattered atomic particles is not bad. Today, the editor of Script House shared the Particles.js Chinese development manual and particles.js parameters with everyone. Friends who need it can refer to it

Because I need to make products, a good UI interface is also very important. , I found that the special effect of scattering atomic particles was pretty good, so I made a

official github: https://github.com/VincentGarreau/particles.js/

demo maker, please note You may need FQ

https://codepen.io/VincentGarreau/pen/pnlso This can export the demo you made

http://vincentgarreau.com/particles.js/This can Used to try to configure different effects

Usage method

Load particle.js and configure particles:

index.html


<p id="particles-js"></p>
<script src="particles.js"></script>
Copy after login

app.js


##

/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */
particlesJS.load('particles-js', 'assets/particles.json', function() {
 console.log('callback - particles.js config loaded');
});
Copy after login
particles.json is the main configuration file

Pay attention File order, otherwise problems will occur

Actual demo


<!DOCTYPE html>
<html >
<head>
 <meta charset="UTF-8">
 <title>particles.js</title>
  <link rel="stylesheet" href="style.css" rel="external nofollow" >
</head>
<body>
<p id="particles-js"></p>
</body>
 <script src=&#39;particles.min.js&#39;></script> 这个玩意需要放在下面
 <script src="index.js"></script>
</html>
Copy after login

If you need to download the demo, please go to the QQ group, The black atom effect is very sci-fi, not bad

Create your own sci-fi effect based on css color and json configuration file

Parameters

number Quantityboolean number Area distribution density sizeHEX (string) number The width of the principleHEX (string) Atomic colornumber The number of polygon sides of the atomsvg / png / gif / jpg Atom pictures can use custom picturesnumber #particles.shape.image. heightnumber (0 to 1) Opacityboolean Random opacitytruenumber             Gradient animation speed##0.25#particles.opacity .anim.syncparticles.size.valueboolean atomic size random#particles.size.anim. speed3HEX (string) Linked line color##particles.line_linked.widthboolean Atomic move Boolean mobile random direction ##particles.move.out_modenumber The attraction X horizontal distance between atoms##1500string Detection of interaction between atomsstring boolean Interactive event adjustmentnumber Atomic interactive grab distance0.75 interactivity.events.modes.bubble.distancenumber Atomic grab bubble Ongoing events between effectsnumber Knockback effect distancenumber Knockback effect continuous eventnumber The number of particles pushed out
Key value Parameter options/description Example
##particles.number.value<span style="color:#111111;font-family:NSimsun"></span> 40<span style="color:#111111;font-family:NSimsun"></span>
particles.number.density.enable<span style="color:#111111;font-family:NSimsun"></span> true<span style="color:#111111;font-family:NSimsun"></span> / false<span style="color:#111111;font-family:NSimsun"></span>
##particles.number.density.value_area<span style="color:#111111;font-family:NSimsun"></span> 800<span style="color:#111111;font-family:NSimsun"></span>
##particles.color.value<span style="color:#111111;font-family:NSimsun"></span> RGB (object)

HSL (object)
Array selection (HEX)
Random (string)

Color of atoms

<span style="color:#111111;font-family:NSimsun">"#b61924"</span> 
<span style="color:#111111;font-family:NSimsun">{r:182, g:25, b:36}</span> 
<span style="color:#111111;font-family:NSimsun">{h:356, s:76, l:41}</span> 
<span style="color:#111111;font-family:NSimsun">["#b61924", "#333333", "999999"]</span> 
<span style="color:#111111;font-family:NSimsun">"random"</span>
<span style="color:#111111;font-family:NSimsun">particles.shape.type</span> string 
     array selection 原子的形状
<span style="color:#111111;font-family:NSimsun">"circle"</span> 
<span style="color:#111111;font-family:NSimsun">"edge"</span> 
<span style="color:#111111;font-family:NSimsun">"triangle"</span> 
<span style="color:#111111;font-family:NSimsun">"polygon"</span> 
<span style="color:#111111;font-family:NSimsun">"star"</span> 
<span style="color:#111111;font-family:NSimsun">"image"</span> 
<span style="color:#111111;font-family:NSimsun">["circle", "triangle", "image"]</span>
##particles.shape.stroke.width <span style="color:#111111;font-family:NSimsun"></span> 2<span style="color:#111111;font-family:NSimsun"></span>
particles.shape.stroke.color<span style="color:#111111;font-family:NSimsun"></span> "#222222"<span style="color:#111111;font-family:NSimsun"></span>
particles.shape.polygon.nb_slides<span style="color:#111111;font-family:NSimsun"></span> 5<span style="color:#111111;font-family:NSimsun"></span>
##particles.shape.image.src<span style="color:#111111;font-family:NSimsun"></span>path link <span style="color:#111111;font-family:NSimsun">"assets/img/yop.svg"</span>
<span style="color:#111111;font-family:NSimsun">"http://mywebsite.com/assets/img/yop.png"</span>
##particles.shape.image.width<span style="color:#111111;font-family:NSimsun"></span> (for aspect ratio) Image width
##100<span style="color:#111111;font-family:NSimsun"></span>
<span style="color:#111111;font-family:NSimsun"></span>number (for aspect ratio) Image height <span style="color:#111111;font-family:NSimsun">100</span>
#particles.opacity.value<span style="color:#111111;font-family:NSimsun"></span> 0.75<span style="color:#111111;font-family:NSimsun"></span>
particles.opacity.random<span style="color:#111111;font-family:NSimsun"></span> true<span style="color:#111111;font-family:NSimsun"></span> / false<span style="color:#111111;font-family:NSimsun"></span>
##particles.opacity.anim.enable<span style="color:#111111;font-family:NSimsun"></span>##boolean Gradient animation / <span style="color:#111111;font-family:NSimsun"></span>false
##particles.opacity.anim.speed<span style="color:#111111;font-family:NSimsun"></span> 3<span style="color:#111111;font-family:NSimsun"></span>
##particles.opacity.anim.opacity_min<span style="color:#111111;font-family:NSimsun"></span> number (0 to 1) Gradient animation opacity <span style="color:#111111;font-family:NSimsun"></span>
<span style="color:#111111;font-family:NSimsun">boolean</span> true / <span style="color:#111111;font-family:NSimsun">false</span> <span style="color:#111111;font-family:NSimsun"></span>
number Atomic size <span style="color:#111111;font-family:NSimsun">20</span>
#particles .size.random<span style="color:#111111;font-family:NSimsun"></span> true<span style="color:#111111;font-family:NSimsun"></span> / false<span style="color:#111111;font-family:NSimsun"> </span>
##particles.size.anim.enable<span style="color:#111111;font-family:NSimsun"></span>boolean Atomic gradient true<span style="color:#111111;font-family:NSimsun"> / </span>false<span style="color:#111111;font-family:NSimsun"></span>
<span style="color:#111111;font-family:NSimsun"></span>#number Atomic gradient speed
<span style="color:#111111;font-family:NSimsun">particles.size.anim.size_min</span> number <span style="color:#111111;font-family:NSimsun">0.25</span>
<span style="color:#111111;font-family:NSimsun">particles.size.anim.sync</span> boolean <span style="color:#111111;font-family:NSimsun">true</span> / <span style="color:#111111;font-family:NSimsun">false</span>
<span style="color:#111111;font-family:NSimsun">particles.line_linked.enable</span> boolean       连接线 <span style="color:#111111;font-family:NSimsun">true</span> / <span style="color:#111111;font-family:NSimsun">false</span>
<span style="color:#111111;font-family:NSimsun">particles.line_linked.distance</span> number Connecting line distance <span style="color:#111111;font-family:NSimsun">150</span>
## particles.line_linked.color<span style="color:#111111;font-family:NSimsun"></span> #ffffff<span style="color:#111111;font-family:NSimsun"></span>
##particles.line_linked.opacity<span style="color:#111111;font-family:NSimsun"></span>number (0 to 1) Link opacity 0.5<span style="color:#111111;font-family:NSimsun"></span>
<span style="color:#111111;font-family:NSimsun">##number The width of the connecting line</span> 1.5
##particles.move.enable<span style="color:#111111;font-family:NSimsun"></span> true<span style="color:#111111;font-family:NSimsun"></span> / false<span style="color:#111111;font-family:NSimsun"></span>
##particles.move.speed <span style="color:#111111;font-family:NSimsun"></span>number Atomic moving speed 4<span style="color:#111111;font-family:NSimsun"></span>
particles.move.direction<span style="color:#111111;font-family:NSimsun"></span>string             Atomic movement direction "none"<span style="color:#111111;font-family:NSimsun"> </span>
"top"<span style="color:#111111;font-family:NSimsun"> </span>
"top-right"<span style="color:#111111;font-family:NSimsun"> </span>
"right"<span style="color:#111111;font-family:NSimsun"> </span>
"bottom-right"<span style="color:#111111;font-family:NSimsun"> </span>"bottom"
<span style="color:#111111;font-family:NSimsun">"bottom-left"</span>
<span style="color:#111111;font-family:NSimsun">"left"</span>
<span style="color:#111111;font-family:NSimsun">"top-left"</span>
##particles.move.random<span style="color:#111111;font-family:NSimsun"></span> True <span style="color:#111111;font-family:NSimsun"></span>/ ## false <span style="color:#111111;font-family:NSimsun"></span>
##particles.move.straight<span style="color:#111111;font-family:NSimsun"></span>boolean             Move directly true<span style="color:#111111;font-family:NSimsun"> / </span>false<span style="color:#111111;font-family:NSimsun"></span>
<span style="color:#111111;font-family:NSimsun"></span>string (out of canvas) Whether to move out of the canvas <span style="color:#111111;font-family:NSimsun">"out"</span>
<span style="color:#111111;font-family:NSimsun">"bounce"</span>
<span style="color:#111111;font-family:NSimsun">particles.move.bounce</span> boolean
(between particles) Whether to jump and move
<span style="color:#111111;font-family:NSimsun">true</span> / <span style="color:#111111;font-family:NSimsun">false</span>
<span style="color:#111111;font-family:NSimsun">particles.move.attract.enable</span> boolean Attraction between atoms <span style="color:#111111;font-family:NSimsun">true</span> / <span style="color:#111111;font-family:NSimsun">false</span>
##particles.move.attract.rotateX<span style="color:#111111;font-family:NSimsun"></span> 3000<span style="color:#111111;font-family:NSimsun"></span>
#particles.move .attract.rotateY<span style="color:#111111;font-family:NSimsun"></span>number y vertical distance
##interactivity.detect_on<span style="color:#111111;font-family:NSimsun"></span> "canvas", "window"<span style="color:#111111;font-family:NSimsun"></span>
##interactivity.events.onhover.enable<span style="color:#111111;font-family:NSimsun"></span>boolean Hover true<span style="color:#111111;font-family:NSimsun"> / </span>false<span style="color:#111111;font-family:NSimsun"></span>
interactivity.events.onhover.mode<span style="color:#111111;font-family:NSimsun"></span> Array selection


Hover mode

<span style="color:#111111;font-family:NSimsun">"grab"</span> Grab the nearby
<span style="color:#111111;font-family:NSimsun">"bubble"</span> Bubble ball effect
<span style="color:#111111;font-family:NSimsun">"repulse"</span> Knockback effect
<span style="color:#111111;font-family:NSimsun">["grab", "bubble"]</span>
<span style="color:#111111;font-family:NSimsun">interactivity.events.onclick.enable</span> boolean Click effect <span style="color:#111111;font-family:NSimsun">true</span> / <span style="color:#111111;font-family:NSimsun">false</span>
##interactivity.events.onclick.mode<span style="color:#111111;font-family:NSimsun"></span> string

Array selection

Click effect mode

<span style="color:#111111;font-family:NSimsun">"push"</span> 
<span style="color:#111111;font-family:NSimsun">"remove"</span> 
<span style="color:#111111;font-family:NSimsun">"bubble"</span> 
<span style="color:#111111;font-family:NSimsun">"repulse"</span> 
<span style="color:#111111;font-family:NSimsun">["push", "repulse"]</span>
##interactivity.events.resize<span style="color:#111111;font-family:NSimsun"></span> true<span style="color:#111111;font-family:NSimsun"></span> / false<span style="color:#111111;font-family:NSimsun"></span>
interactivity.events.modes.grab.distance<span style="color:#111111;font-family:NSimsun"></span> 100<span style="color:#111111;font-family:NSimsun"></span>
#interactivity.events.modes.grab.line_linked.opacity<span style="color:#111111;font-family:NSimsun"></span>##number ( 0 to 1) Atomic interaction grab distance line opacity <span style="color:#111111;font-family:NSimsun"></span>
number The distance between the atomic grab bubble effects <span style="color:#111111;font-family:NSimsun">100</span>
<span style="color:#111111;font-family:NSimsun">interactivity.events.modes.bubble.size</span> number The size between atomic capture bubble effects <span style="color:#111111;font-family:NSimsun">40 </span>
##interactivity.events.modes.bubble.duration<span style="color:#111111;font-family:NSimsun"></span>(second) <span style="color:#111111;font-family:NSimsun">0.4</span>
##interactivity.events.modes.repulse.distance<span style="color:#111111;font-family:NSimsun"></span> 200<span style="color:#111111;font-family:NSimsun"></span>
interactivity.events.modes.repulse.duration<span style="color:#111111;font-family:NSimsun"></span> (second) <span style="color:#111111;font-family:NSimsun">1.2</span>
#interactivity.events.modes.push.particles_nb<span style="color:#111111;font-family:NSimsun"></span> 4<span style="color:#111111;font-family:NSimsun"></span>
##interactivity.events.modes.push.particles_nb<span style="color:#111111;font-family:NSimsun"></span>number 4<span style="color:#111111;font-family:NSimsun"></span>
retina_detect<span style="color:#111111;font-family:NSimsun"></span>boolean true<span style="color:#111111;font-family:NSimsun"> / </span>false<span style="color:#111111;font-family:NSimsun"></span>

The above is the detailed content of JS Library Particles.js Chinese Development Manual. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement an online speech recognition system using WebSocket and JavaScript How to implement an online speech recognition system using WebSocket and JavaScript Dec 17, 2023 pm 02:54 PM

How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems WebSocket and JavaScript: key technologies for implementing real-time monitoring systems Dec 17, 2023 pm 05:30 PM

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

How to use JavaScript and WebSocket to implement a real-time online ordering system How to use JavaScript and WebSocket to implement a real-time online ordering system Dec 17, 2023 pm 12:09 PM

Introduction to how to use JavaScript and WebSocket to implement a real-time online ordering system: With the popularity of the Internet and the advancement of technology, more and more restaurants have begun to provide online ordering services. In order to implement a real-time online ordering system, we can use JavaScript and WebSocket technology. WebSocket is a full-duplex communication protocol based on the TCP protocol, which can realize real-time two-way communication between the client and the server. In the real-time online ordering system, when the user selects dishes and places an order

How to implement an online reservation system using WebSocket and JavaScript How to implement an online reservation system using WebSocket and JavaScript Dec 17, 2023 am 09:39 AM

How to use WebSocket and JavaScript to implement an online reservation system. In today's digital era, more and more businesses and services need to provide online reservation functions. It is crucial to implement an efficient and real-time online reservation system. This article will introduce how to use WebSocket and JavaScript to implement an online reservation system, and provide specific code examples. 1. What is WebSocket? WebSocket is a full-duplex method on a single TCP connection.

JavaScript and WebSocket: Building an efficient real-time weather forecasting system JavaScript and WebSocket: Building an efficient real-time weather forecasting system Dec 17, 2023 pm 05:13 PM

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

How to use insertBefore in javascript How to use insertBefore in javascript Nov 24, 2023 am 11:56 AM

Usage: In JavaScript, the insertBefore() method is used to insert a new node in the DOM tree. This method requires two parameters: the new node to be inserted and the reference node (that is, the node where the new node will be inserted).

JavaScript and WebSocket: Building an efficient real-time image processing system JavaScript and WebSocket: Building an efficient real-time image processing system Dec 17, 2023 am 08:41 AM

JavaScript is a programming language widely used in web development, while WebSocket is a network protocol used for real-time communication. Combining the powerful functions of the two, we can create an efficient real-time image processing system. This article will introduce how to implement this system using JavaScript and WebSocket, and provide specific code examples. First, we need to clarify the requirements and goals of the real-time image processing system. Suppose we have a camera device that can collect real-time image data

See all articles