Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use as background / container for React components ? #4

Closed
revskill10 opened this issue Dec 31, 2018 · 2 comments
Closed

Use as background / container for React components ? #4

revskill10 opened this issue Dec 31, 2018 · 2 comments

Comments

@revskill10
Copy link

Could i put children inside shadertoy-react to have background ?

@mvilledieu
Copy link
Owner

What kind of background do you need?

If you are willing to get a classic background: in CSS just pass a style uniform to your component this way:

<ShadertoyReact style={{ background: "red" }} fs={fragmentShader} />

Just make sure to pass an alpha value to your gl_FragColor = vec4(r, g, b, a);

The other way of having a background is to directly render the background image or color in your shader and don't have a transparent shader.

@Jarred-Sumner
Copy link

@revskill10 -- you can wrap it in a container and then set the ShaderToy component to position: absolute with a z-index of 0 and then the text with a z-index of 1

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants