riot-web/src/effects/ICanvasEffect.ts

48 lines
1.5 KiB
TypeScript
Raw Normal View History

/*
Copyright 2020 Nurjin Jafar
Copyright 2020 Nordeck IT + Consulting GmbH.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
2020-10-21 19:06:10 +02:00
/**
* Defines the constructor of a canvas based room effect
*/
2020-10-21 17:58:54 +02:00
export interface ICanvasEffectConstructable {
2020-10-21 19:06:10 +02:00
/**
2020-12-07 23:12:26 +01:00
* @param {{[key:string]:any}} options? Optional animation options
2020-10-21 19:06:10 +02:00
* @returns ICanvasEffect Returns a new instance of the canvas effect
*/
2020-12-07 23:12:26 +01:00
new(options?: { [key: string]: any }): ICanvasEffect;
2020-10-21 17:58:54 +02:00
}
2020-10-21 19:06:10 +02:00
/**
* Defines the interface of a canvas based room effect
*/
export default interface ICanvasEffect {
2020-10-21 19:06:10 +02:00
/**
2020-12-07 23:12:26 +01: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 19:06:10 +02:00
*/
2020-12-07 23:12:26 +01:00
start: (canvas: HTMLCanvasElement, timeout?: number) => Promise<void>;
2020-10-21 19:06:10 +02:00
/**
* Stops the current animation
*/
2020-12-07 23:12:26 +01:00
stop: () => Promise<void>;
2020-10-21 19:06:10 +02:00
/**
* Returns a value that defines if the animation is currently running
*/
2020-12-07 23:12:26 +01:00
isRunning: boolean;
}