Skip to content

feat: add support for resizing emoji particles #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion registry/magicui/cool-mode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,14 @@ const applyParticleEffect = (
circleSVG.setAttribute("height", size.toString());

particle.appendChild(circleSVG);
} else {
} else if (particleType.startsWith("http") || particleType.startsWith("/")) {
// Handle URL-based images
particle.innerHTML = `<img src="${particleType}" width="${size}" height="${size}" style="border-radius: 50%">`;
} else {
// Handle emoji or text characters
const fontSizeMultiplier = 3; // Make emojis 3x bigger
const emojiSize = size * fontSizeMultiplier;
particle.innerHTML = `<div style="font-size: ${emojiSize}px; line-height: 1; text-align: center; width: ${size}px; height: ${size}px; display: flex; align-items: center; justify-content: center; transform: scale(${fontSizeMultiplier}); transform-origin: center;">${particleType}</div>`;
}

particle.style.position = "absolute";
Expand Down