/VideoElement.js Secret
Created
June 27, 2017 19:25
Star
You must be signed in to star a gist
VideoElement.js
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 from 'react'; | |
import { | |
Video, | |
View, | |
asset, | |
Animated | |
} from 'react-vr'; | |
import { Easing } from 'react-native'; | |
//Element | |
class VideoElement extends React.Component { | |
constructor() { | |
super(); | |
this.state = { fadeIn: new Animated.Value(0) }; | |
} | |
componentDidMount() { | |
Animated.sequence([ | |
Animated.timing( | |
this.state.fadeIn, | |
{ | |
toValue: 1, | |
duration: 2000, | |
easing: Easing.ease | |
} | |
) | |
]).start(); | |
} | |
render() { | |
return ( | |
<Animated.View style={{ margin: 0.1, height: 4, opacity: this.state.fadeIn}}> | |
<Video style={{height: 4}} source={asset('fireplace.mp4')} /> | |
</Animated.View> | |
) | |
} | |
} | |
module.exports = VideoElement; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment