Skip to content

Commit

Permalink
website: Add more animations.. will prob need to tone this down
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Nov 23, 2020
1 parent f5b9aed commit a1a5779
Showing 1 changed file with 59 additions and 10 deletions.
69 changes: 59 additions & 10 deletions src/website/Landing.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import {Global} from '@emotion/core';
import {css, Global} from '@emotion/core';
import styled from '@emotion/styled';
import {motion, Variants} from 'framer-motion';

Expand Down Expand Up @@ -58,7 +58,12 @@ const Landing = () => (

<ActivityLink transition={{delay: 2}} initial={{opacity: 0}} animate={{opacity: 1}} />

<OverlaysSection>
<OverlaysSection
initial="initial"
animate="animate"
variants={{animate: {transition: {delayChildren: 1, staggerChildren: 6}}}}
>
<OverlayShade />
<ExampleContent>
<NowPlayingContainer>
<ExampleOverlay />
Expand All @@ -67,7 +72,6 @@ const Landing = () => (
<ExampleConfig />
</ConfigContainer>
</ExampleContent>
<OverlayInfo></OverlayInfo>
</OverlaysSection>
</React.Fragment>
);
Expand Down Expand Up @@ -125,18 +129,23 @@ const Spotlight = styled(motion.div)`
}
`;

const SpotlightShade = styled(motion.div)`
const shadeStyles = css`
display: block;
position: absolute;
background: #f6f6f6;
top: 0;
left: 40px;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
transform-origin: 0 100%;
`;

const SpotlightShade = styled(motion.div)`
${shadeStyles};
left: 40px;
margin: 60px;
margin-right: 0;
background: #f6f6f6;
@media only screen and (max-width: 1200px) {
right: calc(-1 * var(--padding));
Expand Down Expand Up @@ -215,15 +224,43 @@ Demo.defaultProps = {
},
};

const OverlaysSection = styled('section')`
const OverlaysSection = styled(motion.section)`
position: relative;
display: flex;
flex-direction: column;
align-items: center;
background: #38373d;
margin-bottom: 30rem;
max-height: 330px;
`;

const OverlayShade = styled(motion.div)`
${shadeStyles};
left: -40px;
right: 40px;
background: #38373d;
transform: skew(-3deg);
`;

OverlayShade.defaultProps = {
variants: {
initial: {
x: -80,
opacity: 0,
skewX: '0deg',
},
animate: {
x: 0,
opacity: 1,
skewX: '-5deg',
transition: {
type: 'spring',
stiffness: 200,
damping: 30,
},
},
},
};

const ExampleContent = styled('div')`
width: 100%;
height: 400px;
Expand All @@ -237,7 +274,7 @@ const ExampleContent = styled('div')`

const NowPlayingContainer = styled('div')``;

const ConfigContainer = styled('div')`
const ConfigContainer = styled(motion.div)`
position: relative;
background: #fff;
box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
Expand All @@ -249,6 +286,18 @@ const ConfigContainer = styled('div')`
}
`;

const OverlayInfo = styled('div')``;
ConfigContainer.defaultProps = {
variants: {
initial: {
y: 30,
opacity: 0,
},
animate: {
y: 0,
opacity: 1,
transition: {duration: 0.4},
},
},
};

export default Landing;

1 comment on commit a1a5779

@vercel
Copy link

@vercel vercel bot commented on a1a5779 Nov 23, 2020

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.