-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from UjjwalSaini07/Patch-Branch38
Pre Release 3 Stabilizing
- Loading branch information
Showing
10 changed files
with
104 additions
and
17 deletions.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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
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,45 @@ | ||
import { useState } from 'react'; | ||
import { motion, useAnimationControls } from 'framer-motion'; | ||
|
||
const TextSpan = ({ children }) => { | ||
const controls = useAnimationControls(); | ||
const [isPlaying, setIsPlaying] = useState(false); | ||
|
||
const rubberBand = () => { | ||
controls.start({ | ||
scale: [1, 1.4, 0.75, 1.25, 0.9, 1], | ||
// rotate: [0, 10, -10, 5, -5, 0], // Adds a slight rotation effect | ||
color: ['#e73e0d', '#ff5722', '#ff9800', '#ff5722', '#e73e0d'], | ||
textShadow: [ | ||
'0px 0px 0px rgba(0,0,0,0)', | ||
'4px 4px 10px rgba(0,0,0,0.2)', | ||
'2px 2px 8px rgba(0,0,0,0.3)', | ||
'4px 4px 10px rgba(0,0,0,0.2)', | ||
'0px 0px 0px rgba(0,0,0,0)', | ||
], | ||
transition: { | ||
times: [0, 0.3, 0.5, 0.7, 0.9], | ||
duration: 1, | ||
}, | ||
}); | ||
setIsPlaying(true); | ||
}; | ||
|
||
return ( | ||
<motion.span | ||
animate={controls} | ||
onMouseOver={() => { | ||
if (!isPlaying) rubberBand(); | ||
}} | ||
onAnimationComplete={() => setIsPlaying(false)} | ||
style={{ | ||
display: 'inline-block', | ||
cursor: 'pointer', | ||
}} | ||
> | ||
{children} | ||
</motion.span> | ||
); | ||
}; | ||
|
||
export default TextSpan; |
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.