DefinitelyTyped/types/bounce.js/index.d.ts
2017-08-17 14:53:41 -07:00

67 lines
1.5 KiB
TypeScript

// Type definitions for Bounce.js v0.8.2
// Project: https://github.com/tictail/bounce.js
// Definitions by: Cherry <https://github.com/cherrry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery"/>
export default Bounce
interface Point2D {
x: number
y: number
}
interface BounceOptions<T> {
from: T
to: T
duration?: number
delay?: number
easing?: string
bounces?: number
stiffness?: number
}
interface AnimationOptions {
loop?: boolean
remove?: boolean
onComplete?: () => void
}
interface SerailizedComponent<T> {
type: string
from: T
to: T
duration: number
delay: number
easing: string
bounces: number
stiffness: number
}
declare class Bounce {
static FPS: number
static counter: number
static isSupported(): boolean
constructor();
scale(options: BounceOptions<Point2D>): Bounce
rotate(options: BounceOptions<number>): Bounce
translate(options: BounceOptions<Point2D>): Bounce
skew(options: BounceOptions<Point2D>): Bounce
serialize(): SerailizedComponent<number | Point2D>[]
deserialize(serailized: SerailizedComponent<number | Point2D>[]): Bounce
applyTo(element: Element, options?: AnimationOptions): void
applyTo(elements: Element[], options?: AnimationOptions): void
applyTo(elements: JQuery, options?: AnimationOptions): JQueryPromise<void>
define(name: string): Bounce
remove(): void
}