|
|
import Evented = require("../Evented");
|
|
|
|
|
|
/* dojo/_base/fx */
|
|
|
|
|
|
export interface _Line {
|
|
|
/**
|
|
|
* Returns the point on the line
|
|
|
* @param {number} n a floating point number greater than 0 and less than 1
|
|
|
*/
|
|
|
getValue(n: number): number;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Object used to generate values from a start value to an end value
|
|
|
*/
|
|
|
export interface LineConstructor {
|
|
|
new(start: number, end: number): _Line;
|
|
|
|
|
|
prototype: _Line;
|
|
|
}
|
|
|
|
|
|
export interface EasingFunction {
|
|
|
(n?: number): number;
|
|
|
}
|
|
|
|
|
|
export interface Animation extends Evented {
|
|
|
/**
|
|
|
* The time in milliseconds the animation will take to run
|
|
|
*/
|
|
|
duration: number;
|
|
|
|
|
|
/**
|
|
|
* A two element array of start and end values, or a `_Line` instance to be
|
|
|
* used in the Animation.
|
|
|
*/
|
|
|
curve: _Line | [number, number];
|
|
|
|
|
|
/**
|
|
|
* A Function to adjust the acceleration (or deceleration) of the progress
|
|
|
* across a _Line
|
|
|
*/
|
|
|
easing?: EasingFunction;
|
|
|
|
|
|
/**
|
|
|
* The number of times to loop the animation
|
|
|
*/
|
|
|
repeat: number;
|
|
|
|
|
|
/**
|
|
|
* the time in milliseconds to wait before advancing to next frame
|
|
|
* (used as a fps timer: 1000/rate = fps)
|
|
|
*/
|
|
|
rate: number;
|
|
|
|
|
|
/**
|
|
|
* The time in milliseconds to wait before starting animation after it
|
|
|
* has been .play()'ed
|
|
|
*/
|
|
|
delay?: number;
|
|
|
|
|
|
/**
|
|
|
* Synthetic event fired before a Animation begins playing (synchronous)
|
|
|
*/
|
|
|
beforeBegin?: Event;
|
|
|
|
|
|
/**
|
|
|
* Synthetic event fired as a Animation begins playing (useful?)
|
|
|
*/
|
|
|
onBegin?: Event;
|
|
|
|
|
|
/**
|
|
|
* Synthetic event fired at each interval of the Animation
|
|
|
*/
|
|
|
onAnimate?: Event;
|
|
|
|
|
|
/**
|
|
|
* Synthetic event fired after the final frame of the Animation
|
|
|
*/
|
|
|
onEnd?: Event;
|
|
|
|
|
|
/**
|
|
|
* Synthetic event fired any time the Animation is play()'ed
|
|
|
*/
|
|
|
onPlay?: Event;
|
|
|
|
|
|
/**
|
|
|
* Synthetic event fired when the Animation is paused
|
|
|
*/
|
|
|
onPause?: Event;
|
|
|
|
|
|
/**
|
|
|
* Synthetic event fires when the Animation is stopped
|
|
|
*/
|
|
|
onStop?: Event;
|
|
|
|
|
|
_percent: number;
|
|
|
_startRepeatCount: number;
|
|
|
_getStep(): number;
|
|
|
|
|
|
/**
|
|
|
* Convenience function. Fire event "evt" and pass it the
|
|
|
* arguments specified in "args".
|
|
|
*/
|
|
|
_fire(evt: Event, args?: any[]): this;
|
|
|
|
|
|
/**
|
|
|
* Start the animation.
|
|
|
*/
|
|
|
play(delay?: number, gotoStart?: boolean): this;
|
|
|
|
|
|
_play(gotoStart?: boolean): this;
|
|
|
|
|
|
/**
|
|
|
* Pauses a running animation.
|
|
|
*/
|
|
|
pause(): this;
|
|
|
|
|
|
/**
|
|
|
* Sets the progress of the animation.
|
|
|
*/
|
|
|
gotoPercent(precent: number, andPlay?: boolean): this;
|
|
|
|
|
|
/**
|
|
|
* Stops a running animation.
|
|
|
*/
|
|
|
stop(gotoEnd?: boolean): Animation;
|
|
|
|
|
|
/**
|
|
|
* cleanup the animation
|
|
|
*/
|
|
|
destroy(): void;
|
|
|
|
|
|
/**
|
|
|
* Returns a string token representation of the status of
|
|
|
* the animation, one of: "paused", "playing", "stopped"
|
|
|
*/
|
|
|
status(): string;
|
|
|
|
|
|
_cycle(): Animation;
|
|
|
_clearTimer(): void;
|
|
|
_startTimer(): void;
|
|
|
_stopTimer(): void;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* A generic animation class that fires callbacks into its handlers
|
|
|
* object at various states.
|
|
|
*/
|
|
|
export interface AnimationConstructor {
|
|
|
new(args: any): Animation;
|
|
|
prototype: Animation;
|
|
|
}
|
|
|
|
|
|
export interface AnimationCallback {
|
|
|
(node: HTMLElement): void;
|
|
|
}
|
|
|
|
|
|
export interface FadeArguments {
|
|
|
node: HTMLElement | string;
|
|
|
duration?: number;
|
|
|
easing?: EasingFunction;
|
|
|
|
|
|
start?: Function;
|
|
|
end?: Function;
|
|
|
}
|
|
|
|
|
|
export interface AnimationArgumentsProperties {
|
|
|
[name: string]: any;
|
|
|
}
|
|
|
|
|
|
export interface AnimationArguments extends FadeArguments {
|
|
|
properties?: AnimationArgumentsProperties;
|
|
|
onEnd?: AnimationCallback;
|
|
|
}
|
|
|
|
|
|
|
|
|
export const _Line: LineConstructor;
|
|
|
|
|
|
export const Animation: AnimationConstructor;
|
|
|
|
|
|
export function _fade(args: any): Animation;
|
|
|
|
|
|
/**
|
|
|
* Returns an animation that will fade node defined in 'args' from
|
|
|
* its current opacity to fully opaque.
|
|
|
*/
|
|
|
export function fadeIn(args: FadeArguments): Animation;
|
|
|
|
|
|
/**
|
|
|
* Returns an animation that will fade node defined in 'args'
|
|
|
* from its current opacity to fully transparent.
|
|
|
*/
|
|
|
export function fadeOut(args: FadeArguments): Animation;
|
|
|
|
|
|
export function _defaultEasing(n?: number): number;
|
|
|
|
|
|
/**
|
|
|
* Returns an animation that will transition the properties of
|
|
|
* node defined in `args` depending how they are defined in
|
|
|
* `args.properties`
|
|
|
*/
|
|
|
export function animateProperty(args: AnimationArguments): Animation;
|
|
|
|
|
|
/**
|
|
|
* A simpler interface to `animateProperty()`, also returns
|
|
|
* an instance of `Animation` but begins the animation
|
|
|
* immediately, unlike nearly every other Dojo animation API.
|
|
|
*/
|
|
|
export function anim(
|
|
|
node: HTMLElement | string,
|
|
|
properties: { [name: string]: any },
|
|
|
duration?: number,
|
|
|
easing?: Function,
|
|
|
onEnd?: AnimationCallback,
|
|
|
delay?: number): Animation;
|
|
|
|