mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-09-17 11:11:47 +08:00
feat: @motajs/animate 部分类型声明
This commit is contained in:
parent
49a2b8d4b9
commit
0fc77f5007
@ -159,6 +159,7 @@ export class Winskin extends RenderItem<EWinskinEvent> {
|
||||
private patternCache?: WinskinPatterns;
|
||||
private patternTransform: DOMMatrix;
|
||||
|
||||
// todo: 跨上下文可能是未定义行为,需要上下文无关化
|
||||
private static patternMap: Map<string, WinskinPatterns> = new Map();
|
||||
|
||||
constructor(
|
||||
|
@ -83,7 +83,7 @@ export class WeatherController implements IWeatherController {
|
||||
const instance = new WeatherInstance(obj, element);
|
||||
instance.setZIndex(this.zIndex + this.active.size);
|
||||
this.active.add(instance);
|
||||
this.container?.appendChild(element);
|
||||
this.container.appendChild(element);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
3
packages/animate/package.json
Normal file
3
packages/animate/package.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "@motajs/animate"
|
||||
}
|
1
packages/animate/src/index.ts
Normal file
1
packages/animate/src/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './types';
|
55
packages/animate/src/types.ts
Normal file
55
packages/animate/src/types.ts
Normal file
@ -0,0 +1,55 @@
|
||||
export interface IExcitable<T> {
|
||||
/**
|
||||
* 受到激励源激励
|
||||
* @param payload 由激励源传递而来的负载
|
||||
*/
|
||||
excited(payload: T): void;
|
||||
}
|
||||
|
||||
export interface IExcitableController<T> {
|
||||
/** 受激励对象 */
|
||||
readonly excitable: T;
|
||||
|
||||
/**
|
||||
* 释放此受激励对象,不再受到当前激励源激励,可以换用其他激励源
|
||||
*/
|
||||
revoke(): void;
|
||||
|
||||
/**
|
||||
* 手动激励此受激励对象一次
|
||||
* @param payload 激励负载
|
||||
*/
|
||||
excite(payload: T): void;
|
||||
}
|
||||
|
||||
export interface IExcitation<T> {
|
||||
/**
|
||||
* 获取当前的激励负载
|
||||
*/
|
||||
payload(): T;
|
||||
|
||||
/**
|
||||
* 激励所有由此激励源激励的内容
|
||||
* @param payload 传递给激励内容的负载
|
||||
*/
|
||||
excite(payload: T): void;
|
||||
|
||||
/**
|
||||
* 添加受激励对象
|
||||
* @param object 受激励对象
|
||||
* @returns 受激励对象控制器
|
||||
*/
|
||||
add(object: IExcitable<T>): IExcitableController<T>;
|
||||
|
||||
/**
|
||||
* 移除一个受激励对象
|
||||
* @param object 受激励对象
|
||||
* @returns 是否成功移除,内容不存在或是其他特殊情况会返回 `false`
|
||||
*/
|
||||
remove(object: IExcitable<T>): boolean;
|
||||
|
||||
/**
|
||||
* 摧毁这个激励源
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
Loading…
Reference in New Issue
Block a user