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 f8ce809 commit d94bafd
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/shockwave/ShockwaveFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ import {
PointData,
RenderSurface,
Texture,
// eslint-disable-next-line camelcase
v8_0_0,
} from 'pixi.js';
import { vertex, wgslVertex } from '../defaults';
import fragment from './shockwave.frag';
import source from './shockwave.wgsl';

type DeprecatedPointLike = PointData | number[];

interface DeprecatedShockwaveFilterOptions
{
amplitude: number;
Expand Down Expand Up @@ -103,7 +99,7 @@ export class ShockwaveFilter extends Filter
*/
constructor(options?: ShockwaveFilterOptions);
/**
* @deprecated since 8.0.0
* @deprecated since 6.0.0
*
* @param {PIXI.PointData|number[]} [center=[0.5, 0.5]] - See `center` property.
* @param {object} [options] - The optional parameters of shockwave filter.
Expand All @@ -114,23 +110,20 @@ export class ShockwaveFilter extends Filter
* @param {number} [options.radius=4] - See `radius` property.
* @param {number} [time=0] - See `time` property.
*/
constructor(center?: DeprecatedPointLike, options?: Partial<DeprecatedShockwaveFilterOptions>, time?: number);
constructor(center?: PointData | number[], options?: Partial<DeprecatedShockwaveFilterOptions>, time?: number);
// eslint-disable-next-line max-len
constructor(...args: [ShockwaveFilterOptions?] | [DeprecatedPointLike?, Partial<DeprecatedShockwaveFilterOptions>?, number?])
constructor(...args: [ShockwaveFilterOptions?] | [(PointData | number[])?, Partial<DeprecatedShockwaveFilterOptions>?, number?])
{
let options = args[0] ?? {};

if (Array.isArray(options) || ('x' in options && 'y' in options))
{
// eslint-disable-next-line max-len
deprecation(v8_0_0, 'ShockwaveFilter constructor params are now options object. See params: { center, speed, amplitude, wavelength, brightness, radius, time }');

const x = 'x' in options ? options.x : options[0];
const y = 'y' in options ? options.y : options[1];
deprecation('6.0.0', 'ShockwaveFilter constructor params are now options object. See params: { center, speed, amplitude, wavelength, brightness, radius, time }');

options = { center: { x, y }, ...args[1] };
options = { center: options, ...args[1] } as ShockwaveFilterOptions;

if (args[2]) options.time = args[2];
if (args[2] !== undefined) options.time = args[2];
}

options = { ...ShockwaveFilter.DEFAULT_OPTIONS, ...options };
Expand Down Expand Up @@ -191,11 +184,10 @@ export class ShockwaveFilter extends Filter
* @default [0,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, 'ShockwaveFilter.center now only accepts {x,y} PointData.');
value = { x: value[0], y: value[1] };
}

Expand Down

0 comments on commit d94bafd

Please sign in to comment.