Transition.js 535 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");

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