Skip to content
Permalink
6434347984
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
49 lines (46 sloc) 1.26 KB
import React from 'react'
import { StaggeredMotion , spring } from 'react-motion'
const AnimatedGridContents = props => {
return (
< StaggeredMotion
defaultStyles = { props . items . map ( ( ) => ( { opacity : 1 , translateY : - 30 } ) ) }
styles = { prevInterpolatedStyles =>
prevInterpolatedStyles . map ( ( _ , i ) => {
return i ===
? { opacity : spring ( 1 ) , translateY : spring ( ) }
: {
opacity : prevInterpolatedStyles [ i - 1 ] . opacity ,
translateY : spring ( prevInterpolatedStyles [ i - 1 ] . translateY )
}
} )
}
>
{ interpolatingStyles => (
< div className = "grid" >
{ interpolatingStyles . map ( ( style , i ) => (
< div
className = "card"
key = { props . items [ i ] }
style = { {
opacity : style . opacity ,
transform : `translateY( ${ style . translateY } px)`
} }
>
{ props . items [ i ] }
< / div >
) ) }
< / div >
) }
< / StaggeredMotion >
)
}
const TransitionGrid = ( { items , visible } ) => {
return (
visible && (
< div className = "animated-grid" >
< AnimatedGridContents items = { items } / >
< / div >
)
)
}
export default TransitionGrid

友情链: IM·体育网上直播_IM·体育赛事最新版_im体育官网在线官网在线 | im体育app平台下载|IM体育v2.3 安卓版|IM体育今天官网赛表 | im体育推荐官网_im体育今晚高清_im体育买软件 | 2022im体育网网址_分析观看比赛_2022im体育在线软件 | IM体育开户网址-Im体育官方网站-IM体育期胜负彩专家分析 | im电竞体育登录入口_IM·体育比分分析在线_IM·体育v8.5 IOS版 | im体育app官网下载|IM体育最新今天观看|IM体育赛事注册 |