@erikwatson/snowfall 4.1.3 → 4.1.4

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.
Files changed (2) hide show
  1. package/README.md +36 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -36,10 +36,10 @@ It's recommended that you make it full screen and attach it to the background, s
36
36
  </style>
37
37
  ```
38
38
 
39
- Then, at the bottom of your page body add the following, this will run snowfall with the default settings.
39
+ If you're using a CDN, add the following
40
40
 
41
41
  ```html
42
- <script src="https://cdn.jsdelivr.net/npm/@erikwatson/snowfall@4/dist/index.min.js"></script>
42
+ <script src="https://cdn.jsdelivr.net/npm/@erikwatson/snowfall@4.1/dist/index.min.js"></script>
43
43
  <script>
44
44
  snowfall.start({
45
45
  layers: [{}]
@@ -47,36 +47,63 @@ Then, at the bottom of your page body add the following, this will run snowfall
47
47
  </script>
48
48
  ```
49
49
 
50
+ Otherwise, install it with your favourite package manager and include it in your projects build step.
51
+
52
+ ```sh
53
+ npm install @erikwatson/snowfall
54
+ ```
55
+
56
+ ```ts
57
+ import snowfall from '@erikwatson/snowfall'
58
+
59
+ snowfall.start({
60
+ layers: [{}]
61
+ })
62
+ ```
63
+
50
64
  ### Custom configs
51
65
 
52
66
  Same as above but we pass a config object. Your config overrides the default settings.
53
67
 
54
- ```js
55
- snowfall.start({
68
+ If you're using TypeScript, import the UserConfig type too.
69
+
70
+ ```ts
71
+ import snowfall, { UserConfig } from '@erikwatson/snowfall'
72
+
73
+ const config: UserConfig = {
56
74
  layers: [
57
75
  {
58
76
  colour: '#8d90b7'
59
77
  }
60
78
  ]
61
- })
79
+ }
80
+
81
+ snowfall.start(config)
62
82
  ```
63
83
 
64
84
  ### Scheduling
65
85
 
66
86
  Same as the above, but we pass a schedule config and the optional snowfall config to the `.schedule(user_schedule, user_config)` function.
67
87
 
68
- ```js
69
- const userSchedule = {
88
+ If you're using TypeScript, import the UserSchedule type too.
89
+
90
+ ```ts
91
+ import snowfall, { UserSchedule } from '@erikwatson/snowfall'
92
+
93
+ const userSchedule: UserSchedule = {
70
94
  from: { month: 12, day: 1 },
71
95
  to: { month: 12, day: 31 }
72
96
  }
73
- snowfall.schedule(userSchedule, {
97
+
98
+ const config: UserConfig = {
74
99
  layers: [
75
100
  {
76
101
  colour: '#8d90b7'
77
102
  }
78
103
  ]
79
- })
104
+ }
105
+
106
+ snowfall.schedule(userSchedule, config)
80
107
  ```
81
108
 
82
109
  ### CDN Links
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erikwatson/snowfall",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "description": "A beautiful and highly configurable snow effect for your winter themed project",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",