Loads the provided options to create a Container object.
the particles container element id
the options object to initialize the Container
this method is obsolete, please use the new tsParticles.load
Loads the provided json with a GET request. The content will be used to create a Container object.
this method is obsolete, please use the new tsParticles.load
Adds an additional click handler to all the loaded Container objects.
the function called after the click event is fired
this method is obsolete, please use the new tsParticles.setOnClickHandler
Migrating from Particles.js
tsParticles is fully compatible with Particles.js and the migration is really easy to do.
Let's checkout your possible HTML code.
Simple solution
You should have something like the following code
Well to migrate from particles.js to tsParticles all you have to do is replace that to this
If you have customized the css like this:
You have to change it like this
And you're done. Easy isn't it?
Advanced solution
Probably you noticed some warnings in the console. Well yes, it's really easy doing the migration but new features requires new configs and bug fixes can mess up some things.
If you're not familiar with Javascript don't worry, you can skip this part and keep the warnings, everything will work fine.
If you care about console warnings well you are in the right place.
The particlesJS identifier is now obsolete, well the library has a new name so it changed.
Now let's checkout the Javascript code, you should have something like this
or something like this
All you have to do to use the new identifiers it replacing the function
particlesJS()
intotsParticles.load()
or the function
particlesJS.load()
intotsParticles.loadJSON()
Warning here, the
loadJSON
doesn't have a third parameter, if you need a callback use thethen
function.Still really simple.
Let's convert the sample provided above to understand
But probably you noticed that your warnings are still there, well the options are changed too but like the identifier this is not an issue.
Transforming Options
Let's checkout the options warning. They suggest you to change the old property in the newer one.
The changed properties still continues to work, but they will be dropped probably for new features.
If you find a property with a
_
in the name, that property was renamed. We can takeline_linked
property as sample. It's renamedlineLinked
now.Boom. Another warning gone!
Checkout warnings for finding all other properties renamed.