A fast, flexible CD+Graphics (CD+G) renderer
npm install cdgraphicsA fast, flexible CD+Graphics (CD+G) renderer.
* Designed for requestAnimationFrame
* Audio synchronization when used with currentTime
* Optional background keying (transparency)
* Reports background RGBA and content bounds for each frame
* Supports all modern browsers
* No dependencies
bash
npm i cdgraphics
`API
$3
Instantiates a new renderer with the given CD+G file data. The data must be an ArrayBuffer, which can be had via the Response of a fetch().
`js
import CDGraphics from 'cdgraphics'
let cdgfetch(cdgFileUrl)
.then(response => response.arrayBuffer())
.then(buffer => {
cdg = new CDGraphics(buffer)
})
`$3
Renders the frame at the given time index.
-
time: Number (in fractional seconds) of the frame to render. Should usually be the currentTime from an