Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi-essentials/gradients

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi-essentials/gradients - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

12

CHANGELOG.json

@@ -5,2 +5,14 @@ {

{
"version": "0.0.3",
"tag": "@pixi-essentials/gradients_v0.0.3",
"date": "Sun, 31 Jan 2021 03:42:33 GMT",
"comments": {
"patch": [
{
"comment": "Upgrade build to output correct IIFE namespace"
}
]
}
},
{
"version": "0.0.2",

@@ -7,0 +19,0 @@ "tag": "@pixi-essentials/gradients_v0.0.2",

9

CHANGELOG.md
# Change Log - @pixi-essentials/gradients
This log was last generated on Sat, 26 Dec 2020 22:47:29 GMT and should not be manually modified.
This log was last generated on Sun, 31 Jan 2021 03:42:33 GMT and should not be manually modified.
## 0.0.3
Sun, 31 Jan 2021 03:42:33 GMT
### Patches
- Upgrade build to output correct IIFE namespace
## 0.0.2

@@ -6,0 +13,0 @@ Sat, 26 Dec 2020 22:47:29 GMT

131

dist/gradients.js
/* eslint-disable */
/*!
* @pixi-essentials/gradients - v0.0.1
* Compiled Sat, 26 Dec 2020 22:14:07 UTC
* @pixi-essentials/gradients - v0.0.2
* Compiled Sun, 31 Jan 2021 03:34:48 UTC
*

@@ -21,3 +21,3 @@ * @pixi-essentials/gradients is licensed under the MIT License.

* Converts a hexadecimal color into a CSS color string.
*
*
* @ignore

@@ -27,16 +27,19 @@ * @param color - The hexadecimal form of the color.

function cssColor(color) {
var string = color.toString(16);
let string = color.toString(16);
while (string.length < 6) {
string = "0" + string;
string = `0${string}`;
}
return "#" + string;
return `#${string}`;
}
var tempSourceFrame = new math.Rectangle();
var tempDestinationFrame = new math.Rectangle();
const tempSourceFrame = new math.Rectangle();
const tempDestinationFrame = new math.Rectangle();
/**
* Factory class for generating color-gradient textures.
*/
var GradientFactory = /** @class */ (function () {
function GradientFactory() {
}
class GradientFactory
{
/**

@@ -46,6 +49,6 @@ * Renders a linear-gradient into `renderTexture` that starts from (x0, y0) and ends at (x1, y1). These

* will be rendered.
*
*
* This method can be called inside a render cycle, and will preserve the renderer state. However, the current implementation
* causes a batch renderer flush.
*
*
* @param renderer - The renderer to use for drawing the gradient.

@@ -62,33 +65,57 @@ * @param renderTexture - The texture to render the gradient into.

*/
GradientFactory.createLinearGradient = function (renderer, renderTexture, options) {
var x0 = options.x0, y0 = options.y0, x1 = options.x1, y1 = options.y1, colorStops = options.colorStops;
var canvas = document.createElement('canvas');
static createLinearGradient(
renderer,
renderTexture,
options
)
{
const { x0, y0, x1, y1, colorStops } = options;
const canvas = document.createElement('canvas');
canvas.width = renderTexture.width;
canvas.height = renderTexture.height;
var context = canvas.getContext('2d');
var gradient = context.createLinearGradient(x0, y0, x1, y1);
colorStops.forEach(function (stop) {
const context = canvas.getContext('2d');
const gradient = context.createLinearGradient(x0, y0, x1, y1);
colorStops.forEach((stop) => {
gradient.addColorStop(stop.offset, cssColor(stop.color));
});
context.fillStyle = gradient;
context.fillRect(0, 0, renderTexture.width, renderTexture.height);
// Store the current render-texture binding.
var renderTarget = renderer.renderTexture.current;
var sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
var destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
var renderSprite = new sprite.Sprite(core.Texture.from(canvas));
const renderTarget = renderer.renderTexture.current;
const sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
const destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
const renderSprite = new sprite.Sprite(core.Texture.from(canvas));
renderer.batch.flush();
renderer.renderTexture.bind(renderTexture);
renderSprite.render(renderer);
renderer.batch.flush();
renderer.renderTexture.bind(renderTarget, sourceFrame, destinationFrame);
return renderTexture;
};
}
/**
* Renders a radial-gradient into `renderTexture` that starts at the circle centered at (x0, y0) of radius r0 and
* ends at the circle centered at (x1, y1) of radius r1.
*
*
* This method can be called inside a render cycle, and will preserve the renderer state. However, the current implementation
* causes a batch renderer flush.
*
*
* @param renderer - The renderer to use for drawing the gradient.

@@ -106,29 +133,55 @@ * @param renderTexture - The texture to render the gradient into.

*/
GradientFactory.createRadialGradient = function (renderer, renderTexture, options) {
var x0 = options.x0, y0 = options.y0, r0 = options.r0, x1 = options.x1, y1 = options.y1, r1 = options.r1, colorStops = options.colorStops;
var canvas = document.createElement('canvas');
static createRadialGradient(
renderer,
renderTexture,
options
)
{
const { x0, y0, r0, x1, y1, r1, colorStops } = options;
const canvas = document.createElement('canvas');
canvas.width = renderTexture.width;
canvas.height = renderTexture.height;
var context = canvas.getContext('2d');
var gradient = context.createRadialGradient(x0, y0, r0, x1, y1, r1);
colorStops.forEach(function (stop) {
const context = canvas.getContext('2d');
const gradient = context.createRadialGradient(x0, y0, r0, x1, y1, r1);
colorStops.forEach((stop) => {
gradient.addColorStop(stop.offset, cssColor(stop.color));
});
context.fillStyle = gradient;
context.fillRect(0, 0, renderTexture.width, renderTexture.height);
// Store the current render-texture binding.
var renderTarget = renderer.renderTexture.current;
var sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
var destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
var renderSprite = new sprite.Sprite(core.Texture.from(canvas));
const renderTarget = renderer.renderTexture.current;
const sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
const destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
const renderSprite = new sprite.Sprite(core.Texture.from(canvas));
renderer.batch.flush();
renderer.renderTexture.bind(renderTexture);
renderSprite.render(renderer);
renderer.batch.flush();
renderer.renderTexture.bind(renderTarget, sourceFrame, destinationFrame);
return renderTexture;
};
return GradientFactory;
}());
}
}
;
exports.GradientFactory = GradientFactory;

@@ -135,0 +188,0 @@

/* eslint-disable */
/*!
* @pixi-essentials/gradients - v0.0.1
* Compiled Sat, 26 Dec 2020 22:14:07 UTC
* @pixi-essentials/gradients - v0.0.2
* Compiled Sun, 31 Jan 2021 03:34:48 UTC
*

@@ -18,3 +18,3 @@ * @pixi-essentials/gradients is licensed under the MIT License.

* Converts a hexadecimal color into a CSS color string.
*
*
* @ignore

@@ -24,16 +24,19 @@ * @param color - The hexadecimal form of the color.

function cssColor(color) {
var string = color.toString(16);
let string = color.toString(16);
while (string.length < 6) {
string = "0" + string;
string = `0${string}`;
}
return "#" + string;
return `#${string}`;
}
var tempSourceFrame = new Rectangle();
var tempDestinationFrame = new Rectangle();
const tempSourceFrame = new Rectangle();
const tempDestinationFrame = new Rectangle();
/**
* Factory class for generating color-gradient textures.
*/
var GradientFactory = /** @class */ (function () {
function GradientFactory() {
}
class GradientFactory
{
/**

@@ -43,6 +46,6 @@ * Renders a linear-gradient into `renderTexture` that starts from (x0, y0) and ends at (x1, y1). These

* will be rendered.
*
*
* This method can be called inside a render cycle, and will preserve the renderer state. However, the current implementation
* causes a batch renderer flush.
*
*
* @param renderer - The renderer to use for drawing the gradient.

@@ -59,33 +62,57 @@ * @param renderTexture - The texture to render the gradient into.

*/
GradientFactory.createLinearGradient = function (renderer, renderTexture, options) {
var x0 = options.x0, y0 = options.y0, x1 = options.x1, y1 = options.y1, colorStops = options.colorStops;
var canvas = document.createElement('canvas');
static createLinearGradient(
renderer,
renderTexture,
options
)
{
const { x0, y0, x1, y1, colorStops } = options;
const canvas = document.createElement('canvas');
canvas.width = renderTexture.width;
canvas.height = renderTexture.height;
var context = canvas.getContext('2d');
var gradient = context.createLinearGradient(x0, y0, x1, y1);
colorStops.forEach(function (stop) {
const context = canvas.getContext('2d');
const gradient = context.createLinearGradient(x0, y0, x1, y1);
colorStops.forEach((stop) => {
gradient.addColorStop(stop.offset, cssColor(stop.color));
});
context.fillStyle = gradient;
context.fillRect(0, 0, renderTexture.width, renderTexture.height);
// Store the current render-texture binding.
var renderTarget = renderer.renderTexture.current;
var sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
var destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
var renderSprite = new Sprite(Texture.from(canvas));
const renderTarget = renderer.renderTexture.current;
const sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
const destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
const renderSprite = new Sprite(Texture.from(canvas));
renderer.batch.flush();
renderer.renderTexture.bind(renderTexture);
renderSprite.render(renderer);
renderer.batch.flush();
renderer.renderTexture.bind(renderTarget, sourceFrame, destinationFrame);
return renderTexture;
};
}
/**
* Renders a radial-gradient into `renderTexture` that starts at the circle centered at (x0, y0) of radius r0 and
* ends at the circle centered at (x1, y1) of radius r1.
*
*
* This method can be called inside a render cycle, and will preserve the renderer state. However, the current implementation
* causes a batch renderer flush.
*
*
* @param renderer - The renderer to use for drawing the gradient.

@@ -103,30 +130,54 @@ * @param renderTexture - The texture to render the gradient into.

*/
GradientFactory.createRadialGradient = function (renderer, renderTexture, options) {
var x0 = options.x0, y0 = options.y0, r0 = options.r0, x1 = options.x1, y1 = options.y1, r1 = options.r1, colorStops = options.colorStops;
var canvas = document.createElement('canvas');
static createRadialGradient(
renderer,
renderTexture,
options
)
{
const { x0, y0, r0, x1, y1, r1, colorStops } = options;
const canvas = document.createElement('canvas');
canvas.width = renderTexture.width;
canvas.height = renderTexture.height;
var context = canvas.getContext('2d');
var gradient = context.createRadialGradient(x0, y0, r0, x1, y1, r1);
colorStops.forEach(function (stop) {
const context = canvas.getContext('2d');
const gradient = context.createRadialGradient(x0, y0, r0, x1, y1, r1);
colorStops.forEach((stop) => {
gradient.addColorStop(stop.offset, cssColor(stop.color));
});
context.fillStyle = gradient;
context.fillRect(0, 0, renderTexture.width, renderTexture.height);
// Store the current render-texture binding.
var renderTarget = renderer.renderTexture.current;
var sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
var destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
var renderSprite = new Sprite(Texture.from(canvas));
const renderTarget = renderer.renderTexture.current;
const sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
const destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
const renderSprite = new Sprite(Texture.from(canvas));
renderer.batch.flush();
renderer.renderTexture.bind(renderTexture);
renderSprite.render(renderer);
renderer.batch.flush();
renderer.renderTexture.bind(renderTarget, sourceFrame, destinationFrame);
return renderTexture;
};
return GradientFactory;
}());
}
}
export { GradientFactory };
//# sourceMappingURL=gradients.es.js.map
/* eslint-disable */
/*!
* @pixi-essentials/gradients - v0.0.1
* Compiled Sat, 26 Dec 2020 22:14:07 UTC
* @pixi-essentials/gradients - v0.0.2
* Compiled Sun, 31 Jan 2021 03:34:48 UTC
*

@@ -22,3 +22,3 @@ * @pixi-essentials/gradients is licensed under the MIT License.

* Converts a hexadecimal color into a CSS color string.
*
*
* @ignore

@@ -28,16 +28,19 @@ * @param color - The hexadecimal form of the color.

function cssColor(color) {
var string = color.toString(16);
let string = color.toString(16);
while (string.length < 6) {
string = "0" + string;
string = `0${string}`;
}
return "#" + string;
return `#${string}`;
}
var tempSourceFrame = new math.Rectangle();
var tempDestinationFrame = new math.Rectangle();
const tempSourceFrame = new math.Rectangle();
const tempDestinationFrame = new math.Rectangle();
/**
* Factory class for generating color-gradient textures.
*/
var GradientFactory = /** @class */ (function () {
function GradientFactory() {
}
class GradientFactory
{
/**

@@ -47,6 +50,6 @@ * Renders a linear-gradient into `renderTexture` that starts from (x0, y0) and ends at (x1, y1). These

* will be rendered.
*
*
* This method can be called inside a render cycle, and will preserve the renderer state. However, the current implementation
* causes a batch renderer flush.
*
*
* @param renderer - The renderer to use for drawing the gradient.

@@ -63,33 +66,57 @@ * @param renderTexture - The texture to render the gradient into.

*/
GradientFactory.createLinearGradient = function (renderer, renderTexture, options) {
var x0 = options.x0, y0 = options.y0, x1 = options.x1, y1 = options.y1, colorStops = options.colorStops;
var canvas = document.createElement('canvas');
static createLinearGradient(
renderer,
renderTexture,
options
)
{
const { x0, y0, x1, y1, colorStops } = options;
const canvas = document.createElement('canvas');
canvas.width = renderTexture.width;
canvas.height = renderTexture.height;
var context = canvas.getContext('2d');
var gradient = context.createLinearGradient(x0, y0, x1, y1);
colorStops.forEach(function (stop) {
const context = canvas.getContext('2d');
const gradient = context.createLinearGradient(x0, y0, x1, y1);
colorStops.forEach((stop) => {
gradient.addColorStop(stop.offset, cssColor(stop.color));
});
context.fillStyle = gradient;
context.fillRect(0, 0, renderTexture.width, renderTexture.height);
// Store the current render-texture binding.
var renderTarget = renderer.renderTexture.current;
var sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
var destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
var renderSprite = new sprite.Sprite(core.Texture.from(canvas));
const renderTarget = renderer.renderTexture.current;
const sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
const destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
const renderSprite = new sprite.Sprite(core.Texture.from(canvas));
renderer.batch.flush();
renderer.renderTexture.bind(renderTexture);
renderSprite.render(renderer);
renderer.batch.flush();
renderer.renderTexture.bind(renderTarget, sourceFrame, destinationFrame);
return renderTexture;
};
}
/**
* Renders a radial-gradient into `renderTexture` that starts at the circle centered at (x0, y0) of radius r0 and
* ends at the circle centered at (x1, y1) of radius r1.
*
*
* This method can be called inside a render cycle, and will preserve the renderer state. However, the current implementation
* causes a batch renderer flush.
*
*
* @param renderer - The renderer to use for drawing the gradient.

@@ -107,30 +134,54 @@ * @param renderTexture - The texture to render the gradient into.

*/
GradientFactory.createRadialGradient = function (renderer, renderTexture, options) {
var x0 = options.x0, y0 = options.y0, r0 = options.r0, x1 = options.x1, y1 = options.y1, r1 = options.r1, colorStops = options.colorStops;
var canvas = document.createElement('canvas');
static createRadialGradient(
renderer,
renderTexture,
options
)
{
const { x0, y0, r0, x1, y1, r1, colorStops } = options;
const canvas = document.createElement('canvas');
canvas.width = renderTexture.width;
canvas.height = renderTexture.height;
var context = canvas.getContext('2d');
var gradient = context.createRadialGradient(x0, y0, r0, x1, y1, r1);
colorStops.forEach(function (stop) {
const context = canvas.getContext('2d');
const gradient = context.createRadialGradient(x0, y0, r0, x1, y1, r1);
colorStops.forEach((stop) => {
gradient.addColorStop(stop.offset, cssColor(stop.color));
});
context.fillStyle = gradient;
context.fillRect(0, 0, renderTexture.width, renderTexture.height);
// Store the current render-texture binding.
var renderTarget = renderer.renderTexture.current;
var sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
var destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
var renderSprite = new sprite.Sprite(core.Texture.from(canvas));
const renderTarget = renderer.renderTexture.current;
const sourceFrame = tempSourceFrame.copyFrom(renderer.renderTexture.sourceFrame);
const destinationFrame = tempDestinationFrame.copyFrom(renderer.renderTexture.destinationFrame);
const renderSprite = new sprite.Sprite(core.Texture.from(canvas));
renderer.batch.flush();
renderer.renderTexture.bind(renderTexture);
renderSprite.render(renderer);
renderer.batch.flush();
renderer.renderTexture.bind(renderTarget, sourceFrame, destinationFrame);
return renderTexture;
};
return GradientFactory;
}());
}
}
exports.GradientFactory = GradientFactory;
//# sourceMappingURL=gradients.js.map
{
"name": "@pixi-essentials/gradients",
"version": "0.0.2",
"version": "0.0.3",
"description": "Generates textures with color gradients",

@@ -46,5 +46,5 @@ "main": "lib/gradients.js",

"rollup": "^2.28.2",
"@pixi-build-tools/rollup-configurator": "^1.0.5",
"@pixi-build-tools/rollup-configurator": "^1.0.8",
"typescript": "~4.1.3"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc