From d55724a1b55faf542a8b75661fb401b560913d94 Mon Sep 17 00:00:00 2001 From: Ivan Popelyshev Date: Fri, 8 Mar 2019 18:36:05 +0300 Subject: [PATCH] Make let not var (#1298) --- spine-ts/core/src/Animation.ts | 8 ++++---- spine-ts/core/src/AnimationState.ts | 18 +++++++++--------- spine-ts/core/src/AssetManager.ts | 4 ++-- spine-ts/core/src/PathConstraint.ts | 6 +++--- spine-ts/core/src/SharedAssetManager.ts | 18 +++++++++--------- spine-ts/core/src/Utils.ts | 4 ++-- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/spine-ts/core/src/Animation.ts b/spine-ts/core/src/Animation.ts index fc242d75c..d11c78ed9 100644 --- a/spine-ts/core/src/Animation.ts +++ b/spine-ts/core/src/Animation.ts @@ -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 = null; + let zeros : ArrayLike = null; export class DeformTimeline extends CurveTimeline { slotIndex: number; @@ -779,7 +779,7 @@ module spine { let vertices: Array = 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 { diff --git a/spine-ts/core/src/AnimationState.ts b/spine-ts/core/src/AnimationState.ts index 5b70b8f5e..9e877e430 100644 --- a/spine-ts/core/src/AnimationState.ts +++ b/spine-ts/core/src/AnimationState.ts @@ -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; } diff --git a/spine-ts/core/src/AssetManager.ts b/spine-ts/core/src/AssetManager.ts index f861323df..d6af69119 100644 --- a/spine-ts/core/src/AssetManager.ts +++ b/spine-ts/core/src/AssetManager.ts @@ -147,8 +147,8 @@ module spine { this.toLoad++; AssetManager.downloadText(path, (atlasData: string): void => { - var pagesLoaded: any = { count: 0 }; - var atlasPages = new Array(); + let pagesLoaded: any = { count: 0 }; + let atlasPages = new Array(); try { let atlas = new TextureAtlas(atlasData, (path: string) => { atlasPages.push(parent + "/" + path); diff --git a/spine-ts/core/src/PathConstraint.ts b/spine-ts/core/src/PathConstraint.ts index c412da143..b0c5195d9 100644 --- a/spine-ts/core/src/PathConstraint.ts +++ b/spine-ts/core/src/PathConstraint.ts @@ -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; diff --git a/spine-ts/core/src/SharedAssetManager.ts b/spine-ts/core/src/SharedAssetManager.ts index 41d8dc7ca..8436e1605 100644 --- a/spine-ts/core/src/SharedAssetManager.ts +++ b/spine-ts/core/src/SharedAssetManager.ts @@ -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(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(); diff --git a/spine-ts/core/src/Utils.ts b/spine-ts/core/src/Utils.ts index 55daa771f..014b68413 100644 --- a/spine-ts/core/src/Utils.ts +++ b/spine-ts/core/src/Utils.ts @@ -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;