@tsparticles/template-confetti 4.1.3 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +3 -0
- package/package.json +4 -3
- package/template/angular/package.json +34 -0
- package/template/angular/src/app/app.component.css +54 -0
- package/template/angular/src/app/app.component.html +11 -0
- package/template/angular/src/app/app.component.ts +44 -0
- package/template/angular/src/app/app.module.ts +13 -0
- package/template/angular-confetti/package.json +35 -0
- package/template/angular-confetti/src/app/app.component.css +47 -0
- package/template/angular-confetti/src/app/app.component.html +11 -0
- package/template/angular-confetti/src/app/app.component.ts +44 -0
- package/template/angular-fireworks/package.json +35 -0
- package/template/angular-fireworks/src/app/app.component.css +47 -0
- package/template/angular-fireworks/src/app/app.component.html +11 -0
- package/template/angular-fireworks/src/app/app.component.ts +44 -0
- package/template/astro/package.json +21 -0
- package/template/astro/src/pages/index.astro +77 -0
- package/template/ember/app/templates/application.hbs +26 -0
- package/template/ember/package.json +41 -0
- package/template/inferno/package.json +23 -0
- package/template/inferno/src/App.css +54 -0
- package/template/inferno/src/App.tsx +69 -0
- package/template/jquery/package.json +21 -0
- package/template/jquery/src/main.ts +49 -0
- package/template/jquery/src/style.css +54 -0
- package/template/lit/package.json +21 -0
- package/template/lit/src/my-app.ts +68 -0
- package/template/nextjs/package.json +24 -0
- package/template/nextjs/src/app/page.tsx +59 -0
- package/template/nuxt2/package.json +16 -0
- package/template/nuxt2/pages/index.vue +72 -0
- package/template/nuxt3/app.vue +65 -0
- package/template/nuxt3/package.json +20 -0
- package/template/nuxt4/app.vue +65 -0
- package/template/nuxt4/package.json +20 -0
- package/template/preact/package.json +22 -0
- package/template/preact/src/App.css +54 -0
- package/template/preact/src/App.tsx +62 -0
- package/template/qwik/package.json +21 -0
- package/template/qwik/src/App.tsx +61 -0
- package/template/react/package.json +19 -0
- package/template/react/src/App.css +54 -0
- package/template/react/src/App.tsx +60 -0
- package/template/riot/package.json +23 -0
- package/template/riot/src/app.riot +111 -0
- package/template/solid/package.json +18 -0
- package/template/solid/src/App.tsx +66 -0
- package/template/solid/src/index.css +54 -0
- package/template/solid/src/main.tsx +9 -0
- package/template/stencil/package.json +19 -0
- package/template/stencil/src/components/app-home/app-home.tsx +73 -0
- package/template/svelte/package.json +20 -0
- package/template/svelte/src/App.svelte +119 -0
- package/template/svelte/src/main.ts +6 -0
- package/template/vanilla/LICENSE +21 -0
- package/template/vanilla/package.json +1 -1
- package/template/vue2/package.json +23 -0
- package/template/vue2/src/App.vue +121 -0
- package/template/vue3/package.json +19 -0
- package/template/vue3/src/App.vue +110 -0
- package/template/vue3/src/main.ts +9 -0
- package/template/webcomponents/package.json +20 -0
- package/template/webcomponents/src/main.ts +48 -0
- package/template/webcomponents/src/style.css +54 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [4.2.1](https://github.com/tsparticles/tsparticles/compare/v4.2.0...v4.2.1) (2026-06-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- fixed some various issues ([8534979](https://github.com/tsparticles/tsparticles/commit/85349791a4978f80f98f141a94a403a7e15785c0))
|
|
11
|
+
|
|
12
|
+
# [4.2.0](https://github.com/tsparticles/tsparticles/compare/v4.1.3...v4.2.0) (2026-06-17)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- adding templates to cli create ([bc118ef](https://github.com/tsparticles/tsparticles/commit/bc118efa3f40497f9fa84186ac6102411a19fda7))
|
package/README.md
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/template-confetti",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"prebuild": "node scripts/prebuild.js",
|
|
10
10
|
"build": "pnpm run prebuild",
|
|
11
|
-
"build:ci": "pnpm run prebuild"
|
|
11
|
+
"build:ci": "pnpm run prebuild",
|
|
12
|
+
"version": "pnpm run build && git add template.json"
|
|
12
13
|
},
|
|
13
|
-
"gitHead": "
|
|
14
|
+
"gitHead": "e2a7699c1f4212bbda4e6933970c062e6fc000dc"
|
|
14
15
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"ng": "ng",
|
|
7
|
+
"start": "ng serve",
|
|
8
|
+
"dev": "ng serve",
|
|
9
|
+
"build": "ng build",
|
|
10
|
+
"preview": "ng serve",
|
|
11
|
+
"watch": "ng build --watch --configuration development"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@angular/animations": "~22.0.0",
|
|
15
|
+
"@angular/common": "~22.0.0",
|
|
16
|
+
"@angular/compiler": "~22.0.0",
|
|
17
|
+
"@angular/core": "~22.0.0",
|
|
18
|
+
"@angular/forms": "~22.0.0",
|
|
19
|
+
"@angular/platform-browser": "~22.0.0",
|
|
20
|
+
"@angular/platform-browser-dynamic": "~22.0.0",
|
|
21
|
+
"@angular/router": "~22.0.0",
|
|
22
|
+
"@tsparticles/angular": "^4.1.3",
|
|
23
|
+
"@tsparticles/confetti": "^3.8.1",
|
|
24
|
+
"rxjs": "~7.8.2",
|
|
25
|
+
"tslib": "^2.8.1",
|
|
26
|
+
"zone.js": "~0.16.2"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@angular-devkit/build-angular": "~22.0.0",
|
|
30
|
+
"@angular/cli": "~22.0.0",
|
|
31
|
+
"@angular/compiler-cli": "~22.0.0",
|
|
32
|
+
"typescript": "~6.0.3"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
body {
|
|
2
|
+
margin: 0;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
background: #1a1a2e;
|
|
5
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#app {
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 50%;
|
|
11
|
+
left: 50%;
|
|
12
|
+
transform: translate(-50%, -50%);
|
|
13
|
+
z-index: 10;
|
|
14
|
+
text-align: center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
h1 {
|
|
18
|
+
font-size: 3.2em;
|
|
19
|
+
color: #fff;
|
|
20
|
+
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.controls {
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: 1rem;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: center;
|
|
28
|
+
margin-top: 2rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
button {
|
|
32
|
+
padding: 0.8em 2em;
|
|
33
|
+
font-size: 1.1em;
|
|
34
|
+
border: none;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
background: #e94560;
|
|
37
|
+
color: #fff;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
transition: background 0.2s;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
button:hover {
|
|
43
|
+
background: #ff6b81;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
select {
|
|
47
|
+
padding: 0.8em 1em;
|
|
48
|
+
font-size: 1em;
|
|
49
|
+
border-radius: 8px;
|
|
50
|
+
border: 1px solid #444;
|
|
51
|
+
background: #16213e;
|
|
52
|
+
color: #fff;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div id="app">
|
|
2
|
+
<h1>Confetti!</h1>
|
|
3
|
+
<div class="controls">
|
|
4
|
+
<button (click)="fireConfetti()">Fire Confetti</button>
|
|
5
|
+
<select [(ngModel)]="mode">
|
|
6
|
+
<option value="cannon">Cannon</option>
|
|
7
|
+
<option value="waterfall">Waterfall</option>
|
|
8
|
+
<option value="random">Random</option>
|
|
9
|
+
</select>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { confetti } from "@tsparticles/confetti";
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: "app-root",
|
|
6
|
+
templateUrl: "./app.component.html",
|
|
7
|
+
styleUrls: ["./app.component.css"],
|
|
8
|
+
})
|
|
9
|
+
export class AppComponent {
|
|
10
|
+
mode = "cannon";
|
|
11
|
+
|
|
12
|
+
randomInRange(min: number, max: number): number {
|
|
13
|
+
return Math.random() * (max - min) + min;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
fireConfetti(): void {
|
|
17
|
+
switch (this.mode) {
|
|
18
|
+
case "cannon":
|
|
19
|
+
confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } });
|
|
20
|
+
break;
|
|
21
|
+
case "waterfall": {
|
|
22
|
+
const duration = 3000;
|
|
23
|
+
const end = Date.now() + duration;
|
|
24
|
+
const interval = setInterval(() => {
|
|
25
|
+
if (Date.now() > end) {
|
|
26
|
+
clearInterval(interval);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
confetti({ particleCount: 10, angle: 60, spread: 55, origin: { x: 0, y: 0.6 } });
|
|
30
|
+
confetti({ particleCount: 10, angle: 120, spread: 55, origin: { x: 1, y: 0.6 } });
|
|
31
|
+
}, 100);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "random":
|
|
35
|
+
confetti({
|
|
36
|
+
angle: this.randomInRange(55, 125),
|
|
37
|
+
spread: this.randomInRange(50, 70),
|
|
38
|
+
particleCount: this.randomInRange(50, 100),
|
|
39
|
+
origin: { y: 0.6 },
|
|
40
|
+
});
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NgModule } from "@angular/core";
|
|
2
|
+
import { BrowserModule } from "@angular/platform-browser";
|
|
3
|
+
import { FormsModule } from "@angular/forms";
|
|
4
|
+
import { NgxParticlesModule } from "@tsparticles/angular";
|
|
5
|
+
import { AppComponent } from "./app.component";
|
|
6
|
+
|
|
7
|
+
@NgModule({
|
|
8
|
+
declarations: [AppComponent],
|
|
9
|
+
imports: [BrowserModule, FormsModule, NgxParticlesModule],
|
|
10
|
+
providers: [],
|
|
11
|
+
bootstrap: [AppComponent],
|
|
12
|
+
})
|
|
13
|
+
export class AppModule {}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"ng": "ng",
|
|
7
|
+
"start": "ng serve",
|
|
8
|
+
"dev": "ng serve",
|
|
9
|
+
"build": "ng build",
|
|
10
|
+
"preview": "ng serve",
|
|
11
|
+
"watch": "ng build --watch --configuration development"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@angular/animations": "~22.0.0",
|
|
15
|
+
"@angular/common": "~22.0.0",
|
|
16
|
+
"@angular/compiler": "~22.0.0",
|
|
17
|
+
"@angular/core": "~22.0.0",
|
|
18
|
+
"@angular/forms": "~22.0.0",
|
|
19
|
+
"@angular/platform-browser": "~22.0.0",
|
|
20
|
+
"@angular/platform-browser-dynamic": "~22.0.0",
|
|
21
|
+
"@angular/router": "~22.0.0",
|
|
22
|
+
"angular-confetti": "^4.1.3",
|
|
23
|
+
"@tsparticles/confetti": "^4.1.3",
|
|
24
|
+
"@tsparticles/engine": "^4.1.3",
|
|
25
|
+
"rxjs": "~7.8.2",
|
|
26
|
+
"tslib": "^2.8.1",
|
|
27
|
+
"zone.js": "~0.16.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@angular-devkit/build-angular": "~22.0.0",
|
|
31
|
+
"@angular/cli": "~22.0.0",
|
|
32
|
+
"@angular/compiler-cli": "~22.0.0",
|
|
33
|
+
"typescript": "~6.0.3"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#app {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 50%;
|
|
4
|
+
left: 50%;
|
|
5
|
+
transform: translate(-50%, -50%);
|
|
6
|
+
z-index: 10;
|
|
7
|
+
text-align: center;
|
|
8
|
+
color: #fff;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
h1 {
|
|
12
|
+
font-size: 3.2em;
|
|
13
|
+
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.controls {
|
|
17
|
+
display: flex;
|
|
18
|
+
gap: 1rem;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
margin-top: 2rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
button {
|
|
25
|
+
padding: 0.8em 2em;
|
|
26
|
+
font-size: 1.1em;
|
|
27
|
+
border: none;
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
background: #e94560;
|
|
30
|
+
color: #fff;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
transition: background 0.2s;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
button:hover {
|
|
36
|
+
background: #ff6b81;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
select {
|
|
40
|
+
padding: 0.8em 1em;
|
|
41
|
+
font-size: 1em;
|
|
42
|
+
border-radius: 8px;
|
|
43
|
+
border: 1px solid #444;
|
|
44
|
+
background: #16213e;
|
|
45
|
+
color: #fff;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div id="app">
|
|
2
|
+
<h1>Confetti!</h1>
|
|
3
|
+
<div class="controls">
|
|
4
|
+
<button (click)="fireConfetti()">Fire Confetti</button>
|
|
5
|
+
<select [(ngModel)]="mode">
|
|
6
|
+
<option value="cannon">Cannon</option>
|
|
7
|
+
<option value="waterfall">Waterfall</option>
|
|
8
|
+
<option value="random">Random</option>
|
|
9
|
+
</select>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { confetti } from "@tsparticles/confetti";
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: "app-root",
|
|
6
|
+
templateUrl: "./app.component.html",
|
|
7
|
+
styleUrls: ["./app.component.css"],
|
|
8
|
+
})
|
|
9
|
+
export class AppComponent {
|
|
10
|
+
mode = "cannon";
|
|
11
|
+
|
|
12
|
+
randomInRange(min: number, max: number): number {
|
|
13
|
+
return Math.random() * (max - min) + min;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
fireConfetti(): void {
|
|
17
|
+
switch (this.mode) {
|
|
18
|
+
case "cannon":
|
|
19
|
+
confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } });
|
|
20
|
+
break;
|
|
21
|
+
case "waterfall": {
|
|
22
|
+
const duration = 3000;
|
|
23
|
+
const end = Date.now() + duration;
|
|
24
|
+
const interval = setInterval(() => {
|
|
25
|
+
if (Date.now() > end) {
|
|
26
|
+
clearInterval(interval);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
confetti({ particleCount: 10, angle: 60, spread: 55, origin: { x: 0, y: 0.6 } });
|
|
30
|
+
confetti({ particleCount: 10, angle: 120, spread: 55, origin: { x: 1, y: 0.6 } });
|
|
31
|
+
}, 100);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "random":
|
|
35
|
+
confetti({
|
|
36
|
+
angle: this.randomInRange(55, 125),
|
|
37
|
+
spread: this.randomInRange(50, 70),
|
|
38
|
+
particleCount: this.randomInRange(50, 100),
|
|
39
|
+
origin: { y: 0.6 },
|
|
40
|
+
});
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"ng": "ng",
|
|
7
|
+
"start": "ng serve",
|
|
8
|
+
"dev": "ng serve",
|
|
9
|
+
"build": "ng build",
|
|
10
|
+
"preview": "ng serve",
|
|
11
|
+
"watch": "ng build --watch --configuration development"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@angular/animations": "~22.0.0",
|
|
15
|
+
"@angular/common": "~22.0.0",
|
|
16
|
+
"@angular/compiler": "~22.0.0",
|
|
17
|
+
"@angular/core": "~22.0.0",
|
|
18
|
+
"@angular/forms": "~22.0.0",
|
|
19
|
+
"@angular/platform-browser": "~22.0.0",
|
|
20
|
+
"@angular/platform-browser-dynamic": "~22.0.0",
|
|
21
|
+
"@angular/router": "~22.0.0",
|
|
22
|
+
"angular-fireworks": "^4.1.3",
|
|
23
|
+
"@tsparticles/confetti": "^4.1.3",
|
|
24
|
+
"@tsparticles/engine": "^4.1.3",
|
|
25
|
+
"rxjs": "~7.8.2",
|
|
26
|
+
"tslib": "^2.8.1",
|
|
27
|
+
"zone.js": "~0.16.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@angular-devkit/build-angular": "~22.0.0",
|
|
31
|
+
"@angular/cli": "~22.0.0",
|
|
32
|
+
"@angular/compiler-cli": "~22.0.0",
|
|
33
|
+
"typescript": "~6.0.3"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#app {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 50%;
|
|
4
|
+
left: 50%;
|
|
5
|
+
transform: translate(-50%, -50%);
|
|
6
|
+
z-index: 10;
|
|
7
|
+
text-align: center;
|
|
8
|
+
color: #fff;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
h1 {
|
|
12
|
+
font-size: 3.2em;
|
|
13
|
+
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.controls {
|
|
17
|
+
display: flex;
|
|
18
|
+
gap: 1rem;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
margin-top: 2rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
button {
|
|
25
|
+
padding: 0.8em 2em;
|
|
26
|
+
font-size: 1.1em;
|
|
27
|
+
border: none;
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
background: #e94560;
|
|
30
|
+
color: #fff;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
transition: background 0.2s;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
button:hover {
|
|
36
|
+
background: #ff6b81;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
select {
|
|
40
|
+
padding: 0.8em 1em;
|
|
41
|
+
font-size: 1em;
|
|
42
|
+
border-radius: 8px;
|
|
43
|
+
border: 1px solid #444;
|
|
44
|
+
background: #16213e;
|
|
45
|
+
color: #fff;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div id="app">
|
|
2
|
+
<h1>Confetti!</h1>
|
|
3
|
+
<div class="controls">
|
|
4
|
+
<button (click)="fireConfetti()">Fire Confetti</button>
|
|
5
|
+
<select [(ngModel)]="mode">
|
|
6
|
+
<option value="cannon">Cannon</option>
|
|
7
|
+
<option value="waterfall">Waterfall</option>
|
|
8
|
+
<option value="random">Random</option>
|
|
9
|
+
</select>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { confetti } from "@tsparticles/confetti";
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: "app-root",
|
|
6
|
+
templateUrl: "./app.component.html",
|
|
7
|
+
styleUrls: ["./app.component.css"],
|
|
8
|
+
})
|
|
9
|
+
export class AppComponent {
|
|
10
|
+
mode = "cannon";
|
|
11
|
+
|
|
12
|
+
randomInRange(min: number, max: number): number {
|
|
13
|
+
return Math.random() * (max - min) + min;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
fireConfetti(): void {
|
|
17
|
+
switch (this.mode) {
|
|
18
|
+
case "cannon":
|
|
19
|
+
confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } });
|
|
20
|
+
break;
|
|
21
|
+
case "waterfall": {
|
|
22
|
+
const duration = 3000;
|
|
23
|
+
const end = Date.now() + duration;
|
|
24
|
+
const interval = setInterval(() => {
|
|
25
|
+
if (Date.now() > end) {
|
|
26
|
+
clearInterval(interval);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
confetti({ particleCount: 10, angle: 60, spread: 55, origin: { x: 0, y: 0.6 } });
|
|
30
|
+
confetti({ particleCount: 10, angle: 120, spread: 55, origin: { x: 1, y: 0.6 } });
|
|
31
|
+
}, 100);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "random":
|
|
35
|
+
confetti({
|
|
36
|
+
angle: this.randomInRange(55, 125),
|
|
37
|
+
spread: this.randomInRange(50, 70),
|
|
38
|
+
particleCount: this.randomInRange(50, 100),
|
|
39
|
+
origin: { y: 0.6 },
|
|
40
|
+
});
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "astro dev",
|
|
8
|
+
"build": "astro build",
|
|
9
|
+
"preview": "astro preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@astrojs/check": "^0.9.4",
|
|
13
|
+
"astro": "^5.7.10",
|
|
14
|
+
"@tsparticles/astro": "^4.1.3",
|
|
15
|
+
"@tsparticles/confetti": "^4.1.3",
|
|
16
|
+
"@tsparticles/engine": "^4.1.3"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^6.0.3"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Particles, { initParticlesEngine } from "@tsparticles/astro";
|
|
3
|
+
|
|
4
|
+
const id = "tsparticles";
|
|
5
|
+
---
|
|
6
|
+
<html lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<meta charset="utf-8" />
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10
|
+
<title>{{projectName}}</title>
|
|
11
|
+
<style>
|
|
12
|
+
body { margin: 0; overflow: hidden; background: #1a1a2e; font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; }
|
|
13
|
+
#app { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; text-align: center; }
|
|
14
|
+
h1 { font-size: 3.2em; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
|
|
15
|
+
.controls { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 2rem; }
|
|
16
|
+
button { padding: 0.8em 2em; font-size: 1.1em; border: none; border-radius: 8px; background: #e94560; color: #fff; cursor: pointer; transition: background 0.2s; }
|
|
17
|
+
button:hover { background: #ff6b81; }
|
|
18
|
+
select { padding: 0.8em 1em; font-size: 1em; border-radius: 8px; border: 1px solid #444; background: #16213e; color: #fff; cursor: pointer; }
|
|
19
|
+
</style>
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
<div id="app">
|
|
23
|
+
<h1>Confetti!</h1>
|
|
24
|
+
<div class="controls">
|
|
25
|
+
<button id="fireBtn">Fire Confetti</button>
|
|
26
|
+
<select id="modeSelect">
|
|
27
|
+
<option value="cannon">Cannon</option>
|
|
28
|
+
<option value="waterfall">Waterfall</option>
|
|
29
|
+
<option value="random">Random</option>
|
|
30
|
+
</select>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<Particles client:load id={id} options={{}} />
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import { confetti } from "@tsparticles/confetti";
|
|
39
|
+
|
|
40
|
+
function randomInRange(min: number, max: number): number {
|
|
41
|
+
return Math.random() * (max - min) + min;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const fireBtn = document.getElementById("fireBtn") as HTMLButtonElement;
|
|
45
|
+
const modeSelect = document.getElementById("modeSelect") as HTMLSelectElement;
|
|
46
|
+
|
|
47
|
+
fireBtn.addEventListener("click", () => {
|
|
48
|
+
const mode = modeSelect.value;
|
|
49
|
+
|
|
50
|
+
switch (mode) {
|
|
51
|
+
case "cannon":
|
|
52
|
+
confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } });
|
|
53
|
+
break;
|
|
54
|
+
case "waterfall": {
|
|
55
|
+
const duration = 3000;
|
|
56
|
+
const end = Date.now() + duration;
|
|
57
|
+
const interval = setInterval(() => {
|
|
58
|
+
if (Date.now() > end) {
|
|
59
|
+
clearInterval(interval);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
confetti({ particleCount: 10, angle: 60, spread: 55, origin: { x: 0, y: 0.6 } });
|
|
63
|
+
confetti({ particleCount: 10, angle: 120, spread: 55, origin: { x: 1, y: 0.6 } });
|
|
64
|
+
}, 100);
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
case "random":
|
|
68
|
+
confetti({
|
|
69
|
+
angle: randomInRange(55, 125),
|
|
70
|
+
spread: randomInRange(50, 70),
|
|
71
|
+
particleCount: randomInRange(50, 100),
|
|
72
|
+
origin: { y: 0.6 },
|
|
73
|
+
});
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<div id="particles-container" {{did-insert this.initParticles}} {{particles options=this.options}}>
|
|
2
|
+
</div>
|
|
3
|
+
|
|
4
|
+
<div id="app">
|
|
5
|
+
<h1>Confetti!</h1>
|
|
6
|
+
<div class="controls">
|
|
7
|
+
<button {{on "click" this.fireConfetti}}>Fire Confetti</button>
|
|
8
|
+
<select {{on "change" this.setMode}}>
|
|
9
|
+
<option value="cannon">Cannon</option>
|
|
10
|
+
<option value="waterfall">Waterfall</option>
|
|
11
|
+
<option value="random">Random</option>
|
|
12
|
+
</select>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
{{outlet}}
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
body { margin: 0; overflow: hidden; background: #1a1a2e; font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; }
|
|
20
|
+
#app { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; text-align: center; color: #fff; }
|
|
21
|
+
h1 { font-size: 3.2em; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
|
|
22
|
+
.controls { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 2rem; }
|
|
23
|
+
button { padding: 0.8em 2em; font-size: 1.1em; border: none; border-radius: 8px; background: #e94560; color: #fff; cursor: pointer; transition: background 0.2s; }
|
|
24
|
+
button:hover { background: #ff6b81; }
|
|
25
|
+
select { padding: 0.8em 1em; font-size: 1em; border-radius: 8px; border: 1px solid #444; background: #16213e; color: #fff; cursor: pointer; }
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "ember serve",
|
|
7
|
+
"build": "ember build",
|
|
8
|
+
"preview": "ember serve"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@ember/optional-features": "^3.0.0",
|
|
12
|
+
"@glimmer/component": "^2.1.1",
|
|
13
|
+
"@glimmer/tracking": "^1.1.2",
|
|
14
|
+
"broccoli-asset-rev": "^3.0.0",
|
|
15
|
+
"ember-auto-import": "^2.13.1",
|
|
16
|
+
"ember-cli": "~6.12.0",
|
|
17
|
+
"ember-cli-babel": "^8.3.1",
|
|
18
|
+
"ember-cli-htmlbars": "^7.0.1",
|
|
19
|
+
"ember-cli-inject-live-reload": "^2.1.0",
|
|
20
|
+
"ember-cli-sri": "^2.1.1",
|
|
21
|
+
"ember-cli-terser": "^4.0.2",
|
|
22
|
+
"ember-load-initializers": "^3.0.1",
|
|
23
|
+
"ember-modifier": "^4.3.0",
|
|
24
|
+
"ember-resolver": "^13.2.0",
|
|
25
|
+
"ember-source": "~6.12.0",
|
|
26
|
+
"loader.js": "^4.7.0",
|
|
27
|
+
"typescript": "^6.0.3",
|
|
28
|
+
"webpack": "^5.106.1"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@tsparticles/ember": "^4.1.3",
|
|
32
|
+
"@tsparticles/confetti": "^4.1.3",
|
|
33
|
+
"@tsparticles/engine": "^4.1.3"
|
|
34
|
+
},
|
|
35
|
+
"ember": {
|
|
36
|
+
"edition": "octane"
|
|
37
|
+
},
|
|
38
|
+
"ember-addon": {
|
|
39
|
+
"configPath": "tests/dummy/config"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc && vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"inferno": "^9.1.0",
|
|
13
|
+
"@tsparticles/inferno": "^4.1.3",
|
|
14
|
+
"@tsparticles/confetti": "^4.1.3",
|
|
15
|
+
"@tsparticles/engine": "^4.1.3"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^6.0.3",
|
|
19
|
+
"vite": "^8.0.14",
|
|
20
|
+
"babel-plugin-inferno": "^6.8.5",
|
|
21
|
+
"vite-plugin-inferno": "^2.0.1"
|
|
22
|
+
}
|
|
23
|
+
}
|