react-easy-transition icon indicating copy to clipboard operation
react-easy-transition copied to clipboard

how to do slide in/ out?

Open cellis opened this issue 8 years ago • 3 comments

It would be nice if there were examples to do slide in/out as with react-router-transition.

cellis avatar Dec 02 '16 01:12 cellis

not sure what you are trying to achieve. care to provide a link with an example ?

misterfresh avatar Mar 01 '17 21:03 misterfresh

Maybe smth like this?

image

deathmood avatar Mar 19 '17 12:03 deathmood

I did a slide in using aphrodite-css then the following code:

const enteringKeyframes = {
  'from': {
    transform: 'translate3d(100%, 0, 0) skewX(-30deg)',
    opacity: 0,
    zIndex: -99
  },
  '60%': {
    transform: 'skewX(20deg)',
    opacity: 1
  },
  '80%': {
    transform: 'skewX(-5deg)',
    opacity: 1
  },
  'to': {
    transform: 'none',
    opacity: 1,
    zIndex: 99
  }
};
const styles = StyleSheet.create({
  base: {
    transition: 'all 0.6s ease-in'
  },
  entering: {
    animationName: [enteringKeyframes],
    animationDuration: '600ms',
    animationTimingFunction: 'ease-out',
    animationFillMode: 'forwards'
  }
})

let Popup = ({ popupVisible }) => <div
      style={Object.assign({},
        {
          position: 'fixed',
          width: '100%',
          height: '100%',
          top: 0,
          left: 0,
          animationDuration: 0.6
        },
        (!popupVisible) && {
          opacity: 0,
          zIndex: -99
        }
      )}
      className={css(
        (popupVisible === 'entering') && styles.entering
      )}
    >popup contents</div>

misterfresh avatar Mar 20 '17 10:03 misterfresh