-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create snowing component
- Loading branch information
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
frontend/src/Components/SnowflakesOverlay/SnowflakesOverlay.module.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,80 @@ | ||
.snowflake { | ||
position: fixed; | ||
z-index: 9999; | ||
user-select: none; | ||
cursor: default; | ||
animation-name: snowflakes-fall, snowflakes-shake; | ||
animation-timing-function: linear, ease-in-out; | ||
animation-iteration-count: infinite, infinite; | ||
animation-play-state: running, running; | ||
color: #ffffff; | ||
font-size: 1em; | ||
font-family: Arial, sans-serif; | ||
text-shadow: 0 0 5px #000000; | ||
} | ||
|
||
@-webkit-keyframes snowflakes-fall { | ||
0% { | ||
top: -10%; | ||
} | ||
100% { | ||
top: 100%; | ||
} | ||
} | ||
|
||
@-webkit-keyframes snowflakes-shake { | ||
0%, | ||
100% { | ||
-webkit-transform: translateX(0); | ||
transform: translateX(0); | ||
} | ||
50% { | ||
-webkit-transform: translateX(80px); | ||
transform: translateX(80px); | ||
} | ||
} | ||
|
||
@keyframes snowflakes-fall { | ||
0% { | ||
top: -10%; | ||
} | ||
100% { | ||
top: 100%; | ||
} | ||
} | ||
|
||
@keyframes snowflakes-shake { | ||
0%, | ||
100% { | ||
transform: translateX(0); | ||
} | ||
50% { | ||
transform: translateX(80px); | ||
} | ||
} | ||
|
||
@for $i from 1 through 48 { | ||
.snowflake:nth-of-type(#{$i}) { | ||
left: #{random(100)} + '%'; | ||
top: calc(-10% - #{random(10)}) + '%'; | ||
animation-duration: | ||
#{10 + random(5)}s, | ||
#{2.5 + random(2)}s; | ||
animation-delay: | ||
#{($i * 0.2) + random(5)} + 's', | ||
#{random(4)} + 's'; | ||
|
||
@keyframes snowflakes-shake-#{$i} { | ||
0%, | ||
100% { | ||
transform: translateX(0); | ||
} | ||
50% { | ||
transform: translateX(#{40 + random(40)}px); | ||
} | ||
} | ||
animation-name: | ||
snowflakes-fall, | ||
snowflakes-shake-#{$i}; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
frontend/src/Components/SnowflakesOverlay/SnowflakesOverlay.tsx
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,35 @@ | ||
import styles from './SnowflakesOverlay.module.scss'; | ||
|
||
type SnowflakesOverlayProps = { | ||
intensity?: 'low' | 'medium' | 'high' | 'extreme'; | ||
}; | ||
|
||
const SNOWFLAKE_SYMBOLS = ['❅', '❆', '❅', '❆', '❅', '❆', '❅', '❆', '❅', '❆', '❅', '❆']; | ||
|
||
export function SnowflakesOverlay({ intensity = 'low' }: SnowflakesOverlayProps) { | ||
let snowflakes = SNOWFLAKE_SYMBOLS; | ||
|
||
switch (intensity) { | ||
case 'medium': | ||
snowflakes = [...snowflakes, ...SNOWFLAKE_SYMBOLS]; | ||
break; | ||
case 'high': | ||
snowflakes = [...snowflakes, ...SNOWFLAKE_SYMBOLS, ...SNOWFLAKE_SYMBOLS]; | ||
break; | ||
case 'extreme': | ||
snowflakes = [...snowflakes, ...SNOWFLAKE_SYMBOLS, ...SNOWFLAKE_SYMBOLS, ...SNOWFLAKE_SYMBOLS]; | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return ( | ||
<div className={styles.snowflakes} aria-hidden="true"> | ||
{snowflakes.map((symbol, index) => ( | ||
<div key={index} className={styles.snowflake}> | ||
{symbol} | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |
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 @@ | ||
export { SnowflakesOverlay } from './SnowflakesOverlay'; |
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