Commit dc9aebd8 authored by rockyl's avatar rockyl

修复上传

parent 358e1264
/**
* 一些重定义的类型
*/
/**
* 颜色
*/
export declare type color = string;
/**
* 资源
*/
export declare type resource = any;
/**
* 原数据
*/
export declare type raw = any;
/**
* 动态数据
*/
export declare type dynamic = Function;
/**
* 常用框类型
*/
export interface Frame {
x?: number;
y?: number;
w?: number;
h?: number;
}
/**
* Created by rockyl on 2019-04-18.
*
* 资源管理
*/
import { FrameAnimation } from "../core/FrameAnimation";
import { default as Texture } from '../core/Texture';
import { Sheet } from '../core/Sheet';
/**
* 资源管理器
*/
export default class AssetsManager {
private resCache;
private resPath;
private resCacheProxy;
private resLoaderType;
constructor();
/**
* 获取一个加载器
* @param ext
* @param url
*/
getLoader(ext: string, url: string): (url: string, uuid: string, cache: boolean, config: any) => Promise<any>;
/**
* 增加加载器
* @param ext 需加载的文件后缀
* @param loader 加载方法,返回携带最终资源的Promise
*/
addLoader(ext: string, loader: Function): void;
/**
* 设置资源根路径
* @param path
*/
setResPath(path: string): void;
/**
* 加载一批资源
* @param items 资源数组: ['aaa.png', {uuid: 'bbb', url: 'alias.png'}]
* @param progress 进度回调,参数为加载百分比
* @return Promise<Array<any>> 资源组
*/
loadResItems(items: Array<any | string>, progress?: (percentage: number) => void): Promise<Array<any>>;
/**
* 获取资源
* @param uuid
*/
getRes(uuid: string): any;
setResCacheProxy(proxyFunc: Function): void;
/**
* 销毁资源
* @param uuidOrUuids
*/
destroyRes(uuidOrUuids: string | Array<string>): void;
/**
* 销毁全部资源
*/
destroyAllRes(): any;
/**
* 获取所有uuid值
*/
getAllResUuids(): string[];
/**
* 处理url
* @param url url
* @return string 处理后的url
*/
private resolveUrl;
/**
* 根据url推断名称,只是获取短文件名
* @param url
*/
private getUUIDFromUrl;
/**
* 缓存资源
* @param res
* @param url
* @param uuid
*/
private cacheRes;
/**
* 加载任意网络资源
* @param url url
* @param uuid
* @param type 类型(json|text|arraybuffer|blob)
* @param cache 是否缓存
* @param config 资源配置
* @param options 请求配置
* @return Promise<any> 资源
*/
loadAny(url: string, uuid?: string, cache?: boolean, config?: any, options?: {}, type?: string): Promise<any>;
/**
* 加载文本资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadTxt(url: string, uuid?: string, cache?: boolean, config?: any): Promise<string>;
/**
* 加载json资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadJson(url: string, uuid?: string, cache?: boolean, config?: any): Promise<any>;
/**
* 加载json5资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadJson5(url: string, uuid?: string, cache?: boolean, config?: any): Promise<any>;
/**
* 加载预制资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadPrefab(url: any, uuid?: any, cache?: boolean, config?: any): Promise<any>;
/**
* 加载图集资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadSheet(url: string, uuid?: string, cache?: boolean, config?: any): Promise<Sheet>;
/**
* 加载散列的图集
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadSheetDisperse(url: string, uuid?: string, cache?: boolean, config?: any): Promise<Sheet>;
/**
* 加载文图字资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadFont(url: string, uuid?: string, cache?: boolean, config?: any): Promise<Sheet>;
private findAnimConfig;
/**
* 加载帧动画资源(多个)
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadAnim(url: string, uuid?: string, cache?: boolean, config?: any): Promise<FrameAnimation[]>;
/**
* 加载图片资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
*/
loadImage(url: string, uuid?: string, cache?: boolean, config?: any): Promise<HTMLImageElement>;
/**
* 加载blob图片资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadImageFromBlob(url: string, uuid?: string, cache?: boolean, config?: any): Promise<any>;
/**
* 加载纹理资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadTexture(url: string, uuid?: string, cache?: boolean, config?: any): Promise<Texture>;
/**
* 加载blob纹理资源
* @param url url
* @param uuid 唯一名
* @param cache 是否缓存
* @param config 资源配置
* @return Promise<any> 资源
*/
loadTextureFromBlob(url: string, uuid?: string, cache?: boolean, config?: any): Promise<Texture>;
private fileOrBlobToDataURL;
private blobToImage;
}
/**
* Created by rockyl on 2018/7/11.
*
* 资源管理
*/
export { default as AssetsManager } from './AssetsManager';
/**
* Created by rockyl on 2018/11/5.
*/
import HashObject from "./HashObject";
import { Entity } from "./Entity";
/**
* 组件基类
*/
export declare class Component extends HashObject {
/**
* 所依附的实体
*/
entity: Entity;
protected delayCallbacks: any[];
protected _enabled: boolean;
private _firstUpdate;
/**
* 是否有效状态
*/
enabled: boolean;
/**
* 装配实体
* @param entity
*/
_setup(entity: Entity): void;
/**
* 卸载实体
*/
_unSetup(): void;
/**
* 当组件被创建时
*/
onCreate(): void;
$onAwake(): void;
/**
* 当组件被唤醒时
*/
onAwake(): void;
/**
* 当组件生效时
*/
onEnable(): void;
/**
* 当组件失效时
*/
onDisable(): void;
$onUpdate(t: any): void;
$onEditorUpdate(t: any): void;
$afterUpdate(): void;
$afterEditorUpdate(): void;
private invokeDelayCallback;
/**
* 当时钟更新时
* @param t 从引擎开始到当前的毫秒数
*/
onUpdate(t: any): void;
onEditorUpdate(t: any): void;
/**
* 当子节点的时钟更新结束后
*/
afterUpdate(): void;
afterEditorUpdate(): void;
$onSleep(): void;
/**
* 当组件沉睡时
*/
onSleep(): void;
/**
* 当组件被销毁时
*/
onDestroy(): void;
/**
* 当被监听的属性被修改时
* @param value
* @param key
* @param oldValue
*/
protected onModify(value: any, key: any, oldValue: any): void;
private getDelayCallback;
/**
* 执行延迟回调
* @param callback
* @param once 是否只执行一次
*/
callOnNextTick(callback: any, once?: boolean): void;
cancelOnNextTick(callback: any): void;
/**
* 当交互时
* @param type
* @param event
*/
onInteract(type: any, event: any): any;
_dealGlobalTouchBegin(e: any): boolean;
_dealGlobalTouchMove(e: any): boolean;
_dealGlobalTouchEnd(e: any): boolean;
/**
* 当全局触摸开始
* @param e
*/
onGlobalTouchBegin(e: any): boolean;
/**
* 当全触摸移动
* @param e
*/
onGlobalTouchMove(e: any): boolean;
/**
* 当全触摸结束
* @param e
*/
onGlobalTouchEnd(e: any): boolean;
/**
* 向下广播
* 如果某组件调用后返回true,将结束整条链
* @param method 方法名
* @param level 深度,默认全部遍历
* @param params 参数
*/
broadcast(method: any, level?: number, ...params: any[]): void;
/**
* 向上冒泡
* 如果某组件调用后返回true,将结束整条链
* @param method 方法名
* @param params 参数
*/
bubbling(method: any, ...params: any[]): void;
}
/**
* Created by rockyl on 2018/11/5.
*/
import HashObject from "./HashObject";
import { Component } from "./Component";
import ScillaEngine from "./ScillaEngine";
/**
* 实体类
* 实体类只是单纯的父子节点逻辑,不含有其他逻辑
*/
export declare class Entity extends HashObject {
name: string;
protected _uuid: string;
protected _isFree: boolean;
protected _enabled: boolean;
protected _parent: Entity;
protected _children: Entity[];
protected _components: Component[];
constructor(name?: string, uuid?: string);
/**
* 获取唯一ID
*/
readonly uuid: string;
/**
* 是否有效状态
*/
enabled: boolean;
_invokeEnabledState(enabled: boolean): void;
readonly isParentActive: boolean;
readonly isActive: boolean;
/**
* 是否游离状态
*/
readonly isFree: boolean;
/**
* 使游离
*/
_free(): void;
/**
* 使约束
*/
_restrict(): void;
/**
* 获取父节点
*/
readonly parent: Entity;
/**
* 获取根节点
*/
readonly root: RootEntity;
/**
* 是否含有子节点
* @param child
*/
containsChild(child: Entity): boolean;
/**
* 添加子节点时
* @param child
* @private
*/
protected _onChildAdded(child: Entity): void;
/**
* 子节点被移除时
* @param child
* @private
*/
_onChildRemoved(child: Entity): void;
/**
* 添加子节点,重复添加则会加到最后
* @param child
*/
addChild(child: Entity): void;
/**
* 添加子节点到指定索引,重复添加可作为顺序交换
* @param child
* @param index
*/
addChildAt(child: Entity, index: any): void;
/**
* 移除节点
* @param child
*/
removeChild(child: Entity): void;
/**
* 移除指定索引的节点
* @param index
*/
removeChildAt(index: number): void;
/**
* 根据节点获取索引
* @param child
*/
getChildIndex(child: Entity): number;
/**
* 获取指定索引的节点
* @param index
*/
getChildByIndex(index: any): Entity;
/**
* 获取指定名字的节点
* @param name
*/
getChildrenByName(name: any): Entity[];
/**
* 移除所有子节点
*/
removeChildren(): void;
/**
* 获取所有子节点
*/
readonly children: Entity[];
/**
* 增加组件
* @param component
*/
addComponent(component: Component): void;
/**
* 在指定索引增加组件,重复添加可作为顺序交换
* @param component
* @param index
*/
addComponentAt(component: Component, index: number): void;
/**
* 移除组件
* @param component
*/
removeComponent(component: Component): void;
/**
* 移除所有组件
*/
removeAllComponents(): void;
/**
* 根据组件名称获取指定类的组件列表
* @param name
*/
getComponentsByName<T extends Component>(name: string): T[];
/**
* 获取指定类的组件列表
* @param clazz
*/
getComponents<T extends Component>(clazz: new () => T): T[];
/**
* 获取指定类的组件
* @param name
*/
getComponentByName<T extends Component>(name: string): T;
/**
* 获取指定类的组件
* @param clazz
*/
getComponent<T extends Component>(clazz: new () => T): T;
/**
* 获取所有组件
*/
readonly components: Component[];
/**
* 遍历所有组件
* @param func
*/
forEachComponent(func: (component: any) => boolean): void;
/**
* 当组件生效时
*/
onEnable(): void;
/**
* 当组件失效时
*/
onDisable(): void;
/**
* 当时钟更新时
* @param t
*/
onUpdate(t: any): void;
/**
* 当子节点遍历结束后
*/
afterUpdate(): void;
/**
* 当交互时
* @param type
* @param event
*/
onInteract(type: any, event: any): boolean;
/**
* 当添加组件时
* @param component
*/
onAddComponent(component: Component): void;
/**
* 唤醒组件
* @param component
*/
awakeComponent(component: any): void;
/**
* 当移除组件时
* @param component
*/
onRemoveComponent(component: Component): void;
/**
* 睡眠组件
* @param component
*/
sleepComponent(component: Component): void;
/**
* 向下广播
* 如果某组件调用后返回true,将结束整条链
* @param method 方法名
* @param level 深度,默认全部遍历
* @param params 参数
*/
broadcast(method: string, level?: number, ...params: any[]): void;
/**
* 向上冒泡
* 如果某组件调用后返回true,将结束整条链
* @param method 方法名
* @param params 参数
*/
bubbling(method: string, ...params: any[]): void;
/**
* 调用实体上的组件的方法
* @param hitEntity 遇到的实体
* @param method 方法名
* @param params 参数
*/
private invokeOnEntity;
}
/**
* 根实体类
*/
export declare class RootEntity extends Entity {
protected _engine: ScillaEngine;
constructor(engine: ScillaEngine);
/**
* 获取引擎,只有活动的root节点才有这个属性
*/
readonly engine: ScillaEngine;
}
/**
* Created by rockyl on 2018-11-30.
*/
/**
* 获取一个帧动画资源
* @param name
*/
export declare function getFrameAnimation(name: string): FrameAnimation;
/**
* 放置帧动画图片和数据
* @param img
* @param data
*/
export declare function putFrameAnim(img: any, data: any): void;
/**
* 帧动画资源
*/
export interface FrameAnimation {
/**
* 填充帧数据
* @param name
*/
fillMcData(name: string): any;
/**
* 获取帧率
*/
readonly fps: number;
/**
* 获取所有帧标签
*/
readonly labels: any[];
/**
* 获取帧数
*/
readonly frameCount: number;
/**
* 根据名字获取帧标签
* @param name
*/
getLabel(name: string): any;
/**
* 获取帧
* @param frameIndex
*/
getFrame(frameIndex: number): any;
/**
* 销毁自身
*/
destroy(): any;
}
/**
* 帧动画资源实现
*/
export declare class FrameAnimationImpl implements FrameAnimation {
private readonly _name;
private _animData;
constructor(name: string);
readonly name: string;
fillMcData(name: string): void;
readonly fps: number;
readonly labels: any[];
readonly frameCount: number;
getLabel(name: string): any;
getFrame(frameIndex: number): any;
destroy(): void;
}
/**
* Created by rockyl on 2018/11/5.
*/
/**
* 哈希对象
*/
export default class HashObject {
private _hashCode;
constructor();
readonly hashCode: number;
}
/**
* Created by rockyl on 2019-04-22.
*/
import { Entity } from "./Entity";
import ScillaEngine from "./ScillaEngine";
export declare class RootEntity extends Entity {
protected _engine: ScillaEngine;
constructor(engine: ScillaEngine);
/**
* 获取引擎,只有活动的root节点才有这个属性
*/
readonly engine: ScillaEngine;
}
/**
* Created by rockyl on 2018-12-03.
*/
import { Entity } from "./Entity";
/**
* 场景
*/
export declare class Scene {
name: string;
root: Entity;
resourceGroups: any;
config: any;
/**
* 初始化
* @param config
*/
initByConfig(config: any): void;
}
/**
* Created by rockyl on 2018/11/23.
*
* 引擎
*/
import { Entity } from "./Entity";
import InteractContext from "./context/InteractContext";
import RenderContext from "./context/RenderContext";
import './requestAnimationFrame';
import { AssetsManager } from "../assets-manager";
/**
* 引擎类
*/
export default class ScillaEngine {
/**
* 默认配置
*/
readonly engineConfig: any;
/**
* 自定义配置
*/
readonly customConfig: any;
/**
* 数据中心配置
*/
readonly dataCenterConfig: any;
private _root;
private canvasElement;
private _flush;
private _currentFlush;
private tsStart;
private tsLast;
private lastFPS;
private _renderContext;
private _interactContext;
private _assetsManager;
private _dataCenter;
private nextTicks;
constructor();
/**
* 装配引擎
* @param _engineConfig
* @param _customConfig
* @param _dataCenterConfig
*/
setup(_engineConfig?: any, _customConfig?: any, _dataCenterConfig?: any): void;
/**
* 开始引擎
*/
start(): void;
/**
* 暂停引擎
*/
pause(): void;
/**
* 获取根Entity
*/
readonly root: Entity;
/**
* 获取节点路径
* @param entity
*/
getEntityPath(entity?: Entity): string;
/**
* 根据节点路径获取节点
* @param path
*/
getEntityByPath(path?: string): Entity;
/**
* 获取当前帧率
*/
getFPS(): number;
/**
* 获取渲染上下文
*/
readonly renderContext: RenderContext;
/**
* 获取交互上下文
*/
readonly interactContext: InteractContext;
/**
* 获取资源管理
*/
readonly assetsManager: AssetsManager;
private onUpdateScale;
/**
* 开始时钟
*/
private startTick;
/**
* 停止时钟
*/
private stopTick;
/**
* 时钟触发
*/
private flush;
/**
* 下一帧执行
* @param func
* @param tickCount
*/
nextTick(func: any, tickCount?: number): void;
private onFrameTick;
/**
* 代理出来的onTouchBegin方法
* @param event
*/
private onTouchBegin;
/**
* 代理出来的onTouchMove方法
* @param event
*/
private onTouchMove;
/**
* 代理出来的onTouchEnd方法
* @param event
*/
private onTouchEnd;
/**
* 页面坐标转画布坐标
* @param pageX
* @param pageY
* @param identifier
* @param isLocalPos
*/
pagePosToCanvasPos(pageX: any, pageY: any, identifier?: any, isLocalPos?: boolean): {
x: number;
y: number;
identifier: any;
};
/**
* 画布坐标转页面坐标
* @param x
* @param y
* @param isLocalPos
*/
canvasPosToPagePos(x: any, y: any, isLocalPos?: boolean): {
x: any;
y: any;
};
}
/**
* Created by rockyl on 2018-11-27.
*/
/**
* 单一事件类
* 一对多形式的订阅分发机制
*/
export declare class ScillaEvent {
private _subscribers;
constructor();
private findListener;
/**
* 添加侦听
* @param callback
* @param thisObj
* @param priority
* @param params
*/
addListener(callback: any, thisObj?: any, priority?: number, ...params: any[]): void;
/**
* 添加单次侦听
* @param callback
* @param thisObj
* @param priority
* @param params
*/
once(callback: any, thisObj?: any, priority?: number, ...params: any[]): void;
/**
* 移除侦听
* @param callback
*/
removeListener(callback: any): void;
/**
* 是否已经侦听
* @param callback
*/
hasListener(callback: any): boolean;
/**
* 调用派发
* @param paramsNew
*/
invoke(...paramsNew: any[]): void;
}
/**
* Created by rockyl on 2018-11-30.
*/
import HashObject from "../core/HashObject";
import Texture from "./Texture";
import { Frame } from "../ReType";
/**
* 图集
*/
export declare class Sheet extends HashObject {
/**
* 图集原图
*/
img: any;
/**
* 图集分割配置
*/
frames: any;
private _textureCache;
constructor(img?: any, frames?: Frame);
/**
* 生成全部纹理
*/
generateAll(): void;
/**
* 生成一个纹理
* @param name
* @param force
*/
generateTexture(name: string, force?: boolean): Texture;
/**
* 是否有这个纹理
* @param name
*/
hasTexture(name: any): boolean;
/**
* 获取纹理
* @param name
*/
getTexture(name: any): Texture;
/**
* 获取全部存在的纹理
*/
getAllTextures(): Texture[];
/**
* 销毁自身
*/
destroy(): void;
}
/**
* Created by rockyl on 2018/7/12.
*/
import Bounds from "../support/Bounds";
import HashObject from "../core/HashObject";
import { Frame } from "../ReType";
/**
* 纹理类
*/
export default class Texture extends HashObject {
img: any;
bounds: Bounds;
_cacheCanvas: any;
constructor();
/**
* 设置图集中的坐标和尺寸
* @param frame
*/
setFrame(frame: Frame): void;
/**
* 设置图片
* @param img
*/
setImg(img: any): void;
/**
* 获取纹理宽度
*/
readonly width: number;
/**
* 获取纹理高度
*/
readonly height: number;
/**
* 产生一个缓存画布
*/
getCacheCanvas(): any;
/**
* 绘制到一个画布上
* @param context
* @param dx
* @param dy
* @param sx
* @param sy
* @param dw
* @param dh
*/
drawToCanvas(context: any, dx?: number, dy?: number, sx?: any, sy?: any, dw?: any, dh?: any): void;
/**
* 销毁自身
*/
destroy(): void;
/**
* 销毁缓存画布
*/
destroyCacheCanvas(): void;
}
/**
* 快捷创建纹理
* @param img
* @param frame
*/
export declare function createTexture(img: any, frame?: Frame): Texture;
/**
* Created by rockyl on 2018/11/7.
*
* 交互上下文
*/
import ScillaEngine from "../ScillaEngine";
interface InteractContextOption {
/**
* 画布
*/
canvas: any;
/**
* 触摸句柄
*/
touchHandlers: any;
/**
* 触摸开关
*/
touchEnabled: boolean;
}
/**
* 交互上下文
*/
export default class InteractContext {
protected canvas: any;
protected touchHandlers: any;
protected scaleX: any;
protected scaleY: any;
protected rotation: any;
private engine;
constructor(engine: ScillaEngine);
/**
* 装配上下文
* @param options
*/
setup(options?: InteractContextOption): void;
/**
* 更新缩放模式
* @param scaleX
* @param scaleY
* @param rotation
*/
updateScale(scaleX: any, scaleY: any, rotation: any): void;
/**
* 适配鼠标事件
*/
private addListeners;
/**
* 阻断页面拖动
* @param event
*/
private prevent;
/**
* 增加鼠标事件
*/
private addMouseListener;
/**
* 增加触摸事件
*/
private addTouchListener;
private onTouchBegin;
private onMouseMove;
private onTouchMove;
private onTouchEnd;
private getLocation;
}
export {};
/**
* Created by rockyl on 2018/11/5.
*
* 渲染上下文
*/
import Bounds from "../../support/Bounds";
import ScillaEngine from "../ScillaEngine";
/**
* 缩放模式
*
* SHOW_ALL: 全可见
* FIXED_WIDTH: 宽度固定
* FIXED_HEIGHT: 高度固定
*/
export declare enum ScaleMode {
SHOW_ALL = "showAll",
FIXED_WIDTH = "fixedWidth",
FIXED_HEIGHT = "fixedHeight",
NO_SCALE = "noScale",
NO_FIXED = "noFixed"
}
interface RenderContextOption {
/**
* 画布实例
*/
canvas: any;
/**
* 设计宽度
*/
designWidth: number;
/**
* 设计高度
*/
designHeight: number;
/**
* 缩放模式
*/
scaleMode: ScaleMode;
/**
* 是否修改画布尺寸
*/
modifyCanvasSize?: boolean;
/**
* 是否自动调整舞台尺寸
*/
autoAdjustSize?: boolean;
/**
* 当缩放模式修改时
*/
onUpdateScale: Function;
}
/**
* 渲染上下文
*/
export default class RenderContext {
protected canvas: any;
protected canvasContext: any;
protected stageWidth: number;
protected stageHeight: number;
private _scaleX;
private _scaleY;
private _rotation;
protected dirtyFieldTriggerLock: boolean;
private shortcutCanvas;
private onUpdateScale;
private engine;
/**
* 设计宽度
*/
designWidth: any;
/**
* 设计高度
*/
designHeight: any;
/**
* 缩放模式
*/
scaleMode: ScaleMode;
/**
* 是否修改画布的尺寸
*/
modifyCanvasSize: any;
/**
* 是否自动调整舞台尺寸
*/
autoAdjustSize: any;
constructor(engine: ScillaEngine);
private onModify;
/**
* 装配上下文
* @param options
*/
setup(options?: RenderContextOption): void;
/**
* 缩放x
*/
readonly scaleX: number;
/**
* 缩放y
*/
readonly scaleY: number;
/**
* 旋转
*/
readonly rotation: number;
/**
* 清空渲染上下文
*/
clear(): void;
/**
* 获取渲染上下文
*/
readonly context: any;
/**
* 获取舞台尺寸
*/
readonly stageSize: {
width: number;
height: number;
};
/**
* 获取舞台缩放
*/
readonly stageScale: {
x: number;
y: number;
};
/**
* 获取舞台中心
*/
readonly stageCenter: {
x: number;
y: number;
};
/**
* 更新缩放模式
*/
private updateScaleModeSelf;
/**
* 截图
* @param type 目标格式 0:Image, 1:DataURL
* @param params
*/
shortcut(type: number, params: ShortcutParams): Promise<any>;
private shortcutWithSize;
}
interface ShortcutParams {
imgType: string;
zoomToDom?: boolean;
quality?: number;
bounds?: Bounds;
}
/**
* 创建canvas
*/
export declare function createCanvas(): HTMLCanvasElement;
export {};
/**
* Created by rockyl on 2019-04-22.
*/
import { Entity } from "./Entity";
/**
* 节点遍历(先序遍历)
* @param target 目标节点
* @param hitChild 遇到子节点回调
* @param level 深度,默认全部遍历
* @param includeSelf 是否包括自身
* @param fullCallback 子节点遍历完后回调
* @param params 其他参数
*/
export declare function traverse(target: Entity, hitChild: (child: Entity, ...params: any[]) => boolean, level?: number, includeSelf?: boolean, fullCallback?: (current: Entity) => void, ...params: any[]): void;
/**
* 节点遍历(后序遍历且倒序)
* @param target 目标节点
* @param hitChild 遇到子节点回调
* @param level 深度,默认全部遍历
* @param includeSelf 是否包括自身
* @param fullCallback 子节点遍历完后回调
* @param params 其他参数
*/
export declare function traversePostorder(target: Entity, hitChild: (child: Entity, ...params: any[]) => boolean, level?: number, includeSelf?: boolean, fullCallback?: (current: Entity) => void, ...params: any[]): boolean;
/**
* 节点冒泡
* @param target 目标节点
* @param hitParent 遇到父节点回调
* @param includeSelf 是否包括自身
* @param params 其他参数
*/
export declare function bubbling(target: Entity, hitParent: (parent: Entity, ...params: any[]) => boolean, includeSelf?: boolean, ...params: any[]): void;
/**
* Created by rockyl on 2018/11/5.
*/
export { Component } from "./Component";
export { Entity } from './Entity';
export { ScillaEvent } from './ScillaEvent';
export { createCanvas, ScaleMode } from './context/RenderContext';
export { default as ScillaEngine } from './ScillaEngine';
export { default as Texture, createTexture } from './Texture';
export * from './Sheet';
export * from './FrameAnimation';
export * from './interpreter';
/**
* Created by rockyl on 2018-12-03.
*
* 配置文件解释器
*/
import { Entity } from "../core/Entity";
/**
* 注册组件
* @param name
* @param def
*/
export declare function registerDef(name: string, def: any): void;
export declare function setGetResProxy(func: Function): void;
/**
* 装配场景
* @param config
* @param root
* @param getResProxy
*/
export declare function setupScene(config: any, root: Entity, getResProxy: Function): void;
/**
* 清空实体
* @param entity
*/
export declare function cleanEntity(entity: Entity): void;
/**
* 装配预制体
* @param config
*/
export declare function instantiate(config: any): Entity;
/**
* 注入组件属性
* @param component
* @param config
* @param pid
*/
export declare function injectComponentProperties(component: any, config: any, pid?: number): void;
/**
* 实例化组件
* @param entity
* @param config
*/
export declare function instantiateComponent(entity: Entity, config: any): any;
/**
* 根据名称获取定义
* @param name
* @param showWarn
*/
export declare function getDefByName(name: string, showWarn?: boolean): any;
/**
* Created by Administrator on 2017/7/12.
*/
declare var lastTime: number;
declare var vendors: string[];
/**
* Created by rockyl on 2018-12-05.
*
* 引擎配置
*/
/**
* 针对引擎的配置
*/
export declare const EngineConfig: {
lineHeightRatio: number;
entityEnabled: boolean;
componentEnabled: boolean;
awakeComponentWhenAdded: boolean;
sleepComponentWhenRemoved: boolean;
drawRenderRect: boolean;
imgCrossOrigin: boolean;
editorMode: boolean;
};
/**
* 注入配置
* @param _options
*/
export declare function modifyEngineConfig(_options: any): void;
/**
* 投影或者发光滤镜
* @class ShadowFilter
* @public
* @since 1.0.0
*/
export declare class ShadowFilter {
/**
* 颜色值
* @property color
* @public
* @readonly
* @since 1.0.0
* @default black
* @type {string}
*/
color: string;
/**
* x方向投影距离
* @property offsetX
* @public
* @readonly
* @since 1.0.0
* @default 2
* @type {number}
*/
offsetX: number;
/**
* y方向投影距离
* @property offsetY
* @public
* @readonly
* @since 1.0.0
* @default 2
* @type {number}
*/
offsetY: number;
/**
* 模糊值
* @property blur
* @public
* @readonly
* @since 1.0.0
* @default 2
* @type {number}
*/
blur: number;
/**
* 滤镜类型 只读
* @property color
* @public
* @readonly
* @since 1.0.0
* @default Shadow
* @type {string}
*/
type: string;
/**
* @method ShadowFilter
* @param {string} color
* @param {number} offsetX
* @param {number} offsetY
* @param {number} blur
*/
constructor(color?: string, offsetX?: number, offsetY?: number, blur?: number);
/**
*获取滤镜的字符串表现形式以方便比较两个滤镜是否效果一样
* @method toString
* @public
* @since 1.0.0
* @return {string}
*/
toString(): string;
/**
* 绘画滤镜效果
* @method drawFilter
* @public
* @since 1.0.0
* @param {ImageData} imageData
*/
drawFilter(imageData?: ImageData): void;
destroy(): void;
}
/**
* 普通变色滤镜
* @class ColorFilter
* @public
* @since 1.0.0
*/
export declare class ColorFilter {
/**
* @property redMultiplier
* @public
* @since 1.0.0
* @readonly
* @type {number}
*/
redMultiplier: number;
/**
* @property redOffset
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
redOffset: number;
/**
* @property greenMultiplier
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
greenMultiplier: number;
/**
* @property greenOffset
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
greenOffset: number;
/**
* @property blueMultiplier
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
blueMultiplier: number;
/**
* @property blueOffset
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
blueOffset: number;
/**
* @property alphaMultiplier
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
alphaMultiplier: number;
/**
* @property alphaOffset
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
alphaOffset: number;
/**
* @property type
* @public
* @readonly
* @since 1.0.0
* @type {string}
*/
type: string;
/**
* @method ColorFilter
* @param {number} colorArrays 颜色值数据
*/
constructor(colorArrays: number[]);
/**
* 绘画滤镜效果
* @method drawFilter
* @param {ImageData} imageData
* @since 1.0.0
* @public
*/
drawFilter(imageData?: ImageData): void;
/**
*获取滤镜的字符串表现形式以方便比较两个滤镜是否效果一样
* @method toString
* @public
* @since 1.0.0
* @return {string}
*/
toString(): string;
destroy(): void;
}
/**
* 矩阵变色滤镜
* @class ColorMatrixFilter
* @public
* @since 1.0.0
*/
export declare class ColorMatrixFilter {
/**
* @property brightness
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
brightness: number;
/**
* @property contrast
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
contrast: number;
/**
* @property saturation
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
saturation: number;
/**
* @property hue
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
hue: number;
/**
* 滤镜类型 只读
* @property type
* @public
* @readonly
* @since 1.0.0
* @type {string}
*/
type: string;
private colorMatrix;
/**
* @method ColorMatrixFilter
* @param {number} brightness
* @param {number} contrast
* @param {number} saturation
* @param {number} hue
* @public
* @since 1.0.0
*/
constructor(brightness: number, contrast: number, saturation: number, hue: number);
/**
* 绘画滤镜效果
* @method drawFilter
* @param {ImageData} imageData
* @since 1.0.0
* @public
*/
drawFilter(imageData?: ImageData): void;
static DELTA_INDEX: number[];
private _multiplyMatrix;
private _cleanValue;
/**
*获取滤镜的字符串表现形式以方便比较两个滤镜是否效果一样
* @method toString
* @public
* @since 1.0.0
* @return {string}
*/
toString(): string;
destroy(): void;
}
/**
* 模糊滤镜
* @class BlurFilter
* @public
* @since 1.0.0
*/
export declare class BlurFilter {
/**
* 滤镜类型 只读
* @property type
* @public
* @readonly
* @since 1.0.0
* @type {string}
*/
type: string;
/**
* 水平模糊量
* @property blurX
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
blurX: number;
/**
* 垂直模糊量
* @property blurY
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
blurY: number;
/**
* 模糊品质
* @property quality
* @public
* @readonly
* @since 1.0.0
* @type {number}
*/
quality: number;
/**
* @method BlurFilter
* @public
* @since 1.0.0
* @param {number} blurX
* @param {number} blurY
* @param {number} quality
*/
constructor(blurX?: number, blurY?: number, quality?: number);
/**
*获取滤镜的字符串表现形式以方便比较两个滤镜是否效果一样
* @method toString
* @public
* @since 1.0.0
* @return {string}
*/
toString(): string;
private static SHG_TABLE;
private static MUL_TABLE;
/**
* 绘画滤镜效果
* @method drawFilter
* @param {ImageData} imageData
* @since 1.0.0
* @public
*/
drawFilter(imageData?: ImageData): boolean;
destroy(): void;
}
export { ShadowFilter } from './Filters';
export { ColorFilter } from './Filters';
export { ColorMatrixFilter } from './Filters';
export { BlurFilter } from './Filters';
/**
* Created by rockyl on 2018/11/15.
*/
export * from './core';
export * from './assets-manager';
export * from './support';
export * from './tools';
export * from './filter';
export * from './engine-config';
export * from './ReType';
This diff is collapsed.
/**
* Created by rockyl on 2018/11/7.
*
*/
/**
* 边界类
*/
export default class Bounds {
x: number;
y: number;
width: number;
height: number;
constructor(x?: number, y?: number, width?: number, height?: number);
left: number;
top: number;
right: number;
bottom: number;
/**
* 是否包含点
* @param x
* @param y
*/
contains(x: number, y: number): boolean;
/**
* 设置
* @param x
* @param y
* @param width
* @param height
*/
setTo(x: number, y: number, width: number, height: number): void;
/**
* 复制一个边界
* @param target
*/
copyFrom(target: Bounds): void;
/**
* 克隆
*/
clone(): Bounds;
/**
* 扩展
* @param dx
* @param dy
*/
inflate(dx: number, dy: number): void;
/**
* 是否是空边界
*/
isEmpty(): boolean;
/**
* 置空
*/
setEmpty(): void;
/**
* 横切
* @param toIntersect
*/
intersects(toIntersect: Bounds): boolean;
/**
* 是否包含另一个边界
* @param bounds
*/
containsBounds(bounds: Bounds): boolean;
/**
* 判断是否相等
* @param toCompare
*/
equals(toCompare: Bounds): boolean;
toString(): string;
}
export default class DataCenter {
register(type: any): void;
set(type: any, key: any, value: any): void;
get(type: any, key: any): any;
use(type: any, key: any): (resopnse: any) => any;
parse(type: any, expression: any): any;
}
/**
* Created by rockyl on 2018-11-25.
*/
/**
* 事件发射器
*/
export default class EventEmitter {
_events: any;
_eventsCount: any;
off: any;
addListener: any;
static readonly prefixed: string;
constructor();
/**
* 正在侦听的事件名
*/
eventNames(): any[];
/**
* 获取侦听者
* @param event
*/
listeners(event: any): any[];
/**
* 获取侦听者数量
* @param event
*/
listenerCount(event: any): any;
/**
* 发送事件
* @param event
* @param a1
* @param a2
* @param a3
* @param a4
* @param a5
*/
emit(event: any, a1?: any, a2?: any, a3?: any, a4?: any, a5?: any): boolean;
/**
* 侦听
* @param event
* @param fn
* @param context
*/
on(event: any, fn: any, context: any): any;
/**
* 侦听一次
* @param event
* @param fn
* @param context
*/
once(event: any, fn: any, context: any): any;
/**
* 移除侦听
* @param event
* @param fn
* @param context
* @param once
*/
removeListener(event: any, fn: any, context: any, once: any): this;
/**
* 移除全部侦听
* @param event
*/
removeAllListeners(event: any): this;
}
/**
* Created by rockyl on 2019-01-04.
*/
/**
* 本地存储
*/
export default class LocalStorage {
ID: string;
constructor(ID: string);
private getName;
/**
* 获取数据
* @param key
* @param prefix
*/
getItem(key: string, prefix?: string): string;
/**
* 设置数据
* @param key
* @param value
* @param prefix
*/
setItem(key: string, value: string, prefix?: string): void;
/**
* 获取json数据对象
* @param key
* @param defaultObj
* @param prefix
*/
getItemObj(key: string, defaultObj?: any, prefix?: string): any;
/**
* 设置json数据对象
* @param key
* @param itemObj
* @param prefix
*/
setItemObj(key: string, itemObj: any, prefix?: string): void;
}
/**
* Created by rockyl on 2018/11/6.
*
* 矩阵 3x3
*/
/**
* Matrix 类表示一个转换矩阵,它确定如何将点从一个坐标空间映射到另一个坐标空间。
* 您可以对一个显示对象执行不同的图形转换,方法是设置 Matrix 对象的属性,将该 Matrix
* 对象应用于显示对象的 matrix 属性。这些转换函数包括平移(x 和 y 重新定位)、旋转、缩放和倾斜。
*/
export default class Matrix {
a: any;
b: any;
c: any;
d: any;
tx: any;
ty: any;
/**
* 释放一个Matrix实例到对象池
* @param matrix 需要回收的 matrix
*/
static release(matrix: any): void;
/**
* 从对象池中取出或创建一个新的Matrix对象。
*/
static create(): any;
/**
* 使用指定参数创建一个 Matrix 对象
* @param a 缩放或旋转图像时影响像素沿 x 轴定位的值。
* @param b 旋转或倾斜图像时影响像素沿 y 轴定位的值。
* @param c 旋转或倾斜图像时影响像素沿 x 轴定位的值。
* @param d 缩放或旋转图像时影响像素沿 y 轴定位的值。
* @param tx 沿 x 轴平移每个点的距离。
* @param ty 沿 y 轴平移每个点的距离。
*/
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
/**
* 返回一个新的 Matrix 对象,它是此矩阵的克隆,带有与所含对象完全相同的副本。
*/
clone(): any;
/**
* 将某个矩阵与当前矩阵连接,从而将这两个矩阵的几何效果有效地结合在一起。在数学术语中,将两个矩阵连接起来与使用矩阵乘法将它们结合起来是相同的。
* @param other 要连接到源矩阵的矩阵。
*/
concat(other: any): void;
/**
* 将源 Matrix 对象中的所有矩阵数据复制到调用方 Matrix 对象中。
* @param other 要拷贝的目标矩阵
*/
copyFrom(other: any): this;
/**
* 为每个矩阵属性设置一个值,该值将导致矩阵无转换。通过应用恒等矩阵转换的对象将与原始对象完全相同。
* 调用 identity() 方法后,生成的矩阵具有以下属性:a=1、b=0、c=0、d=1、tx=0 和 ty=0。
*/
identity(): void;
/**
* 执行原始矩阵的逆转换。
* 您可以将一个逆矩阵应用于对象来撤消在应用原始矩阵时执行的转换。
*/
invert(): void;
/**
* @private
*/
$invertInto(target: any): void;
/**
* 对 Matrix 对象应用旋转转换。
* rotate() 方法将更改 Matrix 对象的 a、b、c 和 d 属性。
* @param radian 以弧度为单位的旋转角度。
*/
rotate(radian: any): void;
/**
* 获取弧度
*/
readonly rotation: number;
/**
* 对矩阵应用缩放转换。x 轴乘以 sx,y 轴乘以 sy。
* scale() 方法将更改 Matrix 对象的 a 和 d 属性。
* @param sx 用于沿 x 轴缩放对象的乘数。
* @param sy 用于沿 y 轴缩放对象的乘数。
*/
scale(sx: any, sy: any): void;
/**
* 将 Matrix 的成员设置为指定值
* @param a 缩放或旋转图像时影响像素沿 x 轴定位的值。
* @param b 旋转或倾斜图像时影响像素沿 y 轴定位的值。
* @param c 旋转或倾斜图像时影响像素沿 x 轴定位的值。
* @param d 缩放或旋转图像时影响像素沿 y 轴定位的值。
* @param tx 沿 x 轴平移每个点的距离。
* @param ty 沿 y 轴平移每个点的距离。
*/
setTo(a: any, b: any, c: any, d: any, tx: any, ty: any): this;
/**
* 返回将 Matrix 对象表示的几何转换应用于指定点所产生的结果。
* @param pointX 想要获得其矩阵转换结果的点的x坐标。
* @param pointY 想要获得其矩阵转换结果的点的y坐标。
* @param resultPoint 框架建议尽可能减少创建对象次数来优化性能,可以从外部传入一个复用的Point对象来存储结果,若不传入将创建一个新的Point对象返回。
* @returns Object 由应用矩阵转换所产生的点。
*/
transformPoint(pointX: any, pointY: any, resultPoint: any): any;
/**
* 如果给定预转换坐标空间中的点,则此方法返回发生转换后该点的坐标。
* 与使用 transformPoint() 方法应用的标准转换不同,deltaTransformPoint() 方法的转换不考虑转换参数 tx 和 ty。
* @param pointX 想要获得其矩阵转换结果的点的x坐标。
* @param pointY 想要获得其矩阵转换结果的点的y坐标。
* @param resultPoint 框架建议尽可能减少创建对象次数来优化性能,可以从外部传入一个复用的Point对象来存储结果,若不传入将创建一个新的Point对象返回。
*/
deltaTransformPoint(pointX: any, pointY: any, resultPoint: any): any;
/**
* 沿 x 和 y 轴平移矩阵,由 dx 和 dy 参数指定。
* @param dx 沿 x 轴向右移动的量(以像素为单位)。
* @param dy 沿 y 轴向下移动的量(以像素为单位)。
*/
translate(dx: any, dy: any): void;
/**
* 是否与另一个矩阵数据相等
* @param other 要比较的另一个矩阵对象。
* @returns 是否相等,ture表示相等。
*/
equals(other: any): boolean;
/**
* 前置矩阵
* @param a 缩放或旋转图像时影响像素沿 x 轴定位的值
* @param b 缩放或旋转图像时影响像素沿 y 轴定位的值
* @param c 缩放或旋转图像时影响像素沿 x 轴定位的值
* @param d 缩放或旋转图像时影响像素沿 y 轴定位的值
* @param tx 沿 x 轴平移每个点的距离
* @param ty 沿 y 轴平移每个点的距离
* @returns 矩阵自身
*/
prepend(a: any, b: any, c: any, d: any, tx: any, ty: any): this;
/**
* 后置矩阵
* @param a 缩放或旋转图像时影响像素沿 x 轴定位的值
* @param b 缩放或旋转图像时影响像素沿 y 轴定位的值
* @param c 缩放或旋转图像时影响像素沿 x 轴定位的值
* @param d 缩放或旋转图像时影响像素沿 y 轴定位的值
* @param tx 沿 x 轴平移每个点的距离
* @param ty 沿 y 轴平移每个点的距离
* @returns 矩阵自身
*/
append(a: any, b: any, c: any, d: any, tx: any, ty: any): this;
/**
* 返回将 Matrix 对象表示的几何转换应用于指定点所产生的结果。
* @returns 一个字符串,它包含 Matrix 对象的属性值:a、b、c、d、tx 和 ty。
*/
toString(): string;
/**
* 包括用于缩放、旋转和转换的参数。当应用于矩阵时,该方法会基于这些参数设置矩阵的值。
* @param scaleX 水平缩放所用的系数
* @param scaleY 垂直缩放所用的系数
* @param rotation 旋转量(以弧度为单位)
* @param tx 沿 x 轴向右平移(移动)的像素数
* @param ty 沿 y 轴向下平移(移动)的像素数
*/
createBox(scaleX: any, scaleY: any, rotation?: number, tx?: number, ty?: number): void;
/**
* 创建 Graphics 类的 beginGradientFill() 和 lineGradientStyle() 方法所需的矩阵的特定样式。
* 宽度和高度被缩放为 scaleX/scaleY 对,而 tx/ty 值偏移了宽度和高度的一半。
* @param width 渐变框的宽度
* @param height 渐变框的高度
* @param rotation 旋转量(以弧度为单位)
* @param tx 沿 x 轴向右平移的距离(以像素为单位)。此值将偏移 width 参数的一半
* @param ty 沿 y 轴向下平移的距离(以像素为单位)。此值将偏移 height 参数的一半
*/
createGradientBox(width: any, height: any, rotation?: number, tx?: number, ty?: number): void;
/**
* @private
*/
$transformBounds(bounds: any): void;
/**
* @private
*/
getDeterminant(): number;
/**
* @private
*/
$getScaleX(): any;
/**
* @private
*/
$getScaleY(): any;
/**
* @private
*/
$getSkewX(): number;
/**
* @private
*/
$getSkewY(): number;
/**
* @private
*/
$updateScaleAndRotation(scaleX: any, scaleY: any, skewX: any, skewY: any): void;
/**
* @private
* target = other * this
*/
$preMultiplyInto(other: any, target: any): void;
}
/**
* Created by rockyl on 2018/8/1.
*
* 对象池
*/
/**
* 注册一个池
* @param name 池名称
* @param newFunc 实例化方法
* @param initFunc 初始化方法
*/
export declare function register(name: string, newFunc: Function, initFunc: Function): void;
/**
* 获取一个对象
* @param name 池名称
* @param params 参数
*/
export declare function get(name: string, ...params: any[]): any;
/**
* 回收一个对象
* @param name 池名称
* @param instance 实例
*/
export declare function recycle(name: string, instance: any): void;
/**
* Created by rockyl on 2018-12-07.
*/
import HashObject from "../core/HashObject";
/**
* 尺寸类
*/
export default class Size extends HashObject {
/**
* 宽度
*/
width: number;
/**
* 高度
*/
height: number;
onChange: any;
constructor(width?: number, height?: number, onChange?: Function);
/**
* 置空
*/
setNaN(): void;
/**
* 是否空尺寸
*/
readonly isEmpty: boolean;
/**
* 设置宽高
* @param width
* @param height
*/
set(width?: number, height?: number): void;
/**
* 克隆一个尺寸实例
*/
clone(): Size;
/**
* 从一个尺寸实例拷贝
* @param target
*/
copyFrom(target: any): void;
onModify(value: any, key: any, oldValue: any): void;
}
/**
* Created by rockyl on 2018-11-29.
*/
export declare enum FontStyle {
/**
* 正常
*/
NORMAL = "normal",
/**
* 斜体
*/
ITALIC = "italic",
/**
* 倾斜
*/
OBLIQUE = "oblique"
}
export declare enum FontVariant {
/**
* 正常
*/
NORMAL = "normal",
/**
* 小型大写
*/
SMALL_CAPS = "small-caps"
}
export declare enum FontWeight {
/**
* 正常
*/
NORMAL = "normal",
/**
* 粗体
*/
BOLD = "bold",
/**
* 更粗
*/
BOLDER = "bolder",
/**
* 更细
*/
LIGHTER = "lighter"
}
/**
* 文本样式
*/
export declare class TextStyle {
private readonly _callback;
onChange: any;
/**
* 字体样式
*/
fontStyle: FontStyle;
/**
* 字体倾斜
*/
fontVariant: FontVariant;
/**
* 字体宽度
*/
fontWeight: FontWeight;
/**
* 字体尺寸
*/
fontSize: number;
/**
* 字体名称
*/
fontFamily: string;
onModify(value: any, key: any, oldValue: any): void;
}
/**
* Created by rockyl on 2018/11/8.
*
* 补间动画
*/
import HashObject from "../core/HashObject";
declare enum STATUS {
IDLE = 0,
PENDING = 1,
DO_SET = 2,
DO_TO = 3,
DO_WAIT = 4,
DO_CALL = 5
}
/**
* 补间动画插件接口
*/
export interface ITweenPlugin {
/**
* 处理插值
* @param fromValue
* @param toValue
* @param ratio
* @param allowOutOfBounds
*/
resolveLerp(fromValue: any, toValue: any, ratio: any, allowOutOfBounds: any): any;
}
/**
* 补间动画参数
*/
export interface TweenOptions {
/**
* 循环次数 <0:无限循环,0:一次,>0:循环次数
* @default 0
*/
loop?: number;
/**
* 是否自动播放
* @default true
*/
autoPlay?: boolean;
/**
* 保存初始的字段名列表
*/
initFields?: string[];
/**
* 支持对象展开的字段名列表
*/
fields?: string[];
}
/**
* 创建补间动画
* @param host 拥有声明周期的组件
* @param target 目标对象
* @param override 是否覆盖该对象上的动画
* @param options 补间动画参数
* @param plugins 插件
*/
export declare function createTween(host: any, target: any, override?: boolean, options?: TweenOptions, plugins?: ITweenPlugin[]): Tween;
/**
* 移除对象上所有的Tween实例
* @param target
*/
export declare function killTweens(target: any): void;
/**
* 补间动画类
*/
export declare class Tween extends HashObject {
protected host: any;
protected target: any;
protected loop: number;
protected queue: any[];
protected loopCounting: number;
protected step: number;
protected status: STATUS;
protected t: any;
protected startTime: any;
protected plugins: ITweenPlugin[];
protected fields: any;
protected autoPlay: boolean;
protected initProps: any;
protected fromProps: any;
protected toProps: any;
protected ease: Function;
protected duration: number;
constructor(host: any, target: any, options?: TweenOptions, plugins?: any[]);
protected resolveLerp(fromValue: any, toValue: any, ratio: any): any;
protected onUpdate: (t: any) => void;
protected getInitProps(fields: any): {};
/**
* 设置目标的属性
* @param props 属性对象
*/
set(props: any): this;
/**
* 进行一次补间动画
* @param props 属性对象
* @param duration 耗时(ms)
* @param ease 缓动方法
*/
to(props: any, duration?: number, ease?: Function): this;
/**
* 等待一段时间
* @param duration 耗时(ms)
*/
wait(duration: any): this;
/**
* 执行一个方法
* @param func 方法体
* @param thisObj 闭包域
* @param params 参数
*/
call(func: Function, thisObj?: any, params?: any): this;
/**
* 播放补间动画
* @param override 是否覆盖该对象上的动画
* @param delay 延迟执行时间(ms)
* @param resetLoopCounting 是否重置循环次数计数
*/
play(override?: boolean, delay?: number, resetLoopCounting?: boolean): void;
private _doPlay;
/**
* 终止补间动画
*/
stop(): void;
protected _set(props: any): void;
protected _to(props: any, duration: any, ease: any): void;
protected _wait(duration: any): void;
protected _call(func: any, thisObj: any, params: any): void;
protected _start(resetLoopCounting?: boolean): void;
protected _readyStart: (t: any) => void;
protected _doStart(): void;
protected _doNextAction: () => void;
}
export {};
/**
* Created by rockyl on 2018/11/6.
*
*/
import HashObject from "../core/HashObject";
/**
* 创建2D矢量
* @param x
* @param y
*/
export declare function createVector2D(x?: number, y?: number): any;
/**
* 回收2D矢量
* @param target
*/
export declare function releaseVector2D(target: any): void;
/**
* 2D矢量
*/
export default class Vector2D extends HashObject {
private _x;
private _y;
private onChange;
/**
* 创建一个2D矢量
* @param x x分量
* @param y y分量
* @param onChange 当改变时触发
*/
constructor(x?: number, y?: number, onChange?: Function);
/**
* x分量
*/
x: number;
/**
* y分量
*/
y: number;
/**
* 设置分量
* @param x
* @param y
*/
setXY(x?: number, y?: number): Vector2D;
/**
* 从一个向量拷贝分量
* @param v2
*/
copyFrom(v2: any): Vector2D;
/**
* 克隆出一个向量
*/
clone(): Vector2D;
/**
* 把向量置空
*/
zero(): Vector2D;
/**
* 是不是一个0向量
*/
readonly isZero: boolean;
/**
* 单位化向量
*/
normalize(): Vector2D;
/**
* 是不是一个单位向量
*/
readonly isNormalized: boolean;
/**
* 截取向量长度
* @param max
*/
truncate(max: any): Vector2D;
/**
* 向量反向
*/
reverse(): Vector2D;
/**
* 获取点乘
* @param v2
*/
dotProd(v2: any): number;
/**
* 获取叉乘
* @param v2
*/
crossProd(v2: any): number;
/**
* 获取长度的平方
* @param v2
*/
distSQ(v2: any): number;
/**
* 获取两个向量的距离
* @param v2
*/
distance(v2: any): number;
/**
* 向量加法
* @param v2
*/
add(v2: any): Vector2D;
/**
* 向量减法
* @param v2
*/
subtract(v2: any): Vector2D;
/**
* 向量乘于某个数
* @param value
*/
multiply(value: number): Vector2D;
/**
* 向量除于某个数
* @param value
*/
divide(value: number): Vector2D;
/**
* 向量角度
* @param value
*/
angle: number;
/**
* 向量弧度
* @param value
*/
radian: number;
/**
* 是否等于某个向量
* @param v2
*/
equals(v2: any): boolean;
/**
* 向量长度
* @param value
*/
length: number;
/**
* 获取向量长度的平方
*/
readonly lengthSQ: number;
/**
* 获取向量斜率
*/
readonly slope: number;
toString(): string;
static corner(v1: any, v2: any): number;
}
/**
* Created by rockyl on 2018/11/15.
*
* 支撑类库
*/
export { default as Bounds } from './Bounds';
export { default as Vector2D, createVector2D, releaseVector2D } from './Vector2D';
export { createTween, Tween } from './Tween';
export { default as Matrix } from './Matrix';
export { default as Size } from './Size';
export { default as LocalStorage } from './LocalStorage';
export { TextStyle } from './TextStyle';
export { default as EventEmitter } from './EventEmitter';
export { default as dataCenter } from './DataCenter';
/**
* Created by rockyl on 2018/11/9.
*
* 装饰器
*/
/**
* 属性修改时触发
* @param onChange
*/
export declare function fieldChanged(onChange: any): (target: any, key: string) => void;
/**
* 属性变脏时设置宿主的dirty属性为true
*/
export declare const dirtyFieldDetector: (target: any, key: string) => void;
/**
* 属性变脏时触发onModify方法
*/
export declare const dirtyFieldTrigger: (target: any, key: string) => void;
/**
* Created by rockyl on 2018/11/8.
*
* 缓动函数集合,使用不同的缓动函数使得动画按照对应的方程进行
*/
export declare enum Ease {
quadIn = "quadIn",
quadOut = "quadOut",
quadInOut = "quadInOut",
cubicIn = "cubicIn",
cubicOut = "cubicOut",
cubicInOut = "cubicInOut",
quartIn = "quartIn",
quartOut = "quartOut",
quartInOut = "quartInOut",
quintIn = "quintIn",
quintOut = "quintOut",
quintInOut = "quintInOut",
sineIn = "sineIn",
sineOut = "sineOut",
sineInOut = "sineInOut",
backIn = "backIn",
backOut = "backOut",
backInOut = "backInOut",
circIn = "circIn",
circOut = "circOut",
circInOut = "circInOut",
bounceIn = "bounceIn",
bounceOut = "bounceOut",
bounceInOut = "bounceInOut",
elasticIn = "elasticIn",
elasticOut = "elasticOut",
elasticInOut = "elasticInOut"
}
export declare function get(amount: any): (t: any) => any;
export declare function getPowIn(pow: any): (t: any) => number;
export declare function getPowOut(pow: any): (t: any) => number;
export declare function getPowInOut(pow: any): (t: any) => number;
export declare const quadIn: (t: any) => number;
export declare const quadOut: (t: any) => number;
export declare const quadInOut: (t: any) => number;
export declare const cubicIn: (t: any) => number;
export declare const cubicOut: (t: any) => number;
export declare const cubicInOut: (t: any) => number;
export declare const quartIn: (t: any) => number;
export declare const quartOut: (t: any) => number;
export declare const quartInOut: (t: any) => number;
export declare const quintIn: (t: any) => number;
export declare const quintOut: (t: any) => number;
export declare const quintInOut: (t: any) => number;
export declare function sineIn(t: any): number;
export declare function sineOut(t: any): number;
export declare function sineInOut(t: any): number;
export declare function getBackIn(amount: any): (t: any) => number;
export declare const backIn: (t: any) => number;
export declare function getBackOut(amount: any): (t: any) => number;
export declare const backOut: (t: any) => number;
export declare function getBackInOut(amount: any): (t: any) => number;
export declare const backInOut: (t: any) => number;
export declare function circIn(t: any): number;
export declare function circOut(t: any): number;
export declare function circInOut(t: any): number;
export declare function bounceIn(t: any): number;
export declare function bounceOut(t: any): number;
export declare function bounceInOut(t: any): number;
export declare function getElasticIn(amplitude: any, period: any): (t: any) => any;
export declare const elasticIn: (t: any) => any;
export declare function getElasticOut(amplitude: any, period: any): (t: any) => any;
export declare const elasticOut: (t: any) => any;
export declare function getElasticInOut(amplitude: any, period: any): (t: any) => number;
export declare const elasticInOut: (t: any) => number;
/**
* Created by rockyl on 2018/11/16.
*/
import * as decorators from './decorators';
import * as ease from './ease';
import * as math from './math';
import * as utils from './utils';
import * as timeUtils from './time';
import { Ease } from "./ease";
export { decorators, ease, Ease, math, utils, timeUtils, };
/**
* Created by rockyl on 2018/11/8.
*
* 数学工具
*/
/**
* 线性插值
* @param begin number
* @param end number
* @param t number
* @param allowOutOfBounds
* @return number
*/
export declare function lerp(begin: any, end: any, t: any, allowOutOfBounds?: boolean): any;
/**
* 线性插值对象
* @param begin
* @param end
* @param t
* @param fields
* @param allowOutOfBounds
* @return
*/
export declare function lerpObj(begin: any, end: any, t: any, fields: any, allowOutOfBounds?: boolean): {};
/**
* 随机生成一个整数
* @param max
* @param min
*/
export declare function makeRandomInt(max: number, min?: number): number;
/**
* 打乱一个数组
* @param arr
* @returns {any}
*/
export declare function mixArray(arr: any): Array<any>;
/**
* Created by rockyl on 2019-01-01.
*
* 时间相关常用方法
*/
/**
* 时间戳转日期
* @param ts
*/
export declare function ts2Date(ts: any): Date;
/**
* 日期类转日期字符串
* @param date
* @param format
*/
export declare function dateToDateString(date: Date, format?: string): string;
/**
* 日期类转时间字符串
* @param date
* @param format
*/
export declare function dateToTimeString(date: Date, format?: string): string;
/**
* 日期类转字符串
* @param date
* @param dayFormat
* @param timeFormat
*/
export declare function dateToString(date: Date, dayFormat: any, timeFormat: any): string;
/**
* 时间戳转时间字符串
* @param ts
* @param format
*/
export declare function tsToTimeString(ts: any, format?: string): string;
/**
* 秒转之间字符串
* @param second
* @param format
* @param placeZero
*/
export declare function secondFormat(second: number, format?: string, placeZero?: boolean): string;
/**
* Created by rockyl on 2018/11/9.
*
* 常用工具
*/
/**
* 属性注入方法
* @param target 目标对象
* @param data 被注入对象
* @param callback 自定义注入方法
* @param ignoreMethod 是否忽略方法
* @param ignoreNull 是否忽略Null字段
*
* @return 是否有字段注入
*/
export declare function injectProp(target: any, data?: any, callback?: Function, ignoreMethod?: boolean, ignoreNull?: boolean): boolean;
/**
* 对象转搜索字符串
* @param obj
*/
export declare function objectStringify(obj: any): string;
/**
* 生成一个等待Promise
* @param duration
*/
export declare function waitPromise(duration: any): Promise<void>;
/**
* 可视化字符串
* @param formatStr
* @param params
*/
export declare function format(formatStr: string, ...params: any[]): string;
/**
* 格式化字符串(apply调用)
* @param formatStr
* @param params
*/
export declare function formatApply(formatStr: string, params: any[]): string;
/**
* 补零
* @param value
* @param count
*/
export declare function supplement(value: number, count: number): string;
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment