Browse Source

fix(YooBackground): make background image also move in the first 10 seconds

dev 0.0.5a
kdxcxs 4 years ago
parent
commit
c139df8fdf
  1. 11
      src/ui/YooBackground.js

11
src/ui/YooBackground.js

@ -10,6 +10,17 @@ export default function YooBackground() {
zIndex: -1, zIndex: -1,
}, },
}); });
// The animation won't play for the first 10 seconds
// if we just use setInterval. So we start the animation
// at the component mounted just for the first 10 seconds.
Animated.timing(imgPosition, {
toValue: {
x: -Math.floor(Math.random() * 5000),
y: -Math.floor(Math.random() * 3000),
},
duration: 10000,
useNativeDriver: true,
}).start();
setInterval(() => { setInterval(() => {
Animated.timing(imgPosition, { Animated.timing(imgPosition, {
toValue: { toValue: {

Loading…
Cancel
Save