luna-shader-toy-player
TypeScript icon, indicating that this package has built-in type declarations

0.5.1 • Public • Published

Luna Shader Toy Player

Shader toy player.

Demo

https://luna.liriliri.io/?path=/story/shader-toy-player

Install

Add the following script and style to your page.

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-shader-toy-player/luna-shader-toy-player.css" />
<script src="//cdn.jsdelivr.net/npm/luna-shader-toy-player/luna-shader-toy-player.js"></script>

You can also get it on npm.

npm install luna-shader-toy-player --save
import 'luna-shader-toy-player/luna-shader-toy-player.css'
import LunaShaderToyPlayer from 'luna-shader-toy-player'

Usage

const container = document.getElementById('container')
const shaderToyPlayer = new LunaShaderToyPlayer(container)

shaderToyPlayer.setOption('renderPass', [
  {
    inputs: [],
    outputs: [],
    code: `void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = fragCoord/iResolution.xy;
    vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));
    fragColor = vec4(col,1.0);
}`,
    name: 'Image',
    description: '',
    type: 'image',
  },
])

Configuration

  • controls(boolean): Player controls.
  • renderPass(any[]): Render pass.

Readme

Keywords

Package Sidebar

Install

npm i luna-shader-toy-player

Weekly Downloads

4

Version

0.5.1

License

MIT

Unpacked Size

1.27 MB

Total Files

30

Last publish

Collaborators

  • surunzi