From 8f9127777e38bb04157efdcb0cc5f4b3ce66fdcf Mon Sep 17 00:00:00 2001 From: printempw Date: Mon, 12 Feb 2018 10:16:26 +0800 Subject: [PATCH] fix type definition of animation functions --- src/animation.js | 2 +- types/animation.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/animation.js b/src/animation.js index 848bfee..d12f0d2 100644 --- a/src/animation.js +++ b/src/animation.js @@ -15,7 +15,7 @@ class AnimationHandle { this.speed = this._speed = 1.0; this._lastChange = null; this._lastChangeX = null; - this._animationNaturalSpeed = animation.naturalSpeed; + this._animationNaturalSpeed = animation.naturalSpeed || 1.0; } play(player, time) { if (this._lastChange === null) { diff --git a/types/animation.d.ts b/types/animation.d.ts index 0d00231..e508bb7 100644 --- a/types/animation.d.ts +++ b/types/animation.d.ts @@ -28,6 +28,6 @@ export class CompositeAnimation implements IAnimation { public play(player: PlayerObject, time: number): void; } -export const WalkAnimation: AnimationFn; -export const RunningAnimation: AnimationFn; -export const RotatingAnimation: AnimationFn; +export const WalkingAnimation: AnimationFn & { naturalSpeed?: number }; +export const RunningAnimation: AnimationFn & { naturalSpeed?: number }; +export const RotatingAnimation: AnimationFn & { naturalSpeed?: number };