@splatrac/vue-snowfall 1.1.2 → 1.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splatrac/vue-snowfall",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "A Vue 3 composable for creating snowfall effects",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -4,8 +4,9 @@ export function useSnowfall() {
4
4
  const DEFAULT_OPTIONS = {
5
5
  // Ranges for the random generators (same as the previous defaults)
6
6
  timeRange: { min: 20, max: 29 }, // seconds the flake falls
7
- posRange: { min: 4, max: 93 }, // % across the viewport
8
- sizeRange: { min: 10, max: 109 } // scale factor
7
+ posRange: { min: 0, max: window.innerWidth }, // % across the viewport
8
+ sizeRange: { min: 10, max: 109 }, // scale factor
9
+ maxFlakes: 100,
9
10
  };
10
11
 
11
12
  const addStyles = () => {
@@ -19,6 +20,7 @@ export function useSnowfall() {
19
20
  width: 30px;
20
21
  height: 30px;
21
22
  pointer-events: none;
23
+ animation-fill-mode: forwards;
22
24
  }
23
25
  @keyframes falling {
24
26
  0% { transform: translateX(0) translateY(0) rotate(0deg); opacity: 1; }
@@ -100,8 +102,11 @@ export function useSnowfall() {
100
102
  if (flakeIntervalId) clearInterval(flakeIntervalId)
101
103
 
102
104
  flakeIntervalId = setInterval(() => {
103
- createSnowflake(finalOptions)
104
- removeSnowflakes()
105
+ if (currentFlakeCount() < maxFlakes) {
106
+ createSnowflake(finalOptions)
107
+ } else {
108
+ removeSnowflakes()
109
+ }
105
110
  }, interval)
106
111
  }
107
112