- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
import { vertex } from '@tools/fragments';
import fragment from './dot.frag';
import { Filter } from '@pixi/core';
// @author Mat Groves http://matgroves.com/ @Doormat23
// original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/fun/dotscreen.js
/**
* This filter applies a dotscreen effect making display objects appear to be made out of
* black and white halftone dots like an old printer.<br>
* 
*
* @class
* @extends PIXI.Filter
* @memberof PIXI.filters
* @see @pixi/filter-dot
* @see pixi-filters
*/
class DotFilter extends Filter
{
/**
* @param {number} [scale=1] - The scale of the effect.
* @param {number} [angle=5] - The radius of the effect.
*/
constructor(scale = 1, angle = 5)
{
super(vertex, fragment);
this.scale = scale;
this.angle = angle;
}
/**
* The scale of the effect.
* @default 1
*/
get scale(): number
{
return this.uniforms.scale;
}
set scale(value: number)
{
this.uniforms.scale = value;
}
/**
* The radius of the effect.
* @default 5
*/
get angle(): number
{
return this.uniforms.angle;
}
set angle(value: number)
{
this.uniforms.angle = value;
}
}
export { DotFilter };