Feature Request: "delay for animation to start" or "delay for first emitter to start"
See original GitHub issueWhat is your request?
Good morning.
I use the firework preset. Currently I need to set in JavaScript a command to await 8 seconds before the first firework explosion ever starts to be emitted. After the first explosion, subsequent explosions follow shortly after, less than a second later.
Is it possible to set just with tsParticles, this initial delay for the first emitter/firework explosion to start? That is, the possibility of set a delay time for the start of tsParticles?
if this option doesn’t exist, please consider developing it as “delay for animation to start” or “delay for first emitter to start” as it allows control over starting animations in sequence with other animations.
I migrated all tsParticles from JavaScript to the WordPress block, successfully, thanks to your nice Gutenberg block. This 8 second delay before the fireworks preset is the only preset that I’m not able to migrate. I’m not experienced in JavaScript. So I’m not able to apply the addeventlistener in the WordPress block.
<script>
(async () => {
const container = await tsParticles.load("tsparticles", {
/*some options omitted*/
"duration": 0,
"emitters": {
"autoPlay": false,
"fill": true,
"life": {
"wait": false,
"count": 0,
"delay": 0.1,
"duration": 0.1
},
"rate": {
"quantity": 1,
"delay": 0.25
},
"shape": "circle",
"startCount": 4,
"size": {
"mode": "percent",
"height": 0.1,
"width": 0.1
},
"direction": "top-center",
"position": {
"x": 48.75,
"y": 77.75
}
}
});
document.addEventListener("DOMContentLoaded", () => {
setTimeout(() => {
container.playEmitter();
}, 8000);
});
})();
</script>
tsParticles Version
2.3.1
Which library are you using?
Vanilla (tsparticles)
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:12 (6 by maintainers)

Top Related StackOverflow Question
https://www.freecodecamp.org/news/javascript-settimeout-js-timer-to-delay-n-seconds/
https://www.npmjs.com/package/event-emitter-es6
These Links might help
Ok, I’ve understood the problem now, you’d like to replicate the fireworks preset with custom options.
I’ll break it down into 3 parts:
lifeoptions of the emitters,durationandcountare not neededrate,quantitydetermines how many particles spawn everydelaysecondsparticles.lifeoptions (mainparticlessections, or can be added toemittersas well, it overrides properties from the main config).You can see all these properties here: https://codepen.io/matteobruni/pen/abJQrbK (it’s an old sample, but you can try the
particles.lifeoptions.In this sample also the
particles.size.animationdestroys the particles when reaching it’s maximum size (like the fireworks preset)