Skip to content

Commit

Permalink
Animating only the home page logo
Browse files Browse the repository at this point in the history
  • Loading branch information
4lejandrito committed Nov 9, 2022
1 parent 200181d commit e9877f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/creepyface-site/pages/index.tsx
Expand Up @@ -18,7 +18,7 @@ export default function Home({ create = false }) {
<CreateProvider open={create} navigate>
<section className="description">
<header>
<Logo />
<Logo animate />
</header>
<p>
{translate('The JavaScript library that makes your face look at')}{' '}
Expand Down
5 changes: 3 additions & 2 deletions packages/creepyface-site/src/components/Logo.tsx
Expand Up @@ -33,6 +33,7 @@ const Pointer = (props: {
}

export default function Logo(props: {
animate?: boolean
onPointerPositionChange?: (position: Point) => void
}) {
const [animating, setAnimating] = useState(false)
Expand All @@ -45,8 +46,8 @@ export default function Logo(props: {
<div className="wrapper">
<svg
className={animating ? ' animate' : ''}
onMouseEnter={() => setAnimating(true)}
onClick={() => setAnimating(true)}
onMouseEnter={props.animate ? () => setAnimating(true) : undefined}
onClick={props.animate ? () => setAnimating(true) : undefined}
onAnimationEnd={() => setAnimating(false)}
viewBox={`0 0 317.8 78`}
xmlns="http://www.w3.org/2000/svg"
Expand Down

0 comments on commit e9877f9

Please sign in to comment.