New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webgl-sketch

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webgl-sketch

A WebGL canvas—shader wrapper library

  • 0.5.0-pre1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

WebGL Sketch

npm

Example

import * as Sketch from 'webgl-sketch';

Sketch.create({
  canvas: document.getElementById('Output'),
  fragmentShaderSource: require('my-fragment.glsl'),
  size: [window.innerWidth, window.innerHeight],
  uniforms: {
    baseColor: [0.424, 0.357, 0.482],
    seed: 42.0
  },
  vertexShaderSource: require('basic-vertex.glsl')
});

API

create (options = {})

Instantiates a WebGL context on a canvas, and renders shaders to it.
Options can include:

  • canvas (optional) – An existing canvas element to render into; if not supplied, a new canvas is created instead.
  • dynamic (optional) – A boolean, whether to animate dynamic rendering of the canvas, which sets the uniform float u_time each render; defaults to false.
  • fragmentShaderSource – GLSL shader source string to use as the fragment shader.
  • size (optional) – An array of [width, height] to size the canvas to; if not supplied, [200, 200] is used.
  • uniforms (optional) – An object to inject as uniforms into the fragment shader, using each key as the uniform name (e.g., "name" as u_name) and the value encoded based on type(s).
  • vertexShaderSource – GLSL shader source string to use as the vertex shader.

Keywords

FAQs

Package last updated on 17 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc