Guest User

Untitled

a guest
Jan 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. import React from 'react';
  2. import {
  3. AppRegistry,
  4. asset,
  5. Pano,
  6. Text,
  7. View,
  8. VideoPano,
  9. MediaPlayerState,
  10. VideoControl,
  11. Animated,
  12. Model,
  13. VrButton,
  14. AmbientLight,
  15. PointLight
  16. } from 'react-vr';
  17.  
  18. const AnimatedModel = Animated.createAnimatedComponent(Model);
  19. import { Easing } from 'react-native';
  20.  
  21. export default class WelcomeToVR extends React.Component {
  22. constructor(){
  23. super()
  24. this.state = {
  25. rotation: new Animated.Value(0),
  26. slideValue: new Animated.Value(1.5),
  27. opacityValue: new Animated.Value(0),
  28. fadeSlide: new Animated.Value(0)
  29. }
  30. }
  31.  
  32. rotate = () => {
  33. this.state.rotation.setValue(0);
  34. Animated.timing(
  35. this.state.rotation,
  36. {
  37. toValue: 360,
  38. duration: 10000,
  39. // easing: Easing.linear
  40. }
  41. ).start(this.rotate);
  42. }
  43.  
  44.  
  45. componentDidMount() {
  46. Animated.timing(
  47. this.state.slideValue,
  48. {
  49. toValue: 0,
  50. duration: 1000,
  51. delay: 1000,
  52. easing: Easing.ease
  53. }
  54. ).start();
  55.  
  56.  
  57. Animated.timing(
  58. this.state.opacityValue,
  59. {
  60. toValue: 1,
  61. duration: 1000,
  62. delay: 1000,
  63. easing: Easing.ease
  64. }
  65. ).start();
  66.  
  67. Animated.timing(
  68. this.state.fadeSlide,
  69. {
  70. toValue: 1,
  71. duration: 1000,
  72. delay: 1000,
  73. easing: Easing.ease
  74. }
  75. ).start();
  76. }
  77.  
  78.  
  79. render() {
  80. return (
  81. <View>
  82.  
  83. <VideoPano source={asset('5.mp4')}
  84. loop={true}
  85. muted={true}
  86. style={{
  87. width: 10
  88. }}
  89. />
  90.  
  91. <View>
  92. <VrButton
  93. onClickSound={{
  94. mp3: asset('click.mp3'),
  95. }}
  96. >
  97. <Text
  98. style={{
  99. backgroundColor: '#777879',
  100. fontSize: 0.8,
  101. layoutOrigin: [0.5, 0.5],
  102. paddingLeft: 0.2,
  103. paddingRight: 0.2,
  104. textAlign: 'center',
  105. textAlignVertical: 'center',
  106. transform: [{translate: [0, 0, -3]}],
  107. }}>
  108. hello
  109. </Text>
  110. </VrButton>
  111. </View>
  112.  
  113. <View>
  114. <Animated.Text
  115. style={{
  116. backgroundColor: '#777879',
  117. fontSize: 0.5,
  118. opacity: this.state.fadeSlide,
  119. layoutOrigin: [0.5, 0.5],
  120. fontWeight: '400',
  121. textAlign: 'center',
  122. textAlignVertical: 'center',
  123. transform: [{translate: [0, 0, -3]},
  124. {translateY: this.state.fadeSlide}
  125. ]
  126. }}>
  127. tes fade text
  128. </Animated.Text>
  129.  
  130. </View>
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137. </View>
  138. );
  139. }
  140. };
  141.  
  142. AppRegistry.registerComponent('WelcomeToVR', () => WelcomeToVR);
Add Comment
Please, Sign In to add comment