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

4 5
module.exports = GL.createComponent(
  ({ width, height, shader, progress, from, to, uniforms }) => {
6
    const scale = React.PixelRatio.get();
7
    return <GL.Node
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" });