Last active
June 11, 2017 07:22
-
-
Save abdurrahmanekr/fd5ac6c782091346c6fea9e53ebc46f5 to your computer and use it in GitHub Desktop.
javascript,react-native,animation,animated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { | |
AppRegistry, | |
Animated, | |
Easing, | |
} from 'react-native'; | |
export default class test extends Component { | |
constructor(props) { | |
super(props); | |
this.donusDegeri = new Animated.Value(0); | |
} | |
componentWillMount() { | |
this.dondur(); | |
} | |
dondur () { | |
this.donusDegeri.setValue(0) | |
Animated.timing( | |
this.donusDegeri, | |
{ | |
toValue: 1, | |
duration: 4000, | |
easing: Easing.linear | |
} | |
).start(() => this.dondur()) | |
} | |
render() { | |
const don = this.donusDegeri.interpolate({ | |
inputRange: [0, 1], | |
outputRange: ['0deg', '360deg'] | |
}); | |
return ( | |
<Animated.Image | |
style={{ | |
width: 323, | |
height: 170, | |
transform: [{rotate: don}] }} | |
source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}} | |
/> | |
); | |
} | |
} | |
AppRegistry.registerComponent('test', () => test); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment