Skip to content

Instantly share code, notes, and snippets.

@michaelmang
Created June 27, 2017 19:25
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 michaelmang/a07bc58635932311eecfd8a13898a007 to your computer and use it in GitHub Desktop.
Save michaelmang/a07bc58635932311eecfd8a13898a007 to your computer and use it in GitHub Desktop.
VideoElement.js
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