Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bbazukun123 committed Feb 14, 2024
1 parent c66ca0e commit 422222a
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/radial-blur/RadialBlurFilter.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// eslint-disable-next-line camelcase
import { deprecation, Filter, GlProgram, GpuProgram, v8_0_0 } from 'pixi.js';
import { deprecation, Filter, GlProgram, GpuProgram } from 'pixi.js';
import { vertex, wgslVertex } from '../defaults';
import fragment from './radial-blur.frag';
import source from './radial-blur.wgsl';

import type { PointData } from 'pixi.js';

type DeprecatedPointLike = PointData | number[];

export interface RadialBlurFilterOptions
{
/**
Expand All @@ -21,7 +18,7 @@ export interface RadialBlurFilterOptions
* once defined in the constructor
* @default {x:0,y:0}
*/
center?: PointData;
center?: PointData | number[];
/**
* The kernelSize of the blur filter. Must be odd number >= 3
* @default 5
Expand Down Expand Up @@ -64,22 +61,22 @@ export class RadialBlurFilter extends Filter

constructor(options?: RadialBlurFilterOptions);
/**
* @deprecated since 8.0.0
* @deprecated since 6.0.0
*
* @param {number} [angle=0] - Sets the angle of the motion for blur effect.
* @param {PIXI.Point|number[]} [center=[0,0]] - The center of the radial.
* @param {number} [kernelSize=5] - The kernelSize of the blur filter. Must be odd number >= 3
* @param {number} [radius=-1] - The maximum size of the blur radius, `-1` is infinite
*/
constructor(angle?: number, center?: DeprecatedPointLike, kernelSize?: number, radius?: number);
constructor(...args: [RadialBlurFilterOptions?] | [number?, DeprecatedPointLike?, number?, number?])
constructor(angle?: number, center?: PointData | number[], kernelSize?: number, radius?: number);
constructor(...args: [RadialBlurFilterOptions?] | [number?, (PointData | number[])?, number?, number?])
{
let options = args[0] ?? {};

if (typeof options === 'number')
{
// eslint-disable-next-line max-len
deprecation(v8_0_0, 'RadialBlurFilter constructor params are now options object. See params: { angle, center, kernelSize, radius }');
deprecation('6.0.0', 'RadialBlurFilter constructor params are now options object. See params: { angle, center, kernelSize, radius }');

options = { angle: options };

Expand Down Expand Up @@ -155,11 +152,10 @@ export class RadialBlurFilter extends Filter
* @default {x:0,y:0}
*/
get center(): PointData { return this.uniforms.uCenter; }
set center(value: PointData | DeprecatedPointLike)
set center(value: PointData | number[])
{
if (Array.isArray(value))
{
deprecation(v8_0_0, 'RadialBlurFilter.center now only accepts {x,y} PointData.');
value = { x: value[0], y: value[1] };
}

Expand Down

0 comments on commit 422222a

Please sign in to comment.