Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #138 from w3bdesign/dev
Browse files Browse the repository at this point in the history
Finpuss animasjoner
  • Loading branch information
w3bdesign authored Jan 25, 2022
2 parents 59a1083 + f789ec8 commit cb792ed
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 17 deletions.
54 changes: 37 additions & 17 deletions src/components/Index/Hero.component.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
import { gsap } from "gsap";
import { useEffect, useRef } from "react";

import { FaReact, FaVuejs, FaPhp } from "react-icons/fa";
import { SiTypescript, SiWordpress } from "react-icons/si";

type TTimeLineRef = HTMLDivElement | null;

const Hero = (): JSX.Element => {
const boxRef = useRef<TTimeLineRef>(null);

// wait until DOM has been rendered
useEffect(() => {
gsap.from(boxRef.current, {
scale: 0.2,
duration: 2,
opacity: 0,
ease: "Expo.easeOut",
delay: 0.2
});

gsap.to(".text-reveal", {
clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
stagger: 0.8,
duration: 0.3,
delay: 0.2,
y: 0
});
gsap
.timeline()
.from(boxRef.current, {
scale: 0.6,
duration: 1.5,
opacity: 0,
ease: "Expo.easeOut",
delay: 0.2
})
.to(
".text-reveal",
{
clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
stagger: 0.7,
duration: 0.3,
y: 0
},
"-=0.5"
)
.to(".icon-reveal", {
clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
stagger: 0.6,
duration: 0.2,
x: 0,
delay: 0.6
});
}, []);

return (
Expand All @@ -31,8 +45,7 @@ const Hero = (): JSX.Element => {
aria-label="Kontainer for animasjoner av introtekst"
id="main-hero"
data-testid="main-hero"
className="flex flex-col justify-center text-lg"
>
className="flex flex-col justify-center text-lg">
<div ref={boxRef} className="p-4 mt-6 mb-6 bg-white opacity-75">
<div className="text-black rounded">
<section role="intro" aria-label="Introduksjonstekst">
Expand All @@ -44,6 +57,13 @@ const Hero = (): JSX.Element => {
Jeg kan PHP, mySQL, Wordpress, Javascript, Typescript, React, Vue, Redux, Docker,
Photoshop og mye mer.
</h2>
<span className="flex justify-center p-6">
<FaReact className="icon-reveal mr-6" title="React ikon" size="3em" />
<FaVuejs className="icon-reveal mr-6" title="Vue ikon" size="3em" />
<SiTypescript className="icon-reveal mr-6" title="Typescript ikon" size="3em" />
<SiWordpress className="icon-reveal mr-6" title="Wordpress ikon" size="3em" />
<FaPhp className="icon-reveal mr-6" title="PHP ikon" size="3em" />
</span>
</section>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ a {
transform: translateY(-3em);
clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
}

.icon-reveal {
transition: all 1.5s;
transform: translateX(3em);
clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
}

1 comment on commit cb792ed

@vercel
Copy link

@vercel vercel bot commented on cb792ed Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.