element-web/src/components/views/elements/effects/ICanvasEffect.ts

30 lines
930 B
TypeScript
Raw Normal View History

2020-10-21 20:06:10 +03:00
/**
* Defines the constructor of a canvas based room effect
*/
2020-10-21 18:58:54 +03:00
export interface ICanvasEffectConstructable {
2020-10-21 20:06:10 +03:00
/**
* @param {{[key:string]:any}} options? Optional animation options
* @returns ICanvasEffect Returns a new instance of the canvas effect
*/
2020-10-21 18:58:54 +03:00
new(options?: { [key: string]: any }): ICanvasEffect
}
2020-10-21 20:06:10 +03:00
/**
* Defines the interface of a canvas based room effect
*/
export default interface ICanvasEffect {
2020-10-21 20:06:10 +03:00
/**
* @param {HTMLCanvasElement} canvas The canvas instance as the render target of the animation
* @param {number} timeout? A timeout that defines the runtime of the animation (defaults to false)
*/
2020-10-21 15:15:27 +03:00
start: (canvas: HTMLCanvasElement, timeout?: number) => Promise<void>,
2020-10-21 20:06:10 +03:00
/**
* Stops the current animation
*/
stop: () => Promise<void>,
2020-10-21 20:06:10 +03:00
/**
* Returns a value that defines if the animation is currently running
*/
isRunning: boolean
}