phaser/src/fx/Bokeh.js

60 lines
1.9 KiB
JavaScript
Raw Normal View History

2023-02-16 15:04:37 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013-2023 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
2023-02-16 23:49:14 +00:00
var Class = require('../utils/Class');
2023-02-17 01:08:52 +00:00
var Controller = require('./Controller');
2023-02-16 15:04:37 +00:00
var FX_CONST = require('./const');
/**
* @classdesc
*
* @class Bokeh
2023-02-17 01:08:52 +00:00
* @extends Phaser.FX.Controller
2023-02-16 23:49:14 +00:00
* @memberof Phaser.FX
2023-02-16 15:04:37 +00:00
* @constructor
* @since 3.60.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx.
* @param {number} [radius=0.5] - The radius of the bokeh effect.
* @param {number} [amount=1] - The amount of the bokeh effect.
* @param {number} [contrast=0.2] - The color contrast of the bokeh effect.
* @param {boolean} [isTiltShift=false] - Is this a bokeh or Tile Shift effect?
* @param {number} [blurX=1] - If Tilt Shift, the amount of horizontal blur.
* @param {number} [blurY=1] - If Tilt Shift, the amount of vertical blur.
* @param {number} [strength=1] - If Tilt Shift, the strength of the blur.
2023-02-16 15:04:37 +00:00
*/
var Bokeh = new Class({
2023-02-17 01:08:52 +00:00
Extends: Controller,
2023-02-16 15:04:37 +00:00
initialize:
function Bokeh (gameObject, radius, amount, contrast, isTiltShift, blurX, blurY, strength)
2023-02-16 15:04:37 +00:00
{
if (radius === undefined) { radius = 0.5; }
if (amount === undefined) { amount = 1; }
if (contrast === undefined) { contrast = 0.2; }
if (isTiltShift === undefined) { isTiltShift = false; }
if (blurX === undefined) { blurX = 1; }
if (blurY === undefined) { blurY = 1; }
if (strength === undefined) { strength = 1; }
2023-02-17 01:08:52 +00:00
Controller.call(this, FX_CONST.BOKEH, gameObject);
2023-02-16 15:04:37 +00:00
this.radius = radius;
this.amount = amount;
this.contrast = contrast;
this.isTiltShift = isTiltShift;
this.strength = strength;
this.blurX = blurX;
this.blurY = blurY;
2023-02-16 15:04:37 +00:00
}
});
module.exports = Bokeh;