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

pixi.js

Package Overview
Dependencies
Maintainers
1
Versions
460
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixi.js - npm Package Compare versions

Comparing version 3.0.0-rc3 to 3.0.0-rc4

src/core/text/Text.js

2

bower.json
{
"name": "pixi.js",
"version": "3.0.0-rc3",
"version": "3.0.0-rc4",

@@ -5,0 +5,0 @@ "main": "bin/pixi.js",

{
"name": "pixi.js",
"version": "3.0.0-rc3",
"version": "3.0.0-rc4",
"description": "Pixi.js is a fast lightweight 2D library that works across all devices.",

@@ -27,3 +27,3 @@ "author": "Mat Groves",

"object-assign": "^2.0.0",
"resource-loader": "^1.3.0"
"resource-loader": "^1.3.2"
},

@@ -30,0 +30,0 @@ "devDependencies": {

@@ -17,2 +17,23 @@ /**

/**
* @property {number} PI_2 - Two Pi
* @constant
* @static
*/
PI_2: Math.PI * 2,
/**
* @property {number} RAD_TO_DEG - Constant conversion factor for converting radians to degrees
* @constant
* @static
*/
RAD_TO_DEG: 180 / Math.PI,
/**
* @property {Number} DEG_TO_RAD - Constant conversion factor for converting degrees to radians
* @constant
* @static
*/
DEG_TO_RAD: Math.PI / 180,
/**
* Constant to identify the Renderer Type.

@@ -19,0 +40,0 @@ *

var math = require('../math'),
RenderTexture = require('../textures/RenderTexture'),
EventEmitter = require('eventemitter3').EventEmitter,
CONST = require('../const'),
_tempMatrix = new math.Matrix();

@@ -286,3 +287,3 @@

// so if rotation is between 0 then we can simplify the multiplication process...
if (this.rotation % math.PI_2)
if (this.rotation % CONST.PI_2)
{

@@ -289,0 +290,0 @@ // check to see if the rotation is the same as the previous render. This means we only need to use sin and cos when rotation actually changes

@@ -16,3 +16,3 @@ /**

{
/*
/*
* @member {number} the width of the line to draw

@@ -22,11 +22,11 @@ */

/*
/*
* @member {number} the color of the line to draw
*/
this.lineColor = lineColor;
/*
/*
* @member {number} the alpha of the line to draw
*/
this.lineAlpha = lineAlpha;
/*
/*
* @member {number} cached tint of the line to draw

@@ -36,3 +36,3 @@ */

/*
/*
* @member {number} the color of the fill

@@ -42,3 +42,3 @@ */

/*
/*
* @member {number} the alpha of the fill

@@ -48,3 +48,3 @@ */

/*
/*
* @member {number} cached tint of the fill

@@ -54,3 +54,3 @@ */

/*
/*
* @member {boolean} whether or not the shape is filled with a colour

@@ -60,3 +60,3 @@ */

/*
/*
* @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw.

@@ -66,4 +66,4 @@ */

/*
* @member {number} The type of the shape, see the Const.Shapes file for all the existing types,
/*
* @member {number} The type of the shape, see the Const.Shapes file for all the existing types,
*/

@@ -70,0 +70,0 @@ this.type = shape.type;

@@ -378,3 +378,5 @@ var utils = require('../../utils'),

this.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y, recPoints);
this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius, recPoints);
this.quadraticBezierCurve(x + radius, y, x, y, x, y + radius + 0.0000000001, recPoints);
// this tiny number deals with the issue that occurs when points overlap and polyK fails to triangulate the item.
// TODO - fix this properly, this is not very elegant.. but it works for now.

@@ -397,3 +399,2 @@ if (graphicsData.fill)

var triangles = utils.PolyK.Triangulate(recPoints);
//

@@ -400,0 +401,0 @@

@@ -11,7 +11,7 @@ /**

*/
var core = {
// export core and const. We assign core to const so that the non-reference types in const remain in-tact
var core = module.exports = Object.assign(require('./const'), require('./math'), {
// utils
utils: require('./utils'),
math: require('./math'),
CONST: require('./const'),

@@ -22,6 +22,3 @@ // display

// legacy..
Stage: require('./display/Container'),
DisplayObjectContainer: require('./display/Container'),
// sprites
Sprite: require('./sprites/Sprite'),

@@ -32,2 +29,5 @@ ParticleContainer: require('./particles/ParticleContainer'),

// text
Text: require('./text/Text'),
// primitives

@@ -43,2 +43,3 @@ Graphics: require('./graphics/Graphics'),

VideoBaseTexture: require('./textures/VideoBaseTexture'),
TextureUvs: require('./textures/TextureUvs'),

@@ -63,2 +64,3 @@ // renderers - canvas

*
* @memberof PIXI
* @param width=800 {number} the width of the renderers view

@@ -89,5 +91,2 @@ * @param height=600 {number} the height of the renderers view

}
};
// export core and const. We assign core to const so that the non-reference types in const remain in-tact
module.exports = Object.assign(require('./const'), core);
});

@@ -1,26 +0,2 @@

/**
* @namespace PIXI.math
*/
module.exports = {
/**
* @property {number} PI_2 - Two Pi
* @constant
* @static
*/
PI_2: Math.PI * 2,
/**
* @property {number} RAD_TO_DEG - Constant conversion factor for converting radians to degrees
* @constant
* @static
*/
RAD_TO_DEG: 180 / Math.PI,
/**
* @property {Number} DEG_TO_RAD - Constant conversion factor for converting degrees to radians
* @constant
* @static
*/
DEG_TO_RAD: Math.PI / 180,
Point: require('./Point'),

@@ -27,0 +3,0 @@ Matrix: require('./Matrix'),

@@ -11,3 +11,3 @@ var Point = require('./Point');

* @class
* @memberof PIXI.math
* @memberof PIXI
*/

@@ -14,0 +14,0 @@ function Matrix()

@@ -6,3 +6,3 @@ /**

* @class
* @memberof PIXI.math
* @memberof PIXI
* @param [x=0] {number} position of the point on the x axis

@@ -9,0 +9,0 @@ * @param [y=0] {number} position of the point on the y axis

@@ -27,4 +27,9 @@ var Container = require('../display/Container');

*
* @param size {number} The number of images in the SpriteBatch before it flushes.
* @param properties {object} The properties to be uploaded
* @param [size=15000] {number} The number of images in the SpriteBatch before it flushes.
* @param [properties] {object} The properties of children that should be uploaded to the gpu and applied.
* @param [properties.scale=false] {boolean} When true, scale be uploaded and applied.
* @param [properties.position=true] {boolean} When true, position be uploaded and applied.
* @param [properties.rotation=false] {boolean} When true, rotation be uploaded and applied.
* @param [properties.uvs=false] {boolean} When true, uvs be uploaded and applied.
* @param [properties.alpha=false] {boolean} When true, alpha be uploaded and applied.
*/

@@ -35,17 +40,10 @@ function ParticleContainer(size, properties)

// set properties to be dynamic (true) / static (false)
// TODO this could be easier to understand!
/* this._properties = {
scale : false,
position : true,
rotation : false,
uvs : false,
alpha : false
* }
*/
/**
* @member {object}
* Set properties to be dynamic (true) / static (false)
*
* @member {array}
* @private
*/
this._properties = properties || [false, true, false, false, false];
this._properties = [false, true, false, false, false];
/**

@@ -75,2 +73,3 @@ * @member {number}

this.setProperties(properties);
}

@@ -83,2 +82,18 @@

/**
* Sets the private properties array to dynamic / static based on the passed properties object
*
* @param properties {object} The properties to be uploaded
*/
ParticleContainer.prototype.setProperties = function(properties)
{
if ( properties ) {
this._properties[0] = 'scale' in properties ? !!properties.scale : this._properties[0];
this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];
this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];
this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];
this._properties[4] = 'alpha' in properties ? !!properties.alpha : this._properties[4];
}
};
/**
* Updates the object transform for rendering

@@ -85,0 +100,0 @@ *

@@ -112,18 +112,28 @@ var WebGLManager = require('./WebGLManager'),

if(bounds.width > 0 && bounds.height > 0)
{
this.currentFrame = bounds;
this.currentFrame = bounds;
var texture = this.getRenderTarget();
var texture = this.getRenderTarget();
this.renderer.setRenderTarget(texture);
this.renderer.setRenderTarget(texture);
// clear the texture..
texture.clear();
// clear the texture..
texture.clear();
// TODO get rid of object creation!
this.filterStack.push({
renderTarget: texture,
filter: filters
});
// TODO get rid of object creation!
this.filterStack.push({
renderTarget: texture,
filter: filters
});
}
else
{
// push somthing on to the stack that is empty
this.filterStack.push({
renderTarget: null,
filter: filters
});
}
};

@@ -143,2 +153,8 @@

// if the renderTarget is null then we don't apply the filter as its offscreen
if(!filterData.renderTarget)
{
return;
}
var output = previousFilterData.renderTarget;

@@ -166,2 +182,5 @@

// restore the normal blendmode!
this.renderer.blendModeManager.setBlendMode(CONST.BLEND_MODES.NORMAL);
if (filters.length === 1)

@@ -168,0 +187,0 @@ {

@@ -45,3 +45,3 @@ var WebGLManager = require('./WebGLManager'),

* Removes the last mask from the mask stack and doesn't return it.
*
*
* @param target {RenderTarget}

@@ -77,2 +77,3 @@ * @param maskData {any[]}

alphaMaskFilter[0].maskSprite = maskData;
this.renderer.filterManager.pushFilter(target, alphaMaskFilter);

@@ -79,0 +80,0 @@ };

@@ -133,3 +133,3 @@ var SystemRenderer = require('../SystemRenderer'),

*/
this.currentRenderTarget = this.renderTarget;
this.currentRenderTarget = null;

@@ -192,2 +192,4 @@ /**

this.setRenderTarget(this.renderTarget);
this.emit('context', gl);

@@ -194,0 +196,0 @@

@@ -481,8 +481,8 @@ var math = require('../math'),

0,
width,
height,
width * resolution * renderer.resolution,
height * resolution * renderer.resolution,
dx / resolution,
dy / resolution,
width / resolution,
width / resolution
width * renderer.resolution,
height * renderer.resolution
);

@@ -494,10 +494,10 @@ }

texture.baseTexture.source,
texture.crop.x,
texture.crop.y,
width,
height,
texture.crop.x * resolution,
texture.crop.y * resolution,
width * resolution * renderer.resolution,
height * resolution * renderer.resolution,
dx / resolution,
dy / resolution,
width / resolution,
height / resolution
width * renderer.resolution,
height * renderer.resolution
);

@@ -504,0 +504,0 @@ }

@@ -158,2 +158,3 @@ var BaseTexture = require('./BaseTexture'),

this.renderer.currentRenderer.start();
this.renderer.currentRenderTarget.activate();
}

@@ -160,0 +161,0 @@ else

@@ -197,2 +197,4 @@ var BaseTexture = require('./BaseTexture'),

this.baseTexture.update();
};

@@ -199,0 +201,0 @@

@@ -190,3 +190,3 @@ var CONST = require('../const');

];
window.console.log.apply(console, args); //jshint ignore:line

@@ -193,0 +193,0 @@ }

/*global console */
var core = require('./core'),
mesh = require('./mesh'),
text = require('./text');
extras = require('./extras');

@@ -20,3 +20,3 @@ /**

* @name PIXI.AssetLoader
* @see {@link PIXI.Loader}
* @see {@link PIXI.loaders.Loader}
* @throws {ReferenceError} The loader system was overhauled in pixi v3, please see the new PIXI.Loader class.

@@ -61,3 +61,3 @@ */

* @name PIXI.Strip
* @see {@link PIXI.Mesh}
* @see {@link PIXI.mesh.Mesh}
* @deprecated since version 3.0

@@ -89,7 +89,7 @@ */

* @method
* @name PIXI.BitmapText#setText
* @name PIXI.extras.BitmapText#setText
* @see {@link PIXI.BitmapText#text}
* @deprecated since version 3.0
*/
text.BitmapText.prototype.setText = function (text)
extras.BitmapText.prototype.setText = function (text)
{

@@ -106,3 +106,3 @@ this.text = text;

*/
text.Text.prototype.setText = function (text)
core.Text.prototype.setText = function (text)
{

@@ -112,3 +112,1 @@ this.text = text;

};
module.exports = {};

@@ -1,8 +0,5 @@

var math = require('../core/math'),
RenderTexture = require('../core/textures/RenderTexture'),
DisplayObject = require('../core/display/DisplayObject'),
Sprite = require('../core/sprites/Sprite'),
var core = require('../core'),
DisplayObject = core.DisplayObject,
_tempMatrix = new core.Matrix();
_tempMatrix = new math.Matrix();
DisplayObject.prototype._cacheAsBitmap = false;

@@ -16,7 +13,4 @@ DisplayObject.prototype._originalRenderWebGL = null;

Object.defineProperties(DisplayObject.prototype, {
/**

@@ -134,3 +128,3 @@ * Set this to true if you want this display object to be cached as a bitmap.

// this renderTexture will be used to store the cached DisplayObject
var renderTexture = new RenderTexture(renderer, bounds.width | 0, bounds.height | 0);
var renderTexture = new core.RenderTexture(renderer, bounds.width | 0, bounds.height | 0);

@@ -160,3 +154,3 @@ // need to set //

// create our cached sprite
this._cachedSprite = new Sprite(renderTexture);
this._cachedSprite = new core.Sprite(renderTexture);
this._cachedSprite.worldTransform = this.worldTransform;

@@ -204,3 +198,3 @@ this._cachedSprite.anchor.x = -( bounds.x / bounds.width );

var renderTexture = new RenderTexture(renderer, bounds.width | 0, bounds.height | 0);
var renderTexture = new core.RenderTexture(renderer, bounds.width | 0, bounds.height | 0);

@@ -227,3 +221,3 @@ // need to set //

// create our cached sprite
this._cachedSprite = new Sprite(renderTexture);
this._cachedSprite = new core.Sprite(renderTexture);
this._cachedSprite.worldTransform = this.worldTransform;

@@ -257,5 +251,1 @@ this._cachedSprite.anchor.x = -( bounds.x / bounds.width );

};
module.exports = {};

@@ -1,3 +0,2 @@

var DisplayObject = require('../core/display/DisplayObject'),
Container = require('../core/display/Container');
var core = require('../core');

@@ -9,3 +8,3 @@ /**

*/
DisplayObject.prototype.name = null;
core.DisplayObject.prototype.name = null;

@@ -18,3 +17,3 @@ /**

*/
Container.prototype.getChildByName = function (name)
core.Container.prototype.getChildByName = function (name)
{

@@ -30,3 +29,1 @@ for (var i = 0; i < this.children.length; i++)

};
module.exports = {};

@@ -8,2 +8,6 @@ /**

require('./cacheAsBitmap');
require('./getChildByName');
require('./getGlobalPosition');
/**

@@ -16,4 +20,3 @@ * @namespace PIXI.extras

TilingSprite: require('./TilingSprite'),
cacheAsBitmap: require('./cacheAsBitmap'),
getChildByName: require('./getChildByName')
BitmapText: require('./BitmapText'),
};
var core = require('../core'),
TextureUvs = require('../core/textures/TextureUvs'),
RenderTexture = require('../core/textures/RenderTexture'),
// a sprite use dfor rendering textures..
tempSprite = new core.Sprite(),
tempPoint = new core.math.Point();
tempPoint = new core.Point(),
tempMatrix = new core.Matrix();

@@ -86,3 +85,3 @@ /**

*/
this._uvs = new TextureUvs();
this._uvs = new core.TextureUvs();
}

@@ -379,17 +378,19 @@

targetHeight = core.utils.getNextPowerOfTwo(frame.height);
tempSprite.texture = texture;
//TODO not create a new one each time you refresh
var renderTexture = new RenderTexture(renderer, targetWidth, targetHeight, texture.baseTexture.scaleMode, texture.baseTexture.resolution);
var renderTexture = new core.RenderTexture(renderer, targetWidth, targetHeight, texture.baseTexture.scaleMode, texture.baseTexture.resolution);
tempSprite.worldTransform.a = (targetWidth + 1) / (frame.width);
tempSprite.worldTransform.d = (targetHeight + 1) / (frame.height);
// fixes the odd fuzzy alpha line that happens..
var cachedRenderTarget = renderer.currentRenderTarget;
var m = tempMatrix;
m.a = (targetWidth + 1) / (frame.width);
m.d = (targetHeight + 1) / (frame.height);
tempSprite.worldTransform.tx -= 0.5;
tempSprite.worldTransform.ty -= 0.5;
var cachedRenderTarget = renderer.currentRenderTarget;
renderer.currentRenderer.flush();
renderTexture.render( tempSprite, tempSprite.worldTransform, true, false );
renderTexture.render( tempSprite, m, true, false );

@@ -396,0 +397,0 @@ renderer.setRenderTarget(cachedRenderTarget);

@@ -36,7 +36,7 @@ var core = require('../../core'),

renderer.blendModeManager.setBlendMode(core.CONST.BLEND_MODES.SCREEN);
renderer.blendModeManager.setBlendMode(core.BLEND_MODES.SCREEN);
this.blurYFilter.applyFilter(renderer, renderTarget, output);
renderer.blendModeManager.setBlendMode(core.CONST.BLEND_MODES.NORMAL);
renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL);

@@ -43,0 +43,0 @@ renderer.filterManager.returnRenderTarget(renderTarget);

@@ -29,3 +29,3 @@ var core = require('../../core'),

this.hideObject = false;
this.blendMode = core.CONST.BLEND_MODES.MULTIPLY;
this.blendMode = core.BLEND_MODES.MULTIPLY;
}

@@ -56,3 +56,3 @@

renderer.blendModeManager.setBlendMode(core.CONST.BLEND_MODES.NORMAL);
renderer.blendModeManager.setBlendMode(core.BLEND_MODES.NORMAL);

@@ -59,0 +59,0 @@ if(!this.hideObject)

// run the polyfills
require('./polyfill');
var core = require('./core'),
assign = Object.assign;
var core = module.exports = require('./core');
assign(core, require('./core/math'));
assign(core, require('./extras'));
assign(core, require('./mesh'));
assign(core, require('./filters'));
assign(core, require('./interaction'));
assign(core, require('./loaders'));
assign(core, require('./spine'));
assign(core, require('./text'));
assign(core, require('./deprecation'));
// add core plugins.
core.extras = require('./extras');
core.filters = require('./filters');
core.interaction = require('./interaction');
core.loaders = require('./loaders');
core.mesh = require('./mesh');
core.spine = require('./spine');
module.exports = core;
// export a premade loader instance
core.loader = new core.loaders.Loader();
// mixin the deprecation features.
Object.assign(core, require('./deprecation'));

@@ -16,3 +16,3 @@ var core = require('../core');

*/
this.global = new core.math.Point();
this.global = new core.Point();

@@ -19,0 +19,0 @@ /**

var core = require('../core'),
InteractionData = require('./InteractionData');
// Mix interactiveTarget into core.DisplayObject.prototype
Object.assign(
core.DisplayObject.prototype,
require('./interactiveTarget')
);
/**

@@ -147,3 +153,3 @@ * The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive

*/
this._tempPoint = new core.math.Point();
this._tempPoint = new core.Point();

@@ -150,0 +156,0 @@ /**

@@ -1,13 +0,46 @@

var core = require('../core');
/**
* Default property values of interactive objects
* used by {@link PIXI.interaction.InteractionManager}.
*
* @mixin
* @memberof PIXI.interaction
* @example
* function MyObject() {}
*
* Object.assign(
* MyObject.prototype,
* PIXI.interaction.interactiveTarget)
* );
*/
module.exports = {
/**
* @todo
*/
interactive: false,
/**
* @todo
*/
buttonMode: false,
/**
* @todo
*/
interactiveChildren: true,
/**
* @todo
*/
defaultCursor: 'pointer',
core.DisplayObject.prototype.interactive = false;
core.DisplayObject.prototype.buttonMode = false;
core.DisplayObject.prototype.interactiveChildren = true;
core.DisplayObject.prototype.defaultCursor = 'pointer';
// some internal checks..
// some internal checks..
core.DisplayObject.prototype._over = false;
core.DisplayObject.prototype._touchDown = false;
module.exports = {};
/**
* @todo
* @private
*/
_over: false,
/**
* @todo
* @private
*/
_touchDown: false
};
var Resource = require('resource-loader').Resource,
core = require('../core'),
text = require('../text'),
extras = require('../extras'),
path = require('path');

@@ -10,21 +10,12 @@

{
if (!resource.data || navigator.isCocoonJS)
// skip if no data
if (!resource.data)
{
if (window.DOMParser)
{
var domparser = new DOMParser();
resource.data = domparser.parseFromString(this.xhr.responseText, 'text/xml');
}
else
{
var div = document.createElement('div');
div.innerHTML = this.xhr.responseText;
resource.data = div;
}
return next();
}
var name = resource.data.nodeName;
var name = resource.data.nodeName && resource.data.nodeName.toLowerCase();
// skip if not xml data
if (!resource.data || !name || (name.toLowerCase() !== '#document' && name.toLowerCase() !== 'div'))
if (!name || (name !== '#document' && name !== 'div'))
{

@@ -123,3 +114,3 @@ return next();

// but it's very likely to change
text.BitmapText.fonts[data.font] = data;
extras.BitmapText.fonts[data.font] = data;

@@ -126,0 +117,0 @@ next();

@@ -20,4 +20,1 @@ /**

};
module.exports.loader = new module.exports.Loader();

@@ -24,25 +24,24 @@ var ResourceLoader = require('resource-loader'),

* @memberof PIXI.loaders
* @param [baseUrl=''] {string} The base url for all resources loaded by this loader.
* @param [concurrency=10] {number} The number of resources to load concurrently.
*/
var Loader = function()
function Loader(baseUrl, concurrency)
{
ResourceLoader.call(this);
ResourceLoader.call(this, baseUrl, concurrency);
// parse any json strings into objects
this.use(ResourceLoader.middleware.parsing.json())
// parse any blob into more usable objects (e.g. Image)
.use(ResourceLoader.middleware.parsing.blob())
this.use(ResourceLoader.middleware.parsing.blob());
// parse any Image objects into textures
.use(textureParser())
this.use(textureParser());
// parse any spritesheet data into multiple textures
.use(spritesheetParser())
this.use(spritesheetParser());
// parse any spine data into a spine object
.use(spineAtlasParser())
this.use(spineAtlasParser());
// parse any spritesheet data into multiple textures
.use(bitmapFontParser());
};
this.use(bitmapFontParser());
}

@@ -49,0 +48,0 @@ Loader.prototype = Object.create(ResourceLoader.prototype);

@@ -9,49 +9,48 @@ var Resource = require('resource-loader').Resource,

{
// if this is a spritesheet object
if (resource.data && resource.data.bones)
// skip if no data
if (!resource.data || !resource.data.bones)
{
/**
* use a bit of hackery to load the atlas file, here we assume that the .json, .atlas and .png files
* that correspond to the spine file are in the same base URL and that the .json and .atlas files
* have the same name
*/
var atlasPath = resource.url.substr(0, resource.url.lastIndexOf('.')) + '.atlas';
var atlasOptions = {
crossOrigin: resource.crossOrigin,
xhrType: Resource.XHR_RESPONSE_TYPE.TEXT
};
var baseUrl = resource.url.substr(0, resource.url.lastIndexOf('/') + 1);
return next();
}
/**
* use a bit of hackery to load the atlas file, here we assume that the .json, .atlas and .png files
* that correspond to the spine file are in the same base URL and that the .json and .atlas files
* have the same name
*/
var atlasPath = resource.url.substr(0, resource.url.lastIndexOf('.')) + '.atlas';
var atlasOptions = {
crossOrigin: resource.crossOrigin,
xhrType: Resource.XHR_RESPONSE_TYPE.TEXT
};
var baseUrl = resource.url.substr(0, resource.url.lastIndexOf('/') + 1);
this.add(resource.name + '_atlas', atlasPath, atlasOptions, function (res)
{
// create a spine atlas using the loaded text
var spineAtlas = new spine.SpineRuntime.Atlas(this.xhr.responseText, baseUrl, res.crossOrigin);
// spine animation
var spineJsonParser = new spine.SpineRuntime.SkeletonJsonParser(new spine.SpineRuntime.AtlasAttachmentParser(spineAtlas));
var skeletonData = spineJsonParser.readSkeletonData(resource.data);
this.add(resource.name + '_atlas', atlasPath, atlasOptions, function (res)
{
// create a spine atlas using the loaded text
var spineAtlas = new spine.SpineRuntime.Atlas(this.xhr.responseText, baseUrl, res.crossOrigin);
resource.spineData = skeletonData;
resource.spineAtlas = spineAtlas;
// spine animation
var spineJsonParser = new spine.SpineRuntime.SkeletonJsonParser(new spine.SpineRuntime.AtlasAttachmentParser(spineAtlas));
var skeletonData = spineJsonParser.readSkeletonData(resource.data);
// Go through each spineAtlas.pages and wait for page.rendererObject (a baseTexture) to
// load. Once all loaded, then call the next function.
async.each(spineAtlas.pages, function (page, done)
resource.spineData = skeletonData;
resource.spineAtlas = spineAtlas;
// Go through each spineAtlas.pages and wait for page.rendererObject (a baseTexture) to
// load. Once all loaded, then call the next function.
async.each(spineAtlas.pages, function (page, done)
{
if (page.rendererObject.hasLoaded)
{
if (page.rendererObject.hasLoaded)
{
done();
}
else
{
page.rendererObject.once('loaded', done);
}
}, next);
});
}
else {
next();
}
done();
}
else
{
page.rendererObject.once('loaded', done);
}
}, next);
});
};
};

@@ -9,75 +9,74 @@ var Resource = require('resource-loader').Resource,

{
// if this is a spritesheet object
if (resource.data && resource.data.frames)
// skip if no data
if (!resource.data || !resource.data.frames)
{
var loadOptions = {
crossOrigin: resource.crossOrigin,
loadType: Resource.LOAD_TYPE.IMAGE
};
return next();
}
var route = path.dirname(resource.url.replace(this.baseUrl, ''));
var loadOptions = {
crossOrigin: resource.crossOrigin,
loadType: Resource.LOAD_TYPE.IMAGE
};
var resolution = core.utils.getResolutionOfUrl( resource.url );
var route = path.dirname(resource.url.replace(this.baseUrl, ''));
// load the image for this sheet
this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res)
var resolution = core.utils.getResolutionOfUrl( resource.url );
// load the image for this sheet
this.add(resource.name + '_image', route + '/' + resource.data.meta.image, loadOptions, function (res)
{
resource.textures = {};
var frames = resource.data.frames;
for (var i in frames)
{
resource.textures = {};
var rect = frames[i].frame;
var frames = resource.data.frames;
for (var i in frames)
if (rect)
{
var rect = frames[i].frame;
var size = null;
var trim = null;
if (rect)
if (frames[i].rotated) {
size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w);
}
else {
size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h);
}
// Check to see if the sprite is trimmed
if (frames[i].trimmed)
{
var size = null;
var trim = null;
trim = new core.math.Rectangle(
frames[i].spriteSourceSize.x / resolution,
frames[i].spriteSourceSize.y / resolution,
frames[i].sourceSize.w / resolution,
frames[i].sourceSize.h / resolution
);
}
if (frames[i].rotated) {
size = new core.math.Rectangle(rect.x, rect.y, rect.h, rect.w);
}
else {
size = new core.math.Rectangle(rect.x, rect.y, rect.w, rect.h);
}
// flip the width and height!
if (frames[i].rotated)
{
var temp = size.width;
size.width = size.height;
size.height = temp;
}
// Check to see if the sprite is trimmed
if (frames[i].trimmed)
{
trim = new core.math.Rectangle(
frames[i].spriteSourceSize.x / resolution,
frames[i].spriteSourceSize.y / resolution,
frames[i].sourceSize.w / resolution,
frames[i].sourceSize.h / resolution
);
}
size.x /= resolution;
size.y /= resolution;
size.width /= resolution;
size.height /= resolution;
// flip the width and height!
if (frames[i].rotated)
{
var temp = size.width;
size.width = size.height;
size.height = temp;
}
resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated);
size.x /= resolution;
size.y /= resolution;
size.width /= resolution;
size.height /= resolution;
resource.textures[i] = new core.Texture(res.texture.baseTexture, size, size.clone(), trim, frames[i].rotated);
// lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions
core.utils.TextureCache[i] = resource.textures[i];
}
// lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions
core.utils.TextureCache[i] = resource.textures[i];
}
}
next();
});
}
else {
next();
}
});
};
};

@@ -9,9 +9,9 @@ /**

/**
* @namespace PIXI.extras
* @namespace PIXI.mesh
*/
module.exports = {
Mesh: require('./Mesh'),
Mesh: require('./Mesh'),
Rope: require('./Rope'),
MeshRenderer: require('./webgl/MeshRenderer'),
MeshShader: require('./webgl/MeshShader')
MeshShader: require('./webgl/MeshShader')
};

@@ -7,3 +7,3 @@ var core = require('../core');

* @extends Container
* @memberof PIXI.extras
* @memberof PIXI.mesh
* @param texture {Texture} The texture to use

@@ -65,3 +65,3 @@ * @param [vertices] {Float32Arrif you want to specify the vertices

*/
this.blendMode = core.CONST.BLEND_MODES.NORMAL;
this.blendMode = core.BLEND_MODES.NORMAL;

@@ -68,0 +68,0 @@ /**

@@ -15,3 +15,3 @@ var Mesh = require('./Mesh');

* @extends Mesh
* @memberof PIXI.extras
* @memberof PIXI.mesh
* @param {Texture} texture - The texture to use on the rope.

@@ -18,0 +18,0 @@ * @param {Array} points - An array of {Point} objects to construct this rope.

@@ -19,3 +19,3 @@ var ObjectRenderer = require('../../core/renderers/webgl/utils/ObjectRenderer'),

* @private
* @memberof PIXI
* @memberof PIXI.mesh
* @extends ObjectRenderer

@@ -22,0 +22,0 @@ * @param renderer {WebGLRenderer} The renderer this sprite batch works for.

@@ -6,3 +6,3 @@ var core = require('../../core');

* @extends Shader
* @memberof PIXI.extras
* @memberof PIXI.mesh
* @param shaderManager {ShaderManager} The WebGL shader manager this shader works for.

@@ -9,0 +9,0 @@ */

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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