Skip to content

Instantly share code, notes, and snippets.

@kitze
Created October 1, 2019 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitze/9708df3721861231c3e6336470949172 to your computer and use it in GitHub Desktop.
Save kitze/9708df3721861231c3e6336470949172 to your computer and use it in GitHub Desktop.
reveal-animations
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