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 f162440 commit 01b5d43
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/motion-blur/MotionBlurFilter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable max-len */
// eslint-disable-next-line camelcase
import { deprecation, Filter, GlProgram, GpuProgram, ObservablePoint, PointData, v8_0_0 } from 'pixi.js';
import { deprecation, Filter, GlProgram, GpuProgram, ObservablePoint, PointData } from 'pixi.js';
import { vertex, wgslVertex } from '../defaults';
import fragment from './motion-blur.frag';
import source from './motion-blur.wgsl';
Expand All @@ -13,7 +12,7 @@ export interface MotionBlurFilterOptions
* once defined in the constructor
* @default {x:0,y:0}
*/
velocity?: PointData;
velocity?: PointData | number[];
/**
* The kernelSize of the blur filter. Must be odd number >= 5
* @default 5
Expand Down Expand Up @@ -67,15 +66,15 @@ export class MotionBlurFilter extends Filter
if (Array.isArray(options) || ('x' in options && 'y' in options) || options instanceof ObservablePoint)
{
// eslint-disable-next-line max-len
deprecation(v8_0_0, 'MotionBlurFilter constructor params are now options object. See params: { velocity, kernelSize, offset }');
deprecation('6.0.0', 'MotionBlurFilter constructor params are now options object. See params: { velocity, kernelSize, offset }');

const x = 'x' in options ? options.x : options[0];
const y = 'y' in options ? options.y : options[1];

options = { velocity: { x, y } };

if (args[1]) options.kernelSize = args[1];
if (args[2]) options.offset = args[2];
if (args[1] !== undefined) options.kernelSize = args[1];
if (args[2] !== undefined) options.offset = args[2];
}

options = { ...MotionBlurFilter.DEFAULT_OPTIONS, ...options };
Expand Down Expand Up @@ -125,7 +124,6 @@ export class MotionBlurFilter extends Filter
{
if (Array.isArray(value))
{
deprecation(v8_0_0, 'MotionBlurFilter.velocity now only accepts {x, y} PointData type.');
value = { x: value[0], y: value[1] };
}

Expand Down

0 comments on commit 01b5d43

Please sign in to comment.