Skip to content

Latest commit

 

History

History
79 lines (63 loc) · 2.33 KB

README.md

File metadata and controls

79 lines (63 loc) · 2.33 KB

modern-filters

Minzip Version Downloads Issues License

📦 Install

npm i modern-filters

🦄 Usage

import { createTexture, createEmbossFilter, createFadeFilter } from 'modern-filters'

const image = new Image()
image.src = 'example.jpg'
image.onload = () => {
  const texture = createTexture({
    source: image,
    view: document.querySelector('canvas'),
  })

  texture.useFilter([
    createEmbossFilter({ strength: 5 }),
    createFadeFilter({ duration: 1.2 }),
  ])

  // This zero is filter current time of timeline
  texture.draw(0)
  // texture.draw(1)

  // Read image data for current frame
  // texture.readImageData()
}

🚀 Filter creaters

createFilter(options?: Options)

Types

See the types.ts

Reference