Code Monkey home page Code Monkey logo

website's Introduction

banner

tsParticles - TypeScript Particles

A lightweight TypeScript library for creating particles. Dependency free (*), browser ready and compatible with React.js, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno, Riot.js, Solid.js, and Web Components

GitHub Sponsors jsDelivr hits (npm) Cdnjs npm npm lerna CodeFactor Codacy Badge Rate this package Gitpod Ready-to-Code Run on Repl.it

Discord Slack WhatsApp Telegram Reddit

tsParticles Product Hunt Buy Me A Coffee


Table of Contents

⚠️⚠️ _This readme refers to v2 version, read here for v1 documentation* ⚠️⚠️


Do you want to use it on your website?

Documentation and Development references here 📖

This library is available on two of the most popular CDNs and it's easy and ready to use, if you were using particles.js it's even easier.

You'll find the instructions below, with all the links you need, and don't be scared by TypeScript, it's just the source language.

The output files are just JavaScript. 🤩

CDNs and npm have all the sources you need in Javascript, a bundle browser ready (tsparticles.engine.min.js), and all files splitted for import syntax.

If you are interested there are some simple instructions just below to guide you to migrate from the old particles.js library.

Library installation

Hosting / CDN

Please use these hosts or your own to load tsParticles on your projects

jsDelivr

jsDelivr jsDelivr jsDelivr jsDelivr jsDelivr

cdnjs

Cdnjs

unpkg

https://unpkg.com/tsparticles-confetti/ https://unpkg.com/tsparticles-engine/ https://unpkg.com/tsparticles-fireworks/ https://unpkg.com/tsparticles-slim/ https://unpkg.com/tsparticles/


npm

tsParticles Confetti

npm npmjs

tsParticles Engine

npm npmjs

tsParticles Fireworks

npm npmjs

tsParticles Slim

npm npmjs

tsParticles

npm npmjs

npm install tsparticles-engine

yarn

yarn add tsparticles-engine

pnpm

pnpm install tsparticles-engine

Import and require

const tsParticles = require("tsparticles-engine");

// or

import { tsParticles } from "tsparticles-engine";

The imported tsParticles is the same instance you have when including the script in the page using the <script> tag.


Usage

Load tsParticles and configure the particles:

tsParticles demo tsParticles Confetti demo

index.html

<div id="tsparticles"></div>

<script src="tsparticles.engine.min.js"></script>

app.js

/* tsParticles.load(@params); */

tsParticles.load({
    id: "tsparticles",
    options: {
        /* options here */
    },
    // url: "http://foo.bar/particles.js // this can be used as an alternative to options property
});

// after initialization this can be used.

/* tsParticles.setOnClickHandler(@callback); */

/* this will be fired from all particles loaded */

tsParticles.setOnClickHandler((event, particles) => {
    /* custom on click handler */
});

// now you can control the animations too, it's possible to pause and resume the animations
// these methods don't change the config so you're safe with all your configurations
// domItem(0) returns the first tsParticles instance loaded in the dom
const particles = tsParticles.domItem(0);

// play will start the animations, if the move is not enabled it won't enable it, it just updates the frame
particles.play();

// pause will stop the animations
particles.pause();

Official components for some of the most used frameworks

Angular

ng-particles

npm npm

Instructions available here

Astro

astro-particles

npm npm

Instructions available here

Ember.js

ember-tsparticles

npm npm

Instructions available here

Inferno

inferno-particles

npm npm

Instructions available here

jQuery

jquery-particles

npm npm

Instructions available here

Preact

preact-particles

npm npm

Instructions available here

ReactJS

react-particles

npm npm

Instructions available here

RiotJS

riot-particles

npm npm

You can find the instructions here

SolidJS

solid-particles

npm npm

You can find the instructions here

Svelte

svelte-particles

npm npm downloads

Instructions available here

VueJS 2.x

vue2-particles

npm npm

Instructions available here

VueJS 3.x

vue3-particles

npm npm

Instruction available here

Web Components

web-particles

npm npm

You can find the instructions here

WordPress

wordpress-particles

npm npm WordPress Plugin Downloads WordPress Plugin Active Installs

The plugin page hosted on WordPress.org can be found here

Elementor

Actually, an official tsParticles plugin isn't existing, but I have a collaboration with the Premium Addons for Elementor plugin collection.

Premium Addons for Elementor
Premium Addons for Elementor is one of the most common plugins for Elementor that offers more than 55 highly customizable Elementor Widgets and Section Add-ons. tsParticles is exclusively included in Premium Particles Section Add-on for Elementor Page Builder. Check It Now.
Use Premium Addons for Elementor Page Builder and get the chance to include tsParticles in your next WordPress website without the need to write a single line of code. See a Live Example.

Presets

There are some presets ready to be used in this repository, and they also have a bundle file that contains everything needed to run.

Big Circles

jsDelivr npmjs npmjs

This preset loads big colored circles moving upwards on a white background.

demo

You can find the instructions here

Bubbles

jsDelivr npmjs npmjs

This preset loads colored bubbles coming from the bottom of the screen on a white background.

demo

You can find the instructions here

Confetti

jsDelivr npmjs npmjs

This preset loads white and red confetti launched from the screen center on a transparent background.

demo

You can find the instructions here

Fire

jsDelivr npmjs npmjs

This preset loads a faded red to a black background with particles colored like fire and ash sparks.

demo

You can find the instructions here

Firefly

jsDelivr npmjs npmjs

This preset loads a mouse trail made with small fading particles like little fireflies.

demo

You can find the instructions here

Fireworks

jsDelivr npmjs npmjs

This preset loads a beautiful fireworks effect.

demo

You can find the instructions here

Fountain

jsDelivr npmjs npmjs

demo

You can find the instructions here

Links

jsDelivr npmjs npmjs

demo

You can find the instructions here

Sea Anemone

jsDelivr npmjs npmjs

demo

You can find the instructions here

Snow

jsDelivr npmjs npmjs

demo

You can find the instructions here

Stars

jsDelivr npmjs npmjs

demo

You can find the instructions here

Triangles

jsDelivr npmjs npmjs

demo

You can find the instructions here


Templates and Resources

You can find some tsParticles related templates here. The templates are created for Vanilla Javascript, ReactJS, VueJS, Angular, SvelteJS, and other frameworks.

The templates will vary, new ones can be created or older ones updated with the latest features or changed to a better style. Check them out once in a while.

If you created some good design with tsParticles feel free to submit a pull request with your cool template, you'll be credited as the template author!

https://github.com/tsparticles/templates


Demo / Generator

https://particles.js.org/samples

Particles demo


Video Tutorials

You can find all video tutorials on the website here: https://particles.js.org/video.html

More videos are coming soon! Check every day if there are some new contents.


Characters as particles

Particles chars demo


Polygon mask

tsParticles Polygon Mask demo


Animated stars

Particles NASA demo


Nyan cat flying on scrolling stars

Particles Nyan Cat demo


Snow particles

tsParticles Snow demo


Background Mask particles

tsParticles Background Mask demo


particles.json

You can find some config samples here 📖


Options

You can find all options available here 📖

Want to see it in action and try it?

I've created a tsParticles collection on CodePen 😮 or you can check out my profile

Otherwise, there's the demo page link below.

tsParticles demo

Want to see even more demos? Clone the repository on your computer and follow these instructions

$ pnpm i
$ pnpm run build
$ cd demo/vanilla
$ pnpm start

Boom! 💥 http://localhost:3000 and you can check out other demos.

If you are brave enough you can switch to the dev branch for trying the features under development.


Migrating from Particles.js

tsParticles has a package that makes this library 100% compatible with the particles.js configuration.

jsDelivr npmjs npm

Seriously, you just need to change the script from particles.js to the bundled compatibility package, et-voilà, you're ready 🧙!

You can read more here

Want to know 5 reasons to do the switch? Read here

Below you can find all the information you need to install tsParticles and its new syntax.


Plugins/Customizations

tsParticles now supports some customizations 🥳.

You can create your own plugins

Read more here...


Dependency Graphs

flowchart LR

subgraph b [Bundles]
bp[Particles.js compatibility bundle] --> bs[tsParticles Slim]
bs --> bf[tsParticles]
end

e[tsParticles Engine] --> b

iea & iebo & iebu & iec & ieg & iepa & iepu & ierem & ierep & ies --> bs
ipa & ipc & ipl --> bs
mb & mp --> bs
ple4 --> bs
sc & si & sl & sp & ssq & sst & st --> bs
ua & uc & ul & uop & uou & usi & ust --> bs

iet --> bf
pla & plem --> bf
ur & uti & utw & uw --> bf

subgraph i [Interactions]

subgraph ie [Externals]
iea[Attract]
iebo[Bounce]
iebu[Bubble]
iec[Connect]
ieg[Grab]
iepa[Pause]
iepu[Push]
ierem[Remove]
ierep[Repulse]
ies[Slow]
iet[Trail]
end

il[Light]

subgraph ip [Particles]
ipa[Attract]
ipc[Collisions]
ipl[Links]
ipr[Repulse]
end

end

i --> ie
i --> ip

e --> i

subgraph m [Movers]
mb[Base]
mp[Parallax]
end

e --> m

subgraph pa [Paths]
pac[Curves]
pape[Perlin Noise]
papo[Polygon]
pas[Simplex Noise]
end

e --> pa

subgraph pl [Plugins]
pla[Absorbers]
plem[Emitters]
plh[HSV Color]
pli[Infection]
plm[Motion]
plp[Polygon Mask]

subgraph plea [Easings]
pleb[Back]
pleci[Circ]
plecu[Cubic]
plee[Expo]
ple4[Quad]
ple5[Quint]
ples[Sine]
end

end

pl --> plea

e --> pl

subgraph s [Shapes]
sb[Bubble]
sc[Circle]
sh[Heart]
si[Image]
sl[Line]
sm[Multiline Text]
sp[Polygon]
sr[Rounded Rectangle]
ssp[Spiral]
ssq[Square]
sst[Star]
st[Text]
end

e --> s

subgraph u [Updaters]
ua[Angle]
uc[Color]
ud[Destroy]
ug[Gradient]
ul[Life]
uop[Opacity]
uor[Orbit]
uou[Out Modes]
ur[Roll]
usi[Size]
ust[Stroke Color]
uti[Tilt]
utw[Twinkle]
uw[Wobble]
end

e --> u

JetBrains JetBrains

Huge thanks to JetBrains for the 2020-2022 Open Source Licenses!

JetBrains WebStorm is used to maintain this project.

website's People

Contributors

matteobruni avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

machine1376

website's Issues

Cant export config

Hello there, Im trying to use tsParticles on wordpress, using the premiun addons pro plugin. Following their tutorial, but when I click on MORE / EXPORT CONFIG nothing happens.

In their tutorial appears a popup with the code but it seems is not working.

How can I get this code?

ty!

remove praticle snow

Hello, I hope you're well. I would like to have instructions on how to remove the praticle snow on certain pages. I have integrated it into my site so that it animates on all pages and works correctly, but I would like it to stop when certain pages are opened.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency minify to v11.1.1
  • fix(deps): update dependency simple-git to v3.24.0
  • fix(deps): update dependency typedoc-plugin-missing-exports to v2.2.0
  • fix(deps): update dependency typescript to v5.4.5
  • chore(deps): update pnpm/action-setup action to v4
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/deploy.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • pnpm/action-setup v2.4.0
  • actions/cache v3
.github/workflows/nodejs.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • pnpm/action-setup v2.4.0
  • actions/cache v3
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • pnpm/action-setup v2.4.0
  • actions/cache v3
npm
package.json
  • @pnpm/exec ^2.0.0
  • @types/fs-extra ^11.0.4
  • @types/node ^20.10.6
  • fs-extra ^11.2.0
  • gh-pages ^6.1.1
  • minify ^11.0.1
  • prettier ^3.1.1
  • rimraf ^5.0.5
  • sass ^1.69.7
  • simple-git ^3.22.0
  • terser ^5.26.0
  • typedoc ^0.25.4
  • typedoc-plugin-carbon-ads ^1.6.0
  • typedoc-plugin-clarity ^1.6.0
  • typedoc-plugin-coverage ^2.2.0
  • typedoc-plugin-keywords ^1.6.0
  • typedoc-plugin-missing-exports ^2.1.0
  • typescript ^5.3.3
  • tsparticles ^3.0.3
  • @tsparticles/editor ^3.0.0
  • @tsparticles/engine ^3.0.3
  • @tsparticles/preset-links ^3.0.2

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.