@tsparticles/fireworks 烟花特效
html版
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta charset="utf-8" />
<link
rel="shortcut icon"
href="https://particles.js.org/tsParticles-64.png"
/>
<meta
name="description"
content="tsParticles - Easily create highly customizable particles, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno."
/>
<meta name="author" content="Matteo Bruni" />
<meta
name="keywords"
content="html css javascript typescript particles js ts jsx tsx canvas confetti fireworks animations react vue angular svelte libraries how to create add"
/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:creator" content="@HollowMatt_ITA" />
<meta
name="twitter:image:src"
content="https://particles.js.org/images/demo2.png"
/>
<meta
property="og:title"
content="tsParticles - JavaScript Particles, Confetti and Fireworks animations for your website"
/>
<meta property="og:site_name" content="tsParticles" />
<meta property="og:url" content="https://particles.js.org/" />
<meta
property="og:description"
content="Easily create highly customizable particles, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno."
/>
<meta
property="og:image"
content="https://particles.js.org/images/demo2.png"
/>
<title>
tsParticles | Fireworks Preset | JavaScript Particles, Confetti and
Fireworks animations for your website
</title>
<link rel="stylesheet" href="fire1_files/presets.min.css" />
<style>
#carbonads * {
margin: initial;
padding: initial;
}
#carbonads {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', Helvetica, Arial,
sans-serif;
}
#carbonads {
display: flex;
max-width: 330px;
background-color: hsl(0, 0%, 98%);
box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, 0.1);
z-index: 100;
}
#carbonads a {
color: inherit;
text-decoration: none;
}
#carbonads a:hover {
color: inherit;
}
#carbonads span {
position: relative;
display: block;
overflow: hidden;
}
#carbonads .carbon-wrap {
display: flex;
}
#carbonads .carbon-img {
display: block;
margin: 0;
line-height: 1;
}
#carbonads .carbon-img img {
display: block;
}
#carbonads .carbon-text {
font-size: 13px;
padding: 10px;
margin-bottom: 16px;
line-height: 1.5;
text-align: left;
}
#carbonads .carbon-poweredby {
display: block;
padding: 6px 8px;
background: #f1f1f2;
text-align: center;
text-transform: uppercase;
letter-spacing: 0.5px;
font-weight: 600;
font-size: 8px;
line-height: 1;
border-top-left-radius: 3px;
position: absolute;
bottom: 0;
right: 0;
}
</style>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="" src="fire1_files/clarity.js"></script>
<script async="" src="fire1_files/8q4bxin4tm.js"></script>
<script async="" src="fire1_files/js"></script>
<script>
window.dataLayer = window.dataLayer || []
function gtag() {
dataLayer.push(arguments)
}
gtag('js', new Date())
gtag('config', 'G-922Z47NPS0')
</script>
<meta
http-equiv="origin-trial"
content="AymqwRC7u88Y4JPvfIF2F37QKylC04248hLCdJAsh8xgOfe/dVJPV3XS3wLFca1ZMVOtnBfVjaCMTVudWM//5g4AAAB7eyJvcmlnaW4iOiJodHRwczovL3d3dy5nb29nbGV0YWdtYW5hZ2VyLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjk1MTY3OTk5LCJpc1RoaXJkUGFydHkiOnRydWV9"
/>
</head>
<body>
<div id="tsparticles">
<canvas
data-generated="true"
style="
width: 100% !important;
height: 100% !important;
position: fixed !important;
z-index: 0 !important;
top: 0px !important;
left: 0px !important;
background-color: rgb(0, 0, 0);
pointer-events: none;
"
aria-hidden="true"
width="3840"
height="1918"
></canvas
><img
style="
user-select: none;
position: absolute;
top: 20px;
left: 2424px;
display: block;
z-index: 2;
"
src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wI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NCwwLTMsMS4zNDYtMywzdjJjMCwxLjY1NCwxLjM0NiwzLDMsM2MwLjkwNCwwLDIuMzU3LDAuNDM5LDMuMTA5LDAuOTQxbDIuNjcyLDEuNzgxYzAuNDUxLDAuMzAxLDAuOTA3LDAuNDUzLDEuMzU2LDAuNDUzQzE4LjAzNSwyMC4xNzYsMTksMTkuNDk1LDE5LDE4VjhDMTksNi41MDUsMTguMDM1LDUuODI0LDE3LjEzOCw1LjgyNHogTTE0LDE2LjE0NkMxMi45MDcsMTUuNDk1LDExLjIxMSwxNSwxMCwxNWMtMC41NTIsMC0xLTAuNDQ4LTEtMXYtMmMwLTAuNTUyLDAuNDQ4LTEsMS0xYzEuMjExLDAsMi45MDctMC40OTUsNC0xLjE0NlYxNi4xNDZ6IE0xNywxOGMwLDAuMDQ2LTAuMDAyLDAuMDg2LTAuMDA2LDAuMTJjLTAuMDMtMC4wMTYtMC4wNjUtMC4wMzYtMC4xMDQtMC4wNjJMMTUsMTYuNzk4VjkuMjAybDEuODkxLTEuMjYxYzAuMDM4LTAuMDI1LDAuMDczLTAuMDQ2LDAuMTA0LTAuMDYyQzE2Ljk5OCw3LjkxNCwxNyw3Ljk1NCwxNyw4VjE4eiIvPgogICAgPC9nPgo8L3N2Zz4="
/><img
style="
user-select: none;
position: absolute;
top: 20px;
left: 2458px;
display: block;
z-index: 2;
"
src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgYmFzZVByb2ZpbGU9InRpbnkiIGhlaWdodD0iMjRweCIgdmVyc2lvbj0iMS4yIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNHB4IgogICAgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICAgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPGcgaWQ9IkxheWVyXzEiPgogICAgICAgI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w5Yy0xLjY1NCwwLTMsMS4zNDYtMywzdjJjMCwxLjY1NCwxLjM0NiwzLDMsM2MwLjkwNCwwLDIuMzU3LDAuNDM5LDMuMTA5LDAuOTQxbDIuNjcyLDEuNzgxYzAuNDUxLDAuMzAxLDAuOTA3LDAuNDUzLDEuMzU2LDAuNDUzQzEzLjAzNSwyMC4xNzYsMTQsMTkuNDk1LDE0LDE4VjhDMTQsNi41MDUsMTMuMDM1LDUuODI0LDEyLjEzOCw1LjgyNHogTTUsMTVjLTAuNTUyLDAtMS0wLjQ0OC0xLTF2LTJjMC0wLjU1MiwwLjQ0OC0xLDEtMWMxLjIxMSwwLDIuOTA3LTAuNDk1LDQtMS4xNDZ2Ni4yOTNDNy45MDcsMTUuNDk1LDYuMjExLDE1LDUsMTV6IE0xMiwxOGMwLDAuMDQ2LTAuMDAyLDAuMDg2LTAuMDA2LDAuMTJjLTAuMDMtMC4wMTYtMC4wNjUtMC4wMzYtMC4xMDQtMC4wNjJMMTAsMTYuNzk4VjkuMjAybDEuODkxLTEuMjYxYzAuMDM4LTAuMDI1LDAuMDczLTAuMDQ2LDAuMTA0LTAuMDYyQzExLjk5OCw3LjkxNCwxMiw3Ljk1NCwxMiw4VjE4eiIvPgogICAgPC9nPgo8L3N2Zz4="
/>
</div>
<script type="text/javascript">
;(function (c, l, a, r, i, t, y) {
c[a] =
c[a] ||
function () {
;(c[a].q = c[a].q || []).push(arguments)
}
t = l.createElement(r)
t.async = 1
t.src = 'https://www.clarity.ms/tag/' + i
y = l.getElementsByTagName(r)[0]
y.parentNode.insertBefore(t, y)
})(window, document, 'clarity', 'script', '8q4bxin4tm')
</script>
<script
async=""
defer="defer"
type="text/javascript"
src="fire1_files/carbon.js"
id="_carbonads_js"
></script>
<div id="carbonads">
<span>
<span class="carbon-wrap">
<a
href="https://srv.carbonads.net/ads/click/x/GTND427JCVBDVK7LCV74YKQUC67DLKJJCYYDPZ3JCAYI6537CWSI52JKCEADEK7UCKBIT23EFTSDK5QJCAYD62JKC6SI4KJIF6BDTK3EHJNCLSIZ"
class="carbon-img"
target="_blank"
rel="noopener sponsored"
>
<img
src="fire1_files/030b1e0468f5e27497d97bbbd2e24fbfa607e581.jpg"
alt="ads via Carbon"
border="0"
height="100"
width="130"
data-no-statview="no"
style="max-width: 130px"
/>
</a>
<a
href="https://srv.carbonads.net/ads/click/x/GTND427JCVBDVK7LCV74YKQUC67DLKJJCYYDPZ3JCAYI6537CWSI52JKCEADEK7UCKBIT23EFTSDK5QJCAYD62JKC6SI4KJIF6BDTK3EHJNCLSIZ"
class="carbon-text"
target="_blank"
rel="noopener sponsored"
>
Work smarter, not harder. Effectively run workloads and builds with
Kubes.
</a>
</span>
<a
href="http://carbonads.net/?utm_source=particlesjsorg&utm_medium=ad_via_link&utm_campaign=in_unit&utm_term=carbon"
class="carbon-poweredby"
target="_blank"
rel="noopener sponsored"
>ads via Carbon</a
>
</span>
</div>
<script src="fire1_files/tsparticles.preset.fireworks.bundle.min.js"></script>
<script type="text/javascript">
;(async () => {
await tsParticles.load({
id: 'tsparticles',
options: { preset: 'fireworks' },
})
})()
</script>
</body>
</html>
React版
import { useEffect, useMemo, useState } from "react";
import Particles, { initParticlesEngine } from "@tsparticles/react";
// import { loadAll } from "@tsparticles/all"; // if you are going to use `loadAll`, install the "@tsparticles/all" package too.
// import { loadFull } from "tsparticles"; // if you are going to use `loadFull`, install the "tsparticles" package too.
// import { loadSlim } from "@tsparticles/slim"; // if you are going to use `loadSlim`, install the "@tsparticles/slim" package too.
import { loadFireworksPreset } from "@tsparticles/preset-fireworks"
// import { loadBasic } from "@tsparticles/basic"; // if you are going to use `loadBasic`, install the "@tsparticles/basic" package too.
const App = () => {
const [init, setInit] = useState(false);
// this should be run only once per application lifetime
useEffect(() => {
initParticlesEngine(async (engine) => {
// you can initiate the tsParticles instance (engine) here, adding custom shapes or presets
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
// starting from v2 you can add only the features you need reducing the bundle size
//await loadAll(engine);
//await loadFull(engine);
//await loadSlim(engine);
await loadFireworksPreset(engine)
//await loadBasic(engine);
}).then(() => {
setInit(true);
});
}, []);
const particlesLoaded = (container) => {
console.log(container);
};
const options = useMemo(
() => ({
preset: "fireworks",
// background: {
// color: {
// value: "#fff",
// },
// },
// fpsLimit: 120,
// interactivity: {
// events: {
// onClick: {
// enable: true,
// mode: "push",
// },
// onHover: {
// enable: true,
// mode: "repulse",
// },
// },
// modes: {
// push: {
// quantity: 4,
// },
// repulse: {
// distance: 200,
// duration: 0.4,
// },
// },
// },
// particles: {
// color: {
// value: "#ffffff",
// },
// links: {
// color: "#ffffff",
// distance: 150,
// enable: true,
// opacity: 0.5,
// width: 1,
// },
// move: {
// direction: "none",
// enable: true,
// outModes: {
// default: "bounce",
// },
// random: false,
// speed: 6,
// straight: false,
// },
// number: {
// density: {
// enable: true,
// },
// value: 80,
// },
// opacity: {
// value: 0.5,
// },
// shape: {
// type: "circle",
// },
// size: {
// value: { min: 1, max: 5 },
// },
// },
// detectRetina: true,
}),
[],
);
if (init) {
return (
<Particles
id="tsparticles"
particlesLoaded={particlesLoaded}
options={options}
/>
);
}
return <></>;
};
export default App
在线效果
https://particles.js.org/samples/presets/fireworks
人工智能学习网站
参考链接: