-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
41 lines (31 loc) · 978 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import {
Animated, View, Image, TouchableOpacity, Easing,
} from 'react-native';
const App = () => {
const [val, setVal] = React.useState(0);
const spinValue = new Animated.Value(val);
const rotateImage = () => {
setVal(val + 1);
};
const spin = spinValue.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '90deg']
});
return (
<>
<View>
<Animated.View>
<Animated.Image
style={{transform: [{rotate: spin}], height: 400, width: 400, alignSelf: 'center', marginTop: 80}}
source={require('./src/assets/harshil.jpeg')} />
</Animated.View>
<TouchableOpacity style={{paddingRight: 4, marginTop: 100}} onPress={rotateImage}>
<Image style={{width: 60, height: 60, alignSelf: 'center'}}
source={require('./src/assets/rotate.png')}/>
</TouchableOpacity>
</View>
</>
);
};
export default App;