Merge branch '3.7-beta' into 3.7-beta-cpp

This commit is contained in:
badlogic 2018-12-05 11:44:38 +01:00
commit 92980c9416
27 changed files with 23481 additions and 23177 deletions

View File

@ -241,6 +241,7 @@ package spine.animation {
from.totalAlpha = 0;
for (i = 0; i < timelineCount; i++) {
var timeline : Timeline = timelines[i];
var direction : MixDirection = MixDirection.Out;
var timelineBlend: MixBlend;
var alpha : Number = 0;
switch (timelineMode[i]) {
@ -268,7 +269,14 @@ package spine.animation {
if (timeline is RotateTimeline)
applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
else {
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, MixDirection.Out);
if (timelineBlend == MixBlend.setup) {
if (timeline is AttachmentTimeline) {
if (attachments) direction = MixDirection.In;
} else if (timeline is DrawOrderTimeline) {
if (drawOrder) direction = MixDirection.In;
}
}
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
}
}
}

View File

@ -462,7 +462,9 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
from->totalAlpha = 0;
for (i = 0; i < timelineCount; i++) {
spMixDirection direction = SP_MIX_DIRECTION_OUT;
spTimeline *timeline = timelines[i];
switch (timelineMode->items[i]) {
case SUBSEQUENT:
if (!attachments && timeline->type == SP_TIMELINE_ATTACHMENT) continue;
@ -489,8 +491,16 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
_spAnimationState_applyRotateTimeline(self, timeline, skeleton, animationTime, alpha, timelineBlend,
timelinesRotation, i << 1, firstFrame);
else {
if (timelineBlend == SP_MIX_BLEND_SETUP) {
if (timeline->type == SP_TIMELINE_ATTACHMENT) {
if (attachments) direction = SP_MIX_DIRECTION_IN;
} else if (timeline->type == SP_TIMELINE_DRAWORDER) {
if (drawOrder) direction = SP_MIX_DIRECTION_IN;
}
}
spTimeline_apply(timeline, skeleton, animationLast, animationTime, events, &internal->eventsCount,
alpha, timelineBlend, SP_MIX_DIRECTION_OUT);
alpha, timelineBlend, direction);
}
}
}

View File

@ -777,6 +777,7 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
from->_totalAlpha = 0;
for (size_t i = 0; i < timelineCount; i++) {
Timeline *timeline = timelines[i];
MixDirection direction = MixDirection_Out;
MixBlend timelineBlend;
float alpha;
switch (timelineMode[i]) {
@ -805,8 +806,15 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
applyRotateTimeline((RotateTimeline*)timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1,
firstFrame);
} else {
if (timelineBlend == MixBlend_Setup) {
if (timeline->getRTTI().isExactly(AttachmentTimeline::rtti)) {
if (attachments) direction = MixDirection_In;
} else if (timeline->getRTTI().isExactly(DrawOrderTimeline::rtti)) {
if (drawOrder) direction = MixDirection_In;
}
}
timeline->apply(skeleton, animationLast, animationTime, eventBuffer, alpha, timelineBlend,
MixDirection_Out);
direction);
}
}
}

View File

@ -415,6 +415,7 @@ function AnimationState:applyMixingFrom (to, skeleton, blend)
for i,timeline in ipairs(timelines) do
local skipSubsequent = false;
local direction = MixDirection.out;
local timelineBlend = MixBlend.setup
local alpha = 0
if timelineMode[i] == SUBSEQUENT then
@ -439,7 +440,14 @@ function AnimationState:applyMixingFrom (to, skeleton, blend)
if timeline.type == Animation.TimelineType.rotate then
self:applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i * 2, firstFrame)
else
timeline:apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, MixDirection.out)
if timelineBlend == MixBlend.setup then
if timeline.type == Animation.TimelineType.attachment then
if attachments then direction = MixDirection._in end
elseif timeline.type == Animation.TimelineType.drawOrder then
if drawOrder then direction = MixDirection._in end
end
end
timeline:apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction)
end
end
end

View File

@ -16,11 +16,11 @@ declare module spine {
setup = 0,
first = 1,
replace = 2,
add = 3,
add = 3
}
enum MixDirection {
in = 0,
out = 1,
out = 1
}
enum TimelineType {
rotate = 0,
@ -37,7 +37,7 @@ declare module spine {
pathConstraintPosition = 11,
pathConstraintSpacing = 12,
pathConstraintMix = 13,
twoColor = 14,
twoColor = 14
}
abstract class CurveTimeline implements Timeline {
static LINEAR: number;
@ -341,7 +341,7 @@ declare module spine {
end = 2,
dispose = 3,
complete = 4,
event = 5,
event = 5
}
interface AnimationStateListener2 {
start(entry: TrackEntry): void;
@ -380,8 +380,8 @@ declare module spine {
private toLoad;
private loaded;
constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
private static downloadText(url, success, error);
private static downloadBinary(url, success, error);
private static downloadText;
private static downloadBinary;
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
@ -414,7 +414,7 @@ declare module spine {
Normal = 0,
Additive = 1,
Multiply = 2,
Screen = 3,
Screen = 3
}
}
declare module spine {
@ -483,7 +483,7 @@ declare module spine {
OnlyTranslation = 1,
NoRotationOrReflection = 2,
NoScale = 3,
NoScaleOrReflection = 4,
NoScaleOrReflection = 4
}
}
declare module spine {
@ -593,17 +593,17 @@ declare module spine {
}
enum PositionMode {
Fixed = 0,
Percent = 1,
Percent = 1
}
enum SpacingMode {
Length = 0,
Fixed = 1,
Percent = 2,
Percent = 2
}
enum RotateMode {
Tangent = 0,
Chain = 1,
ChainScale = 2,
ChainScale = 2
}
}
declare module spine {
@ -614,12 +614,12 @@ declare module spine {
private rawAssets;
private errors;
constructor(pathPrefix?: string);
private queueAsset(clientId, textureLoader, path);
private queueAsset;
loadText(clientId: string, path: string): void;
loadJson(clientId: string, path: string): void;
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
get(clientId: string, path: string): any;
private updateClientAssets(clientAssets);
private updateClientAssets;
isLoadingComplete(clientId: string): boolean;
dispose(): void;
hasErrors(): boolean;
@ -823,12 +823,12 @@ declare module spine {
MipMapNearestNearest = 9984,
MipMapLinearNearest = 9985,
MipMapNearestLinear = 9986,
MipMapLinearLinear = 9987,
MipMapLinearLinear = 9987
}
enum TextureWrap {
MirroredRepeat = 33648,
ClampToEdge = 33071,
Repeat = 10497,
Repeat = 10497
}
class TextureRegion {
renderObject: any;
@ -855,7 +855,7 @@ declare module spine {
pages: TextureAtlasPage[];
regions: TextureAtlasRegion[];
constructor(atlasText: string, textureLoader: (path: string) => any);
private load(atlasText, textureLoader);
private load;
findRegion(name: string): TextureAtlasRegion;
dispose(): void;
}
@ -931,9 +931,9 @@ declare module spine {
private polygonIndicesPool;
triangulate(verticesArray: ArrayLike<number>): Array<number>;
decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
private static isConcave(index, vertexCount, vertices, indices);
private static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y);
private static winding(p1x, p1y, p2x, p2y, p3x, p3y);
private static isConcave;
private static positiveArea;
private static winding;
}
}
declare module spine {
@ -1105,7 +1105,7 @@ declare module spine {
Mesh = 2,
LinkedMesh = 3,
Path = 4,
Point = 5,
Point = 5
}
}
declare module spine {
@ -1271,11 +1271,11 @@ declare module spine.canvas {
private tempColor;
constructor(context: CanvasRenderingContext2D);
draw(skeleton: Skeleton): void;
private drawImages(skeleton);
private drawTriangles(skeleton);
private drawTriangle(img, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2);
private computeRegionVertices(slot, region, pma);
private computeMeshVertices(slot, mesh, pma);
private drawImages;
private drawTriangles;
private drawTriangle;
private computeRegionVertices;
private computeMeshVertices;
}
}
declare module spine.webgl {
@ -1330,7 +1330,7 @@ declare module spine.webgl {
touchesPool: Pool<Touch>;
private listeners;
constructor(element: HTMLElement);
private setupCallbacks(element);
private setupCallbacks;
addListener(listener: InputListener): void;
removeListener(listener: InputListener): void;
}
@ -1439,7 +1439,7 @@ declare module spine.webgl {
drawWithOffset(shader: Shader, primitiveType: number, offset: number, count: number): void;
bind(shader: Shader): void;
unbind(shader: Shader): void;
private update();
private update;
restore(): void;
dispose(): void;
}
@ -1465,7 +1465,7 @@ declare module spine.webgl {
constructor();
}
enum VertexAttributeType {
Float = 0,
Float = 0
}
}
declare module spine.webgl {
@ -1484,7 +1484,7 @@ declare module spine.webgl {
begin(shader: Shader): void;
setBlendMode(srcBlend: number, dstBlend: number): void;
draw(texture: GLTexture, vertices: ArrayLike<number>, indices: Array<number>): void;
private flush();
private flush;
end(): void;
getDrawCalls(): number;
dispose(): void;
@ -1524,13 +1524,13 @@ declare module spine.webgl {
curve(x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, segments: number, color?: Color): void;
end(): void;
resize(resizeMode: ResizeMode): void;
private enableRenderer(renderer);
private enableRenderer;
dispose(): void;
}
enum ResizeMode {
Stretch = 0,
Expand = 1,
Fit = 2,
Fit = 2
}
}
declare module spine.webgl {
@ -1558,9 +1558,9 @@ declare module spine.webgl {
getVertexShaderSource(): string;
getFragmentSource(): string;
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, vertexShader: string, fragmentShader: string);
private compile();
private compileShader(type, source);
private compileProgram(vs, fs);
private compile;
private compileShader;
private compileProgram;
restore(): void;
bind(): void;
unbind(): void;
@ -1607,16 +1607,16 @@ declare module spine.webgl {
polygon(polygonVertices: ArrayLike<number>, offset: number, count: number, color?: Color): void;
circle(filled: boolean, x: number, y: number, radius: number, color?: Color, segments?: number): void;
curve(x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, segments: number, color?: Color): void;
private vertex(x, y, color);
private vertex;
end(): void;
private flush();
private check(shapeType, numVertices);
private flush;
private check;
dispose(): void;
}
enum ShapeType {
Point = 0,
Line = 1,
Filled = 4,
Filled = 4
}
}
declare module spine.webgl {
@ -1756,9 +1756,9 @@ declare module spine.threejs {
private tempColor;
constructor(skeletonData: SkeletonData);
update(deltaTime: number): void;
private clearBatches();
private nextBatch();
private updateGeometry();
private clearBatches;
private nextBatch;
private updateGeometry;
}
}
declare module spine.threejs {
@ -1773,6 +1773,16 @@ declare module spine.threejs {
}
}
declare module spine {
interface Viewport {
x: number;
y: number;
width: number;
height: number;
padLeft: string | number;
padRight: string | number;
padTop: string | number;
padBottom: string | number;
}
interface SpinePlayerConfig {
jsonUrl: string;
atlasUrl: string;
@ -1798,6 +1808,13 @@ declare module spine {
y: number;
width: number;
height: number;
padLeft: string | number;
padRight: string | number;
padTop: string | number;
padBottom: string | number;
animations: Map<Viewport>;
debugRender: boolean;
transitionTime: number;
};
alpha: boolean;
backgroundColor: string;
@ -1836,6 +1853,10 @@ declare module spine {
private paused;
private playTime;
private speed;
private animationViewports;
private currentViewport;
private previousViewport;
private viewportTransitionStart;
private selectedBones;
constructor(parent: HTMLElement, config: SpinePlayerConfig);
validateConfig(config: SpinePlayerConfig): SpinePlayerConfig;
@ -1849,8 +1870,11 @@ declare module spine {
scale(sourceWidth: number, sourceHeight: number, targetWidth: number, targetHeight: number): Vector2;
loadSkeleton(): void;
setupInput(): void;
private play();
private pause();
private play;
private pause;
private setAnimation;
private percentageToWorldUnit;
private calculateAnimationViewport;
}
}
declare module spine {
@ -1874,10 +1898,10 @@ declare module spine {
private loaded;
private bounds;
constructor(element: HTMLElement | string, config: SpineWidgetConfig);
private validateConfig(config);
private load();
private render();
private resize();
private validateConfig;
private load;
private render;
private resize;
pause(): void;
play(): void;
isPlaying(): boolean;
@ -1885,7 +1909,7 @@ declare module spine {
static loadWidgets(): void;
static loadWidget(widget: HTMLElement): void;
static pageLoaded: boolean;
private static ready();
private static ready;
static setupDOMListener(): void;
}
class SpineWidgetConfig {

View File

@ -1,7 +1,10 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
@ -1470,6 +1473,7 @@ var spine;
from.totalAlpha = 0;
for (var i = 0; i < timelineCount; i++) {
var timeline = timelines[i];
var direction = spine.MixDirection.out;
var timelineBlend;
var alpha = 0;
switch (timelineMode[i]) {
@ -1500,7 +1504,17 @@ var spine;
this.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
else {
spine.Utils.webkit602BugfixHelper(alpha, blend);
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, spine.MixDirection.out);
if (timelineBlend = spine.MixBlend.setup) {
if (timeline instanceof spine.AttachmentTimeline) {
if (attachments)
direction = spine.MixDirection.out;
}
else if (timeline instanceof spine.DrawOrderTimeline) {
if (drawOrder)
direction = spine.MixDirection.out;
}
}
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
}
}
}
@ -10065,7 +10079,8 @@ var spine;
var spine;
(function (spine) {
var Popup = (function () {
function Popup(parent, htmlContent) {
function Popup(player, parent, htmlContent) {
this.player = player;
this.dom = createElement("\n\t\t\t\t<div class=\"spine-player-popup spine-player-hidden\">\n\t\t\t\t</div>\n\t\t\t");
this.dom.innerHTML = htmlContent;
parent.appendChild(this.dom);
@ -10074,6 +10089,16 @@ var spine;
var _this = this;
if (dismissedListener === void 0) { dismissedListener = function () { }; }
this.dom.classList.remove("spine-player-hidden");
var dismissed = false;
var resize = function () {
if (!dismissed)
requestAnimationFrame(resize);
var bottomOffset = Math.abs(_this.dom.getBoundingClientRect().bottom - _this.player.getBoundingClientRect().bottom);
var rightOffset = Math.abs(_this.dom.getBoundingClientRect().right - _this.player.getBoundingClientRect().right);
var maxHeight = _this.player.clientHeight - bottomOffset - rightOffset;
_this.dom.style.maxHeight = maxHeight + "px";
};
requestAnimationFrame(resize);
var justClicked = true;
var windowClickListener = function (event) {
if (justClicked) {
@ -10084,6 +10109,7 @@ var spine;
_this.dom.parentNode.removeChild(_this.dom);
window.removeEventListener("click", windowClickListener);
dismissedListener();
dismissed = true;
}
};
window.addEventListener("click", windowClickListener);
@ -10190,6 +10216,10 @@ var spine;
this.paused = true;
this.playTime = 0;
this.speed = 1;
this.animationViewports = {};
this.currentViewport = null;
this.previousViewport = null;
this.viewportTransitionStart = 0;
parent.appendChild(this.render());
}
SpinePlayer.prototype.validateConfig = function (config) {
@ -10317,8 +10347,25 @@ var spine;
};
var oldWidth = this.canvas.clientWidth;
var oldHeight = this.canvas.clientHeight;
var oldStyleWidth = this.canvas.style.width;
var oldStyleHeight = this.canvas.style.height;
var isFullscreen = false;
fullscreenButton.onclick = function () {
var fullscreenChanged = function () {
isFullscreen = !isFullscreen;
if (!isFullscreen) {
_this.canvas.style.width = "" + oldWidth + "px";
_this.canvas.style.height = "" + oldHeight + "px";
_this.drawFrame(false);
requestAnimationFrame(function () {
_this.canvas.style.width = oldStyleWidth;
_this.canvas.style.height = oldStyleHeight;
});
}
};
var doc = document;
dom.onfullscreenchange = fullscreenChanged;
dom.onwebkitfullscreenchange = fullscreenChanged;
if (doc.fullscreenElement || doc.webkitFullscreenElement || doc.mozFullScreenElement || doc.msFullscreenElement) {
if (doc.exitFullscreen)
doc.exitFullscreen();
@ -10328,19 +10375,12 @@ var spine;
doc.webkitExitFullscreen();
else if (doc.msExitFullscreen)
doc.msExitFullscreen();
var oldStyleWidth_1 = _this.canvas.style.width;
var oldStyleHeight_1 = _this.canvas.style.height;
_this.canvas.style.width = "" + oldWidth + "px";
_this.canvas.style.height = "" + oldHeight + "px";
_this.drawFrame(false);
requestAnimationFrame(function () {
_this.canvas.style.width = oldStyleWidth_1;
_this.canvas.style.height = oldStyleHeight_1;
});
}
else {
oldWidth = _this.canvas.clientWidth;
oldHeight = _this.canvas.clientHeight;
oldStyleWidth = _this.canvas.style.width;
oldStyleHeight = _this.canvas.style.height;
var player = dom;
if (player.requestFullscreen)
player.requestFullscreen();
@ -10362,7 +10402,7 @@ var spine;
};
SpinePlayer.prototype.showSpeedDialog = function (speedButton) {
var _this = this;
var popup = new Popup(this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Speed</div>\n\t\t\t\t<hr>\n\t\t\t\t<div class=\"spine-player-row\" style=\"user-select: none; align-items: center; padding: 8px;\">\n\t\t\t\t\t<div class=\"spine-player-column\">\n\t\t\t\t\t\t<div class=\"spine-player-speed-slider\" style=\"margin-bottom: 4px;\"></div>\n\t\t\t\t\t\t<div class=\"spine-player-row\" style=\"justify-content: space-between;\">\n\t\t\t\t\t\t\t<div>0.1x</div>\n\t\t\t\t\t\t\t<div>1x</div>\n\t\t\t\t\t\t\t<div>2x</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t");
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Speed</div>\n\t\t\t\t<hr>\n\t\t\t\t<div class=\"spine-player-row\" style=\"user-select: none; align-items: center; padding: 8px;\">\n\t\t\t\t\t<div class=\"spine-player-column\">\n\t\t\t\t\t\t<div class=\"spine-player-speed-slider\" style=\"margin-bottom: 4px;\"></div>\n\t\t\t\t\t\t<div class=\"spine-player-row\" style=\"justify-content: space-between;\">\n\t\t\t\t\t\t\t<div>0.1x</div>\n\t\t\t\t\t\t\t<div>1x</div>\n\t\t\t\t\t\t\t<div>2x</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t");
var sliderParent = findWithClass(popup.dom, "spine-player-speed-slider")[0];
var slider = new Slider(2, 0.1, true);
sliderParent.appendChild(slider.render());
@ -10379,7 +10419,7 @@ var spine;
var _this = this;
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Animations</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\"></ul>\n\t\t\t");
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Animations</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\"></ul>\n\t\t\t");
var rows = findWithClass(popup.dom, "spine-player-list")[0];
this.skeleton.data.animations.forEach(function (animation) {
if (_this.config.animations && _this.config.animations.indexOf(animation.name) < 0) {
@ -10395,7 +10435,7 @@ var spine;
row.classList.add("selected");
_this.config.animation = animation.name;
_this.playTime = 0;
_this.animationState.setAnimation(0, _this.config.animation, true);
_this.setAnimation(animation.name);
};
});
animationsButton.classList.add("spine-player-button-icon-animations-selected");
@ -10407,7 +10447,7 @@ var spine;
var _this = this;
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Skins</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\"></ul>\n\t\t\t");
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Skins</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\"></ul>\n\t\t\t");
var rows = findWithClass(popup.dom, "spine-player-list")[0];
this.skeleton.data.skins.forEach(function (skin) {
if (_this.config.skins && _this.config.skins.indexOf(skin.name) < 0) {
@ -10435,7 +10475,7 @@ var spine;
var _this = this;
if (!this.skeleton || this.skeleton.data.animations.length == 0)
return;
var popup = new Popup(this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Debug</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\">\n\t\t\t\t</li>\n\t\t\t");
var popup = new Popup(this.dom, this.playerControls, "\n\t\t\t\t<div class=\"spine-player-popup-title\">Debug</div>\n\t\t\t\t<hr>\n\t\t\t\t<ul class=\"spine-player-list\">\n\t\t\t\t</li>\n\t\t\t");
var rows = findWithClass(popup.dom, "spine-player-list")[0];
var makeItem = function (label, name) {
var row = createElement("<li class=\"spine-player-list-item\"></li>");
@ -10492,15 +10532,36 @@ var spine;
this.animationState.apply(this.skeleton);
}
this.skeleton.updateWorldTransform();
var viewportSize = this.scale(this.config.viewport.width, this.config.viewport.height, this.canvas.width, this.canvas.height);
this.sceneRenderer.camera.zoom = this.config.viewport.width / viewportSize.x;
this.sceneRenderer.camera.position.x = this.config.viewport.x + this.config.viewport.width / 2;
this.sceneRenderer.camera.position.y = this.config.viewport.y + this.config.viewport.height / 2;
var viewport = {
x: this.currentViewport.x - this.currentViewport.padLeft,
y: this.currentViewport.y - this.currentViewport.padBottom,
width: this.currentViewport.width + this.currentViewport.padLeft + this.currentViewport.padRight,
height: this.currentViewport.height + this.currentViewport.padBottom + this.currentViewport.padTop
};
var transitionAlpha = ((performance.now() - this.viewportTransitionStart) / 1000) / this.config.viewport.transitionTime;
if (this.previousViewport && transitionAlpha < 1) {
var oldViewport = {
x: this.previousViewport.x - this.previousViewport.padLeft,
y: this.previousViewport.y - this.previousViewport.padBottom,
width: this.previousViewport.width + this.previousViewport.padLeft + this.previousViewport.padRight,
height: this.previousViewport.height + this.previousViewport.padBottom + this.previousViewport.padTop
};
viewport = {
x: oldViewport.x + (viewport.x - oldViewport.x) * transitionAlpha,
y: oldViewport.y + (viewport.y - oldViewport.y) * transitionAlpha,
width: oldViewport.width + (viewport.width - oldViewport.width) * transitionAlpha,
height: oldViewport.height + (viewport.height - oldViewport.height) * transitionAlpha
};
}
var viewportSize = this.scale(viewport.width, viewport.height, this.canvas.width, this.canvas.height);
this.sceneRenderer.camera.zoom = viewport.width / viewportSize.x;
this.sceneRenderer.camera.position.x = viewport.x + viewport.width / 2;
this.sceneRenderer.camera.position.y = viewport.y + viewport.height / 2;
this.sceneRenderer.begin();
if (this.config.backgroundImage && this.config.backgroundImage.url) {
var bgImage = this.assetManager.get(this.config.backgroundImage.url);
if (!this.config.backgroundImage.x) {
this.sceneRenderer.drawTexture(bgImage, this.config.viewport.x, this.config.viewport.y, this.config.viewport.width, this.config.viewport.height);
this.sceneRenderer.drawTexture(bgImage, viewport.x, viewport.y, viewport.width, viewport.height);
}
else {
this.sceneRenderer.drawTexture(bgImage, this.config.backgroundImage.x, this.config.backgroundImage.y, this.config.backgroundImage.width, this.config.backgroundImage.height);
@ -10529,6 +10590,10 @@ var spine;
this.sceneRenderer.circle(false, skeleton.x + bone.worldX, skeleton.y + bone.worldY, 20, colorOuter);
}
gl.lineWidth(1);
if (this.config.viewport.debugRender) {
this.sceneRenderer.rect(false, this.currentViewport.x, this.currentViewport.y, this.currentViewport.width, this.currentViewport.height, spine.Color.GREEN);
this.sceneRenderer.rect(false, viewport.x, viewport.y, viewport.width, viewport.height, spine.Color.RED);
}
this.sceneRenderer.end();
this.sceneRenderer.camera.zoom = 0;
}
@ -10593,21 +10658,27 @@ var spine;
this.skeleton.setSkinByName(this.config.skin);
this.skeleton.setSlotsToSetupPose();
}
if (!this.config.viewport || !this.config.viewport.x || !this.config.viewport.y || !this.config.viewport.width || !this.config.viewport.height) {
if (!this.config.viewport) {
this.config.viewport = {
x: 0,
y: 0,
width: 0,
height: 0
animations: {},
debugRender: false,
transitionTime: 0.2
};
this.skeleton.updateWorldTransform();
var offset = new spine.Vector2();
var size = new spine.Vector2();
this.skeleton.getBounds(offset, size);
this.config.viewport.x = offset.x + size.x / 2 - size.x / 2 * 1.2;
this.config.viewport.y = offset.y + size.y / 2 - size.y / 2 * 1.2;
this.config.viewport.width = size.x * 1.2;
this.config.viewport.height = size.y * 1.2;
}
if (typeof this.config.viewport.debugRender === "undefined")
this.config.viewport.debugRender = false;
if (typeof this.config.viewport.transitionTime === "undefined")
this.config.viewport.transitionTime = 0.2;
if (!this.config.viewport.animations) {
this.config.viewport.animations = {};
}
else {
Object.getOwnPropertyNames(this.config.viewport.animations).forEach(function (animation) {
if (!skeletonData.findAnimation(animation)) {
_this.showError("Error: animation '" + animation + "' for which a viewport was specified does not exist in skeleton.");
return;
}
});
}
if (this.config.animations && this.config.animations.length > 0) {
this.config.animations.forEach(function (animation) {
@ -10742,7 +10813,7 @@ var spine;
this.playButton.classList.add("spine-player-button-icon-pause");
if (this.config.animation) {
if (!this.animationState.getCurrent(0)) {
this.animationState.setAnimation(0, this.config.animation, true);
this.setAnimation(this.config.animation);
}
}
};
@ -10751,6 +10822,103 @@ var spine;
this.playButton.classList.remove("spine-player-button-icon-pause");
this.playButton.classList.add("spine-player-button-icon-play");
};
SpinePlayer.prototype.setAnimation = function (animation) {
this.previousViewport = this.currentViewport;
var animViewport = this.calculateAnimationViewport(animation);
var viewport = {
x: animViewport.x,
y: animViewport.y,
width: animViewport.width,
height: animViewport.height,
padLeft: "10%",
padRight: "10%",
padTop: "10%",
padBottom: "10%"
};
var globalViewport = this.config.viewport;
if (typeof globalViewport.x !== "undefined" && typeof globalViewport.y !== "undefined" && typeof globalViewport.width !== "undefined" && typeof globalViewport.height !== "undefined") {
viewport.x = globalViewport.x;
viewport.y = globalViewport.y;
viewport.width = globalViewport.width;
viewport.height = globalViewport.height;
}
if (typeof globalViewport.padLeft !== "undefined")
viewport.padLeft = globalViewport.padLeft;
if (typeof globalViewport.padRight !== "undefined")
viewport.padRight = globalViewport.padRight;
if (typeof globalViewport.padTop !== "undefined")
viewport.padTop = globalViewport.padTop;
if (typeof globalViewport.padBottom !== "undefined")
viewport.padBottom = globalViewport.padBottom;
var userAnimViewport = this.config.viewport.animations[animation];
if (userAnimViewport) {
if (typeof userAnimViewport.x !== "undefined" && typeof userAnimViewport.y !== "undefined" && typeof userAnimViewport.width !== "undefined" && typeof userAnimViewport.height !== "undefined") {
viewport.x = userAnimViewport.x;
viewport.y = userAnimViewport.y;
viewport.width = userAnimViewport.width;
viewport.height = userAnimViewport.height;
}
if (typeof userAnimViewport.padLeft !== "undefined")
viewport.padLeft = userAnimViewport.padLeft;
if (typeof userAnimViewport.padRight !== "undefined")
viewport.padRight = userAnimViewport.padRight;
if (typeof userAnimViewport.padTop !== "undefined")
viewport.padTop = userAnimViewport.padTop;
if (typeof userAnimViewport.padBottom !== "undefined")
viewport.padBottom = userAnimViewport.padBottom;
}
viewport.padLeft = this.percentageToWorldUnit(viewport.width, viewport.padLeft);
viewport.padRight = this.percentageToWorldUnit(viewport.width, viewport.padRight);
viewport.padBottom = this.percentageToWorldUnit(viewport.height, viewport.padBottom);
viewport.padTop = this.percentageToWorldUnit(viewport.height, viewport.padTop);
this.currentViewport = viewport;
this.viewportTransitionStart = performance.now();
this.animationState.clearTracks();
this.skeleton.setToSetupPose();
this.animationState.setAnimation(0, this.config.animation, true);
};
SpinePlayer.prototype.percentageToWorldUnit = function (size, percentageOrAbsolute) {
if (typeof percentageOrAbsolute === "string") {
return size * parseFloat(percentageOrAbsolute.substr(0, percentageOrAbsolute.length - 1)) / 100;
}
else {
return percentageOrAbsolute;
}
};
SpinePlayer.prototype.calculateAnimationViewport = function (animationName) {
var animation = this.skeleton.data.findAnimation(animationName);
this.animationState.clearTracks();
this.skeleton.setToSetupPose();
this.animationState.setAnimationWith(0, animation, true);
var steps = 100;
var stepTime = animation.duration > 0 ? animation.duration / steps : 0;
var minX = 100000000;
var maxX = -100000000;
var minY = 100000000;
var maxY = -100000000;
var offset = new spine.Vector2();
var size = new spine.Vector2();
for (var i = 0; i < steps; i++) {
this.animationState.update(stepTime);
this.animationState.apply(this.skeleton);
this.skeleton.updateWorldTransform();
this.skeleton.getBounds(offset, size);
minX = Math.min(offset.x, minX);
maxX = Math.max(offset.x + size.x, maxX);
minY = Math.min(offset.y, minY);
maxY = Math.max(offset.y + size.y, maxY);
}
offset.x = minX;
offset.y = minY;
size.x = maxX - minX;
size.y = maxY - minY;
return {
x: offset.x,
y: offset.y,
width: size.x,
height: size.y
};
};
SpinePlayer.HOVER_COLOR_INNER = new spine.Color(0.478, 0, 0, 0.25);
SpinePlayer.HOVER_COLOR_OUTER = new spine.Color(1, 1, 1, 1);
SpinePlayer.NON_HOVER_COLOR_INNER = new spine.Color(0.478, 0, 0, 0.5);

File diff suppressed because one or more lines are too long

View File

@ -16,11 +16,11 @@ declare module spine {
setup = 0,
first = 1,
replace = 2,
add = 3,
add = 3
}
enum MixDirection {
in = 0,
out = 1,
out = 1
}
enum TimelineType {
rotate = 0,
@ -37,7 +37,7 @@ declare module spine {
pathConstraintPosition = 11,
pathConstraintSpacing = 12,
pathConstraintMix = 13,
twoColor = 14,
twoColor = 14
}
abstract class CurveTimeline implements Timeline {
static LINEAR: number;
@ -341,7 +341,7 @@ declare module spine {
end = 2,
dispose = 3,
complete = 4,
event = 5,
event = 5
}
interface AnimationStateListener2 {
start(entry: TrackEntry): void;
@ -380,8 +380,8 @@ declare module spine {
private toLoad;
private loaded;
constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
private static downloadText(url, success, error);
private static downloadBinary(url, success, error);
private static downloadText;
private static downloadBinary;
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
@ -414,7 +414,7 @@ declare module spine {
Normal = 0,
Additive = 1,
Multiply = 2,
Screen = 3,
Screen = 3
}
}
declare module spine {
@ -483,7 +483,7 @@ declare module spine {
OnlyTranslation = 1,
NoRotationOrReflection = 2,
NoScale = 3,
NoScaleOrReflection = 4,
NoScaleOrReflection = 4
}
}
declare module spine {
@ -593,17 +593,17 @@ declare module spine {
}
enum PositionMode {
Fixed = 0,
Percent = 1,
Percent = 1
}
enum SpacingMode {
Length = 0,
Fixed = 1,
Percent = 2,
Percent = 2
}
enum RotateMode {
Tangent = 0,
Chain = 1,
ChainScale = 2,
ChainScale = 2
}
}
declare module spine {
@ -614,12 +614,12 @@ declare module spine {
private rawAssets;
private errors;
constructor(pathPrefix?: string);
private queueAsset(clientId, textureLoader, path);
private queueAsset;
loadText(clientId: string, path: string): void;
loadJson(clientId: string, path: string): void;
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
get(clientId: string, path: string): any;
private updateClientAssets(clientAssets);
private updateClientAssets;
isLoadingComplete(clientId: string): boolean;
dispose(): void;
hasErrors(): boolean;
@ -823,12 +823,12 @@ declare module spine {
MipMapNearestNearest = 9984,
MipMapLinearNearest = 9985,
MipMapNearestLinear = 9986,
MipMapLinearLinear = 9987,
MipMapLinearLinear = 9987
}
enum TextureWrap {
MirroredRepeat = 33648,
ClampToEdge = 33071,
Repeat = 10497,
Repeat = 10497
}
class TextureRegion {
renderObject: any;
@ -855,7 +855,7 @@ declare module spine {
pages: TextureAtlasPage[];
regions: TextureAtlasRegion[];
constructor(atlasText: string, textureLoader: (path: string) => any);
private load(atlasText, textureLoader);
private load;
findRegion(name: string): TextureAtlasRegion;
dispose(): void;
}
@ -931,9 +931,9 @@ declare module spine {
private polygonIndicesPool;
triangulate(verticesArray: ArrayLike<number>): Array<number>;
decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
private static isConcave(index, vertexCount, vertices, indices);
private static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y);
private static winding(p1x, p1y, p2x, p2y, p3x, p3y);
private static isConcave;
private static positiveArea;
private static winding;
}
}
declare module spine {
@ -1105,7 +1105,7 @@ declare module spine {
Mesh = 2,
LinkedMesh = 3,
Path = 4,
Point = 5,
Point = 5
}
}
declare module spine {
@ -1271,10 +1271,10 @@ declare module spine.canvas {
private tempColor;
constructor(context: CanvasRenderingContext2D);
draw(skeleton: Skeleton): void;
private drawImages(skeleton);
private drawTriangles(skeleton);
private drawTriangle(img, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2);
private computeRegionVertices(slot, region, pma);
private computeMeshVertices(slot, mesh, pma);
private drawImages;
private drawTriangles;
private drawTriangle;
private computeRegionVertices;
private computeMeshVertices;
}
}

View File

@ -1,7 +1,10 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
@ -1470,6 +1473,7 @@ var spine;
from.totalAlpha = 0;
for (var i = 0; i < timelineCount; i++) {
var timeline = timelines[i];
var direction = spine.MixDirection.out;
var timelineBlend;
var alpha = 0;
switch (timelineMode[i]) {
@ -1500,7 +1504,17 @@ var spine;
this.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
else {
spine.Utils.webkit602BugfixHelper(alpha, blend);
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, spine.MixDirection.out);
if (timelineBlend = spine.MixBlend.setup) {
if (timeline instanceof spine.AttachmentTimeline) {
if (attachments)
direction = spine.MixDirection.out;
}
else if (timeline instanceof spine.DrawOrderTimeline) {
if (drawOrder)
direction = spine.MixDirection.out;
}
}
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -16,11 +16,11 @@ declare module spine {
setup = 0,
first = 1,
replace = 2,
add = 3,
add = 3
}
enum MixDirection {
in = 0,
out = 1,
out = 1
}
enum TimelineType {
rotate = 0,
@ -37,7 +37,7 @@ declare module spine {
pathConstraintPosition = 11,
pathConstraintSpacing = 12,
pathConstraintMix = 13,
twoColor = 14,
twoColor = 14
}
abstract class CurveTimeline implements Timeline {
static LINEAR: number;
@ -341,7 +341,7 @@ declare module spine {
end = 2,
dispose = 3,
complete = 4,
event = 5,
event = 5
}
interface AnimationStateListener2 {
start(entry: TrackEntry): void;
@ -380,8 +380,8 @@ declare module spine {
private toLoad;
private loaded;
constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
private static downloadText(url, success, error);
private static downloadBinary(url, success, error);
private static downloadText;
private static downloadBinary;
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
@ -414,7 +414,7 @@ declare module spine {
Normal = 0,
Additive = 1,
Multiply = 2,
Screen = 3,
Screen = 3
}
}
declare module spine {
@ -483,7 +483,7 @@ declare module spine {
OnlyTranslation = 1,
NoRotationOrReflection = 2,
NoScale = 3,
NoScaleOrReflection = 4,
NoScaleOrReflection = 4
}
}
declare module spine {
@ -593,17 +593,17 @@ declare module spine {
}
enum PositionMode {
Fixed = 0,
Percent = 1,
Percent = 1
}
enum SpacingMode {
Length = 0,
Fixed = 1,
Percent = 2,
Percent = 2
}
enum RotateMode {
Tangent = 0,
Chain = 1,
ChainScale = 2,
ChainScale = 2
}
}
declare module spine {
@ -614,12 +614,12 @@ declare module spine {
private rawAssets;
private errors;
constructor(pathPrefix?: string);
private queueAsset(clientId, textureLoader, path);
private queueAsset;
loadText(clientId: string, path: string): void;
loadJson(clientId: string, path: string): void;
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
get(clientId: string, path: string): any;
private updateClientAssets(clientAssets);
private updateClientAssets;
isLoadingComplete(clientId: string): boolean;
dispose(): void;
hasErrors(): boolean;
@ -823,12 +823,12 @@ declare module spine {
MipMapNearestNearest = 9984,
MipMapLinearNearest = 9985,
MipMapNearestLinear = 9986,
MipMapLinearLinear = 9987,
MipMapLinearLinear = 9987
}
enum TextureWrap {
MirroredRepeat = 33648,
ClampToEdge = 33071,
Repeat = 10497,
Repeat = 10497
}
class TextureRegion {
renderObject: any;
@ -855,7 +855,7 @@ declare module spine {
pages: TextureAtlasPage[];
regions: TextureAtlasRegion[];
constructor(atlasText: string, textureLoader: (path: string) => any);
private load(atlasText, textureLoader);
private load;
findRegion(name: string): TextureAtlasRegion;
dispose(): void;
}
@ -931,9 +931,9 @@ declare module spine {
private polygonIndicesPool;
triangulate(verticesArray: ArrayLike<number>): Array<number>;
decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
private static isConcave(index, vertexCount, vertices, indices);
private static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y);
private static winding(p1x, p1y, p2x, p2y, p3x, p3y);
private static isConcave;
private static positiveArea;
private static winding;
}
}
declare module spine {
@ -1105,7 +1105,7 @@ declare module spine {
Mesh = 2,
LinkedMesh = 3,
Path = 4,
Point = 5,
Point = 5
}
}
declare module spine {

View File

@ -1,7 +1,10 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
@ -1470,6 +1473,7 @@ var spine;
from.totalAlpha = 0;
for (var i = 0; i < timelineCount; i++) {
var timeline = timelines[i];
var direction = spine.MixDirection.out;
var timelineBlend;
var alpha = 0;
switch (timelineMode[i]) {
@ -1500,7 +1504,17 @@ var spine;
this.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
else {
spine.Utils.webkit602BugfixHelper(alpha, blend);
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, spine.MixDirection.out);
if (timelineBlend = spine.MixBlend.setup) {
if (timeline instanceof spine.AttachmentTimeline) {
if (attachments)
direction = spine.MixDirection.out;
}
else if (timeline instanceof spine.DrawOrderTimeline) {
if (drawOrder)
direction = spine.MixDirection.out;
}
}
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -16,11 +16,11 @@ declare module spine {
setup = 0,
first = 1,
replace = 2,
add = 3,
add = 3
}
enum MixDirection {
in = 0,
out = 1,
out = 1
}
enum TimelineType {
rotate = 0,
@ -37,7 +37,7 @@ declare module spine {
pathConstraintPosition = 11,
pathConstraintSpacing = 12,
pathConstraintMix = 13,
twoColor = 14,
twoColor = 14
}
abstract class CurveTimeline implements Timeline {
static LINEAR: number;
@ -341,7 +341,7 @@ declare module spine {
end = 2,
dispose = 3,
complete = 4,
event = 5,
event = 5
}
interface AnimationStateListener2 {
start(entry: TrackEntry): void;
@ -380,8 +380,8 @@ declare module spine {
private toLoad;
private loaded;
constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
private static downloadText(url, success, error);
private static downloadBinary(url, success, error);
private static downloadText;
private static downloadBinary;
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
@ -414,7 +414,7 @@ declare module spine {
Normal = 0,
Additive = 1,
Multiply = 2,
Screen = 3,
Screen = 3
}
}
declare module spine {
@ -483,7 +483,7 @@ declare module spine {
OnlyTranslation = 1,
NoRotationOrReflection = 2,
NoScale = 3,
NoScaleOrReflection = 4,
NoScaleOrReflection = 4
}
}
declare module spine {
@ -593,17 +593,17 @@ declare module spine {
}
enum PositionMode {
Fixed = 0,
Percent = 1,
Percent = 1
}
enum SpacingMode {
Length = 0,
Fixed = 1,
Percent = 2,
Percent = 2
}
enum RotateMode {
Tangent = 0,
Chain = 1,
ChainScale = 2,
ChainScale = 2
}
}
declare module spine {
@ -614,12 +614,12 @@ declare module spine {
private rawAssets;
private errors;
constructor(pathPrefix?: string);
private queueAsset(clientId, textureLoader, path);
private queueAsset;
loadText(clientId: string, path: string): void;
loadJson(clientId: string, path: string): void;
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
get(clientId: string, path: string): any;
private updateClientAssets(clientAssets);
private updateClientAssets;
isLoadingComplete(clientId: string): boolean;
dispose(): void;
hasErrors(): boolean;
@ -823,12 +823,12 @@ declare module spine {
MipMapNearestNearest = 9984,
MipMapLinearNearest = 9985,
MipMapNearestLinear = 9986,
MipMapLinearLinear = 9987,
MipMapLinearLinear = 9987
}
enum TextureWrap {
MirroredRepeat = 33648,
ClampToEdge = 33071,
Repeat = 10497,
Repeat = 10497
}
class TextureRegion {
renderObject: any;
@ -855,7 +855,7 @@ declare module spine {
pages: TextureAtlasPage[];
regions: TextureAtlasRegion[];
constructor(atlasText: string, textureLoader: (path: string) => any);
private load(atlasText, textureLoader);
private load;
findRegion(name: string): TextureAtlasRegion;
dispose(): void;
}
@ -931,9 +931,9 @@ declare module spine {
private polygonIndicesPool;
triangulate(verticesArray: ArrayLike<number>): Array<number>;
decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
private static isConcave(index, vertexCount, vertices, indices);
private static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y);
private static winding(p1x, p1y, p2x, p2y, p3x, p3y);
private static isConcave;
private static positiveArea;
private static winding;
}
}
declare module spine {
@ -1105,7 +1105,7 @@ declare module spine {
Mesh = 2,
LinkedMesh = 3,
Path = 4,
Point = 5,
Point = 5
}
}
declare module spine {
@ -1290,9 +1290,9 @@ declare module spine.threejs {
private tempColor;
constructor(skeletonData: SkeletonData);
update(deltaTime: number): void;
private clearBatches();
private nextBatch();
private updateGeometry();
private clearBatches;
private nextBatch;
private updateGeometry;
}
}
declare module spine.threejs {

View File

@ -1,7 +1,10 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
@ -1470,6 +1473,7 @@ var spine;
from.totalAlpha = 0;
for (var i = 0; i < timelineCount; i++) {
var timeline = timelines[i];
var direction = spine.MixDirection.out;
var timelineBlend;
var alpha = 0;
switch (timelineMode[i]) {
@ -1500,7 +1504,17 @@ var spine;
this.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
else {
spine.Utils.webkit602BugfixHelper(alpha, blend);
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, spine.MixDirection.out);
if (timelineBlend = spine.MixBlend.setup) {
if (timeline instanceof spine.AttachmentTimeline) {
if (attachments)
direction = spine.MixDirection.out;
}
else if (timeline instanceof spine.DrawOrderTimeline) {
if (drawOrder)
direction = spine.MixDirection.out;
}
}
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -16,11 +16,11 @@ declare module spine {
setup = 0,
first = 1,
replace = 2,
add = 3,
add = 3
}
enum MixDirection {
in = 0,
out = 1,
out = 1
}
enum TimelineType {
rotate = 0,
@ -37,7 +37,7 @@ declare module spine {
pathConstraintPosition = 11,
pathConstraintSpacing = 12,
pathConstraintMix = 13,
twoColor = 14,
twoColor = 14
}
abstract class CurveTimeline implements Timeline {
static LINEAR: number;
@ -341,7 +341,7 @@ declare module spine {
end = 2,
dispose = 3,
complete = 4,
event = 5,
event = 5
}
interface AnimationStateListener2 {
start(entry: TrackEntry): void;
@ -380,8 +380,8 @@ declare module spine {
private toLoad;
private loaded;
constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
private static downloadText(url, success, error);
private static downloadBinary(url, success, error);
private static downloadText;
private static downloadBinary;
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
@ -414,7 +414,7 @@ declare module spine {
Normal = 0,
Additive = 1,
Multiply = 2,
Screen = 3,
Screen = 3
}
}
declare module spine {
@ -483,7 +483,7 @@ declare module spine {
OnlyTranslation = 1,
NoRotationOrReflection = 2,
NoScale = 3,
NoScaleOrReflection = 4,
NoScaleOrReflection = 4
}
}
declare module spine {
@ -593,17 +593,17 @@ declare module spine {
}
enum PositionMode {
Fixed = 0,
Percent = 1,
Percent = 1
}
enum SpacingMode {
Length = 0,
Fixed = 1,
Percent = 2,
Percent = 2
}
enum RotateMode {
Tangent = 0,
Chain = 1,
ChainScale = 2,
ChainScale = 2
}
}
declare module spine {
@ -614,12 +614,12 @@ declare module spine {
private rawAssets;
private errors;
constructor(pathPrefix?: string);
private queueAsset(clientId, textureLoader, path);
private queueAsset;
loadText(clientId: string, path: string): void;
loadJson(clientId: string, path: string): void;
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
get(clientId: string, path: string): any;
private updateClientAssets(clientAssets);
private updateClientAssets;
isLoadingComplete(clientId: string): boolean;
dispose(): void;
hasErrors(): boolean;
@ -823,12 +823,12 @@ declare module spine {
MipMapNearestNearest = 9984,
MipMapLinearNearest = 9985,
MipMapNearestLinear = 9986,
MipMapLinearLinear = 9987,
MipMapLinearLinear = 9987
}
enum TextureWrap {
MirroredRepeat = 33648,
ClampToEdge = 33071,
Repeat = 10497,
Repeat = 10497
}
class TextureRegion {
renderObject: any;
@ -855,7 +855,7 @@ declare module spine {
pages: TextureAtlasPage[];
regions: TextureAtlasRegion[];
constructor(atlasText: string, textureLoader: (path: string) => any);
private load(atlasText, textureLoader);
private load;
findRegion(name: string): TextureAtlasRegion;
dispose(): void;
}
@ -931,9 +931,9 @@ declare module spine {
private polygonIndicesPool;
triangulate(verticesArray: ArrayLike<number>): Array<number>;
decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
private static isConcave(index, vertexCount, vertices, indices);
private static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y);
private static winding(p1x, p1y, p2x, p2y, p3x, p3y);
private static isConcave;
private static positiveArea;
private static winding;
}
}
declare module spine {
@ -1105,7 +1105,7 @@ declare module spine {
Mesh = 2,
LinkedMesh = 3,
Path = 4,
Point = 5,
Point = 5
}
}
declare module spine {
@ -1299,7 +1299,7 @@ declare module spine.webgl {
touchesPool: Pool<Touch>;
private listeners;
constructor(element: HTMLElement);
private setupCallbacks(element);
private setupCallbacks;
addListener(listener: InputListener): void;
removeListener(listener: InputListener): void;
}
@ -1408,7 +1408,7 @@ declare module spine.webgl {
drawWithOffset(shader: Shader, primitiveType: number, offset: number, count: number): void;
bind(shader: Shader): void;
unbind(shader: Shader): void;
private update();
private update;
restore(): void;
dispose(): void;
}
@ -1434,7 +1434,7 @@ declare module spine.webgl {
constructor();
}
enum VertexAttributeType {
Float = 0,
Float = 0
}
}
declare module spine.webgl {
@ -1453,7 +1453,7 @@ declare module spine.webgl {
begin(shader: Shader): void;
setBlendMode(srcBlend: number, dstBlend: number): void;
draw(texture: GLTexture, vertices: ArrayLike<number>, indices: Array<number>): void;
private flush();
private flush;
end(): void;
getDrawCalls(): number;
dispose(): void;
@ -1493,13 +1493,13 @@ declare module spine.webgl {
curve(x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, segments: number, color?: Color): void;
end(): void;
resize(resizeMode: ResizeMode): void;
private enableRenderer(renderer);
private enableRenderer;
dispose(): void;
}
enum ResizeMode {
Stretch = 0,
Expand = 1,
Fit = 2,
Fit = 2
}
}
declare module spine.webgl {
@ -1527,9 +1527,9 @@ declare module spine.webgl {
getVertexShaderSource(): string;
getFragmentSource(): string;
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, vertexShader: string, fragmentShader: string);
private compile();
private compileShader(type, source);
private compileProgram(vs, fs);
private compile;
private compileShader;
private compileProgram;
restore(): void;
bind(): void;
unbind(): void;
@ -1576,16 +1576,16 @@ declare module spine.webgl {
polygon(polygonVertices: ArrayLike<number>, offset: number, count: number, color?: Color): void;
circle(filled: boolean, x: number, y: number, radius: number, color?: Color, segments?: number): void;
curve(x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, segments: number, color?: Color): void;
private vertex(x, y, color);
private vertex;
end(): void;
private flush();
private check(shapeType, numVertices);
private flush;
private check;
dispose(): void;
}
enum ShapeType {
Point = 0,
Line = 1,
Filled = 4,
Filled = 4
}
}
declare module spine.webgl {

View File

@ -1,7 +1,10 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
@ -1470,6 +1473,7 @@ var spine;
from.totalAlpha = 0;
for (var i = 0; i < timelineCount; i++) {
var timeline = timelines[i];
var direction = spine.MixDirection.out;
var timelineBlend;
var alpha = 0;
switch (timelineMode[i]) {
@ -1500,7 +1504,17 @@ var spine;
this.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
else {
spine.Utils.webkit602BugfixHelper(alpha, blend);
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, spine.MixDirection.out);
if (timelineBlend = spine.MixBlend.setup) {
if (timeline instanceof spine.AttachmentTimeline) {
if (attachments)
direction = spine.MixDirection.out;
}
else if (timeline instanceof spine.DrawOrderTimeline) {
if (drawOrder)
direction = spine.MixDirection.out;
}
}
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -16,11 +16,11 @@ declare module spine {
setup = 0,
first = 1,
replace = 2,
add = 3,
add = 3
}
enum MixDirection {
in = 0,
out = 1,
out = 1
}
enum TimelineType {
rotate = 0,
@ -37,7 +37,7 @@ declare module spine {
pathConstraintPosition = 11,
pathConstraintSpacing = 12,
pathConstraintMix = 13,
twoColor = 14,
twoColor = 14
}
abstract class CurveTimeline implements Timeline {
static LINEAR: number;
@ -341,7 +341,7 @@ declare module spine {
end = 2,
dispose = 3,
complete = 4,
event = 5,
event = 5
}
interface AnimationStateListener2 {
start(entry: TrackEntry): void;
@ -380,8 +380,8 @@ declare module spine {
private toLoad;
private loaded;
constructor(textureLoader: (image: HTMLImageElement) => any, pathPrefix?: string);
private static downloadText(url, success, error);
private static downloadBinary(url, success, error);
private static downloadText;
private static downloadBinary;
loadText(path: string, success?: (path: string, text: string) => void, error?: (path: string, error: string) => void): void;
loadTexture(path: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
loadTextureData(path: string, data: string, success?: (path: string, image: HTMLImageElement) => void, error?: (path: string, error: string) => void): void;
@ -414,7 +414,7 @@ declare module spine {
Normal = 0,
Additive = 1,
Multiply = 2,
Screen = 3,
Screen = 3
}
}
declare module spine {
@ -483,7 +483,7 @@ declare module spine {
OnlyTranslation = 1,
NoRotationOrReflection = 2,
NoScale = 3,
NoScaleOrReflection = 4,
NoScaleOrReflection = 4
}
}
declare module spine {
@ -593,17 +593,17 @@ declare module spine {
}
enum PositionMode {
Fixed = 0,
Percent = 1,
Percent = 1
}
enum SpacingMode {
Length = 0,
Fixed = 1,
Percent = 2,
Percent = 2
}
enum RotateMode {
Tangent = 0,
Chain = 1,
ChainScale = 2,
ChainScale = 2
}
}
declare module spine {
@ -614,12 +614,12 @@ declare module spine {
private rawAssets;
private errors;
constructor(pathPrefix?: string);
private queueAsset(clientId, textureLoader, path);
private queueAsset;
loadText(clientId: string, path: string): void;
loadJson(clientId: string, path: string): void;
loadTexture(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): void;
get(clientId: string, path: string): any;
private updateClientAssets(clientAssets);
private updateClientAssets;
isLoadingComplete(clientId: string): boolean;
dispose(): void;
hasErrors(): boolean;
@ -823,12 +823,12 @@ declare module spine {
MipMapNearestNearest = 9984,
MipMapLinearNearest = 9985,
MipMapNearestLinear = 9986,
MipMapLinearLinear = 9987,
MipMapLinearLinear = 9987
}
enum TextureWrap {
MirroredRepeat = 33648,
ClampToEdge = 33071,
Repeat = 10497,
Repeat = 10497
}
class TextureRegion {
renderObject: any;
@ -855,7 +855,7 @@ declare module spine {
pages: TextureAtlasPage[];
regions: TextureAtlasRegion[];
constructor(atlasText: string, textureLoader: (path: string) => any);
private load(atlasText, textureLoader);
private load;
findRegion(name: string): TextureAtlasRegion;
dispose(): void;
}
@ -931,9 +931,9 @@ declare module spine {
private polygonIndicesPool;
triangulate(verticesArray: ArrayLike<number>): Array<number>;
decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
private static isConcave(index, vertexCount, vertices, indices);
private static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y);
private static winding(p1x, p1y, p2x, p2y, p3x, p3y);
private static isConcave;
private static positiveArea;
private static winding;
}
}
declare module spine {
@ -1105,7 +1105,7 @@ declare module spine {
Mesh = 2,
LinkedMesh = 3,
Path = 4,
Point = 5,
Point = 5
}
}
declare module spine {
@ -1299,7 +1299,7 @@ declare module spine.webgl {
touchesPool: Pool<Touch>;
private listeners;
constructor(element: HTMLElement);
private setupCallbacks(element);
private setupCallbacks;
addListener(listener: InputListener): void;
removeListener(listener: InputListener): void;
}
@ -1408,7 +1408,7 @@ declare module spine.webgl {
drawWithOffset(shader: Shader, primitiveType: number, offset: number, count: number): void;
bind(shader: Shader): void;
unbind(shader: Shader): void;
private update();
private update;
restore(): void;
dispose(): void;
}
@ -1434,7 +1434,7 @@ declare module spine.webgl {
constructor();
}
enum VertexAttributeType {
Float = 0,
Float = 0
}
}
declare module spine.webgl {
@ -1453,7 +1453,7 @@ declare module spine.webgl {
begin(shader: Shader): void;
setBlendMode(srcBlend: number, dstBlend: number): void;
draw(texture: GLTexture, vertices: ArrayLike<number>, indices: Array<number>): void;
private flush();
private flush;
end(): void;
getDrawCalls(): number;
dispose(): void;
@ -1493,13 +1493,13 @@ declare module spine.webgl {
curve(x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, segments: number, color?: Color): void;
end(): void;
resize(resizeMode: ResizeMode): void;
private enableRenderer(renderer);
private enableRenderer;
dispose(): void;
}
enum ResizeMode {
Stretch = 0,
Expand = 1,
Fit = 2,
Fit = 2
}
}
declare module spine.webgl {
@ -1527,9 +1527,9 @@ declare module spine.webgl {
getVertexShaderSource(): string;
getFragmentSource(): string;
constructor(context: ManagedWebGLRenderingContext | WebGLRenderingContext, vertexShader: string, fragmentShader: string);
private compile();
private compileShader(type, source);
private compileProgram(vs, fs);
private compile;
private compileShader;
private compileProgram;
restore(): void;
bind(): void;
unbind(): void;
@ -1576,16 +1576,16 @@ declare module spine.webgl {
polygon(polygonVertices: ArrayLike<number>, offset: number, count: number, color?: Color): void;
circle(filled: boolean, x: number, y: number, radius: number, color?: Color, segments?: number): void;
curve(x1: number, y1: number, cx1: number, cy1: number, cx2: number, cy2: number, x2: number, y2: number, segments: number, color?: Color): void;
private vertex(x, y, color);
private vertex;
end(): void;
private flush();
private check(shapeType, numVertices);
private flush;
private check;
dispose(): void;
}
enum ShapeType {
Point = 0,
Line = 1,
Filled = 4,
Filled = 4
}
}
declare module spine.webgl {
@ -1780,11 +1780,11 @@ declare module spine {
scale(sourceWidth: number, sourceHeight: number, targetWidth: number, targetHeight: number): Vector2;
loadSkeleton(): void;
setupInput(): void;
private play();
private pause();
private setAnimation(animation);
private percentageToWorldUnit(size, percentageOrAbsolute);
private calculateAnimationViewport(animationName);
private play;
private pause;
private setAnimation;
private percentageToWorldUnit;
private calculateAnimationViewport;
}
}
declare module spine {
@ -1808,10 +1808,10 @@ declare module spine {
private loaded;
private bounds;
constructor(element: HTMLElement | string, config: SpineWidgetConfig);
private validateConfig(config);
private load();
private render();
private resize();
private validateConfig;
private load;
private render;
private resize;
pause(): void;
play(): void;
isPlaying(): boolean;
@ -1819,7 +1819,7 @@ declare module spine {
static loadWidgets(): void;
static loadWidget(widget: HTMLElement): void;
static pageLoaded: boolean;
private static ready();
private static ready;
static setupDOMListener(): void;
}
class SpineWidgetConfig {

View File

@ -1,7 +1,10 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
@ -1470,6 +1473,7 @@ var spine;
from.totalAlpha = 0;
for (var i = 0; i < timelineCount; i++) {
var timeline = timelines[i];
var direction = spine.MixDirection.out;
var timelineBlend;
var alpha = 0;
switch (timelineMode[i]) {
@ -1500,7 +1504,17 @@ var spine;
this.applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
else {
spine.Utils.webkit602BugfixHelper(alpha, blend);
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, spine.MixDirection.out);
if (timelineBlend = spine.MixBlend.setup) {
if (timeline instanceof spine.AttachmentTimeline) {
if (attachments)
direction = spine.MixDirection.out;
}
else if (timeline instanceof spine.DrawOrderTimeline) {
if (drawOrder)
direction = spine.MixDirection.out;
}
}
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -225,6 +225,7 @@ module spine {
from.totalAlpha = 0;
for (var i = 0; i < timelineCount; i++) {
let timeline = timelines[i];
var direction = MixDirection.out;
var timelineBlend: MixBlend;
var alpha = 0;
switch (timelineMode[i]) {
@ -254,7 +255,14 @@ module spine {
else {
// This fixes the WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109
Utils.webkit602BugfixHelper(alpha, blend);
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, MixDirection.out);
if (timelineBlend = MixBlend.setup) {
if (timeline instanceof AttachmentTimeline) {
if (attachments) direction = MixDirection.out;
} else if (timeline instanceof DrawOrderTimeline) {
if (drawOrder) direction = MixDirection.out;
}
}
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
}
}
}

View File

@ -475,7 +475,7 @@
let doc = document as any;
(dom as any).onfullscreenchange = fullscreenChanged;
dom.onwebkitfullscreenchange = fullscreenChanged;
(dom as any).onwebkitfullscreenchange = fullscreenChanged;
if(doc.fullscreenElement || doc.webkitFullscreenElement || doc.mozFullScreenElement || doc.msFullscreenElement) {
if (doc.exitFullscreen) doc.exitFullscreen();