Skip to content

Instantly share code, notes, and snippets.

@abdurrahmanekr
Last active June 11, 2017 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdurrahmanekr/fd5ac6c782091346c6fea9e53ebc46f5 to your computer and use it in GitHub Desktop.
Save abdurrahmanekr/fd5ac6c782091346c6fea9e53ebc46f5 to your computer and use it in GitHub Desktop.
javascript,react-native,animation,animated
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