Transition.js 561 Bytes
Newer Older
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
1 2
import {PixelRatio} from "react-native";
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();
8
    return <GL.Node
9
      preload
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
10
      shader={shader}
11 12
      width={width}
      height={height}
13
      backgroundColor="transparent"
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
14 15 16 17
      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
  },
  { displayName: "Transition" });