/vedajs

Framework for Shader Arts

Primary LanguageTypeScriptMIT LicenseMIT

logo

VEDA.js

Shader Art Framework


screenshot

npm version license MIT Greenkeeper badge hashtag #vedajs



Install

npm install vedajs

Usage

import Veda from 'vedajs';

const veda = new Veda();

veda.setCanvas(canvas);
veda.loadFragmentShader(code);

veda.play();

Advanced Usage

Fragment shader

veda.loadFragmentShader(code);

This is equivalent to

veda.loadShader({ fs: code });

Vertex shader

veda.loadVertexShader(code);

This is equivalent to

veda.loadShader({ vs: code });

Using both

Pass a shader object to loadShader.

veda.loadShader({
  vs: vertexShaderCode,
  fs: fragmentShaderCode,
});

Multipath rendering

Pass an array of shaders to loadShader.

veda.loadShader([
  {
    vs: vertexShaderFor1stPass,
    fs: fragmentShaderFor1stPass,
  },
  {
    fs: fragmentShaderFor2ndPass,
  },
]);

Audio input

veda.toggleAudio(true);
veda.loadShader(shader);

MIDI input

veda.toggleMidi(true);
veda.loadShader(shader);

WebCam input

veda.toggleCamera(true);
veda.loadShader(shader);

Keyboard input

veda.toggleKeyboard(true);
veda.loadShader(shader);

Gamepad input

veda.toggleGamepad(true);
veda.loadShader(shader);

Sound shader

veda.loadSoundShader(shader);
veda.playSound();

Author

Takayosi Amagi

LICENSE

MIT