mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
added swapMeshes method to swap textures of 2 meshes
This commit is contained in:
parent
1db8de34df
commit
ec7ce459cb
3 changed files with 25 additions and 2 deletions
|
|
@ -103,6 +103,22 @@ function (Parent, PIXI, ColorRangeReplaceFilter, Settings, ColorConverter, Nc) {
|
|||
this.container.setChildIndex(meshB, indexA);
|
||||
};
|
||||
|
||||
Layer.prototype.swapMeshes = function(meshA, meshB) {
|
||||
var textureA = meshA.texture;
|
||||
var textureB = meshB.texture;
|
||||
|
||||
meshA.setTexture(textureB);
|
||||
meshA.onTextureUpdate();
|
||||
meshA.scale.x = 1;
|
||||
meshA.scale.y = 1;
|
||||
|
||||
meshB.setTexture(textureA);
|
||||
meshB.onTextureUpdate();
|
||||
meshB.scale.x = 1;
|
||||
meshB.scale.y = 1;
|
||||
|
||||
};
|
||||
|
||||
Layer.prototype.createMesh = function (texturePath, callback, options) {
|
||||
|
||||
var texture = (options && options.fromFrame)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue