2023-02-14 23:45:44 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2013-2023 Photon Storm Ltd.
|
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
var BaseFX = require('./BaseFX');
|
|
|
|
var Class = require('../../utils/Class');
|
|
|
|
var FX_CONST = require('./const');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @classdesc
|
|
|
|
*
|
2023-02-15 00:05:33 +00:00
|
|
|
* @class Gradient
|
2023-02-14 23:45:44 +00:00
|
|
|
* @extends Phaser.GameObjects.FX.BaseFX
|
|
|
|
* @memberof Phaser.GameObjects.FX
|
|
|
|
* @constructor
|
|
|
|
* @since 3.60.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx.
|
|
|
|
*/
|
2023-02-15 00:05:33 +00:00
|
|
|
var Gradient = new Class({
|
2023-02-14 23:45:44 +00:00
|
|
|
|
|
|
|
Extends: BaseFX,
|
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
2023-02-15 00:05:33 +00:00
|
|
|
function Gradient (gameObject)
|
2023-02-14 23:45:44 +00:00
|
|
|
{
|
2023-02-15 00:05:33 +00:00
|
|
|
BaseFX.call(this, FX_CONST.GRADIENT, gameObject);
|
|
|
|
|
2023-02-15 00:50:31 +00:00
|
|
|
this.alpha = 0.2;
|
|
|
|
|
|
|
|
// How many 'chunks' the gradient is divided in to, over the entire
|
|
|
|
// height of the texture. Leave at zero for a smoothed gradient.
|
2023-02-15 00:05:33 +00:00
|
|
|
this.size = 0;
|
|
|
|
|
|
|
|
this.fromX = 0;
|
|
|
|
this.fromY = 0;
|
|
|
|
|
|
|
|
this.toX = 0;
|
|
|
|
this.toY = 1;
|
2023-02-14 23:45:44 +00:00
|
|
|
|
|
|
|
this.glcolor1 = [ 255, 0, 0 ];
|
|
|
|
this.glcolor2 = [ 0, 255, 0 ];
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2023-02-15 00:05:33 +00:00
|
|
|
module.exports = Gradient;
|