Transition.js 564 Bytes
Newer Older
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
1 2 3
const React = require("react-native");
const GL = require("gl-react-native");

Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
4
class Transition extends GL.Component {
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
5 6
  render () {
    const { width, height, shader, progress, from, to, uniforms } = this.props;
7
    const scale = React.PixelRatio.get();
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
8
    return <GL.View
9
      preload
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
10
      shader={shader}
11 12
      width={width}
      height={height}
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
13 14 15 16 17
      opaque={false}
      uniforms={{
        progress,
        from,
        to,
18 19
        ...uniforms,
        resolution: [ width * scale, height * scale ]
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
20 21 22 23 24 25
      }}
    />;
  }
}

module.exports = Transition;