-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Holiday Snow: switch to a CSS-only implementation
Fixes #40569 Moving away from Javascript: - should be better for performance - will avoid glitches like the one described in #40569 - will avoid issues with other parts of the site, such as notifications or comments. (see p1734109348431089-slack-C029GN3KD )
- Loading branch information
Showing
5 changed files
with
97 additions
and
38 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/packages/jetpack-mu-wpcom/changelog/update-snow-scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: changed | ||
|
||
Holiday Snow: switch to a CSS-only implementation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
projects/packages/jetpack-mu-wpcom/src/features/holiday-snow/holiday-snow.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* Holiday Snow | ||
* Credits: https://codepen.io/keithclark/pen/DjXzBw | ||
* | ||
* @package automattic/jetpack-mu-wpcom | ||
*/ | ||
|
||
$grid_width: 600; | ||
$snow_density: 15; | ||
$snow_speed: 9s; | ||
$snow_selector: '#jetpack-holiday-snow'; | ||
|
||
html { | ||
$grad: ( | ||
); | ||
|
||
@for $i from 0 to $snow_density { | ||
$v: random(4) + 2; | ||
$alpha: random(5) * .1 + .5; | ||
$grad: $grad, radial-gradient($v+px $v+px at (random($grid_width - $v * 2) + $v)+px (random($grid_width - $v * 2) + $v)+px, | ||
rgba(255, 255, 255, $alpha) 50%, | ||
rgba(0, 0, 0, 0)); | ||
} | ||
|
||
#{$snow_selector} { | ||
display: inline !important; | ||
background-color: rgba(0, 0, 0, 0.05); | ||
z-index: 9999999999 !important; | ||
} | ||
|
||
#{$snow_selector}, | ||
#{$snow_selector}:before, | ||
#{$snow_selector}:after { | ||
pointer-events: none; | ||
position: fixed; | ||
top: -600px; | ||
left: 0; | ||
bottom: 0; | ||
right: 0; | ||
background-image: $grad; | ||
background-size: 600px 600px; | ||
animation: snowstorm $snow_speed linear infinite; | ||
content: ""; | ||
} | ||
|
||
#{$snow_selector}:after { | ||
margin-left: -$grid_width/3 + px; | ||
opacity: .4; | ||
animation-duration: $snow_speed * 2; | ||
animation-direction: reverse; | ||
filter: blur(3px); | ||
} | ||
|
||
#{$snow_selector}:before { | ||
animation-duration: $snow_speed * 3; | ||
animation-direction: reverse; | ||
margin-left: -$grid_width/2 + px; | ||
opacity: .65; | ||
filter: blur(1.5px); | ||
} | ||
|
||
@keyframes snowstorm { | ||
to { | ||
transform: translateY($grid_width + px); | ||
} | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
projects/packages/jetpack-mu-wpcom/src/features/holiday-snow/snowstorm.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters