UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

63 lines 2.14 kB
import EventDispatcher from "../events/EventDispatcher"; import IAnimatable from "./IAnimatable"; declare namespace starling.animation { /** * A DelayedCall allows you to execute a method after a certain time has passed. Since it * * implements the IAnimatable interface, it can be added to a juggler. In most cases, you * * do not have to use this class directly; the juggler class contains a method to delay * * calls directly. * * * * <p>DelayedCall dispatches an Event of type 'Event.REMOVE_FROM_JUGGLER' when it is finished, * * so that the juggler automatically removes it when its no longer needed.</p> * * * * @see Juggler * */ export class DelayedCall extends EventDispatcher implements IAnimatable { /** * Creates a delayed call. */ constructor(callback: Function, delay: number, args?: Array<any>); /** * Resets the delayed call to its default values, which is useful for pooling. */ reset(callback: Function, delay: number, args?: Array<any>): DelayedCall; /** * @inheritDoc */ advanceTime(time: number): void; /** * Advances the delayed call so that it is executed right away. If 'repeatCount' is * * anything else than '1', this method will complete only the current iteration. */ complete(): void; /** * Indicates if enough time has passed, and the call has already been executed. */ get isComplete(): boolean; /** * The time for which calls will be delayed (in seconds). */ get totalTime(): number; /** * The time that has already passed (in seconds). */ get currentTime(): number; /** * The number of times the call will be repeated. * * Set to '0' to repeat indefinitely. @default 1 */ get repeatCount(): number; set repeatCount(value: number) /** * The callback that will be executed when the time is up. */ get callback(): Function; /** * The arguments that the callback will be executed with. * * Beware: not a copy, but the actual object! */ get arguments(): Array<any>; } } export default starling.animation.DelayedCall;