aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-02-18 19:36:23 +0100
committerArmand Philippot <git@armandphilippot.com>2022-02-18 19:36:23 +0100
commitad00b2dc9492d20b3b8c3dcd7c5b425ee7f8d404 (patch)
tree2530905a57d08a3f2933cf24c37c3f42278d22be /src/components
parentc0f7c1c22749b66a0ec588753e7f705f3ca4224e (diff)
refactor(animations): replace width animations with transform
Animations based on width or height can be expensive and can cause lower performances. So, instead I use transform to obtain the same effect.
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Branding/Branding.module.scss8
-rw-r--r--src/components/Branding/Branding.tsx6
2 files changed, 9 insertions, 5 deletions
diff --git a/src/components/Branding/Branding.module.scss b/src/components/Branding/Branding.module.scss
index 402fa8b..ed2cc16 100644
--- a/src/components/Branding/Branding.module.scss
+++ b/src/components/Branding/Branding.module.scss
@@ -95,7 +95,7 @@
&::after {
content: "|";
display: block;
- width: 0;
+ width: 100%;
height: 100%;
position: absolute;
top: 0;
@@ -104,6 +104,8 @@
color: var(--color-primary-darker);
font-weight: 400;
visibility: hidden;
+ transform: scaleX(0) translateX(100%);
+ transform-origin: right;
animation: var(--branding-name-animation);
}
}
@@ -124,7 +126,7 @@
&::after {
content: "|";
display: block;
- width: 0;
+ width: 100%;
height: 100%;
position: absolute;
top: 0;
@@ -133,6 +135,8 @@
color: var(--color-primary-darker);
font-weight: 400;
visibility: hidden;
+ transform: scaleX(0) translateX(100%);
+ transform-origin: right;
animation: var(--branding-job-animation);
}
}
diff --git a/src/components/Branding/Branding.tsx b/src/components/Branding/Branding.tsx
index 4ec52c3..07b9259 100644
--- a/src/components/Branding/Branding.tsx
+++ b/src/components/Branding/Branding.tsx
@@ -24,7 +24,7 @@ const Branding: BrandingReturn = ({ isHome = false }) => {
if (logoRef.current) {
logoRef.current.style.setProperty(
'--branding-logo-animation',
- 'flip-logo 5.4s ease-in 0s 1'
+ 'flip-logo 6.4s ease-in 0s 1'
);
}
}, []);
@@ -33,7 +33,7 @@ const Branding: BrandingReturn = ({ isHome = false }) => {
if (titleRef.current) {
titleRef.current.style.setProperty(
'--branding-name-animation',
- 'blink 0.5s ease-in-out 0s 1, branding-name-typing 2.8s linear 0s 1'
+ 'blink 0.5s ease-in-out 0s 1, branding-name-typing 3s linear 0s 1'
);
}
}, []);
@@ -42,7 +42,7 @@ const Branding: BrandingReturn = ({ isHome = false }) => {
if (jobRef.current) {
jobRef.current.style.setProperty(
'--branding-job-animation',
- 'branding-job-typing 7s linear 0s 1, blink 0.8s ease-in-out 5s 3'
+ 'branding-job-typing 8s linear 0s 1, blink 0.8s ease-in-out 6s 3'
);
}
}, []);