Created
October 1, 2019 16:02
-
-
Save kitze/9708df3721861231c3e6336470949172 to your computer and use it in GitHub Desktop.
reveal-animations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createGlobalStyle, keyframes } from 'styled-components'; | |
import fadeIn from 'react-animations/lib/fade-in'; | |
import slideInLeft from 'react-animations/lib/slide-in-left'; | |
import slideInRight from 'react-animations/lib/slide-in-right'; | |
export const reveals = { | |
fadeInUp: 'fade-in-up', | |
fadeIn: 'fade-in', | |
slideInLeft: 'slide-in-left', | |
slideInRight: 'slide-in-right' | |
}; | |
function translate3d(a, b, c) { | |
return 'translate3d(' + a + ', ' + b + ', ' + c + ')'; | |
} | |
const fadeInUp = { | |
from: { | |
opacity: 0, | |
transform: translate3d(0, '50px', 0) | |
}, | |
to: { | |
opacity: 1, | |
transform: 'none' | |
} | |
}; | |
export const RevealGlobalStyles = createGlobalStyle` | |
.${reveals.fadeInUp} { | |
animation: ${keyframes`${fadeInUp}`} 500ms; | |
} | |
.${reveals.fadeIn} { | |
animation: ${keyframes`${fadeIn}`} 500ms; | |
} | |
.${reveals.slideInLeft} { | |
animation: ${keyframes`${slideInLeft}`} 500ms; | |
} | |
.${reveals.slideInRight} { | |
animation: ${keyframes`${slideInRight}`} 500ms; | |
} | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment