Transition.js 625 Bytes
Newer Older
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
1
import { PixelRatio } from "react-native";
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
2
import React from "react";
3
import GL from "gl-react";
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
4

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