Commit a78e1c71 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

simplify code

parent 0877cc44
import React, {Component} from "react";
import {View, Animated } from "react-native";
import {View, Animated} from "react-native";
import {AnimatedSurface} from "gl-react-native";
import GL from "gl-react";
import Dimensions from "Dimensions";
const { width: viewportW, height: viewportH } = Dimensions.get("window");
export default class Tests extends Component {
export default class AnimatedExample extends Component {
state = {
heightValue: new Animated.Value(200)
heightValue: new Animated.Value(200),
};
componentWillMount () {
let i = 0;
this.interval = setInterval(() => {
this.interval = setInterval(() =>
Animated.spring(this.state.heightValue, {
toValue: ++i % 2 ? 500 : 200,
}).start();
}, 1000);
}).start(), 1000);
}
componentWillUnmount () {
clearInterval(this.interval);
}
render () {
const { heightValue } = this.state;
return <View style={{
backgroundColor: "#000",
flex: 1,
paddingTop: 60,
alignItems: "center"
}}>
return <View style={{ paddingTop: 60, alignItems: "center" }}>
<AnimatedSurface
width={200}
height={heightValue}>
<GL.Node shader={{
<GL.Node shader={{// inline example
frag: `
precision highp float;
varying vec2 uv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment