mirror of
https://github.com/gre/gl-react.git
synced 2026-01-25 16:43:36 +00:00
next-js example (just to check it works)
This commit is contained in:
parent
dab6ded6d0
commit
c8a6d00e29
2
examples/next-js/.gitignore
vendored
Normal file
2
examples/next-js/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
.next/
|
||||
19
examples/next-js/package.json
Normal file
19
examples/next-js/package.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "next-js",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next",
|
||||
"build": "next build",
|
||||
"start": "next start"
|
||||
},
|
||||
"dependencies": {
|
||||
"gl-react": "3.14.0-beta.dab6ded6",
|
||||
"gl-react-dom": "3.14.0-beta.dab6ded6",
|
||||
"next": "^5.0.0",
|
||||
"react": "^16.2.0",
|
||||
"react-dom": "^16.2.0"
|
||||
}
|
||||
}
|
||||
27
examples/next-js/pages/index.js
Normal file
27
examples/next-js/pages/index.js
Normal file
@ -0,0 +1,27 @@
|
||||
import React from "react";
|
||||
import { Shaders, Node, GLSL } from "gl-react";
|
||||
import { Surface } from "gl-react-dom";
|
||||
|
||||
const shaders = Shaders.create({
|
||||
helloBlue: {
|
||||
frag: GLSL`
|
||||
precision highp float;
|
||||
varying vec2 uv;
|
||||
uniform float blue;
|
||||
void main() {
|
||||
gl_FragColor = vec4(uv.x, uv.y, blue, 1.0);
|
||||
}`
|
||||
}
|
||||
});
|
||||
class HelloBlue extends React.Component {
|
||||
render() {
|
||||
const { blue } = this.props;
|
||||
return <Node shader={shaders.helloBlue} uniforms={{ blue }} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default () => (
|
||||
<Surface width={300} height={300}>
|
||||
<HelloBlue blue={0.5} />
|
||||
</Surface>
|
||||
);
|
||||
4200
examples/next-js/yarn.lock
Normal file
4200
examples/next-js/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user