Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 829 Bytes

README.md

File metadata and controls

36 lines (25 loc) · 829 Bytes

sakuraFx-typescript

Animation based on WebGL.

It is Sakura for TypeScript version.
fork from gryng02

Install pnpm add -D sakurafx-typescript

In html

<canvas id="sakura"></canvas>

In TypeScript

//import
import sakura from "sakurafx-typescript";

//get canvas
const canvas = document.getElementById("sakura") as HTMLCanvasElement

//set canvas size
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

//initialization and get render
const render = sakura(canvas) as () => void

if(render) {
  //creat animation callback
  function callback(){
    render() //render
    requestAnimationFrame(callback) //call self in next frame
  }

  callback()
}