-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
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,30 @@ | ||
import React from 'react' | ||
import clsx from 'clsx' | ||
|
||
import styles from './index.module.less' | ||
|
||
const Meteors = ({ number, className }) => { | ||
const meteors = new Array(number || 20).fill(true) | ||
return ( | ||
<> | ||
{meteors.map((el, idx) => ( | ||
<span | ||
key={'meteor' + idx} | ||
className={clsx( | ||
`${styles['animate-meteor-effect']} absolute top-1/2 left-1/2 h-0.5 w-0.5 rounded-[9999px] bg-slate-500 shadow-[0_0_0_1px_#ffffff10] rotate-[215deg]`, | ||
"before:content-[''] before:absolute before:top-1/2 before:transform before:-translate-y-[50%] before:w-[50px] before:h-[1px] before:bg-gradient-to-r before:from-[#64748b] before:to-transparent", | ||
className | ||
)} | ||
style={{ | ||
top: 0, | ||
left: Math.floor(Math.random() * (400 - -400) + -400) + 'px', | ||
animationDelay: Math.random() * (0.8 - 0.2) + 0.2 + 's', | ||
animationDuration: Math.floor(Math.random() * (10 - 2) + 2) + 's', | ||
}} | ||
></span> | ||
))} | ||
</> | ||
) | ||
} | ||
|
||
export default Meteors |
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,19 @@ | ||
.animate-meteor-effect { | ||
animation: meteor 5s linear infinite; | ||
} | ||
|
||
@keyframes meteor { | ||
0% { | ||
transform: rotate(215deg) translateX(0); | ||
opacity: 1; | ||
} | ||
|
||
70% { | ||
opacity: 1; | ||
} | ||
|
||
100% { | ||
transform: rotate(215deg) translateX(-500px); | ||
opacity: 0; | ||
} | ||
} |
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