# Interface TrajectoryController

plugin 的基本控制器

interface TrajectoryController {
currentKeyFrame: Keyframe | null;
data?: any;
five: Five;
hooks: Subscribe<PluginTemplateType.EventMap>;
keyframes: Keyframe[];
location: number;
nextButOneKeyframe: Keyframe | null;
nextKeyframe: Keyframe | null;
playbackEndTime: number | null;
playbackStartTime: number | null;
rate: number;
skipEnd: number;
skipStart: number;
startTimestamp: number | null;
state: PluginTemplateType.State;
staticPrefix: string;
totalDistance: number;
trajectory: Trajectory | null;
get config(): { rate?: number };
absoluteUrl(url: string): string;
appendTo?(wrapper: Element): void;
disable(options?: BaseOptions): void;
dispose(): void;
enable(options?: BaseOptions): void;
findKeyFrameByLocation(
location: number,
): number | { keyframeIndex: number; progress: number } | undefined;
findKeyFrameByTimestamp(timestamp: number): number | undefined;
getCurrentState(): PluginTemplateType.State;
getTotalTime(): number | null;
hide?(options?: BaseOptions): void | Promise<void>;
load(data: PluginTemplateType.ServerData): Promise<void>;
loadTrajectory(trajectory: Trajectory): void;
pause(): void;
play(): void;
playByTimestamp(): void;
resetPlayingState(): void;
setPlayingState(playingState: Partial<PlayingState>): void;
setPlayingStateByTimestamp(keyframeIndex: number): void;
setState?(state: Partial<PluginState>, options?: BaseOptions): void;
show?(options?: BaseOptions): void | Promise<void>;
}

#### Hierarchy (View Summary)

- Controller<
  PluginTemplateType.State,
  PluginTemplateType.EventMap,
  PluginTemplateType.ServerData,
  PluginTemplateType.PluginData,
  >
  - TrajectoryController

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:60

##### Index

### Properties

currentKeyFrame
data?
five
hooks
keyframes
location
nextButOneKeyframe
nextKeyframe
playbackEndTime
playbackStartTime
rate
skipEnd
skipStart
startTimestamp
state
staticPrefix
totalDistance
trajectory

### Accessors

config

### Methods

absoluteUrl
appendTo?
disable
dispose
enable
findKeyFrameByLocation
findKeyFrameByTimestamp
getCurrentState
getTotalTime
hide?
load
loadTrajectory
pause
play
playByTimestamp
resetPlayingState
setPlayingState
setPlayingStateByTimestamp
setState?
show?

## Properties

### currentKeyFrame

currentKeyFrame: Keyframe | null

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:84

### `Optional` data

data?: any

当前使用的数据

Overrides BasePlugin.Controller.data

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:63

### five

five: Five

Inherited from Controller.five

- Defined in lib/plugins/BasePlugin/index.ts:68

### hooks

hooks: Subscribe<PluginTemplateType.EventMap> = ...

#### Description

插件事件钩子

Inherited from Controller.hooks

- Defined in lib/plugins/BasePlugin/index.ts:82

### keyframes

keyframes: Keyframe[]

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:86

### location

location: number

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:81

### nextButOneKeyframe

nextButOneKeyframe: Keyframe | null

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:83

### nextKeyframe

nextKeyframe: Keyframe | null

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:82

### playbackEndTime

playbackEndTime: number | null

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:94

### playbackStartTime

playbackStartTime: number | null

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:93

### rate

rate: number

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:87

### skipEnd

skipEnd: number

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:89

### skipStart

skipStart: number

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:88

### startTimestamp

startTimestamp: number | null

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:92

### state

state: PluginTemplateType.State

插件当前状态

Overrides Controller.state

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:66

### `Readonly` staticPrefix

staticPrefix: string = '//vr-image-4.realsee-cdn.cn'

Inherited from Controller.staticPrefix

- Defined in lib/plugins/BasePlugin/index.ts:84

### totalDistance

totalDistance: number

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:80

### trajectory

trajectory: Trajectory | null

- Defined in lib/plugins/TrajectoryPlugin/Controller.ts:85

## Accessors

### config

- get config(): { rate?: number }

  #### Returns { rate?: number }

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:71

## Methods

### absoluteUrl

- absoluteUrl(url: string): string

  #### Parameters

  - url: string

  #### Returns string

  #### Description

  获取静态资源的url

  Inherited from Controller.absoluteUrl

  - Defined in lib/plugins/BasePlugin/index.ts:135

### `Optional` appendTo

- appendTo?(wrapper: Element): void

  插件自身DOM添加到父容器

  #### Parameters

  - wrapper: Element

    Element元素

  #### Returns void

  Inherited from Controller.appendTo

  - Defined in lib/plugins/BasePlugin/index.ts:113

### disable

- disable(options?: BaseOptions): void

  禁用插件，让插件停止响应交互

  #### Parameters

  - `Optional` options: BaseOptions

  #### Returns void

  Overrides Controller.disable

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:890

### dispose

- dispose(): void

  销毁插件，移除所有副作用，销毁后将不响应任何 API

  #### Returns void

  Overrides Controller.dispose

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:898

### enable

- enable(options?: BaseOptions): void

  启用插件，让插件能够响应交互

  #### Parameters

  - `Optional` options: BaseOptions

  #### Returns void

  Overrides Controller.enable

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:880

### findKeyFrameByLocation

- findKeyFrameByLocation(
  location: number,
  ): number | { keyframeIndex: number; progress: number } | undefined

  #### Parameters

  - location: number

  #### Returns number | { keyframeIndex: number; progress: number } | undefined

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:606

### findKeyFrameByTimestamp

- findKeyFrameByTimestamp(timestamp: number): number | undefined

  根据时间戳找到最近的 keyframe

  #### Parameters

  - timestamp: number

  #### Returns number | undefined

  keyframe 索引，如果找不到返回 undefined

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:631

### getCurrentState

- getCurrentState(): PluginTemplateType.State

  获取当前的插件状态，如果当初插件内存在需要通过动画变更的 state 值，则通过此方法可以得到中间状态

  #### Returns PluginTemplateType.State

  Inherited from Controller.getCurrentState

  - Defined in lib/plugins/BasePlugin/index.ts:105

### getTotalTime

- getTotalTime(): number | null

  获取总播放时间（毫秒） 考虑 skipStart 和 skipEnd

  #### Returns number | null

  总时间（毫秒），如果轨迹未加载则返回 null

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:688

### `Optional` hide

- hide?(options?: BaseOptions): void | Promise<void>

  隐藏UI

  #### Parameters

  - `Optional` options: BaseOptions

  #### Returns void | Promise<void>

  Inherited from Controller.hide

  - Defined in lib/plugins/BasePlugin/index.ts:123

### load

- load(data: PluginTemplateType.ServerData): Promise<void>

  加载插件依赖数据

  #### Parameters

  - data: PluginTemplateType.ServerData

  #### Returns Promise<void>

  Overrides Controller.load

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:158

### loadTrajectory

- loadTrajectory(trajectory: Trajectory): void

  #### Parameters

  - trajectory: Trajectory

  #### Returns void

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:162

### pause

- pause(): void

  #### Returns void

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:338

### play

- play(): void

  #### Returns void

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:237

### playByTimestamp

- playByTimestamp(): void

  基于真实时间戳播放轨迹动画 使用 timeArray 中的时间戳，按照真实时间播放

  #### Returns void

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:400

### resetPlayingState

- resetPlayingState(): void

  #### Returns void

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:678

### setPlayingState

- setPlayingState(playingState: Partial<PlayingState>): void

  #### Parameters

  - playingState: Partial<PlayingState>

  #### Returns void

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:224

### setPlayingStateByTimestamp

- setPlayingStateByTimestamp(keyframeIndex: number): void

  设置时间戳模式的播放状态并继续播放

  #### Parameters

  - keyframeIndex: number

  #### Returns void

  - Defined in lib/plugins/TrajectoryPlugin/Controller.ts:708

### `Optional` setState

- setState?(state: Partial<PluginState>, options?: BaseOptions): void

  设置state

  #### Parameters

  - state: Partial<PluginState>

    插件的目标状态

  - `Optional` options: BaseOptions

    配置项

  #### Returns void

  Inherited from Controller.setState

  - Defined in lib/plugins/BasePlugin/index.ts:130

### `Optional` show

- show?(options?: BaseOptions): void | Promise<void>

  展示UI

  #### Parameters

  - `Optional` options: BaseOptions

  #### Returns void | Promise<void>

  Inherited from Controller.show

  - Defined in lib/plugins/BasePlugin/index.ts:118