masoneffect 0.1.9 → 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 +65 -56
- package/package.json +2 -2
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
|
|
|
@@ -93,6 +93,7 @@ function App() {
|
|
|
93
93
|
@ready="onReady"
|
|
94
94
|
/>
|
|
95
95
|
<button @click="handleMorph">Morph</button>
|
|
96
|
+
<button @click="handleMorphWithOptions">Morph with Options</button>
|
|
96
97
|
<button @click="handleScatter">Scatter</button>
|
|
97
98
|
</div>
|
|
98
99
|
</template>
|
|
@@ -107,6 +108,14 @@ const handleMorph = () => {
|
|
|
107
108
|
effectRef.value?.morph('New Text');
|
|
108
109
|
};
|
|
109
110
|
|
|
111
|
+
const handleMorphWithOptions = () => {
|
|
112
|
+
effectRef.value?.morph({
|
|
113
|
+
text: 'Hello',
|
|
114
|
+
particleColor: '#ff00ff',
|
|
115
|
+
maxParticles: 3000,
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
|
|
110
119
|
const handleScatter = () => {
|
|
111
120
|
effectRef.value?.scatter();
|
|
112
121
|
};
|
|
@@ -119,37 +128,37 @@ const onReady = (instance) => {
|
|
|
119
128
|
|
|
120
129
|
## API
|
|
121
130
|
|
|
122
|
-
###
|
|
123
|
-
|
|
124
|
-
|
|
|
125
|
-
|
|
126
|
-
| `text` | `string` | `'mason effect'` |
|
|
127
|
-
| `densityStep` | `number` | `2` |
|
|
128
|
-
| `maxParticles` | `number` | `3200` |
|
|
129
|
-
| `pointSize` | `number` | `0.5` |
|
|
130
|
-
| `ease` | `number` | `0.05` |
|
|
131
|
-
| `repelRadius` | `number` | `150` |
|
|
132
|
-
| `repelStrength` | `number` | `1` |
|
|
133
|
-
| `particleColor` | `string` | `'#fff'` |
|
|
134
|
-
| `fontFamily` | `string` | `'Inter, system-ui, Arial'` |
|
|
135
|
-
| `fontSize` | `number \| null` | `null` |
|
|
136
|
-
| `width` | `number \| null` | `null` |
|
|
137
|
-
| `height` | `number \| null` | `null` |
|
|
138
|
-
| `devicePixelRatio` | `number \| null` | `null` |
|
|
139
|
-
| `onReady` | `function` | `null` |
|
|
140
|
-
| `onUpdate` | `function` | `null` |
|
|
141
|
-
|
|
142
|
-
###
|
|
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
|
|
143
152
|
|
|
144
153
|
#### `morph(textOrOptions?: string | Partial<MasonEffectOptions>)`
|
|
145
|
-
|
|
154
|
+
Morphs particles into text form.
|
|
146
155
|
|
|
147
|
-
|
|
156
|
+
**Using string:**
|
|
148
157
|
```javascript
|
|
149
158
|
effect.morph('New Text');
|
|
150
159
|
```
|
|
151
160
|
|
|
152
|
-
|
|
161
|
+
**Using object (change text along with other properties):**
|
|
153
162
|
```javascript
|
|
154
163
|
effect.morph({
|
|
155
164
|
text: 'New Text',
|
|
@@ -161,51 +170,51 @@ effect.morph({
|
|
|
161
170
|
```
|
|
162
171
|
|
|
163
172
|
#### `scatter()`
|
|
164
|
-
|
|
173
|
+
Returns particles to their initial position. Each particle returns to the position where it was first created.
|
|
165
174
|
|
|
166
175
|
#### `updateConfig(config: Partial<MasonEffectOptions>)`
|
|
167
|
-
|
|
176
|
+
Updates the configuration.
|
|
168
177
|
|
|
169
178
|
#### `destroy()`
|
|
170
|
-
|
|
179
|
+
Destroys the instance and cleans up resources.
|
|
171
180
|
|
|
172
|
-
##
|
|
181
|
+
## Features
|
|
173
182
|
|
|
174
|
-
- 🎨
|
|
175
|
-
- 🖱️
|
|
176
|
-
- 📱
|
|
177
|
-
- ⚡
|
|
178
|
-
- 🔧 React, Vue,
|
|
179
|
-
- 🎯 TypeScript
|
|
180
|
-
- 💾
|
|
181
|
-
-
|
|
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
|
|
182
191
|
|
|
183
|
-
##
|
|
192
|
+
## Development
|
|
184
193
|
|
|
185
194
|
```bash
|
|
186
|
-
#
|
|
195
|
+
# Install dependencies
|
|
187
196
|
npm install
|
|
188
197
|
|
|
189
|
-
#
|
|
198
|
+
# Development mode (watch)
|
|
190
199
|
npm run dev
|
|
191
200
|
|
|
192
|
-
#
|
|
201
|
+
# Build (generate production min files)
|
|
193
202
|
npm run build
|
|
194
203
|
|
|
195
|
-
#
|
|
204
|
+
# Example test server
|
|
196
205
|
npm run serve
|
|
197
206
|
```
|
|
198
207
|
|
|
199
|
-
##
|
|
208
|
+
## Build Output
|
|
200
209
|
|
|
201
|
-
|
|
210
|
+
Running the build will generate the following files:
|
|
202
211
|
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
- **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)
|
|
206
215
|
|
|
207
|
-
|
|
216
|
+
When installed via npm, min files are automatically used. For more details, see the [Build Guide](./BUILD.md).
|
|
208
217
|
|
|
209
|
-
##
|
|
218
|
+
## License
|
|
210
219
|
|
|
211
220
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "masoneffect",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "파티클 모핑 효과를 제공하는 라이브러리 - React, Vue, 바닐라 JS 지원",
|
|
5
5
|
"main": "dist/index.min.js",
|
|
6
6
|
"module": "dist/index.esm.min.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"type": "git",
|
|
48
48
|
"url": "https://github.com/fe-hyunsu/masoneffect.git"
|
|
49
49
|
},
|
|
50
|
-
"homepage": "https://
|
|
50
|
+
"homepage": "https://masoneffect.com",
|
|
51
51
|
"bugs": {
|
|
52
52
|
"url": "https://github.com/fe-hyunsu/masoneffect/issues"
|
|
53
53
|
},
|