Skip to content

Commit

Permalink
Update Projects.tsx
Browse files Browse the repository at this point in the history
Key Changes for Shaking Animation:
Shaking Effect:

The whileHover property now uses x: ["0%", "-10%", "10%", "0%"] to simulate the shake. This moves the card left (-10%), right (10%), and then back to its original position (0%).
The transition property applies a spring-based animation with stiffness and damping to control the speed and smoothness of the shake.
Smooth Transition:

A spring-based transition is used (type: "spring", stiffness: 100, damping: 10) to give the shake a bouncy feel, making it more natural and appealing.
  • Loading branch information
aniruddhaadak80 authored Nov 9, 2024
1 parent fe731f0 commit 08754f9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/Projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ const Projects: React.FC = () => {
className="bg-gray-100 rounded-lg overflow-hidden shadow-lg transition-transform duration-300 hover:scale-105"
onClick={() => setSelectedProject(project.id)}
whileHover={{
scale: 1.05,
rotateX: -10,
rotateY: 10,
transition: { type: 'spring', stiffness: 300 },
x: ["0%", "-10%", "10%", "0%"], // Shaking effect on X axis
transition: { type: "spring", stiffness: 100, damping: 10 }
}}
whileTap={{ scale: 0.95 }}
>
Expand Down

0 comments on commit 08754f9

Please sign in to comment.