@@ -76,6 +76,79 @@ WithEasing.args = {
7676 easing : options [ 0 ] ,
7777} ;
7878
79+ const Template2 = ( ) => {
80+ const amount = 16 ;
81+ const offA = 0 ;
82+ const offB = 500 ;
83+ const unit = 'px' ;
84+ const elements = new Array ( amount ) . fill ( null ) . map ( ( x , i ) => i ) ;
85+
86+ return (
87+ < ParallaxProvider >
88+ < div className = "w-full p-20" >
89+ { options . map ( ( easing ) => (
90+ < div
91+ className = "relative flex flex-row items-center justify-between"
92+ style = { { height : '150vh' } }
93+ >
94+ < h1 className = "absolute top-1/2 left-0 w-full text-center text-white text-4xl z-10" >
95+ { easing }
96+ </ h1 >
97+ < div className = "w-1/2 flex flex-col" >
98+ { elements . map ( ( _ , i ) => {
99+ const n = amount - i ;
100+ return (
101+ < Parallax
102+ key = { n }
103+ className = "bg-blue-500 m-1 opacity-1 w-10 h-10"
104+ easing = { easing }
105+ rootMargin = { {
106+ top : 0 ,
107+ right : 0 ,
108+ bottom : 0 ,
109+ left : 0 ,
110+ } }
111+ rotate = { [ 0 , 90 ] }
112+ translateX = { [ `${ offA } ${ unit } ` , `${ offB } ${ unit } ` ] }
113+ // translateX={[`${offA * n}${unit}`, `${offB * n}${unit}`]}
114+ >
115+ < div className = "w-10 h-10 bg-purple-400 rounded-md" />
116+ </ Parallax >
117+ ) ;
118+ } ) }
119+ </ div >
120+ < div className = "w-1/2 flex flex-col items-end" >
121+ { elements . map ( ( _ , i ) => {
122+ const n = amount - i ;
123+ return (
124+ < Parallax
125+ key = { n }
126+ className = "bg-blue-500 m-1 opacity-1 w-10 h-10"
127+ easing = { easing }
128+ rootMargin = { {
129+ top : 0 ,
130+ right : 0 ,
131+ bottom : 0 ,
132+ left : 0 ,
133+ } }
134+ rotate = { [ 0 , 90 ] }
135+ translateX = { [ `${ - 1 * offA } ${ unit } ` , `${ - 1 * offB } ${ unit } ` ] }
136+ // translateX={[`${offA * n}${unit}`, `${offB * n}${unit}`]}
137+ >
138+ < div className = "w-10 h-10 bg-green-400 rounded-md" />
139+ </ Parallax >
140+ ) ;
141+ } ) }
142+ </ div >
143+ </ div >
144+ ) ) }
145+ </ div >
146+ </ ParallaxProvider >
147+ ) ;
148+ } ;
149+
150+ export const WithAllEasing = Template2 . bind ( { } ) ;
151+
79152export default {
80153 title : '<Parallax> Easing' ,
81154 component : WithEasing ,
0 commit comments