2018-02-09 05:29:42 +01:00
|
|
|
import { PlayerObject } from "./model";
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-09 05:29:42 +01:00
|
|
|
type AnimationFn = (player: PlayerObject, time: number) => void;
|
2018-02-05 02:14:43 +01:00
|
|
|
interface IAnimation {
|
2018-02-09 05:29:42 +01:00
|
|
|
play(player: PlayerObject, time: number): void;
|
2018-02-05 02:14:43 +01:00
|
|
|
}
|
2018-02-09 05:29:42 +01:00
|
|
|
export type Animation = AnimationFn | IAnimation;
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-09 05:44:12 +01:00
|
|
|
export function invokeAnimation(
|
2018-02-09 05:29:42 +01:00
|
|
|
animation: Animation,
|
|
|
|
player: PlayerObject,
|
|
|
|
time: number,
|
|
|
|
): void;
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-05 02:14:43 +01:00
|
|
|
declare class AnimationHandle implements IAnimation {
|
2018-02-09 05:41:14 +01:00
|
|
|
public readonly animation: Animation;
|
|
|
|
public paused: boolean;
|
|
|
|
public speed: number;
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-09 05:29:42 +01:00
|
|
|
constructor(animation: Animation);
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-09 05:41:14 +01:00
|
|
|
public play(player: PlayerObject, time: number): void;
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-09 05:41:14 +01:00
|
|
|
public reset(): void;
|
2018-02-04 15:15:03 +01:00
|
|
|
}
|
|
|
|
|
2018-02-05 02:14:43 +01:00
|
|
|
export class CompositeAnimation implements IAnimation {
|
2018-02-09 05:29:42 +01:00
|
|
|
private handles: Set<AnimationHandle>;
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-09 05:29:42 +01:00
|
|
|
constructor();
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-09 05:41:14 +01:00
|
|
|
public add(animation: Animation): AnimationHandle;
|
2018-02-04 15:15:03 +01:00
|
|
|
|
2018-02-09 05:41:14 +01:00
|
|
|
public play(player: PlayerObject, time: number): void;
|
2018-02-04 15:15:03 +01:00
|
|
|
}
|
|
|
|
|
2018-02-09 05:29:42 +01:00
|
|
|
export const WalkAnimation: AnimationFn;
|