threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
141 lines • 5.06 kB
TypeScript
import { Object3D, Vector3 } from 'three';
import { Easing } from '@repalash/popmotion';
import { AViewerPluginEventMap, AViewerPluginSync, ThreeViewer } from '../../viewer';
import { UiObjectConfig } from 'uiconfig.js';
import { EasingFunctionType } from '../../utils';
import { CameraView, ICamera, ICameraView, IMaterial } from '../../core';
import { PopmotionPlugin } from './PopmotionPlugin';
export interface CameraViewPluginOptions {
duration?: number;
ease?: EasingFunctionType;
interpolateMode?: 'spherical' | 'linear';
}
export interface CameraViewPluginEventMap extends AViewerPluginEventMap {
viewChange: {
view: CameraView;
};
startViewChange: {
view: CameraView;
};
viewAdd: {
view: CameraView;
};
viewDelete: {
view: CameraView;
};
viewUpdate: {
view: CameraView;
};
update: {
key?: string;
};
}
/**
* Camera View Plugin
*
* Provides API to save, interact and animate and loop between with multiple camera states/views using the {@link PopmotionPlugin}.
*
*/
export declare class CameraViewPlugin extends AViewerPluginSync<CameraViewPluginEventMap> {
static readonly PluginType = "CameraViews";
enabled: boolean;
constructor(options?: CameraViewPluginOptions);
private _cameraViews;
get cameraViews(): CameraView[];
get camViews(): CameraView[];
viewLooping: boolean;
/**
* Pauses time between view changes when animating all views or looping.
*/
viewPauseTime: number;
/**
* {@link EasingFunctions}
*/
animEase: EasingFunctionType;
animDuration: number;
interpolateMode: 'spherical' | 'linear' | 'spline';
rotationOffset: number;
private _animating;
get animating(): boolean;
dependencies: (typeof PopmotionPlugin)[];
onAdded(viewer: ThreeViewer): void;
onRemove(viewer: ThreeViewer): void;
resetToFirstView(duration?: number): Promise<void>;
addCurrentView(): Promise<CameraView | undefined>;
addView(view: CameraView, force?: boolean): void;
deleteView(view: CameraView, force?: boolean): void;
getView(camera?: ICamera, worldSpace?: boolean, view?: CameraView): CameraView;
setView(view: ICameraView, camera?: ICamera): void;
private _currentView;
focusNext: (wrap?: boolean) => void;
focusPrevious: (wrap?: boolean) => void;
private _popAnimations;
animateToView(_view: CameraView | number | string, duration?: number, easing?: Easing | EasingFunctionType, camera?: ICamera, throwOnStop?: boolean): Promise<void>;
animateAllViews(): Promise<void>;
stopAllAnimations(): Promise<void>;
fromJSON(data: any, meta?: any): this | null;
setDirty(ops?: any): any;
animateToObject(selected?: Object3D, distanceMultiplier?: number, duration?: number, ease?: Easing | EasingFunctionType, distanceBounds?: {
min: number;
max: number;
}): Promise<void>;
animateToFitObject(selected?: Object3D | Object3D[] | IMaterial | IMaterial[], distanceMultiplier?: number, duration?: number, ease?: Easing | EasingFunctionType, distanceBounds?: {
min: number;
max: number;
}): Promise<void>;
/**
*
* @param distanceFromTarget - in world units
* @param center - target (center) of the view in world coordinates
* @param duration - in milliseconds
* @param ease
*/
animateToTarget(distanceFromTarget: number, center: Vector3, duration?: number, ease?: Easing | EasingFunctionType): Promise<void>;
uiConfig: UiObjectConfig;
get animationLooping(): boolean;
private _viewQueue;
private _animationLooping;
private _infiniteLooping;
private _animationLoop;
protected _viewSetView: ({ view, camera }: {
view?: CameraView;
camera?: ICamera;
}) => void;
protected _viewUpdateView: ({ view, camera }: {
view: CameraView;
camera?: ICamera;
}) => void;
protected _viewDeleteView: ({ view }: {
view: CameraView;
}) => void;
protected _viewAnimateView: ({ view, camera, duration, easing, throwOnStop }: {
view: CameraView;
camera?: ICamera;
duration?: number;
easing?: Easing | EasingFunctionType;
throwOnStop?: boolean;
}) => Promise<void>;
protected _viewUpdated: (e: {
target: ICameraView;
key?: string;
}) => Promise<void>;
/**
* @deprecated - renamed to {@link getView} or {@link ICamera.getView}
* @param camera
* @param worldSpace
*/
getCurrentCameraView(camera?: ICamera, worldSpace?: boolean): CameraView;
/**
* @deprecated - renamed to {@link setView} or {@link ICamera.setView}
* @param view
*/
setCurrentCameraView(view: CameraView): void;
/**
* @deprecated - use {@link animateToView} instead
* @param view
*/
focusView(view: CameraView): Promise<void>;
private _lastAnimTime;
protected _postFrame(): true | undefined;
}
//# sourceMappingURL=CameraViewPlugin.d.ts.map