Fixed graphics bug + updated docs
Fixed issue with getBounds being incorrect for graphics Updated docs Linted code
This commit is contained in:
parent
53506da65e
commit
7713731ab3
145 changed files with 15583 additions and 24078 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
</div>
|
||||
<div class="yui3-u-1-4 version">
|
||||
<em>API Docs for: 1.3.0</em>
|
||||
<em>API Docs for: 1.4.0</em>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bd" class="yui3-g">
|
||||
|
@ -45,6 +45,8 @@
|
|||
|
||||
<li><a href="../classes/AssetLoader.html">AssetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/AtlasLoader.html">AtlasLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
@ -61,7 +63,7 @@
|
|||
|
||||
<li><a href="../classes/ColorMatrixFilter.html">ColorMatrixFilter</a></li>
|
||||
|
||||
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
|
||||
<li><a href="../classes/ColorStepFilter.html">ColorStepFilter</a></li>
|
||||
|
||||
<li><a href="../classes/DisplacementFilter.html">DisplacementFilter</a></li>
|
||||
|
||||
|
@ -75,7 +77,7 @@
|
|||
|
||||
<li><a href="../classes/Graphics.html">Graphics</a></li>
|
||||
|
||||
<li><a href="../classes/GreyFilter.html">GreyFilter</a></li>
|
||||
<li><a href="../classes/GrayFilter.html">GrayFilter</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
|
@ -87,6 +89,8 @@
|
|||
|
||||
<li><a href="../classes/PixelateFilter.html">PixelateFilter</a></li>
|
||||
|
||||
<li><a href="../classes/PIXI.PixiShader.html">PIXI.PixiShader</a></li>
|
||||
|
||||
<li><a href="../classes/Point.html">Point</a></li>
|
||||
|
||||
<li><a href="../classes/Polygon.html">Polygon</a></li>
|
||||
|
@ -109,10 +113,10 @@
|
|||
|
||||
<li><a href="../classes/Spine.html">Spine</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite.html">Sprite</a></li>
|
||||
|
||||
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite™.html">Sprite™</a></li>
|
||||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
@ -121,8 +125,6 @@
|
|||
|
||||
<li><a href="../classes/TilingSprite.html">TilingSprite</a></li>
|
||||
|
||||
<li><a href="../classes/WebGLBatch.html">WebGLBatch</a></li>
|
||||
|
||||
<li><a href="../classes/WebGLRenderer.html">WebGLRenderer</a></li>
|
||||
|
||||
</ul>
|
||||
|
@ -174,30 +176,28 @@
|
|||
* @author Mat Groves http://matgroves.com/
|
||||
*/
|
||||
|
||||
|
||||
PIXI.Rope = function(texture, points)
|
||||
{
|
||||
PIXI.Strip.call( this, texture );
|
||||
this.points = points;
|
||||
PIXI.Strip.call( this, texture );
|
||||
this.points = points;
|
||||
|
||||
try
|
||||
{
|
||||
this.verticies = new Float32Array( points.length * 4);
|
||||
this.uvs = new Float32Array( points.length * 4);
|
||||
this.colors = new Float32Array( points.length * 2);
|
||||
this.indices = new Uint16Array( points.length * 2);
|
||||
}
|
||||
catch(error)
|
||||
{
|
||||
this.verticies = verticies
|
||||
try
|
||||
{
|
||||
this.verticies = new Float32Array(points.length * 4);
|
||||
this.uvs = new Float32Array(points.length * 4);
|
||||
this.colors = new Float32Array(points.length * 2);
|
||||
this.indices = new Uint16Array(points.length * 2);
|
||||
}
|
||||
catch(error)
|
||||
{
|
||||
this.verticies = new Array(points.length * 4);
|
||||
this.uvs = new Array(points.length * 4);
|
||||
this.colors = new Array(points.length * 2);
|
||||
this.indices = new Array(points.length * 2);
|
||||
}
|
||||
|
||||
this.uvs = uvs
|
||||
this.colors = colors
|
||||
this.indices = indices
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
}
|
||||
this.refresh();
|
||||
};
|
||||
|
||||
|
||||
// constructor
|
||||
|
@ -206,145 +206,138 @@ PIXI.Rope.prototype.constructor = PIXI.Rope;
|
|||
|
||||
PIXI.Rope.prototype.refresh = function()
|
||||
{
|
||||
var points = this.points;
|
||||
if(points.length < 1)return;
|
||||
var points = this.points;
|
||||
if(points.length < 1) return;
|
||||
|
||||
var uvs = this.uvs
|
||||
var indices = this.indices;
|
||||
var colors = this.colors;
|
||||
var uvs = this.uvs;
|
||||
|
||||
var lastPoint = points[0];
|
||||
var nextPoint;
|
||||
var perp = {x:0, y:0};
|
||||
var point = points[0];
|
||||
var lastPoint = points[0];
|
||||
var indices = this.indices;
|
||||
var colors = this.colors;
|
||||
|
||||
this.count-=0.2;
|
||||
this.count-=0.2;
|
||||
|
||||
|
||||
uvs[0] = 0
|
||||
uvs[1] = 1
|
||||
uvs[2] = 0
|
||||
uvs[3] = 1
|
||||
uvs[0] = 0;
|
||||
uvs[1] = 1;
|
||||
uvs[2] = 0;
|
||||
uvs[3] = 1;
|
||||
|
||||
colors[0] = 1;
|
||||
colors[1] = 1;
|
||||
colors[0] = 1;
|
||||
colors[1] = 1;
|
||||
|
||||
indices[0] = 0;
|
||||
indices[1] = 1;
|
||||
indices[0] = 0;
|
||||
indices[1] = 1;
|
||||
|
||||
var total = points.length;
|
||||
var total = points.length,
|
||||
point, index, amount;
|
||||
|
||||
for (var i = 1; i < total; i++)
|
||||
{
|
||||
for (var i = 1; i < total; i++)
|
||||
{
|
||||
|
||||
var point = points[i];
|
||||
var index = i * 4;
|
||||
// time to do some smart drawing!
|
||||
var amount = i/(total-1)
|
||||
point = points[i];
|
||||
index = i * 4;
|
||||
// time to do some smart drawing!
|
||||
amount = i / (total-1);
|
||||
|
||||
if(i%2)
|
||||
{
|
||||
uvs[index] = amount;
|
||||
uvs[index+1] = 0;
|
||||
if(i%2)
|
||||
{
|
||||
uvs[index] = amount;
|
||||
uvs[index+1] = 0;
|
||||
|
||||
uvs[index+2] = amount
|
||||
uvs[index+3] = 1
|
||||
uvs[index+2] = amount;
|
||||
uvs[index+3] = 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
uvs[index] = amount
|
||||
uvs[index+1] = 0
|
||||
}
|
||||
else
|
||||
{
|
||||
uvs[index] = amount;
|
||||
uvs[index+1] = 0;
|
||||
|
||||
uvs[index+2] = amount
|
||||
uvs[index+3] = 1
|
||||
}
|
||||
uvs[index+2] = amount;
|
||||
uvs[index+3] = 1;
|
||||
}
|
||||
|
||||
index = i * 2;
|
||||
colors[index] = 1;
|
||||
colors[index+1] = 1;
|
||||
index = i * 2;
|
||||
colors[index] = 1;
|
||||
colors[index+1] = 1;
|
||||
|
||||
index = i * 2;
|
||||
indices[index] = index;
|
||||
indices[index + 1] = index + 1;
|
||||
index = i * 2;
|
||||
indices[index] = index;
|
||||
indices[index + 1] = index + 1;
|
||||
|
||||
lastPoint = point;
|
||||
}
|
||||
}
|
||||
lastPoint = point;
|
||||
}
|
||||
};
|
||||
|
||||
PIXI.Rope.prototype.updateTransform = function()
|
||||
{
|
||||
|
||||
var points = this.points;
|
||||
if(points.length < 1)return;
|
||||
var points = this.points;
|
||||
if(points.length < 1)return;
|
||||
|
||||
var verticies = this.verticies
|
||||
var lastPoint = points[0];
|
||||
var nextPoint;
|
||||
var perp = {x:0, y:0};
|
||||
|
||||
var lastPoint = points[0];
|
||||
var nextPoint;
|
||||
var perp = {x:0, y:0};
|
||||
var point = points[0];
|
||||
this.count-=0.2;
|
||||
|
||||
this.count-=0.2;
|
||||
var verticies = this.verticies;
|
||||
verticies[0] = lastPoint.x + perp.x;
|
||||
verticies[1] = lastPoint.y + perp.y; //+ 200
|
||||
verticies[2] = lastPoint.x - perp.x;
|
||||
verticies[3] = lastPoint.y - perp.y;//+200
|
||||
// time to do some smart drawing!
|
||||
|
||||
verticies[0] = point.x + perp.x
|
||||
verticies[1] = point.y + perp.y //+ 200
|
||||
verticies[2] = point.x - perp.x
|
||||
verticies[3] = point.y - perp.y//+200
|
||||
// time to do some smart drawing!
|
||||
var total = points.length,
|
||||
point, index, ratio, perpLength, num;
|
||||
|
||||
var total = points.length;
|
||||
for (var i = 1; i < total; i++)
|
||||
{
|
||||
point = points[i];
|
||||
index = i * 4;
|
||||
|
||||
for (var i = 1; i < total; i++)
|
||||
{
|
||||
if(i < points.length-1)
|
||||
{
|
||||
nextPoint = points[i+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
nextPoint = point;
|
||||
}
|
||||
|
||||
var point = points[i];
|
||||
var index = i * 4;
|
||||
perp.y = -(nextPoint.x - lastPoint.x);
|
||||
perp.x = nextPoint.y - lastPoint.y;
|
||||
|
||||
if(i < points.length-1)
|
||||
{
|
||||
nextPoint = points[i+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
nextPoint = point
|
||||
}
|
||||
ratio = (1 - (i / (total-1))) * 10;
|
||||
|
||||
perp.y = -(nextPoint.x - lastPoint.x);
|
||||
perp.x = nextPoint.y - lastPoint.y;
|
||||
if(ratio > 1) ratio = 1;
|
||||
|
||||
var ratio = (1 - (i / (total-1))) * 10;
|
||||
if(ratio > 1)ratio = 1;
|
||||
perpLength = Math.sqrt(perp.x * perp.x + perp.y * perp.y);
|
||||
num = this.texture.height / 2; //(20 + Math.abs(Math.sin((i + this.count) * 0.3) * 50) )* ratio;
|
||||
perp.x /= perpLength;
|
||||
perp.y /= perpLength;
|
||||
|
||||
var perpLength = Math.sqrt(perp.x * perp.x + perp.y * perp.y);
|
||||
var num = this.texture.height/2//(20 + Math.abs(Math.sin((i + this.count) * 0.3) * 50) )* ratio;
|
||||
perp.x /= perpLength;
|
||||
perp.y /= perpLength;
|
||||
perp.x *= num;
|
||||
perp.y *= num;
|
||||
|
||||
perp.x *= num;
|
||||
perp.y *= num;
|
||||
verticies[index] = point.x + perp.x;
|
||||
verticies[index+1] = point.y + perp.y;
|
||||
verticies[index+2] = point.x - perp.x;
|
||||
verticies[index+3] = point.y - perp.y;
|
||||
|
||||
verticies[index] = point.x + perp.x
|
||||
verticies[index+1] = point.y + perp.y
|
||||
verticies[index+2] = point.x - perp.x
|
||||
verticies[index+3] = point.y - perp.y
|
||||
lastPoint = point;
|
||||
}
|
||||
|
||||
lastPoint = point;
|
||||
}
|
||||
|
||||
PIXI.DisplayObjectContainer.prototype.updateTransform.call( this );
|
||||
}
|
||||
PIXI.DisplayObjectContainer.prototype.updateTransform.call( this );
|
||||
};
|
||||
|
||||
PIXI.Rope.prototype.setTexture = function(texture)
|
||||
{
|
||||
// stop current texture
|
||||
this.texture = texture;
|
||||
this.updateFrame = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// stop current texture
|
||||
this.texture = texture;
|
||||
this.updateFrame = true;
|
||||
};
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue