@realsee/five
Version:
Realsee Renderer SDK
86 lines (85 loc) • 2.79 kB
TypeScript
import type { Five } from '@realsee/five';
import { BasePlugin } from '../BasePlugin';
import type * as PluginType from './typing';
import { Trajectory } from '@realsee/five';
import * as THREE from 'three';
export interface Keyframe {
position: THREE.Vector3;
location: number;
}
export interface PlayingState {
keyframeIndex: number | null;
progress: number | null;
}
export declare class Controller extends BasePlugin.Controller<PluginType.State, PluginType.EventMap, PluginType.ServerData, PluginType.PluginData> {
/** 当前使用的数据 */
data?: PluginType.PluginData;
/** 插件当前状态 */
state: PluginType.State;
/** config 的原始值 */
private _config;
get config(): {
rate?: number;
};
private cancelAnimation;
private playingState;
totalDistance: number;
location: number;
nextKeyframe: Keyframe | null;
nextButOneKeyframe: Keyframe | null;
currentKeyFrame: Keyframe | null;
trajectory: Trajectory | null;
keyframes: Keyframe[];
rate: number;
skipStart: number;
skipEnd: number;
private virualCamera;
private timeArray;
startTimestamp: number | null;
playbackStartTime: number | null;
playbackEndTime: number | null;
private updateState;
constructor(five: Five, params?: PluginType.Params);
load(data: PluginType.ServerData): Promise<void>;
loadTrajectory(trajectory: Trajectory): void;
setPlayingState(playingState: Partial<PlayingState>): void;
private _enable;
play(): void;
pause(): void;
/**
* 基于真实时间戳播放轨迹动画
* 使用 timeArray 中的时间戳,按照真实时间播放
*/
playByTimestamp(): void;
findKeyFrameByLocation(location: number): number | {
keyframeIndex: number;
progress: number;
} | undefined;
/**
* 根据时间戳找到最近的 keyframe
* @returns keyframe 索引,如果找不到返回 undefined
*/
findKeyFrameByTimestamp(timestamp: number): number | undefined;
resetPlayingState(): void;
/**
* 获取总播放时间(毫秒)
* 考虑 skipStart 和 skipEnd
* @returns 总时间(毫秒),如果轨迹未加载则返回 null
*/
getTotalTime(): number | null;
/**
* 设置时间戳模式的播放状态并继续播放
*/
setPlayingStateByTimestamp(keyframeIndex: number): void;
private _disable;
/**
* 启用插件,让插件能够响应交互
*/
enable(options?: BasePlugin.BaseOptions): void;
/**
* 禁用插件,让插件停止响应交互
*/
disable(options?: BasePlugin.BaseOptions): void;
/** 销毁插件,移除所有副作用,销毁后将不响应任何 API */
dispose: () => void;
}