masoneffect 1.0.28 → 1.0.29

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 +31 -16
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # MasonEffect ![npm](https://img.shields.io/npm/dy/masoneffect)
2
2
 
3
- **Release version 1.0.28**
3
+ **Release version 1.0.29**
4
4
 
5
- A library that provides particle morphing effects. It can be used with React, Vue, and vanilla JavaScript.
5
+ A library that provides particle morphing effects. It can be used with React, Vue, Svelte, and vanilla JavaScript.
6
6
 
7
7
  ## Installation
8
8
 
@@ -47,7 +47,7 @@ effect.scatter();
47
47
  #### Using CDN (UMD)
48
48
 
49
49
  ```html
50
- <script src="https://cdn.jsdelivr.net/npm/masoneffect@1.0.28/dist/index.umd.min.js"></script>
50
+ <script src="https://cdn.jsdelivr.net/npm/masoneffect@1.0.29/dist/index.umd.min.js"></script>
51
51
  <script>
52
52
  const container = document.getElementById('my-container');
53
53
  const effect = new MasonEffect(container, {
@@ -192,17 +192,19 @@ const onReady = (instance) => {
192
192
  ### Svelte
193
193
 
194
194
  ```svelte
195
- <script>
195
+ <script lang="ts">
196
196
  import MasonEffect from 'masoneffect/svelte';
197
- import { createEventDispatcher } from 'svelte';
197
+ import type { MasonEffect as MasonEffectType } from 'masoneffect';
198
198
 
199
- let effectRef;
199
+ let effectRef: MasonEffect | null = null;
200
200
 
201
201
  const handleMorph = () => {
202
+ // Change text
202
203
  effectRef?.morph({ text: 'Morphed!' });
203
204
  };
204
205
 
205
206
  const handleScatter = () => {
207
+ // Return particles to initial position
206
208
  effectRef?.scatter();
207
209
  };
208
210
 
@@ -212,28 +214,41 @@ const onReady = (instance) => {
212
214
  effectRef?.morph({ text: randomText });
213
215
  };
214
216
 
215
- const onReady = (instance) => {
217
+ const handleChangeWithOptions = () => {
218
+ // Change text along with other properties
219
+ effectRef?.morph({
220
+ text: 'New Text',
221
+ particleColor: '#ff00ff',
222
+ maxParticles: 3000,
223
+ pointSize: 1.0,
224
+ });
225
+ };
226
+
227
+ const onReady = (instance: MasonEffectType) => {
216
228
  console.log('Ready!', instance);
217
229
  };
218
230
  </script>
219
231
 
220
- <div style="width: 100%; height: 70vh; background: #000">
221
- <MasonEffect
222
- bind:this={effectRef}
223
- text="Hello Svelte"
224
- particleColor="#00ff88"
225
- maxParticles={2000}
226
- on:ready={onReady}
227
- />
232
+ <div style="width: 100%; height: 70vh; background: #000; display: flex; flex-direction: column">
233
+ <div style="flex: 1; position: relative; min-height: 400px">
234
+ <MasonEffect
235
+ bind:this={effectRef}
236
+ text="Hello Svelte"
237
+ particleColor="#00ff88"
238
+ maxParticles={2000}
239
+ on:ready={onReady}
240
+ />
241
+ </div>
228
242
  <div style="padding: 20px; display: flex; gap: 10px">
229
243
  <button on:click={handleMorph}>Morph</button>
230
244
  <button on:click={handleScatter}>Scatter</button>
231
245
  <button on:click={handleChangeText}>Change Text</button>
246
+ <button on:click={handleChangeWithOptions}>Change with Options</button>
232
247
  </div>
233
248
  </div>
234
249
  ```
235
250
 
236
- **Note**: In Svelte, you can access component methods using `bind:this`. The component exposes `morph()`, `scatter()`, `updateConfig()`, and `destroy()` methods.
251
+ **Note**: In Svelte, you can access component methods using `bind:this`. The component exposes `morph()`, `scatter()`, `updateConfig()`, and `destroy()` methods. Make sure to specify an explicit size for the container.
237
252
 
238
253
  ## API
239
254
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "masoneffect",
3
- "version": "1.0.28",
4
- "description": "파티클 모핑 효과를 제공하는 라이브러리 - React, Vue, 바닐라 JS 지원",
3
+ "version": "1.0.29",
4
+ "description": "A library that provides particle morphing effects. It can be used with React, Vue, Svelte, and vanilla JavaScript.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",