Setup to use canvas-recorder in combination with image-shader.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { draw, options, stop, start, bootstrap } from "canvas-recorder/gl"; | |
import { ImageShader } from "image-shader"; | |
// @ts-ignore | |
import fragment from "./fragmant.glsl"; | |
const SIZE = 1024; | |
const canvas = document.createElement( "canvas" ); | |
canvas.width = SIZE; | |
canvas.height = SIZE; | |
const context = canvas.getContext( "2d" ); | |
const shader = new ImageShader( canvas, fragment ); | |
options( { | |
size: [ SIZE, SIZE ], | |
canvas: shader.domElement, | |
record: false, | |
clear: false, | |
color: "black", | |
} ); | |
draw( ( _, time: number ) => { | |
// use context vairable here to draw | |
shader.update(); | |
} ); | |
bootstrap(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment