I am using react-motion to loop through a bunch of images. I'm trying to make the background change programmatically after a certain amount of time.
Asked
Active
Viewed 1,441 times
0
-
I'm trying to know if it can be done with react-motion, I have 3 background images and I'm trying to loop through them with a cross fade animation. – AziCode Sep 23 '16 at 18:56
1 Answers
0
The component render should be something like this. Motion and spring are from 'react-motion' package. Checkout the code for the photo demo for more details.
<Motion style={{height: spring(currHeight), width: spring(currWidth)}}>
{container =>
<div className="demo4-inner" style={container}>
{configs.map((style, i) =>
<Motion key={i} style={style}>
{style =>
<img className="demo4-photo" src={`./${i}.jpg`} style={style} />
}
</Motion>
)}
</div>
}
</Motion>

vijayst
- 20,359
- 18
- 69
- 113