Skip to content

Commit

Permalink
perf: improve the breathing cricle
Browse files Browse the repository at this point in the history
  • Loading branch information
remvze committed Jul 6, 2024
1 parent ddf929f commit 3d83a14
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/components/toolbox/breathing/exercise/exercise.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,22 @@ export function Exercise() {
);

const animationVariants = {
exhale: { scale: 1, transition: { duration: durations.exhale } },
exhale: {
transform: 'translate(-50%, -50%) scale(1)',
transition: { duration: durations.exhale },
},
holdExhale: {
scale: 1,
transform: 'translate(-50%, -50%) scale(1)',
transition: { duration: durations.holdExhale || 4 },
},
holdInhale: {
scale: 1.5,
transform: 'translate(-50%, -50%) scale(1.5)',
transition: { duration: durations.holdInhale || 4 },
},
inhale: { scale: 1.5, transition: { duration: durations.inhale } },
inhale: {
transform: 'translate(-50%, -50%) scale(1.5)',
transition: { duration: durations.inhale },
},
};

useEffect(() => {
Expand Down Expand Up @@ -97,11 +103,7 @@ export function Exercise() {
animate={phase}
className={styles.circle}
key={selectedExercise}
transition={{ ease: 'linear' }}
variants={animationVariants}
transformTemplate={(_, generatedString) =>
`translate(-50%, -50%) ${generatedString}`
}
/>
<p className={styles.phase}>{getLabel(phase)}</p>
</div>
Expand Down

0 comments on commit 3d83a14

Please sign in to comment.