masoneffect 0.1.10 → 0.1.11
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/README.md +56 -56
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# MasonEffect
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A library that provides particle morphing effects. It can be used with React, Vue, and vanilla JavaScript.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install masoneffect
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Usage
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Vanilla JavaScript
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
16
|
import { MasonEffect } from 'masoneffect';
|
|
@@ -22,17 +22,17 @@ const effect = new MasonEffect(container, {
|
|
|
22
22
|
maxParticles: 2000,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
//
|
|
25
|
+
// Change text
|
|
26
26
|
effect.morph('New Text');
|
|
27
27
|
|
|
28
|
-
//
|
|
28
|
+
// Change text along with other properties
|
|
29
29
|
effect.morph({
|
|
30
30
|
text: 'New Text',
|
|
31
31
|
particleColor: '#ff00ff',
|
|
32
32
|
maxParticles: 3000,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// Return particles to initial position
|
|
36
36
|
effect.scatter();
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -78,7 +78,7 @@ function App() {
|
|
|
78
78
|
}
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
**⚠️
|
|
81
|
+
**⚠️ Note**: When using the React component, you must specify an explicit size for the container. For more details, see the [React Troubleshooting Guide](./REACT_TROUBLESHOOTING.md).
|
|
82
82
|
|
|
83
83
|
### Vue 3
|
|
84
84
|
|
|
@@ -128,37 +128,37 @@ const onReady = (instance) => {
|
|
|
128
128
|
|
|
129
129
|
## API
|
|
130
130
|
|
|
131
|
-
###
|
|
132
|
-
|
|
133
|
-
|
|
|
134
|
-
|
|
135
|
-
| `text` | `string` | `'mason effect'` |
|
|
136
|
-
| `densityStep` | `number` | `2` |
|
|
137
|
-
| `maxParticles` | `number` | `3200` |
|
|
138
|
-
| `pointSize` | `number` | `0.5` |
|
|
139
|
-
| `ease` | `number` | `0.05` |
|
|
140
|
-
| `repelRadius` | `number` | `150` |
|
|
141
|
-
| `repelStrength` | `number` | `1` |
|
|
142
|
-
| `particleColor` | `string` | `'#fff'` |
|
|
143
|
-
| `fontFamily` | `string` | `'Inter, system-ui, Arial'` |
|
|
144
|
-
| `fontSize` | `number \| null` | `null` |
|
|
145
|
-
| `width` | `number \| null` | `null` |
|
|
146
|
-
| `height` | `number \| null` | `null` |
|
|
147
|
-
| `devicePixelRatio` | `number \| null` | `null` |
|
|
148
|
-
| `onReady` | `function` | `null` |
|
|
149
|
-
| `onUpdate` | `function` | `null` |
|
|
150
|
-
|
|
151
|
-
###
|
|
131
|
+
### Options
|
|
132
|
+
|
|
133
|
+
| Option | Type | Default | Description |
|
|
134
|
+
|--------|------|---------|-------------|
|
|
135
|
+
| `text` | `string` | `'mason effect'` | Text to display |
|
|
136
|
+
| `densityStep` | `number` | `2` | Particle sampling density (smaller = denser) |
|
|
137
|
+
| `maxParticles` | `number` | `3200` | Maximum number of particles |
|
|
138
|
+
| `pointSize` | `number` | `0.5` | Particle point size |
|
|
139
|
+
| `ease` | `number` | `0.05` | Movement acceleration |
|
|
140
|
+
| `repelRadius` | `number` | `150` | Mouse repel radius |
|
|
141
|
+
| `repelStrength` | `number` | `1` | Mouse repel strength |
|
|
142
|
+
| `particleColor` | `string` | `'#fff'` | Particle color |
|
|
143
|
+
| `fontFamily` | `string` | `'Inter, system-ui, Arial'` | Font family |
|
|
144
|
+
| `fontSize` | `number \| null` | `null` | Font size (auto if null) |
|
|
145
|
+
| `width` | `number \| null` | `null` | Canvas width (container size if null) |
|
|
146
|
+
| `height` | `number \| null` | `null` | Canvas height (container size if null) |
|
|
147
|
+
| `devicePixelRatio` | `number \| null` | `null` | Device pixel ratio (auto if null) |
|
|
148
|
+
| `onReady` | `function` | `null` | Initialization complete callback |
|
|
149
|
+
| `onUpdate` | `function` | `null` | Update callback |
|
|
150
|
+
|
|
151
|
+
### Methods
|
|
152
152
|
|
|
153
153
|
#### `morph(textOrOptions?: string | Partial<MasonEffectOptions>)`
|
|
154
|
-
|
|
154
|
+
Morphs particles into text form.
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
**Using string:**
|
|
157
157
|
```javascript
|
|
158
158
|
effect.morph('New Text');
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
**Using object (change text along with other properties):**
|
|
162
162
|
```javascript
|
|
163
163
|
effect.morph({
|
|
164
164
|
text: 'New Text',
|
|
@@ -170,51 +170,51 @@ effect.morph({
|
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
#### `scatter()`
|
|
173
|
-
|
|
173
|
+
Returns particles to their initial position. Each particle returns to the position where it was first created.
|
|
174
174
|
|
|
175
175
|
#### `updateConfig(config: Partial<MasonEffectOptions>)`
|
|
176
|
-
|
|
176
|
+
Updates the configuration.
|
|
177
177
|
|
|
178
178
|
#### `destroy()`
|
|
179
|
-
|
|
179
|
+
Destroys the instance and cleans up resources.
|
|
180
180
|
|
|
181
|
-
##
|
|
181
|
+
## Features
|
|
182
182
|
|
|
183
|
-
- 🎨
|
|
184
|
-
- 🖱️
|
|
185
|
-
- 📱
|
|
186
|
-
- ⚡
|
|
187
|
-
- 🔧 React, Vue,
|
|
188
|
-
- 🎯 TypeScript
|
|
189
|
-
- 💾
|
|
190
|
-
- 🔄
|
|
183
|
+
- 🎨 Morphing effect that converts text into particles
|
|
184
|
+
- 🖱️ Mouse interaction support (repel/attract)
|
|
185
|
+
- 📱 Responsive design
|
|
186
|
+
- ⚡ High-performance Canvas rendering
|
|
187
|
+
- 🔧 Supports React, Vue, and vanilla JS
|
|
188
|
+
- 🎯 Includes TypeScript type definitions
|
|
189
|
+
- 💾 Automatic obfuscation and optimization in production builds
|
|
190
|
+
- 🔄 Scatter effect that returns to initial position
|
|
191
191
|
|
|
192
|
-
##
|
|
192
|
+
## Development
|
|
193
193
|
|
|
194
194
|
```bash
|
|
195
|
-
#
|
|
195
|
+
# Install dependencies
|
|
196
196
|
npm install
|
|
197
197
|
|
|
198
|
-
#
|
|
198
|
+
# Development mode (watch)
|
|
199
199
|
npm run dev
|
|
200
200
|
|
|
201
|
-
#
|
|
201
|
+
# Build (generate production min files)
|
|
202
202
|
npm run build
|
|
203
203
|
|
|
204
|
-
#
|
|
204
|
+
# Example test server
|
|
205
205
|
npm run serve
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
##
|
|
208
|
+
## Build Output
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
Running the build will generate the following files:
|
|
211
211
|
|
|
212
|
-
-
|
|
213
|
-
-
|
|
214
|
-
- **React
|
|
212
|
+
- **Development**: `dist/index.js`, `dist/index.esm.js` (with source maps)
|
|
213
|
+
- **Production**: `dist/index.min.js`, `dist/index.esm.min.js` (obfuscated and optimized)
|
|
214
|
+
- **React component**: `dist/react/MasonEffect.min.js` (obfuscated)
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
When installed via npm, min files are automatically used. For more details, see the [Build Guide](./BUILD.md).
|
|
217
217
|
|
|
218
|
-
##
|
|
218
|
+
## License
|
|
219
219
|
|
|
220
220
|
MIT
|