Make let not var (#1298)

This commit is contained in:
Ivan Popelyshev 2019-03-08 18:36:05 +03:00 committed by Mario Zechner
parent 5ee7d93fce
commit d55724a1b5
6 changed files with 29 additions and 29 deletions

View File

@ -233,7 +233,7 @@ module spine {
}
if (time >= frames[frames.length - RotateTimeline.ENTRIES]) { // Time is after last frame.
var r = frames[frames.length + RotateTimeline.PREV_ROTATION];
let r = frames[frames.length + RotateTimeline.PREV_ROTATION];
switch (blend) {
case MixBlend.setup:
bone.rotation = bone.data.rotation + r * alpha;
@ -255,7 +255,7 @@ module spine {
let percent = this.getCurvePercent((frame >> 1) - 1,
1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime));
r = frames[frame + RotateTimeline.ROTATION] - prevRotation;
let r = frames[frame + RotateTimeline.ROTATION] - prevRotation;
r = prevRotation + (r - (16384 - ((16384.499999999996 - r / 360) | 0)) * 360) * percent;
switch (blend) {
case MixBlend.setup:
@ -728,7 +728,7 @@ module spine {
}
}
var zeros : ArrayLike<number> = null;
let zeros : ArrayLike<number> = null;
export class DeformTimeline extends CurveTimeline {
slotIndex: number;
@ -779,7 +779,7 @@ module spine {
let vertices: Array<number> = Utils.setArraySize(verticesArray, vertexCount);
if (vertexAttachment.bones == null) {
// Unweighted vertex positions.
var setupVertices = vertexAttachment.vertices;
let setupVertices = vertexAttachment.vertices;
for (var i = 0; i < vertexCount; i++)
vertices[i] += (setupVertices[i] - vertices[i]) * alpha;
} else {

View File

@ -212,7 +212,7 @@ module spine {
let timelines = from.animation.timelines;
let alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);
if (blend == MixBlend.add) {
for (var i = 0; i < timelineCount; i++)
for (let i = 0; i < timelineCount; i++)
timelines[i].apply(skeleton, animationLast, animationTime, events, alphaMix, blend, MixDirection.out);
} else {
let timelineMode = from.timelineMode;
@ -223,11 +223,11 @@ module spine {
let timelinesRotation = from.timelinesRotation;
from.totalAlpha = 0;
for (var i = 0; i < timelineCount; i++) {
for (let i = 0; i < timelineCount; i++) {
let timeline = timelines[i];
var direction = MixDirection.out;
var timelineBlend: MixBlend;
var alpha = 0;
let direction = MixDirection.out;
let timelineBlend: MixBlend;
let alpha = 0;
switch (timelineMode[i]) {
case AnimationState.SUBSEQUENT:
if (!attachments && timeline instanceof AttachmentTimeline) continue;
@ -364,7 +364,7 @@ module spine {
}
// Queue complete if completed a loop iteration or the animation.
var complete = false;
let complete = false;
if (entry.loop)
complete = duration == 0 || trackLastWrapped > entry.trackTime % duration;
else
@ -577,7 +577,7 @@ module spine {
this.propertyIDs.clear();
for (var i = 0, n = this.tracks.length; i < n; i++) {
for (let i = 0, n = this.tracks.length; i < n; i++) {
let entry = this.tracks[i];
if (entry == null) continue;
while (entry.mixingFrom != null)
@ -608,7 +608,7 @@ module spine {
}
outer:
for (var i = 0; i < timelinesCount; i++) {
for (let i = 0; i < timelinesCount; i++) {
let id = timelines[i].getPropertyId();
if (!propertyIDs.add(id))
timelineMode[i] = AnimationState.SUBSEQUENT;
@ -631,7 +631,7 @@ module spine {
hasTimeline (entry: TrackEntry, id: number) : boolean {
let timelines = entry.animation.timelines;
for (var i = 0, n = timelines.length; i < n; i++)
for (let i = 0, n = timelines.length; i < n; i++)
if (timelines[i].getPropertyId() == id) return true;
return false;
}

View File

@ -147,8 +147,8 @@ module spine {
this.toLoad++;
AssetManager.downloadText(path, (atlasData: string): void => {
var pagesLoaded: any = { count: 0 };
var atlasPages = new Array<string>();
let pagesLoaded: any = { count: 0 };
let atlasPages = new Array<string>();
try {
let atlas = new TextureAtlas(atlasData, (path: string) => {
atlasPages.push(parent + "/" + path);

View File

@ -78,7 +78,7 @@ module spine {
let spacing = this.spacing;
if (scale || !percentSpacing) {
if (scale) lengths = Utils.setArraySize(this.lengths, boneCount);
var lengthSpacing = data.spacingMode == SpacingMode.Length;
let lengthSpacing = data.spacingMode == SpacingMode.Length;
for (let i = 0, n = spacesCount - 1; i < n;) {
let bone = bones[i];
let setupLength = bone.data.length;
@ -87,8 +87,8 @@ module spine {
spaces[++i] = 0;
} else if (percentSpacing) {
if (scale) {
var x = setupLength * bone.a, y = setupLength * bone.c;
var length = Math.sqrt(x * x + y * y);
let x = setupLength * bone.a, y = setupLength * bone.c;
let length = Math.sqrt(x * x + y * y);
lengths[i] = length;
}
spaces[++i] = spacing;

View File

@ -40,8 +40,8 @@ module spine {
}
loaded() {
var i = 0;
for (var v in this.assets) i++;
let i = 0;
for (let v in this.assets) i++;
return i;
}
}
@ -58,7 +58,7 @@ module spine {
}
private queueAsset(clientId: string, textureLoader: (image: HTMLImageElement) => any, path: string): boolean {
var clientAssets = this.clientAssets[clientId];
let clientAssets = this.clientAssets[clientId];
if (clientAssets === null || clientAssets === undefined) {
clientAssets = new Assets(clientId);
this.clientAssets[clientId] = clientAssets;
@ -127,17 +127,17 @@ module spine {
get (clientId: string, path: string) {
path = this.pathPrefix + path;
var clientAssets = this.clientAssets[clientId];
let clientAssets = this.clientAssets[clientId];
if (clientAssets === null || clientAssets === undefined) return true;
return clientAssets.assets[path];
}
private updateClientAssets(clientAssets: Assets): void {
for (var i = 0; i < clientAssets.toLoad.length; i++) {
var path = clientAssets.toLoad[i];
var asset = clientAssets.assets[path];
for (let i = 0; i < clientAssets.toLoad.length; i++) {
let path = clientAssets.toLoad[i];
let asset = clientAssets.assets[path];
if (asset === null || asset === undefined) {
var rawAsset = this.rawAssets[path];
let rawAsset = this.rawAssets[path];
if (rawAsset === null || rawAsset === undefined) continue;
if (rawAsset instanceof HTMLImageElement) {
clientAssets.assets[path] = clientAssets.textureLoader(<HTMLImageElement>rawAsset);
@ -149,7 +149,7 @@ module spine {
}
isLoadingComplete (clientId: string): boolean {
var clientAssets = this.clientAssets[clientId];
let clientAssets = this.clientAssets[clientId];
if (clientAssets === null || clientAssets === undefined) return true;
this.updateClientAssets(clientAssets);
return clientAssets.toLoad.length == clientAssets.loaded();

View File

@ -155,7 +155,7 @@ module spine {
}
static cbrt (x: number) {
var y = Math.pow(Math.abs(x), 1/3);
let y = Math.pow(Math.abs(x), 1/3);
return x < 0 ? -y : y;
}
@ -341,7 +341,7 @@ module spine {
private frameTime = 0;
update () {
var now = Date.now() / 1000;
let now = Date.now() / 1000;
this.delta = now - this.lastTime;
this.frameTime += this.delta;
this.totalTime += this.delta;