Skip to content

Commit

Permalink
Fix effect collision
Browse files Browse the repository at this point in the history
  • Loading branch information
dhelonious committed Dec 31, 2024
1 parent 770155b commit 41a5ad3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mastodon/addons/snow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import { reduceMotion } from 'mastodon/initial_state';

function animate(ctx, snowflakes, canvas, maxFlakes) {
// Check for other effects
if (window.fediday) {
return; // Don't show snow if confetti effect is there
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Add new snowflake if we haven't reached the maximum
if (snowflakes.length < maxFlakes && Math.random() < 0.05) { // 5% chance each frame to add a new flake
Expand Down Expand Up @@ -42,10 +46,6 @@ function animate(ctx, snowflakes, canvas, maxFlakes) {
}

document.addEventListener('DOMContentLoaded', () => {
// Check if it's fediday
if (window.fediday) {
return; // Don't create snow effect if confetti effect is there
}
// Check if reduced motion is enabled
if (reduceMotion) {
return; // Don't create snow effect if reduced motion is preferred
Expand Down

0 comments on commit 41a5ad3

Please sign in to comment.