Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Latest commit

 

History

History
39 lines (32 loc) · 1013 Bytes

snippets.org

File metadata and controls

39 lines (32 loc) · 1013 Bytes

reliable way to unlock videos

Click events is the reliable event to unlock videos.

const onClick = () => {
  dom.removeEventListener('click', onClick)
  // unlock videos
}

dom.addEventListener('click', onClick)

create DOM masks for buttons

There’s a displayObject called `button`. Create a DOM mask for it:

const { x, y, width, height } = button.getBounds()
const buttonMask = new DOM('button')
      .setAlpha(0)
      .setPosition(x, y)
      .setSize(width, height)

this.addChild(buttonMask)

create filter for sprites

// filter for brightness
const colorMatrix = new PIXI.filters.ColorMatrixFilter()
colorMatrix.brightness(0.9)
sprite.setFilters(colorMatrix)
// filter for trimming colors
const colorMatrix = new PIXI.filters.ColorMatrixFilter()
colorMatrix.blackAndWhite(true)
sprite.setFilters(colorMatrix)