masoneffect 0.1.19 → 0.1.21
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/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/dist/react/MasonEffect.cjs +1 -552
- package/dist/react/MasonEffect.d.ts.map +1 -1
- package/dist/react/MasonEffect.mjs +1 -0
- package/dist/react/index.cjs +7 -0
- package/dist/react/index.mjs +1 -0
- package/dist/react/react/MasonEffect.d.ts.map +1 -1
- package/dist/react/vue/index.d.ts +5 -0
- package/dist/react/vue/index.d.ts.map +1 -0
- package/dist/vue/index.cjs +1 -0
- package/dist/vue/index.d.ts +90 -0
- package/{src/core/index.ts → dist/vue/index.mjs} +209 -242
- package/package.json +16 -12
- package/dist/index.esm.js +0 -407
- package/dist/index.esm.js.map +0 -1
- package/dist/index.esm.min.js +0 -1
- package/dist/index.js +0 -412
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -1
- package/dist/index.umd.js +0 -416
- package/dist/index.umd.js.map +0 -1
- package/dist/index.umd.min.js +0 -1
- package/dist/react/MasonEffect.cjs.map +0 -1
- package/dist/react/MasonEffect.js +0 -550
- package/dist/react/MasonEffect.js.map +0 -1
- package/dist/react/MasonEffect.min.cjs +0 -1
- package/dist/react/MasonEffect.min.js +0 -1
- package/dist/react/index.js +0 -549
- package/src/index.ts +0 -14
- package/src/index.umd.ts +0 -10
- package/src/react/MasonEffect.tsx +0 -235
- package/src/react/index.ts +0 -4
- package/src/vue/MasonEffect.vue +0 -140
|
@@ -1,550 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useEffect, useImperativeHandle } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MasonEffect - 파티클 모핑 효과 라이브러리
|
|
5
|
-
* 바닐라 JS 코어 클래스
|
|
6
|
-
*/
|
|
7
|
-
// 디바운스 유틸리티 함수
|
|
8
|
-
function debounce(func, wait) {
|
|
9
|
-
let timeout = null;
|
|
10
|
-
return function executedFunction(...args) {
|
|
11
|
-
const later = () => {
|
|
12
|
-
timeout = null;
|
|
13
|
-
func.apply(this, args);
|
|
14
|
-
};
|
|
15
|
-
if (timeout !== null) {
|
|
16
|
-
clearTimeout(timeout);
|
|
17
|
-
}
|
|
18
|
-
timeout = setTimeout(later, wait);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
class MasonEffect {
|
|
22
|
-
constructor(container, options = {}) {
|
|
23
|
-
// 컨테이너 요소
|
|
24
|
-
this.container = typeof container === 'string'
|
|
25
|
-
? document.querySelector(container)
|
|
26
|
-
: container;
|
|
27
|
-
if (!this.container) {
|
|
28
|
-
throw new Error('Container element not found');
|
|
29
|
-
}
|
|
30
|
-
// 설정값들
|
|
31
|
-
this.config = {
|
|
32
|
-
text: options.text || 'mason effect',
|
|
33
|
-
densityStep: options.densityStep ?? 2,
|
|
34
|
-
maxParticles: options.maxParticles ?? 3200,
|
|
35
|
-
pointSize: options.pointSize ?? 0.5,
|
|
36
|
-
ease: options.ease ?? 0.05,
|
|
37
|
-
repelRadius: options.repelRadius ?? 150,
|
|
38
|
-
repelStrength: options.repelStrength ?? 1,
|
|
39
|
-
particleColor: options.particleColor || '#fff',
|
|
40
|
-
fontFamily: options.fontFamily || 'Inter, system-ui, Arial',
|
|
41
|
-
fontSize: options.fontSize || null,
|
|
42
|
-
width: options.width || null,
|
|
43
|
-
height: options.height || null,
|
|
44
|
-
devicePixelRatio: options.devicePixelRatio ?? null,
|
|
45
|
-
onReady: options.onReady || null,
|
|
46
|
-
onUpdate: options.onUpdate || null,
|
|
47
|
-
};
|
|
48
|
-
// 캔버스 생성
|
|
49
|
-
this.canvas = document.createElement('canvas');
|
|
50
|
-
const ctx = this.canvas.getContext('2d');
|
|
51
|
-
if (!ctx) {
|
|
52
|
-
throw new Error('Canvas context not available');
|
|
53
|
-
}
|
|
54
|
-
this.ctx = ctx;
|
|
55
|
-
this.container.appendChild(this.canvas);
|
|
56
|
-
this.canvas.style.display = 'block';
|
|
57
|
-
// 오프스크린 캔버스 (텍스트 렌더링용)
|
|
58
|
-
this.offCanvas = document.createElement('canvas');
|
|
59
|
-
const offCtx = this.offCanvas.getContext('2d');
|
|
60
|
-
if (!offCtx) {
|
|
61
|
-
throw new Error('Offscreen canvas context not available');
|
|
62
|
-
}
|
|
63
|
-
this.offCtx = offCtx;
|
|
64
|
-
// 상태
|
|
65
|
-
this.W = 0;
|
|
66
|
-
this.H = 0;
|
|
67
|
-
this.DPR = this.config.devicePixelRatio || Math.min(window.devicePixelRatio || 1, 1.8);
|
|
68
|
-
this.particles = [];
|
|
69
|
-
this.mouse = { x: 0, y: 0, down: false };
|
|
70
|
-
this.animationId = null;
|
|
71
|
-
this.isRunning = false;
|
|
72
|
-
this.isVisible = false;
|
|
73
|
-
this.intersectionObserver = null;
|
|
74
|
-
// 디바운스 설정 (ms)
|
|
75
|
-
this.debounceDelay = options.debounceDelay ?? 150;
|
|
76
|
-
// 이벤트 핸들러 바인딩 (디바운스 적용 전에 바인딩)
|
|
77
|
-
const boundHandleResize = this.handleResize.bind(this);
|
|
78
|
-
this.handleResize = debounce(boundHandleResize, this.debounceDelay);
|
|
79
|
-
this.handleMouseMove = this.handleMouseMove.bind(this);
|
|
80
|
-
this.handleMouseLeave = this.handleMouseLeave.bind(this);
|
|
81
|
-
this.handleMouseDown = this.handleMouseDown.bind(this);
|
|
82
|
-
this.handleMouseUp = this.handleMouseUp.bind(this);
|
|
83
|
-
// morph와 updateConfig를 위한 디바운스된 내부 메서드
|
|
84
|
-
this._debouncedMorph = debounce(this._morphInternal.bind(this), this.debounceDelay);
|
|
85
|
-
this._debouncedUpdateConfig = debounce(this._updateConfigInternal.bind(this), this.debounceDelay);
|
|
86
|
-
// 초기화
|
|
87
|
-
this.init();
|
|
88
|
-
}
|
|
89
|
-
init() {
|
|
90
|
-
this.resize();
|
|
91
|
-
this.setupEventListeners();
|
|
92
|
-
this.setupIntersectionObserver();
|
|
93
|
-
if (this.config.onReady) {
|
|
94
|
-
this.config.onReady(this);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
setupIntersectionObserver() {
|
|
98
|
-
// IntersectionObserver가 지원되지 않는 환경에서는 항상 재생
|
|
99
|
-
if (typeof window === 'undefined' || typeof window.IntersectionObserver === 'undefined') {
|
|
100
|
-
this.isVisible = true;
|
|
101
|
-
this.start();
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
// 이미 설정되어 있다면 다시 만들지 않음
|
|
105
|
-
if (this.intersectionObserver) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
this.intersectionObserver = new IntersectionObserver((entries) => {
|
|
109
|
-
for (const entry of entries) {
|
|
110
|
-
if (entry.target !== this.container)
|
|
111
|
-
continue;
|
|
112
|
-
if (entry.isIntersecting) {
|
|
113
|
-
this.isVisible = true;
|
|
114
|
-
this.start();
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
this.isVisible = false;
|
|
118
|
-
this.stop();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
threshold: 0.1, // 10% 이상 보일 때 동작
|
|
123
|
-
});
|
|
124
|
-
this.intersectionObserver.observe(this.container);
|
|
125
|
-
}
|
|
126
|
-
resize() {
|
|
127
|
-
const width = this.config.width || this.container.clientWidth || window.innerWidth;
|
|
128
|
-
const height = this.config.height || this.container.clientHeight || window.innerHeight * 0.7;
|
|
129
|
-
// 최소 크기 보장
|
|
130
|
-
if (width <= 0 || height <= 0) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
this.W = Math.floor(width * this.DPR);
|
|
134
|
-
this.H = Math.floor(height * this.DPR);
|
|
135
|
-
// 캔버스 크기 제한 (메모리 오류 방지)
|
|
136
|
-
// getImageData는 최대 약 268MB (4096x4096x4)까지 지원
|
|
137
|
-
const MAX_CANVAS_SIZE = 4096;
|
|
138
|
-
if (this.W > MAX_CANVAS_SIZE || this.H > MAX_CANVAS_SIZE) {
|
|
139
|
-
const scale = Math.min(MAX_CANVAS_SIZE / this.W, MAX_CANVAS_SIZE / this.H);
|
|
140
|
-
this.W = Math.floor(this.W * scale);
|
|
141
|
-
this.H = Math.floor(this.H * scale);
|
|
142
|
-
this.DPR = this.DPR * scale;
|
|
143
|
-
}
|
|
144
|
-
this.canvas.width = this.W;
|
|
145
|
-
this.canvas.height = this.H;
|
|
146
|
-
this.canvas.style.width = width + 'px';
|
|
147
|
-
this.canvas.style.height = height + 'px';
|
|
148
|
-
// 크기가 유효할 때만 buildTargets 실행
|
|
149
|
-
if (this.W > 0 && this.H > 0) {
|
|
150
|
-
this.buildTargets();
|
|
151
|
-
if (!this.particles.length) {
|
|
152
|
-
this.initParticles();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
buildTargets() {
|
|
157
|
-
// 크기 검증
|
|
158
|
-
if (this.W <= 0 || this.H <= 0) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const text = this.config.text;
|
|
162
|
-
this.offCanvas.width = this.W;
|
|
163
|
-
this.offCanvas.height = this.H;
|
|
164
|
-
this.offCtx.clearRect(0, 0, this.offCanvas.width, this.offCanvas.height);
|
|
165
|
-
const base = Math.min(this.W, this.H);
|
|
166
|
-
const fontSize = this.config.fontSize || Math.max(80, Math.floor(base * 0.18));
|
|
167
|
-
this.offCtx.fillStyle = '#ffffff';
|
|
168
|
-
this.offCtx.textAlign = 'center';
|
|
169
|
-
this.offCtx.textBaseline = 'middle';
|
|
170
|
-
this.offCtx.font = `400 ${fontSize}px ${this.config.fontFamily}`;
|
|
171
|
-
// 글자 간격 계산 및 그리기
|
|
172
|
-
const chars = text.split('');
|
|
173
|
-
const spacing = fontSize * 0.05;
|
|
174
|
-
const totalWidth = this.offCtx.measureText(text).width + spacing * (chars.length - 1);
|
|
175
|
-
let x = this.W / 2 - totalWidth / 2;
|
|
176
|
-
for (const ch of chars) {
|
|
177
|
-
this.offCtx.fillText(ch, x + this.offCtx.measureText(ch).width / 2, this.H / 2);
|
|
178
|
-
x += this.offCtx.measureText(ch).width + spacing;
|
|
179
|
-
}
|
|
180
|
-
// 픽셀 샘플링
|
|
181
|
-
const step = Math.max(2, this.config.densityStep);
|
|
182
|
-
const img = this.offCtx.getImageData(0, 0, this.W, this.H).data;
|
|
183
|
-
const targets = [];
|
|
184
|
-
for (let y = 0; y < this.H; y += step) {
|
|
185
|
-
for (let x = 0; x < this.W; x += step) {
|
|
186
|
-
const i = (y * this.W + x) * 4;
|
|
187
|
-
if (img[i] + img[i + 1] + img[i + 2] > 600) {
|
|
188
|
-
targets.push({ x, y });
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// 파티클 수 제한
|
|
193
|
-
while (targets.length > this.config.maxParticles) {
|
|
194
|
-
targets.splice(Math.floor(Math.random() * targets.length), 1);
|
|
195
|
-
}
|
|
196
|
-
// 파티클 수 조정
|
|
197
|
-
if (this.particles.length < targets.length) {
|
|
198
|
-
const need = targets.length - this.particles.length;
|
|
199
|
-
for (let i = 0; i < need; i++) {
|
|
200
|
-
this.particles.push(this.makeParticle());
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
else if (this.particles.length > targets.length) {
|
|
204
|
-
this.particles.length = targets.length;
|
|
205
|
-
}
|
|
206
|
-
// 목표 좌표 할당
|
|
207
|
-
for (let i = 0; i < this.particles.length; i++) {
|
|
208
|
-
const p = this.particles[i];
|
|
209
|
-
const t = targets[i];
|
|
210
|
-
p.tx = t.x;
|
|
211
|
-
p.ty = t.y;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
makeParticle() {
|
|
215
|
-
// 캔버스 전체에 골고루 분포 (여백 없이)
|
|
216
|
-
const sx = Math.random() * this.W;
|
|
217
|
-
const sy = Math.random() * this.H;
|
|
218
|
-
return {
|
|
219
|
-
x: sx,
|
|
220
|
-
y: sy,
|
|
221
|
-
vx: 0,
|
|
222
|
-
vy: 0,
|
|
223
|
-
tx: sx,
|
|
224
|
-
ty: sy,
|
|
225
|
-
initialX: sx, // 초기 위치 저장 (scatter 시 돌아갈 위치)
|
|
226
|
-
initialY: sy,
|
|
227
|
-
j: Math.random() * Math.PI * 2,
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
initParticles() {
|
|
231
|
-
// 캔버스 전체에 골고루 분포 (여백 없이)
|
|
232
|
-
for (const p of this.particles) {
|
|
233
|
-
const sx = Math.random() * this.W;
|
|
234
|
-
const sy = Math.random() * this.H;
|
|
235
|
-
p.x = sx;
|
|
236
|
-
p.y = sy;
|
|
237
|
-
p.vx = p.vy = 0;
|
|
238
|
-
// 초기 위치 저장 (scatter 시 돌아갈 위치)
|
|
239
|
-
p.initialX = sx;
|
|
240
|
-
p.initialY = sy;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
scatter() {
|
|
244
|
-
// 각 파티클을 초기 위치로 돌아가도록 설정
|
|
245
|
-
for (const p of this.particles) {
|
|
246
|
-
// 초기 위치가 저장되어 있으면 그 위치로, 없으면 현재 위치 유지
|
|
247
|
-
if (p.initialX !== undefined && p.initialY !== undefined) {
|
|
248
|
-
p.tx = p.initialX;
|
|
249
|
-
p.ty = p.initialY;
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
// 초기 위치가 없으면 현재 위치를 초기 위치로 저장
|
|
253
|
-
p.initialX = p.x;
|
|
254
|
-
p.initialY = p.y;
|
|
255
|
-
p.tx = p.initialX;
|
|
256
|
-
p.ty = p.initialY;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
morph(textOrOptions) {
|
|
261
|
-
// 즉시 실행이 필요한 경우 (예: 초기화 시)를 위해 내부 메서드 직접 호출
|
|
262
|
-
// 일반적인 경우에는 디바운스 적용
|
|
263
|
-
this._debouncedMorph(textOrOptions);
|
|
264
|
-
}
|
|
265
|
-
_morphInternal(textOrOptions) {
|
|
266
|
-
// W와 H가 0이면 resize 먼저 실행
|
|
267
|
-
if (this.W === 0 || this.H === 0) {
|
|
268
|
-
this.resize();
|
|
269
|
-
}
|
|
270
|
-
if (typeof textOrOptions === 'string') {
|
|
271
|
-
// 문자열인 경우: 기존 동작 유지
|
|
272
|
-
this.config.text = textOrOptions;
|
|
273
|
-
this.buildTargets();
|
|
274
|
-
}
|
|
275
|
-
else if (textOrOptions && typeof textOrOptions === 'object') {
|
|
276
|
-
// 객체인 경우: 텍스트와 함께 다른 설정도 변경
|
|
277
|
-
const needsRebuild = textOrOptions.text !== undefined;
|
|
278
|
-
this.config = { ...this.config, ...textOrOptions };
|
|
279
|
-
if (needsRebuild) {
|
|
280
|
-
this.buildTargets();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
// null이거나 undefined인 경우: 현재 텍스트로 재빌드
|
|
285
|
-
this.buildTargets();
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
update() {
|
|
289
|
-
this.ctx.clearRect(0, 0, this.W, this.H);
|
|
290
|
-
for (const p of this.particles) {
|
|
291
|
-
// 목표 좌표로 당기는 힘
|
|
292
|
-
let ax = (p.tx - p.x) * this.config.ease;
|
|
293
|
-
let ay = (p.ty - p.y) * this.config.ease;
|
|
294
|
-
// 마우스 반발/흡입
|
|
295
|
-
if (this.mouse.x || this.mouse.y) {
|
|
296
|
-
const dx = p.x - this.mouse.x;
|
|
297
|
-
const dy = p.y - this.mouse.y;
|
|
298
|
-
const d2 = dx * dx + dy * dy;
|
|
299
|
-
const r = this.config.repelRadius * this.DPR;
|
|
300
|
-
if (d2 < r * r) {
|
|
301
|
-
const d = Math.sqrt(d2) + 0.0001;
|
|
302
|
-
const f = (this.mouse.down ? -1 : 1) * this.config.repelStrength * (1 - d / r);
|
|
303
|
-
ax += (dx / d) * f * 6.0;
|
|
304
|
-
ay += (dy / d) * f * 6.0;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
// 진동 효과
|
|
308
|
-
p.j += 2;
|
|
309
|
-
ax += Math.cos(p.j) * 0.05;
|
|
310
|
-
ay += Math.sin(p.j * 1.3) * 0.05;
|
|
311
|
-
// 속도와 위치 업데이트
|
|
312
|
-
p.vx = (p.vx + ax) * Math.random();
|
|
313
|
-
p.vy = (p.vy + ay) * Math.random();
|
|
314
|
-
p.x += p.vx;
|
|
315
|
-
p.y += p.vy;
|
|
316
|
-
}
|
|
317
|
-
// 파티클 그리기
|
|
318
|
-
this.ctx.fillStyle = this.config.particleColor;
|
|
319
|
-
const r = this.config.pointSize * this.DPR;
|
|
320
|
-
for (const p of this.particles) {
|
|
321
|
-
this.ctx.beginPath();
|
|
322
|
-
this.ctx.arc(p.x, p.y, r, 0, Math.PI * 2);
|
|
323
|
-
this.ctx.fill();
|
|
324
|
-
}
|
|
325
|
-
if (this.config.onUpdate) {
|
|
326
|
-
this.config.onUpdate(this);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
animate() {
|
|
330
|
-
if (!this.isRunning)
|
|
331
|
-
return;
|
|
332
|
-
this.update();
|
|
333
|
-
this.animationId = requestAnimationFrame(() => this.animate());
|
|
334
|
-
}
|
|
335
|
-
start() {
|
|
336
|
-
if (this.isRunning)
|
|
337
|
-
return;
|
|
338
|
-
this.isRunning = true;
|
|
339
|
-
this.animate();
|
|
340
|
-
}
|
|
341
|
-
stop() {
|
|
342
|
-
this.isRunning = false;
|
|
343
|
-
if (this.animationId) {
|
|
344
|
-
cancelAnimationFrame(this.animationId);
|
|
345
|
-
this.animationId = null;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
setupEventListeners() {
|
|
349
|
-
window.addEventListener('resize', this.handleResize);
|
|
350
|
-
this.canvas.addEventListener('mousemove', this.handleMouseMove);
|
|
351
|
-
this.canvas.addEventListener('mouseleave', this.handleMouseLeave);
|
|
352
|
-
this.canvas.addEventListener('mousedown', this.handleMouseDown);
|
|
353
|
-
window.addEventListener('mouseup', this.handleMouseUp);
|
|
354
|
-
}
|
|
355
|
-
removeEventListeners() {
|
|
356
|
-
window.removeEventListener('resize', this.handleResize);
|
|
357
|
-
this.canvas.removeEventListener('mousemove', this.handleMouseMove);
|
|
358
|
-
this.canvas.removeEventListener('mouseleave', this.handleMouseLeave);
|
|
359
|
-
this.canvas.removeEventListener('mousedown', this.handleMouseDown);
|
|
360
|
-
window.removeEventListener('mouseup', this.handleMouseUp);
|
|
361
|
-
}
|
|
362
|
-
handleResize() {
|
|
363
|
-
this.resize();
|
|
364
|
-
}
|
|
365
|
-
handleMouseMove(e) {
|
|
366
|
-
const rect = this.canvas.getBoundingClientRect();
|
|
367
|
-
this.mouse.x = (e.clientX - rect.left) * this.DPR;
|
|
368
|
-
this.mouse.y = (e.clientY - rect.top) * this.DPR;
|
|
369
|
-
}
|
|
370
|
-
handleMouseLeave() {
|
|
371
|
-
this.mouse.x = this.mouse.y = 0;
|
|
372
|
-
}
|
|
373
|
-
handleMouseDown() {
|
|
374
|
-
this.mouse.down = true;
|
|
375
|
-
}
|
|
376
|
-
handleMouseUp() {
|
|
377
|
-
this.mouse.down = false;
|
|
378
|
-
}
|
|
379
|
-
// 설정 업데이트
|
|
380
|
-
updateConfig(newConfig) {
|
|
381
|
-
// 디바운스 적용
|
|
382
|
-
this._debouncedUpdateConfig(newConfig);
|
|
383
|
-
}
|
|
384
|
-
_updateConfigInternal(newConfig) {
|
|
385
|
-
this.config = { ...this.config, ...newConfig };
|
|
386
|
-
if (newConfig.text) {
|
|
387
|
-
this.buildTargets();
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
// 파괴 및 정리
|
|
391
|
-
destroy() {
|
|
392
|
-
this.stop();
|
|
393
|
-
this.removeEventListeners();
|
|
394
|
-
if (this.intersectionObserver) {
|
|
395
|
-
this.intersectionObserver.disconnect();
|
|
396
|
-
this.intersectionObserver = null;
|
|
397
|
-
}
|
|
398
|
-
if (this.canvas && this.canvas.parentNode) {
|
|
399
|
-
this.canvas.parentNode.removeChild(this.canvas);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
const MasonEffectComponent = forwardRef((props, ref) => {
|
|
405
|
-
const containerRef = useRef(null);
|
|
406
|
-
const instanceRef = useRef(null);
|
|
407
|
-
useEffect(() => {
|
|
408
|
-
if (!containerRef.current)
|
|
409
|
-
return;
|
|
410
|
-
let resizeObserver = null;
|
|
411
|
-
let initTimeout = null;
|
|
412
|
-
// 컨테이너가 실제 크기를 가지도록 대기
|
|
413
|
-
const initEffect = () => {
|
|
414
|
-
const container = containerRef.current;
|
|
415
|
-
if (!container)
|
|
416
|
-
return;
|
|
417
|
-
// 컨테이너 크기가 0이거나 너무 작으면 다음 프레임에 다시 시도
|
|
418
|
-
const rect = container.getBoundingClientRect();
|
|
419
|
-
if (rect.width <= 0 || rect.height <= 0) {
|
|
420
|
-
initTimeout = window.setTimeout(initEffect, 50);
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
// 최소 크기 보장 (너무 작으면 기본값 사용)
|
|
424
|
-
const minSize = 100;
|
|
425
|
-
if (rect.width < minSize || rect.height < minSize) {
|
|
426
|
-
container.style.minWidth = minSize + 'px';
|
|
427
|
-
container.style.minHeight = minSize + 'px';
|
|
428
|
-
}
|
|
429
|
-
const { className, style, text, densityStep, maxParticles, pointSize, ease, repelRadius, repelStrength, particleColor, fontFamily, fontSize, width, height, devicePixelRatio, onReady, onUpdate, } = props;
|
|
430
|
-
const options = {
|
|
431
|
-
text,
|
|
432
|
-
densityStep,
|
|
433
|
-
maxParticles,
|
|
434
|
-
pointSize,
|
|
435
|
-
ease,
|
|
436
|
-
repelRadius,
|
|
437
|
-
repelStrength,
|
|
438
|
-
particleColor,
|
|
439
|
-
fontFamily,
|
|
440
|
-
fontSize,
|
|
441
|
-
width,
|
|
442
|
-
height,
|
|
443
|
-
devicePixelRatio,
|
|
444
|
-
onReady,
|
|
445
|
-
onUpdate,
|
|
446
|
-
};
|
|
447
|
-
instanceRef.current = new MasonEffect(container, options);
|
|
448
|
-
// ResizeObserver로 컨테이너 크기 변경 감지
|
|
449
|
-
if (typeof ResizeObserver !== 'undefined') {
|
|
450
|
-
resizeObserver = new ResizeObserver(() => {
|
|
451
|
-
if (instanceRef.current) {
|
|
452
|
-
instanceRef.current.resize();
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
resizeObserver.observe(container);
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
// 다음 프레임에 초기화 (DOM이 완전히 렌더링된 후)
|
|
459
|
-
requestAnimationFrame(initEffect);
|
|
460
|
-
return () => {
|
|
461
|
-
if (initTimeout) {
|
|
462
|
-
clearTimeout(initTimeout);
|
|
463
|
-
}
|
|
464
|
-
if (resizeObserver) {
|
|
465
|
-
resizeObserver.disconnect();
|
|
466
|
-
}
|
|
467
|
-
if (instanceRef.current) {
|
|
468
|
-
instanceRef.current.destroy();
|
|
469
|
-
instanceRef.current = null;
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
}, []);
|
|
473
|
-
// props 변경 시 설정 업데이트
|
|
474
|
-
useEffect(() => {
|
|
475
|
-
if (!instanceRef.current)
|
|
476
|
-
return;
|
|
477
|
-
const { text, densityStep, maxParticles, pointSize, ease, repelRadius, repelStrength, particleColor, fontFamily, fontSize, width, height, devicePixelRatio, } = props;
|
|
478
|
-
instanceRef.current.updateConfig({
|
|
479
|
-
text,
|
|
480
|
-
densityStep,
|
|
481
|
-
maxParticles,
|
|
482
|
-
pointSize,
|
|
483
|
-
ease,
|
|
484
|
-
repelRadius,
|
|
485
|
-
repelStrength,
|
|
486
|
-
particleColor,
|
|
487
|
-
fontFamily,
|
|
488
|
-
fontSize,
|
|
489
|
-
width,
|
|
490
|
-
height,
|
|
491
|
-
devicePixelRatio,
|
|
492
|
-
});
|
|
493
|
-
}, [
|
|
494
|
-
props.text,
|
|
495
|
-
props.densityStep,
|
|
496
|
-
props.maxParticles,
|
|
497
|
-
props.pointSize,
|
|
498
|
-
props.ease,
|
|
499
|
-
props.repelRadius,
|
|
500
|
-
props.repelStrength,
|
|
501
|
-
props.particleColor,
|
|
502
|
-
props.fontFamily,
|
|
503
|
-
props.fontSize,
|
|
504
|
-
props.width,
|
|
505
|
-
props.height,
|
|
506
|
-
props.devicePixelRatio,
|
|
507
|
-
]);
|
|
508
|
-
useImperativeHandle(ref, () => ({
|
|
509
|
-
morph: (textOrOptions) => {
|
|
510
|
-
if (!instanceRef.current) {
|
|
511
|
-
console.warn('MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.');
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
instanceRef.current.morph(textOrOptions);
|
|
515
|
-
},
|
|
516
|
-
scatter: () => {
|
|
517
|
-
if (!instanceRef.current) {
|
|
518
|
-
console.warn('MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.');
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
instanceRef.current.scatter();
|
|
522
|
-
},
|
|
523
|
-
updateConfig: (config) => {
|
|
524
|
-
if (!instanceRef.current) {
|
|
525
|
-
console.warn('MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.');
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
instanceRef.current.updateConfig(config);
|
|
529
|
-
},
|
|
530
|
-
destroy: () => {
|
|
531
|
-
if (instanceRef.current) {
|
|
532
|
-
instanceRef.current.destroy();
|
|
533
|
-
instanceRef.current = null;
|
|
534
|
-
}
|
|
535
|
-
},
|
|
536
|
-
}));
|
|
537
|
-
// 기본 스타일: 컨테이너가 크기를 가지도록 함
|
|
538
|
-
const defaultStyle = {
|
|
539
|
-
width: '100%',
|
|
540
|
-
height: '100%',
|
|
541
|
-
minHeight: props.height || 400,
|
|
542
|
-
position: 'relative',
|
|
543
|
-
...props.style,
|
|
544
|
-
};
|
|
545
|
-
return (React.createElement("div", { ref: containerRef, className: props.className, style: defaultStyle }));
|
|
546
|
-
});
|
|
547
|
-
MasonEffectComponent.displayName = 'MasonEffect';
|
|
548
|
-
|
|
549
|
-
export { MasonEffectComponent as default };
|
|
550
|
-
//# sourceMappingURL=MasonEffect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MasonEffect.js","sources":["../../src/core/index.ts","../../src/react/MasonEffect.tsx"],"sourcesContent":[null,null],"names":[],"mappings":";;AAAA;;;AAGG;AAiCH;AACA,SAAS,QAAQ,CACf,IAAO,EACP,IAAY,EAAA;IAEZ,IAAI,OAAO,GAAyC,IAAI;AACxD,IAAA,OAAO,SAAS,gBAAgB,CAAC,GAAG,IAAmB,EAAA;QACrD,MAAM,KAAK,GAAG,MAAK;YACjB,OAAO,GAAG,IAAI;AACd,YAAA,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;AACxB,QAAA,CAAC;AACD,QAAA,IAAI,OAAO,KAAK,IAAI,EAAE;YACpB,YAAY,CAAC,OAAO,CAAC;QACvB;AACA,QAAA,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC;AACnC,IAAA,CAAC;AACH;MAEa,WAAW,CAAA;IAuBtB,WAAA,CAAY,SAA+B,EAAE,OAAA,GAA8B,EAAE,EAAA;;AAE3E,QAAA,IAAI,CAAC,SAAS,GAAG,OAAO,SAAS,KAAK;AACpC,cAAE,QAAQ,CAAC,aAAa,CAAC,SAAS;cAChC,SAAS;AAEb,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;AACnB,YAAA,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC;QAChD;;QAGA,IAAI,CAAC,MAAM,GAAG;AACZ,YAAA,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,cAAc;AACpC,YAAA,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,CAAC;AACrC,YAAA,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,IAAI;AAC1C,YAAA,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,GAAG;AACnC,YAAA,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;AAC1B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AAO,CAAC,YAAY,CAAC,MAAM,CAAC;QAC1C,CAAC;QACD,OAAO,EAAE,MAAK;AACZ,YAAA,IAAI,WAAW,CAAC,OAAO,EAAE;AACvB,gBAAA,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE;AAC7B,gBAAA,WAAW,CAAC,OAAO,GAAG,IAAI;YAC5B;QACF,CAAC;AACF,KAAA,CAAC,CAAC;;AAGH,IAAA,MAAM,YAAY,GAAwB;AACxC,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,MAAM,EAAE,MAAM;AACd,QAAA,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG;AAC9B,QAAA,QAAQ,EAAE,UAAU;QACpB,GAAG,KAAK,CAAC,KAAK;KACf;AAED,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,YAAY,EAAA,CACnB;AAEN,CAAC;AAGH,oBAAoB,CAAC,WAAW,GAAG,aAAa;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=require("react");function i(t,i){let s=null;return function(...h){null!==s&&clearTimeout(s),s=setTimeout(()=>{s=null,t.apply(this,h)},i)}}class s{constructor(t,s={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw Error("Container element not found");this.config={text:s.text||"mason effect",densityStep:s.densityStep??2,maxParticles:s.maxParticles??3200,pointSize:s.pointSize??.5,ease:s.ease??.05,repelRadius:s.repelRadius??150,repelStrength:s.repelStrength??1,particleColor:s.particleColor||"#fff",fontFamily:s.fontFamily||"Inter, system-ui, Arial",fontSize:s.fontSize||null,width:s.width||null,height:s.height||null,devicePixelRatio:s.devicePixelRatio??null,onReady:s.onReady||null,onUpdate:s.onUpdate||null},this.canvas=document.createElement("canvas");const h=this.canvas.getContext("2d");if(!h)throw Error("Canvas context not available");this.ctx=h,this.container.appendChild(this.canvas),this.canvas.style.display="block",this.offCanvas=document.createElement("canvas");const e=this.offCanvas.getContext("2d");if(!e)throw Error("Offscreen canvas context not available");this.offCtx=e,this.W=0,this.H=0,this.DPR=this.config.devicePixelRatio||Math.min(window.devicePixelRatio||1,1.8),this.particles=[],this.mouse={x:0,y:0,down:!1},this.animationId=null,this.isRunning=!1,this.isVisible=!1,this.intersectionObserver=null,this.debounceDelay=s.debounceDelay??150;const n=this.handleResize.bind(this);this.handleResize=i(n,this.debounceDelay),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.t=i(this.i.bind(this),this.debounceDelay),this.h=i(this.o.bind(this),this.debounceDelay),this.init()}init(){this.resize(),this.setupEventListeners(),this.setupIntersectionObserver(),this.config.onReady&&this.config.onReady(this)}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void this.start();this.intersectionObserver||(this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.start()):(this.isVisible=!1,this.stop()))},{threshold:.1}),this.intersectionObserver.observe(this.container))}resize(){const t=this.config.width||this.container.clientWidth||window.innerWidth,i=this.config.height||this.container.clientHeight||.7*window.innerHeight;if(0>=t||0>=i)return;this.W=Math.floor(t*this.DPR),this.H=Math.floor(i*this.DPR);const s=4096;if(this.W>s||this.H>s){const t=Math.min(s/this.W,s/this.H);this.W=Math.floor(this.W*t),this.H=Math.floor(this.H*t),this.DPR=this.DPR*t}this.canvas.width=this.W,this.canvas.height=this.H,this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",this.W>0&&this.H>0&&(this.buildTargets(),this.particles.length||this.initParticles())}buildTargets(){if(0>=this.W||0>=this.H)return;const t=this.config.text;this.offCanvas.width=this.W,this.offCanvas.height=this.H,this.offCtx.clearRect(0,0,this.offCanvas.width,this.offCanvas.height);const i=Math.min(this.W,this.H),s=this.config.fontSize||Math.max(80,Math.floor(.18*i));this.offCtx.fillStyle="#ffffff",this.offCtx.textAlign="center",this.offCtx.textBaseline="middle",this.offCtx.font=`400 ${s}px ${this.config.fontFamily}`;const h=t.split(""),e=.05*s,n=this.offCtx.measureText(t).width+e*(h.length-1);let o=this.W/2-n/2;for(const t of h)this.offCtx.fillText(t,o+this.offCtx.measureText(t).width/2,this.H/2),o+=this.offCtx.measureText(t).width+e;const a=Math.max(2,this.config.densityStep),r=this.offCtx.getImageData(0,0,this.W,this.H).data,l=[];for(let t=0;t<this.H;t+=a)for(let i=0;i<this.W;i+=a){const s=4*(t*this.W+i);r[s]+r[s+1]+r[s+2]>600&&l.push({x:i,y:t})}for(;l.length>this.config.maxParticles;)l.splice(Math.floor(Math.random()*l.length),1);if(this.particles.length<l.length){const t=l.length-this.particles.length;for(let i=0;t>i;i++)this.particles.push(this.makeParticle())}else this.particles.length>l.length&&(this.particles.length=l.length);for(let t=0;t<this.particles.length;t++){const i=this.particles[t],s=l[t];i.tx=s.x,i.ty=s.y}}makeParticle(){const t=Math.random()*this.W,i=Math.random()*this.H;return{x:t,y:i,vx:0,vy:0,tx:t,ty:i,initialX:t,initialY:i,j:Math.random()*Math.PI*2}}initParticles(){for(const t of this.particles){const i=Math.random()*this.W,s=Math.random()*this.H;t.x=i,t.y=s,t.vx=t.vy=0,t.initialX=i,t.initialY=s}}scatter(){for(const t of this.particles)void 0!==t.initialX&&void 0!==t.initialY?(t.tx=t.initialX,t.ty=t.initialY):(t.initialX=t.x,t.initialY=t.y,t.tx=t.initialX,t.ty=t.initialY)}morph(t){this.t(t)}i(t){if(0!==this.W&&0!==this.H||this.resize(),"string"==typeof t)this.config.text=t,this.buildTargets();else if(t&&"object"==typeof t){const i=void 0!==t.text;this.config={...this.config,...t},i&&this.buildTargets()}else this.buildTargets()}update(){this.ctx.clearRect(0,0,this.W,this.H);for(const t of this.particles){let i=(t.tx-t.x)*this.config.ease,s=(t.ty-t.y)*this.config.ease;if(this.mouse.x||this.mouse.y){const h=t.x-this.mouse.x,e=t.y-this.mouse.y,n=h*h+e*e,o=this.config.repelRadius*this.DPR;if(o*o>n){const t=Math.sqrt(n)+1e-4,a=(this.mouse.down?-1:1)*this.config.repelStrength*(1-t/o);i+=h/t*a*6,s+=e/t*a*6}}t.j+=2,i+=.05*Math.cos(t.j),s+=.05*Math.sin(1.3*t.j),t.vx=(t.vx+i)*Math.random(),t.vy=(t.vy+s)*Math.random(),t.x+=t.vx,t.y+=t.vy}this.ctx.fillStyle=this.config.particleColor;const t=this.config.pointSize*this.DPR;for(const i of this.particles)this.ctx.beginPath(),this.ctx.arc(i.x,i.y,t,0,2*Math.PI),this.ctx.fill();this.config.onUpdate&&this.config.onUpdate(this)}animate(){this.isRunning&&(this.update(),this.animationId=requestAnimationFrame(()=>this.animate()))}start(){this.isRunning||(this.isRunning=!0,this.animate())}stop(){this.isRunning=!1,this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null)}setupEventListeners(){window.addEventListener("resize",this.handleResize),this.canvas.addEventListener("mousemove",this.handleMouseMove),this.canvas.addEventListener("mouseleave",this.handleMouseLeave),this.canvas.addEventListener("mousedown",this.handleMouseDown),window.addEventListener("mouseup",this.handleMouseUp)}removeEventListeners(){window.removeEventListener("resize",this.handleResize),this.canvas.removeEventListener("mousemove",this.handleMouseMove),this.canvas.removeEventListener("mouseleave",this.handleMouseLeave),this.canvas.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("mouseup",this.handleMouseUp)}handleResize(){this.resize()}handleMouseMove(t){const i=this.canvas.getBoundingClientRect();this.mouse.x=(t.clientX-i.left)*this.DPR,this.mouse.y=(t.clientY-i.top)*this.DPR}handleMouseLeave(){this.mouse.x=this.mouse.y=0}handleMouseDown(){this.mouse.down=!0}handleMouseUp(){this.mouse.down=!1}updateConfig(t){this.h(t)}o(t){this.config={...this.config,...t},t.text&&this.buildTargets()}destroy(){this.stop(),this.removeEventListeners(),this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}const h=t.forwardRef((i,h)=>{const e=t.useRef(null),n=t.useRef(null);t.useEffect(()=>{if(!e.current)return;let t=null,h=null;const o=()=>{const a=e.current;if(!a)return;const r=a.getBoundingClientRect();if(0>=r.width||0>=r.height)return void(h=window.setTimeout(o,50));const l=100;(r.width<l||r.height<l)&&(a.style.minWidth=l+"px",a.style.minHeight=l+"px");const{className:c,style:f,text:d,densityStep:u,maxParticles:p,pointSize:m,ease:w,repelRadius:v,repelStrength:M,particleColor:y,fontFamily:x,fontSize:S,width:g,height:z,devicePixelRatio:R,onReady:P,onUpdate:C}=i,b={text:d,densityStep:u,maxParticles:p,pointSize:m,ease:w,repelRadius:v,repelStrength:M,particleColor:y,fontFamily:x,fontSize:S,width:g,height:z,devicePixelRatio:R,onReady:P,onUpdate:C};n.current=new s(a,b),"undefined"!=typeof ResizeObserver&&(t=new ResizeObserver(()=>{n.current&&n.current.resize()}),t.observe(a))};return requestAnimationFrame(o),()=>{h&&clearTimeout(h),t&&t.disconnect(),n.current&&(n.current.destroy(),n.current=null)}},[]),t.useEffect(()=>{if(!n.current)return;const{text:t,densityStep:s,maxParticles:h,pointSize:e,ease:o,repelRadius:a,repelStrength:r,particleColor:l,fontFamily:c,fontSize:f,width:d,height:u,devicePixelRatio:p}=i;n.current.updateConfig({text:t,densityStep:s,maxParticles:h,pointSize:e,ease:o,repelRadius:a,repelStrength:r,particleColor:l,fontFamily:c,fontSize:f,width:d,height:u,devicePixelRatio:p})},[i.text,i.densityStep,i.maxParticles,i.pointSize,i.ease,i.repelRadius,i.repelStrength,i.particleColor,i.fontFamily,i.fontSize,i.width,i.height,i.devicePixelRatio]),t.useImperativeHandle(h,()=>({morph(t){n.current?n.current.morph(t):console.warn("MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.")},scatter(){n.current?n.current.scatter():console.warn("MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.")},updateConfig(t){n.current?n.current.updateConfig(t):console.warn("MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.")},destroy(){n.current&&(n.current.destroy(),n.current=null)}}));const o={width:"100%",height:"100%",minHeight:i.height||400,position:"relative",...i.style};return t.createElement("div",{ref:e,className:i.className,style:o})});h.displayName="MasonEffect",module.exports=h;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t,{forwardRef as i,useRef as s,useEffect as h,useImperativeHandle as e}from"react";function n(t,i){let s=null;return function(...h){null!==s&&clearTimeout(s),s=setTimeout(()=>{s=null,t.apply(this,h)},i)}}class o{constructor(t,i={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw Error("Container element not found");this.config={text:i.text||"mason effect",densityStep:i.densityStep??2,maxParticles:i.maxParticles??3200,pointSize:i.pointSize??.5,ease:i.ease??.05,repelRadius:i.repelRadius??150,repelStrength:i.repelStrength??1,particleColor:i.particleColor||"#fff",fontFamily:i.fontFamily||"Inter, system-ui, Arial",fontSize:i.fontSize||null,width:i.width||null,height:i.height||null,devicePixelRatio:i.devicePixelRatio??null,onReady:i.onReady||null,onUpdate:i.onUpdate||null},this.canvas=document.createElement("canvas");const s=this.canvas.getContext("2d");if(!s)throw Error("Canvas context not available");this.ctx=s,this.container.appendChild(this.canvas),this.canvas.style.display="block",this.offCanvas=document.createElement("canvas");const h=this.offCanvas.getContext("2d");if(!h)throw Error("Offscreen canvas context not available");this.offCtx=h,this.W=0,this.H=0,this.DPR=this.config.devicePixelRatio||Math.min(window.devicePixelRatio||1,1.8),this.particles=[],this.mouse={x:0,y:0,down:!1},this.animationId=null,this.isRunning=!1,this.isVisible=!1,this.intersectionObserver=null,this.debounceDelay=i.debounceDelay??150;const e=this.handleResize.bind(this);this.handleResize=n(e,this.debounceDelay),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.t=n(this.i.bind(this),this.debounceDelay),this.h=n(this.o.bind(this),this.debounceDelay),this.init()}init(){this.resize(),this.setupEventListeners(),this.setupIntersectionObserver(),this.config.onReady&&this.config.onReady(this)}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void this.start();this.intersectionObserver||(this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.start()):(this.isVisible=!1,this.stop()))},{threshold:.1}),this.intersectionObserver.observe(this.container))}resize(){const t=this.config.width||this.container.clientWidth||window.innerWidth,i=this.config.height||this.container.clientHeight||.7*window.innerHeight;if(0>=t||0>=i)return;this.W=Math.floor(t*this.DPR),this.H=Math.floor(i*this.DPR);const s=4096;if(this.W>s||this.H>s){const t=Math.min(s/this.W,s/this.H);this.W=Math.floor(this.W*t),this.H=Math.floor(this.H*t),this.DPR=this.DPR*t}this.canvas.width=this.W,this.canvas.height=this.H,this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",this.W>0&&this.H>0&&(this.buildTargets(),this.particles.length||this.initParticles())}buildTargets(){if(0>=this.W||0>=this.H)return;const t=this.config.text;this.offCanvas.width=this.W,this.offCanvas.height=this.H,this.offCtx.clearRect(0,0,this.offCanvas.width,this.offCanvas.height);const i=Math.min(this.W,this.H),s=this.config.fontSize||Math.max(80,Math.floor(.18*i));this.offCtx.fillStyle="#ffffff",this.offCtx.textAlign="center",this.offCtx.textBaseline="middle",this.offCtx.font=`400 ${s}px ${this.config.fontFamily}`;const h=t.split(""),e=.05*s,n=this.offCtx.measureText(t).width+e*(h.length-1);let o=this.W/2-n/2;for(const t of h)this.offCtx.fillText(t,o+this.offCtx.measureText(t).width/2,this.H/2),o+=this.offCtx.measureText(t).width+e;const a=Math.max(2,this.config.densityStep),r=this.offCtx.getImageData(0,0,this.W,this.H).data,l=[];for(let t=0;t<this.H;t+=a)for(let i=0;i<this.W;i+=a){const s=4*(t*this.W+i);r[s]+r[s+1]+r[s+2]>600&&l.push({x:i,y:t})}for(;l.length>this.config.maxParticles;)l.splice(Math.floor(Math.random()*l.length),1);if(this.particles.length<l.length){const t=l.length-this.particles.length;for(let i=0;t>i;i++)this.particles.push(this.makeParticle())}else this.particles.length>l.length&&(this.particles.length=l.length);for(let t=0;t<this.particles.length;t++){const i=this.particles[t],s=l[t];i.tx=s.x,i.ty=s.y}}makeParticle(){const t=Math.random()*this.W,i=Math.random()*this.H;return{x:t,y:i,vx:0,vy:0,tx:t,ty:i,initialX:t,initialY:i,j:Math.random()*Math.PI*2}}initParticles(){for(const t of this.particles){const i=Math.random()*this.W,s=Math.random()*this.H;t.x=i,t.y=s,t.vx=t.vy=0,t.initialX=i,t.initialY=s}}scatter(){for(const t of this.particles)void 0!==t.initialX&&void 0!==t.initialY?(t.tx=t.initialX,t.ty=t.initialY):(t.initialX=t.x,t.initialY=t.y,t.tx=t.initialX,t.ty=t.initialY)}morph(t){this.t(t)}i(t){if(0!==this.W&&0!==this.H||this.resize(),"string"==typeof t)this.config.text=t,this.buildTargets();else if(t&&"object"==typeof t){const i=void 0!==t.text;this.config={...this.config,...t},i&&this.buildTargets()}else this.buildTargets()}update(){this.ctx.clearRect(0,0,this.W,this.H);for(const t of this.particles){let i=(t.tx-t.x)*this.config.ease,s=(t.ty-t.y)*this.config.ease;if(this.mouse.x||this.mouse.y){const h=t.x-this.mouse.x,e=t.y-this.mouse.y,n=h*h+e*e,o=this.config.repelRadius*this.DPR;if(o*o>n){const t=Math.sqrt(n)+1e-4,a=(this.mouse.down?-1:1)*this.config.repelStrength*(1-t/o);i+=h/t*a*6,s+=e/t*a*6}}t.j+=2,i+=.05*Math.cos(t.j),s+=.05*Math.sin(1.3*t.j),t.vx=(t.vx+i)*Math.random(),t.vy=(t.vy+s)*Math.random(),t.x+=t.vx,t.y+=t.vy}this.ctx.fillStyle=this.config.particleColor;const t=this.config.pointSize*this.DPR;for(const i of this.particles)this.ctx.beginPath(),this.ctx.arc(i.x,i.y,t,0,2*Math.PI),this.ctx.fill();this.config.onUpdate&&this.config.onUpdate(this)}animate(){this.isRunning&&(this.update(),this.animationId=requestAnimationFrame(()=>this.animate()))}start(){this.isRunning||(this.isRunning=!0,this.animate())}stop(){this.isRunning=!1,this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null)}setupEventListeners(){window.addEventListener("resize",this.handleResize),this.canvas.addEventListener("mousemove",this.handleMouseMove),this.canvas.addEventListener("mouseleave",this.handleMouseLeave),this.canvas.addEventListener("mousedown",this.handleMouseDown),window.addEventListener("mouseup",this.handleMouseUp)}removeEventListeners(){window.removeEventListener("resize",this.handleResize),this.canvas.removeEventListener("mousemove",this.handleMouseMove),this.canvas.removeEventListener("mouseleave",this.handleMouseLeave),this.canvas.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("mouseup",this.handleMouseUp)}handleResize(){this.resize()}handleMouseMove(t){const i=this.canvas.getBoundingClientRect();this.mouse.x=(t.clientX-i.left)*this.DPR,this.mouse.y=(t.clientY-i.top)*this.DPR}handleMouseLeave(){this.mouse.x=this.mouse.y=0}handleMouseDown(){this.mouse.down=!0}handleMouseUp(){this.mouse.down=!1}updateConfig(t){this.h(t)}o(t){this.config={...this.config,...t},t.text&&this.buildTargets()}destroy(){this.stop(),this.removeEventListeners(),this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}const a=i((i,n)=>{const a=s(null),r=s(null);h(()=>{if(!a.current)return;let t=null,s=null;const h=()=>{const e=a.current;if(!e)return;const n=e.getBoundingClientRect();if(0>=n.width||0>=n.height)return void(s=window.setTimeout(h,50));const l=100;(n.width<l||n.height<l)&&(e.style.minWidth=l+"px",e.style.minHeight=l+"px");const{className:c,style:f,text:d,densityStep:u,maxParticles:p,pointSize:m,ease:w,repelRadius:v,repelStrength:M,particleColor:x,fontFamily:y,fontSize:S,width:g,height:z,devicePixelRatio:R,onReady:P,onUpdate:C}=i,b={text:d,densityStep:u,maxParticles:p,pointSize:m,ease:w,repelRadius:v,repelStrength:M,particleColor:x,fontFamily:y,fontSize:S,width:g,height:z,devicePixelRatio:R,onReady:P,onUpdate:C};r.current=new o(e,b),"undefined"!=typeof ResizeObserver&&(t=new ResizeObserver(()=>{r.current&&r.current.resize()}),t.observe(e))};return requestAnimationFrame(h),()=>{s&&clearTimeout(s),t&&t.disconnect(),r.current&&(r.current.destroy(),r.current=null)}},[]),h(()=>{if(!r.current)return;const{text:t,densityStep:s,maxParticles:h,pointSize:e,ease:n,repelRadius:o,repelStrength:a,particleColor:l,fontFamily:c,fontSize:f,width:d,height:u,devicePixelRatio:p}=i;r.current.updateConfig({text:t,densityStep:s,maxParticles:h,pointSize:e,ease:n,repelRadius:o,repelStrength:a,particleColor:l,fontFamily:c,fontSize:f,width:d,height:u,devicePixelRatio:p})},[i.text,i.densityStep,i.maxParticles,i.pointSize,i.ease,i.repelRadius,i.repelStrength,i.particleColor,i.fontFamily,i.fontSize,i.width,i.height,i.devicePixelRatio]),e(n,()=>({morph(t){r.current?r.current.morph(t):console.warn("MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.")},scatter(){r.current?r.current.scatter():console.warn("MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.")},updateConfig(t){r.current?r.current.updateConfig(t):console.warn("MasonEffect: 인스턴스가 아직 초기화되지 않았습니다.")},destroy(){r.current&&(r.current.destroy(),r.current=null)}}));const l={width:"100%",height:"100%",minHeight:i.height||400,position:"relative",...i.style};return t.createElement("div",{ref:a,className:i.className,style:l})});a.displayName="MasonEffect";export{a as default};
|